V15 Added second level block acceptance tests (#19264)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "^2.0.33",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.50",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.52",
|
||||
"camelize": "^1.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"node-fetch": "^2.6.7"
|
||||
@@ -66,9 +66,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@umbraco/playwright-testhelpers": {
|
||||
"version": "15.0.50",
|
||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-15.0.50.tgz",
|
||||
"integrity": "sha512-gi5bb4DShw3lmEdmQhKpPdkS6Uzg4CdNkrJDSkkUTE8CKY7T5goyE4QBTU8kj+LMHR2DnB7qyRUXrYWyS1ECiQ==",
|
||||
"version": "15.0.52",
|
||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-15.0.52.tgz",
|
||||
"integrity": "sha512-HJ+kiafLX0ck0/nYol0Kr7yks/hBbnCKotr1+TaxIBgowvbirIt0paY7wluQpHQi0e6nAmJZsjZZ08abh9ZKBA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "2.0.33",
|
||||
"node-fetch": "^2.6.7"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "^2.0.33",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.50",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.52",
|
||||
"camelize": "^1.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"node-fetch": "^2.6.7"
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
import {AliasHelper, ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
// Content Name
|
||||
const contentName = 'ContentName';
|
||||
|
||||
// Document Type
|
||||
const documentTypeName = 'DocumentTypeName';
|
||||
let documentTypeId = null;
|
||||
const documentTypeGroupName = 'DocumentGroup';
|
||||
|
||||
// Block Grid
|
||||
const blockGridDataTypeName = 'BlockGridName';
|
||||
let blockGridDataTypeId = null;
|
||||
|
||||
// Text String
|
||||
const textStringElementTypeName = 'TextStringElementName';
|
||||
let textStringElementTypeId = null;
|
||||
let textStringGroupName = 'TextGroup';
|
||||
const textStringDataTypeName = 'Textstring';
|
||||
|
||||
test.beforeEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockGridDataTypeName);
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockGridDataTypeName);
|
||||
});
|
||||
|
||||
test('can publish a block grid editor with a rich text editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const richTextEditorValue = 'Hello World';
|
||||
const expectedRichTextEditorOutputValue = '<p>Hello World</p>';
|
||||
const richTextDataTypeName = 'RichTextDataTypeName';
|
||||
const richTextElementTypeName = 'RichTextElementName';
|
||||
const richTextElementGroupName = 'RichTextElementGroupName';
|
||||
await umbracoApi.dataType.ensureNameNotExists(richTextDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(richTextElementTypeName);
|
||||
|
||||
const richTextEditorDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(richTextDataTypeName);
|
||||
const richTextElementTypeId = await umbracoApi.documentType.createDefaultElementType(richTextElementTypeName, richTextElementGroupName, richTextDataTypeName, richTextEditorDataTypeId);
|
||||
blockGridDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndAllowAtRoot(blockGridDataTypeName, richTextElementTypeId, true);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, blockGridDataTypeName, blockGridDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickAddBlockElementButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(richTextElementTypeName, true);
|
||||
await umbracoUi.content.enterRTETipTapEditor(richTextEditorValue);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the RTE is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentValues = documentData.values.find(value => value.alias === AliasHelper.toAlias(blockGridDataTypeName));
|
||||
expect(documentValues.value.contentData[0].values[0].value.markup).toContain(expectedRichTextEditorOutputValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(richTextDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(richTextElementTypeName);
|
||||
});
|
||||
|
||||
test('can publish a block grid editor with a block list editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const textStringValue = 'Hello World';
|
||||
const blockListDataTypeName = 'BlockListName';
|
||||
const blockListElementTypeName = 'BlockListElementName';
|
||||
const blockListElementGroupName = 'BlockListElementGroupName';
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockListDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockListElementTypeName);
|
||||
|
||||
const textStringDataType = await umbracoApi.dataType.getByName(textStringDataTypeName);
|
||||
textStringElementTypeId = await umbracoApi.documentType.createDefaultElementType(textStringElementTypeName, textStringGroupName, textStringDataTypeName, textStringDataType.id);
|
||||
const blockListDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(blockListDataTypeName, textStringElementTypeId);
|
||||
const blockListElementTypeId = await umbracoApi.documentType.createDefaultElementType(blockListElementTypeName, blockListElementGroupName, blockListDataTypeName, blockListDataTypeId);
|
||||
blockGridDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndAllowAtRoot(blockGridDataTypeName, blockListElementTypeId, true);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, blockGridDataTypeName, blockGridDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickAddBlockElementButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(blockListElementTypeName, true);
|
||||
await umbracoUi.content.clickAddBlockWithNameButton(textStringElementTypeName);
|
||||
await umbracoUi.content.clickBlockCardWithName(textStringElementTypeName, true);
|
||||
await umbracoUi.content.enterTextstring(textStringValue);
|
||||
await umbracoUi.content.clickCreateForModalWithHeadline('Add ' + textStringElementTypeName);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the BlockList is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentValues = documentData.values.find(value => value.alias === AliasHelper.toAlias(blockGridDataTypeName));
|
||||
expect(documentValues.value.contentData[0].values[0].value.contentData[0].values[0].value).toContain(textStringValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockListDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockListElementTypeName);
|
||||
});
|
||||
|
||||
test('can publish a block grid editor with a block grid editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const textStringValue = 'Hello World';
|
||||
const secondBlockGridDataTypeName = 'SecondBlockGridDataTypeName';
|
||||
const blockGridElementTypeName = 'BlockGridElementTypeName';
|
||||
const blockGridElementGroupName = 'BlockGridElementGroupName';
|
||||
await umbracoApi.dataType.ensureNameNotExists(secondBlockGridDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockGridElementTypeName);
|
||||
|
||||
const textStringDataType = await umbracoApi.dataType.getByName(textStringDataTypeName);
|
||||
textStringElementTypeId = await umbracoApi.documentType.createDefaultElementType(textStringElementTypeName, textStringGroupName, textStringDataTypeName, textStringDataType.id);
|
||||
const secondBlockGridDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndAllowAtRoot(secondBlockGridDataTypeName, textStringElementTypeId);
|
||||
const blockGridElementTypeId = await umbracoApi.documentType.createDefaultElementType(blockGridElementTypeName, blockGridElementGroupName, secondBlockGridDataTypeName, secondBlockGridDataTypeId);
|
||||
blockGridDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndAllowAtRoot(blockGridDataTypeName, blockGridElementTypeId, true);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, blockGridDataTypeName, blockGridDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickAddBlockElementButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(blockGridElementTypeName, true);
|
||||
await umbracoUi.content.clickAddBlockWithNameButton(textStringElementTypeName);
|
||||
await umbracoUi.content.clickBlockCardWithName(textStringElementTypeName, true);
|
||||
await umbracoUi.content.enterTextstring(textStringValue);
|
||||
await umbracoUi.content.clickCreateForModalWithHeadline('Add ' + textStringElementTypeName);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the BlockGrid is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentValues = documentData.values.find(value => value.alias === AliasHelper.toAlias(blockGridDataTypeName));
|
||||
expect(documentValues.value.contentData[0].values[0].value.contentData[0].values[0].value).toContain(textStringValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(secondBlockGridDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockGridElementTypeName);
|
||||
});
|
||||
@@ -0,0 +1,161 @@
|
||||
import {AliasHelper, ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
// Content Name
|
||||
const contentName = 'ContentName';
|
||||
|
||||
// Document Type
|
||||
const documentTypeName = 'DocumentTypeName';
|
||||
let documentTypeId = null;
|
||||
const documentTypeGroupName = 'DocumentGroup';
|
||||
|
||||
// Block List
|
||||
const blockListDataTypeName = 'BlockListName';
|
||||
let blockListDataTypeId = null;
|
||||
|
||||
// Text String
|
||||
const textStringElementTypeName = 'TextStringElementName';
|
||||
let textStringElementTypeId = null;
|
||||
let textStringGroupName = 'TextGroup';
|
||||
const textStringDataTypeName = 'Textstring';
|
||||
|
||||
test.beforeEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockListDataTypeName);
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockListDataTypeName);
|
||||
});
|
||||
|
||||
test('can publish a block list editor with a rich text editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const richTextEditorValue = 'Hello World';
|
||||
const expectedRichTextEditorOutputValue = '<p>Hello World</p>';
|
||||
const richTextDataTypeName = 'RichTextName';
|
||||
const richTextElementTypeName = 'RichTextElementName';
|
||||
const richTextElementGroupName = 'RTEElementGroup';
|
||||
await umbracoApi.dataType.ensureNameNotExists(richTextDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(richTextElementTypeName);
|
||||
|
||||
const richTextEditorDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(richTextDataTypeName);
|
||||
const richTextElementTypeId = await umbracoApi.documentType.createDefaultElementType(richTextElementTypeName, richTextElementGroupName, richTextDataTypeName, richTextEditorDataTypeId);
|
||||
blockListDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(blockListDataTypeName, richTextElementTypeId);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, blockListDataTypeName, blockListDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickAddBlockElementButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(richTextElementTypeName, true);
|
||||
await umbracoUi.content.enterRTETipTapEditor(richTextEditorValue);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the RTE is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentRichTextValues = documentData.values[0].value.contentData[0].values.find(value => value.alias === AliasHelper.toAlias(richTextDataTypeName));
|
||||
expect(documentRichTextValues.value.markup).toContain(expectedRichTextEditorOutputValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(richTextDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(richTextElementTypeName);
|
||||
});
|
||||
|
||||
test('can publish a block list editor with a block grid editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const textStringValue = 'Hello World';
|
||||
const blockGridDataTypeName = 'BlockGridDataTypeName';
|
||||
const blockGridElementTypeName = 'BlockGridElementName';
|
||||
const blockGridElementGroupName = 'GridElementGroup';
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockGridDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockGridElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
|
||||
const textStringDataType = await umbracoApi.dataType.getByName(textStringDataTypeName);
|
||||
textStringElementTypeId = await umbracoApi.documentType.createDefaultElementType(textStringElementTypeName, textStringGroupName, textStringDataTypeName, textStringDataType.id);
|
||||
const blockGridDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndAllowAtRoot(blockGridDataTypeName, textStringElementTypeId);
|
||||
const blockGridElementTypeId = await umbracoApi.documentType.createDefaultElementType(blockGridElementTypeName, blockGridElementGroupName, blockGridDataTypeName, blockGridDataTypeId);
|
||||
blockListDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(blockListDataTypeName, blockGridElementTypeId);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, blockListDataTypeName, blockListDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickAddBlockElementButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(blockGridElementTypeName, true);
|
||||
await umbracoUi.content.clickAddBlockWithNameButton(textStringElementTypeName);
|
||||
await umbracoUi.content.clickBlockCardWithName(textStringElementTypeName, true);
|
||||
await umbracoUi.content.enterTextstring(textStringValue);
|
||||
await umbracoUi.content.clickCreateForModalWithHeadline('Add ' + textStringElementTypeName);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the BlockGrid is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentValues = documentData.values.find(value => value.alias === AliasHelper.toAlias(blockListDataTypeName));
|
||||
expect(documentValues.value.contentData[0].values[0].value.contentData[0].values[0].value).toContain(textStringValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockGridDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockGridElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeId);
|
||||
});
|
||||
|
||||
test('can publish a block list editor with a block list editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const textStringValue = 'Hello World';
|
||||
const secondBlockListDataTypeName = 'SecondBlockListName';
|
||||
const blockListElementTypeName = 'BlockListElementName';
|
||||
const blockListElementGroupName = 'ListElementGroup';
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(secondBlockListDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockListElementTypeName);
|
||||
|
||||
const textStringDataType = await umbracoApi.dataType.getByName(textStringDataTypeName);
|
||||
textStringElementTypeId = await umbracoApi.documentType.createDefaultElementType(textStringElementTypeName, textStringGroupName, textStringDataTypeName, textStringDataType.id);
|
||||
const secondBlockListDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(secondBlockListDataTypeName, textStringElementTypeId);
|
||||
const blockListElementTypeId = await umbracoApi.documentType.createDefaultElementType(blockListElementTypeName, blockListElementGroupName, secondBlockListDataTypeName, secondBlockListDataTypeId);
|
||||
blockListDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(blockListDataTypeName, blockListElementTypeId);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, blockListDataTypeName, blockListDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickAddBlockElementButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(blockListElementTypeName, true);
|
||||
await umbracoUi.content.clickAddBlockWithNameButton(textStringElementTypeName);
|
||||
await umbracoUi.content.clickBlockCardWithName(textStringElementTypeName, true);
|
||||
await umbracoUi.content.enterTextstring(textStringValue);
|
||||
await umbracoUi.content.clickCreateForModalWithHeadline('Add ' + textStringElementTypeName);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the BlockList is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentValues = documentData.values.find(value => value.alias === AliasHelper.toAlias(blockListDataTypeName));
|
||||
expect(documentValues.value.contentData[0].values[0].value.contentData[0].values[0].value).toContain(textStringValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(secondBlockListDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockListElementTypeName);
|
||||
});
|
||||
@@ -0,0 +1,165 @@
|
||||
import {AliasHelper, ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers';
|
||||
import {expect} from "@playwright/test";
|
||||
|
||||
// Content Name
|
||||
const contentName = 'ContentName';
|
||||
|
||||
// Document Type
|
||||
const documentTypeName = 'DocumentTypeName';
|
||||
let documentTypeId = null;
|
||||
const documentTypeGroupName = 'DocumentGroup';
|
||||
|
||||
// Rich Text Editor
|
||||
const richTextDataTypeName = 'RichTextDataType';
|
||||
let richTextDataTypeId = null;
|
||||
|
||||
// Text String
|
||||
const textStringElementTypeName = 'TextStringElementName';
|
||||
let textStringElementTypeId = null;
|
||||
let textStringGroupName = 'TextGroup';
|
||||
const textStringDataTypeName = 'Textstring';
|
||||
|
||||
test.beforeEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(richTextDataTypeName);
|
||||
});
|
||||
|
||||
test.afterEach(async ({umbracoApi}) => {
|
||||
await umbracoApi.document.ensureNameNotExists(contentName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
|
||||
await umbracoApi.dataType.ensureNameNotExists(richTextDataTypeName);
|
||||
});
|
||||
|
||||
test('can publish a rich text editor with a rich text editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const richTextEditorValue = 'Hello First World';
|
||||
const secondRichTextEditorValue = 'Hello Second World';
|
||||
const expectedRichTextEditorOutputValue = '<p>' + richTextEditorValue + '</p>';
|
||||
const secondExpectedRichTextEditorOutputValue = '<p>' + secondRichTextEditorValue + '</p>';
|
||||
const secondRichTextDataTypeName = 'SecondRichTextName';
|
||||
const richTextElementTypeName = 'RichTextElementName';
|
||||
const richTextElementGroupName = 'RichTextElementGroupName';
|
||||
await umbracoApi.dataType.ensureNameNotExists(secondRichTextDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(richTextElementGroupName);
|
||||
|
||||
const secondRichTextEditorDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(secondRichTextDataTypeName);
|
||||
const richTextElementTypeId = await umbracoApi.documentType.createDefaultElementType(richTextElementTypeName, richTextElementGroupName, secondRichTextDataTypeName, secondRichTextEditorDataTypeId);
|
||||
richTextDataTypeId = await umbracoApi.dataType.createRichTextEditorWithABlock(richTextDataTypeName, richTextElementTypeId);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, richTextDataTypeName, richTextDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.enterRTETipTapEditor(richTextEditorValue);
|
||||
await umbracoUi.content.clickInsertBlockButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(richTextElementTypeName, true);
|
||||
await umbracoUi.content.enterRTETipTapEditorWithName(AliasHelper.toAlias(secondRichTextDataTypeName), secondRichTextEditorValue);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the RTE is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
const documentValues = documentData.values.find(value => value.alias === AliasHelper.toAlias(richTextDataTypeName));
|
||||
// Value in the first RTE
|
||||
expect(documentValues.value.markup).toContain(expectedRichTextEditorOutputValue);
|
||||
// Value in the second RTE
|
||||
const secondRTEInBlock = documentValues.value.blocks.contentData[0].values.find(value => value.alias === AliasHelper.toAlias(secondRichTextDataTypeName));
|
||||
expect(secondRTEInBlock.value.markup).toContain(secondExpectedRichTextEditorOutputValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.documentType.ensureNameNotExists(richTextElementGroupName);
|
||||
});
|
||||
|
||||
test('can publish a rich text editor with a block grid editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const textStringValue = 'Hello World';
|
||||
const blockGridDataTypeName = 'BlockGridDataTypeName';
|
||||
const blockGridElementTypeName = 'BlockGridElementTypeName';
|
||||
const blockGridElementGroupName = 'BlockGridElementGroupName';
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockGridDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockGridElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
|
||||
const textStringDataType = await umbracoApi.dataType.getByName(textStringDataTypeName);
|
||||
textStringElementTypeId = await umbracoApi.documentType.createDefaultElementType(textStringElementTypeName, textStringGroupName, textStringDataTypeName, textStringDataType.id);
|
||||
const blockGridDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockWithInlineEditingMode(blockGridDataTypeName, textStringElementTypeId, true);
|
||||
const blockGridElementTypeId = await umbracoApi.documentType.createDefaultElementType(blockGridElementTypeName, blockGridElementGroupName, blockGridDataTypeName, blockGridDataTypeId);
|
||||
richTextDataTypeId = await umbracoApi.dataType.createRichTextEditorWithABlock(richTextDataTypeName, blockGridElementTypeId);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, richTextDataTypeName, richTextDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickInsertBlockButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(blockGridElementTypeName, true);
|
||||
await umbracoUi.content.clickAddBlockWithNameButton(textStringElementTypeName);
|
||||
await umbracoUi.content.clickBlockCardWithName(textStringElementTypeName, true);
|
||||
await umbracoUi.content.enterTextstring(textStringValue);
|
||||
await umbracoUi.content.clickCreateForModalWithHeadline('Add ' + textStringElementTypeName);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the BlockGrid is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
expect(documentData.values[0].value.blocks.contentData[0].values[0].value.contentData[0].values[0].value).toContain(textStringValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockGridDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockGridElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
});
|
||||
|
||||
test('can publish a rich text editor with a block list editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const textStringValue = 'Hello World';
|
||||
const blockListDataTypeName = 'BlockListName';
|
||||
const blockListElementTypeName = 'BlockListElementName';
|
||||
const blockListElementGroupName = 'BlockListGroupName';
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockListDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockListElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
|
||||
const textStringDataType = await umbracoApi.dataType.getByName(textStringDataTypeName);
|
||||
textStringElementTypeId = await umbracoApi.documentType.createDefaultElementType(textStringElementTypeName, textStringGroupName, textStringDataTypeName, textStringDataType.id);
|
||||
const blockListDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(blockListDataTypeName, textStringElementTypeId);
|
||||
const blockListElementTypeId = await umbracoApi.documentType.createDefaultElementType(blockListElementTypeName, blockListElementGroupName, blockListDataTypeName, blockListDataTypeId);
|
||||
richTextDataTypeId = await umbracoApi.dataType.createRichTextEditorWithABlock(richTextDataTypeName, blockListElementTypeId);
|
||||
documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, richTextDataTypeName, richTextDataTypeId, documentTypeGroupName);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickInsertBlockButton();
|
||||
await umbracoUi.content.clickBlockCardWithName(blockListElementTypeName, true);
|
||||
await umbracoUi.content.clickAddBlockWithNameButton(textStringElementTypeName);
|
||||
await umbracoUi.content.clickBlockCardWithName(textStringElementTypeName, true);
|
||||
await umbracoUi.content.enterTextstring(textStringValue);
|
||||
await umbracoUi.content.clickCreateForModalWithHeadline('Add ' + textStringElementTypeName);
|
||||
await umbracoUi.content.clickCreateModalButton();
|
||||
await umbracoUi.content.clickSaveAndPublishButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved);
|
||||
await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.published);
|
||||
// Asserts that the value in the BlockGrid is as expected
|
||||
const documentData = await umbracoApi.document.getByName(contentName);
|
||||
expect(documentData.values[0].value.blocks.contentData[0].values[0].value.contentData[0].values[0].value).toContain(textStringValue);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.dataType.ensureNameNotExists(blockListDataTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(blockListElementTypeName);
|
||||
await umbracoApi.documentType.ensureNameNotExists(textStringElementTypeName);
|
||||
});
|
||||
Reference in New Issue
Block a user