diff --git a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json index 48f060b5dc6c..6026df6d2ec7 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json @@ -8,7 +8,7 @@ "hasInstallScript": true, "dependencies": { "@umbraco/json-models-builders": "^2.0.27", - "@umbraco/playwright-testhelpers": "^15.0.17", + "@umbraco/playwright-testhelpers": "^15.0.19", "camelize": "^1.0.0", "dotenv": "^16.3.1", "node-fetch": "^2.6.7" @@ -66,9 +66,9 @@ } }, "node_modules/@umbraco/playwright-testhelpers": { - "version": "15.0.17", - "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-15.0.17.tgz", - "integrity": "sha512-DRNWWzGB16is+J1sqT8+yOobuN2d9mshRfXRDtkaEVRahPpkYBfR1Mjv0DofBkheB2cAlvdvPsBUopzE6bMKSQ==", + "version": "15.0.19", + "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-15.0.19.tgz", + "integrity": "sha512-n/51ycqcrb6QdPlnf2AMVzAbznyJwWrWA38icEmAky49Q3BFVeg1uqQt7W7ZgRttDi3vJyoB19e9gC8tnBe2AQ==", "dependencies": { "@umbraco/json-models-builders": "2.0.28", "node-fetch": "^2.6.7" diff --git a/tests/Umbraco.Tests.AcceptanceTest/package.json b/tests/Umbraco.Tests.AcceptanceTest/package.json index 1a90b1f07174..e72f726fc4b5 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@umbraco/json-models-builders": "^2.0.27", - "@umbraco/playwright-testhelpers": "^15.0.17", + "@umbraco/playwright-testhelpers": "^15.0.19", "camelize": "^1.0.0", "dotenv": "^16.3.1", "node-fetch": "^2.6.7" diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithBlockGrid.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithBlockGrid.spec.ts new file mode 100644 index 000000000000..b22a2e5895af --- /dev/null +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithBlockGrid.spec.ts @@ -0,0 +1,447 @@ +import {ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers'; +import {expect} from "@playwright/test"; + +const contentName = 'TestContent'; +const documentTypeName = 'TestDocumentTypeForContent'; +const customDataTypeName = 'Custom Block Grid'; +const elementTypeName = 'BlockGridElement'; +const propertyInBlock = 'Textstring'; +const groupName = 'testGroup'; +let elementTypeId = ''; + +test.beforeEach(async ({umbracoApi}) => { + await umbracoApi.documentType.ensureNameNotExists(documentTypeName); + await umbracoApi.document.ensureNameNotExists(contentName); + const textStringData = await umbracoApi.dataType.getByName(propertyInBlock); + elementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, propertyInBlock, textStringData.id); +}); + +test.afterEach(async ({umbracoApi}) => { + await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.documentType.ensureNameNotExists(documentTypeName); + await umbracoApi.documentType.ensureNameNotExists(elementTypeName); + await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); +}); + +test('can create content with an empty block grid', async ({umbracoApi, umbracoUi}) => { + // Arrange + const expectedState = 'Draft'; + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, elementTypeId, true, true); + await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.clickActionsMenuAtRoot(); + await umbracoUi.content.clickCreateButton(); + await umbracoUi.content.chooseDocumentType(documentTypeName); + await umbracoUi.content.enterContentName(contentName); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.variants[0].state).toBe(expectedState); + expect(contentData.values).toEqual([]); +}); + +test('can publish content with an empty block grid', async ({umbracoApi, umbracoUi}) => { + // Arrange + const expectedState = 'Published'; + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, elementTypeId, true, true); + await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.clickActionsMenuAtRoot(); + await umbracoUi.content.clickCreateButton(); + await umbracoUi.content.chooseDocumentType(documentTypeName); + await umbracoUi.content.enterContentName(contentName); + await umbracoUi.content.clickSaveAndPublishButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationsHaveCount(2); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.variants[0].state).toBe(expectedState); + expect(contentData.values).toEqual([]); +}); + +test('can add a block element in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, elementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.enterTextstring(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(inputText); + const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value; + expect(blockGridValue).toBeTruthy(); +}); + +test('can edit block element in the content', async ({umbracoApi, umbracoUi}) => { + const updatedText = 'This updated block test'; + await umbracoApi.document.createDefaultDocumentWithABlockGridEditor(contentName, elementTypeId, documentTypeName, customDataTypeName); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickEditBlockGridBlockButton(); + await umbracoUi.content.enterTextstring(updatedText); + await umbracoUi.content.clickUpdateButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(updatedText); +}); + +test('can delete block element in the content', async ({umbracoApi, umbracoUi}) => { + await umbracoApi.document.createDefaultDocumentWithABlockGridEditor(contentName, elementTypeId, documentTypeName, customDataTypeName); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickDeleteBlockGridBlockButton(); + await umbracoUi.content.clickConfirmToDeleteButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + const blockGridValue = contentData.values.find(item => item.value); + expect(blockGridValue).toBeFalsy(); +}); + +test('cannot add block element if allow in root is disabled', async ({umbracoApi, umbracoUi}) => { + // Arrange + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, elementTypeId, false, false); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + + // Assert + await umbracoUi.content.isAddBlockElementButtonVisible(false); +}); + +test('cannot add number of block element greater than the maximum amount', async ({umbracoApi, umbracoUi}) => { + // Arrange + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndMinAndMaxAmount(customDataTypeName, elementTypeId, 0, 0); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.waitForTimeout(500); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + + // Assert + await umbracoUi.content.doesFormValidationMessageContainText('Maximum'); + await umbracoUi.content.doesFormValidationMessageContainText('too many'); +}); + +test('can set the label of create button in root', async ({umbracoApi, umbracoUi}) => { + // Arrange + const createButtonLabel = 'Test Create Button Label'; + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndCreateButtonLabel(customDataTypeName, elementTypeId, createButtonLabel); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + + // Assert + await umbracoUi.content.isAddBlockElementButtonWithLabelVisible(createButtonLabel); +}); + +test('can set the label of block element in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const blockLabel = 'Test Block Label'; + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithLabel(customDataTypeName, elementTypeId, blockLabel); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + await umbracoUi.content.doesBlockElementHaveName(blockLabel); +}); + +test('can set the number of columns for the layout in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const gridColumns = 6; + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithABlockAndGridColumns(customDataTypeName, elementTypeId, gridColumns); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + const layoutValue = contentData.values[0]?.value.layout["Umbraco.BlockGrid"]; + expect(layoutValue[0].columnSpan).toBe(gridColumns); +}); + +// TODO: Remove skip when front-end is ready. Currently, it is impossible to create content with blockgrid that has a setting model +test.skip('can add settings model for the block in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const contentBlockInputText = 'This is textstring'; + const settingBlockInputText = 'This is textarea'; + const settingModelName = 'Test Setting Model'; + const textAreaDataTypeName = 'Textarea'; + const textAreaData = await umbracoApi.dataType.getByName(textAreaDataTypeName); + const settingsElementTypeId = await umbracoApi.documentType.createDefaultElementType(settingModelName, groupName, textAreaDataTypeName, textAreaData.id); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithContentAndSettingsElementType(customDataTypeName, elementTypeId, settingsElementTypeId, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.enterTextstring(contentBlockInputText); + await umbracoUi.content.clickAddBlockSettingsTabButton(); + await umbracoUi.content.enterTextArea(settingBlockInputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(contentBlockInputText); + expect(contentData.values[0].value.settingsData[0].values[0].value).toEqual(settingBlockInputText); + + // Clean + await umbracoApi.documentType.ensureNameNotExists(settingModelName); +}); + +test.skip('can move blocks in the content', async ({umbracoApi, umbracoUi}) => { + // TODO: Implement it later +}); + +test('can add an invariant block element with RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRTETipTapEditor(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an invariant block element with RTE TinyMCE in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETinyMCE'; + const customElementTypeName = 'BlockGridWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTinyMCEDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRichTextArea(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an variant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRTETipTapEditor(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an variant RTE TinyMCE in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTinyMCEDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRichTextArea(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRTETipTapEditor(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an invariant RTE TinyMCE in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTinyMCEDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRichTextArea(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); \ No newline at end of file diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithBlockList.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithBlockList.spec.ts new file mode 100644 index 000000000000..75addacb7f36 --- /dev/null +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithBlockList.spec.ts @@ -0,0 +1,395 @@ +import {ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers'; +import {expect} from "@playwright/test"; + +const contentName = 'TestContent'; +const documentTypeName = 'TestDocumentTypeForContent'; +const customDataTypeName = 'Custom Block List'; +const elementTypeName = 'BlockListElement'; +const propertyInBlock = 'Textstring'; +const groupName = 'testGroup'; +let elementTypeId = ''; + +test.beforeEach(async ({umbracoApi}) => { + await umbracoApi.documentType.ensureNameNotExists(documentTypeName); + await umbracoApi.document.ensureNameNotExists(contentName); + const textStringData = await umbracoApi.dataType.getByName(propertyInBlock); + elementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, propertyInBlock, textStringData.id); +}); + +test.afterEach(async ({umbracoApi}) => { + await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.documentType.ensureNameNotExists(documentTypeName); + await umbracoApi.documentType.ensureNameNotExists(elementTypeName); + await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); +}); + +test('can create content with an empty block list', async ({umbracoApi, umbracoUi}) => { + // Arrange + const expectedState = 'Draft'; + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, elementTypeId); + await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.clickActionsMenuAtRoot(); + await umbracoUi.content.clickCreateButton(); + await umbracoUi.content.chooseDocumentType(documentTypeName); + await umbracoUi.content.enterContentName(contentName); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.variants[0].state).toBe(expectedState); + expect(contentData.values).toEqual([]); +}); + +test('can publish content with an empty block list', async ({umbracoApi, umbracoUi}) => { + // Arrange + const expectedState = 'Published'; + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, elementTypeId); + await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.clickActionsMenuAtRoot(); + await umbracoUi.content.clickCreateButton(); + await umbracoUi.content.chooseDocumentType(documentTypeName); + await umbracoUi.content.enterContentName(contentName); + await umbracoUi.content.clickSaveAndPublishButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationsHaveCount(2); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.variants[0].state).toBe(expectedState); + expect(contentData.values).toEqual([]); +}); + +test('can add a block element in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, elementTypeId); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.enterTextstring(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(inputText); + const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value; + expect(blockListValue).toBeTruthy(); +}); + +test('can edit block element in the content', async ({umbracoApi, umbracoUi}) => { + const updatedText = 'This updated block test'; + await umbracoApi.document.createDefaultDocumentWithABlockListEditor(contentName, elementTypeId, documentTypeName, customDataTypeName); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickEditBlockListBlockButton(); + await umbracoUi.content.enterTextstring(updatedText); + await umbracoUi.content.clickUpdateButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(updatedText); +}); + +test('can delete block element in the content', async ({umbracoApi, umbracoUi}) => { + await umbracoApi.document.createDefaultDocumentWithABlockListEditor(contentName, elementTypeId, documentTypeName, customDataTypeName); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickDeleteBlockListBlockButton(); + await umbracoUi.content.clickConfirmToDeleteButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + const blockGridValue = contentData.values.find(item => item.value); + expect(blockGridValue).toBeFalsy(); +}); + +test('cannot add number of block element greater than the maximum amount', async ({umbracoApi, umbracoUi}) => { + // Arrange + const customDataTypeId = await umbracoApi.dataType.createBlockListWithABlockAndMinAndMaxAmount(customDataTypeName, elementTypeId, 0, 1); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + + // Assert + await umbracoUi.content.doesFormValidationMessageContainText('Maximum'); + await umbracoUi.content.doesFormValidationMessageContainText('too many'); +}); + +test('can set the label of block element in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const blockLabel = 'Test Block Label'; + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithLabel(customDataTypeName, elementTypeId, blockLabel); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + await umbracoUi.content.doesBlockElementHaveName(blockLabel); +}); + +// TODO: Remove skip when front-end is ready. Currently, it is impossible to create content with blocklist that has a setting model +test.skip('can add settings model for the block in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const contentBlockInputText = 'This is textstring'; + const settingBlockInputText = 'This is textarea'; + const settingModelName = 'Test Setting Model'; + const textAreaDataTypeName = 'Textarea'; + const textAreaData = await umbracoApi.dataType.getByName(textAreaDataTypeName); + const settingsElementTypeId = await umbracoApi.documentType.createDefaultElementType(settingModelName, groupName, textAreaDataTypeName, textAreaData.id); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithContentAndSettingsElementType(customDataTypeName, elementTypeId, settingsElementTypeId, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(elementTypeName); + await umbracoUi.content.enterTextstring(contentBlockInputText); + await umbracoUi.content.clickAddBlockSettingsTabButton(); + await umbracoUi.content.enterTextArea(settingBlockInputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(contentBlockInputText); + expect(contentData.values[0].value.settingsData[0].values[0].value).toEqual(settingBlockInputText); + + // Clean + await umbracoApi.documentType.ensureNameNotExists(settingModelName); +}); + +test.skip('can move blocks in the content', async ({umbracoApi, umbracoUi}) => { + // TODO: Implement it later +}); + +test('can add an invariant block element with RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRTETipTapEditor(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an invariant block element with RTE TinyMCE in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETinyMCE'; + const customElementTypeName = 'BlockListWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTinyMCEDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); + await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRichTextArea(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an variant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRTETipTapEditor(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an variant RTE TinyMCE in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTinyMCEDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRichTextArea(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRTETipTapEditor(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add an variant block element with an invariant RTE TinyMCE in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTinyMCEDataType(customRTEDataTypeName); + const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId); + const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true); + const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true); + await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US'); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + + // Act + await umbracoUi.content.goToContentWithName(contentName); + await umbracoUi.content.clickAddBlockElementButton(); + await umbracoUi.content.clickTextButtonWithName(customElementTypeName); + await umbracoUi.content.enterRichTextArea(inputText); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.saved); + expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); \ No newline at end of file