diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockGrid/ContentWithBlockGrid.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockGrid/ContentWithBlockGrid.spec.ts index 23742c85e5..f3b3ed50fa 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockGrid/ContentWithBlockGrid.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockGrid/ContentWithBlockGrid.spec.ts @@ -308,7 +308,112 @@ test('can add a block element with inline editing mode enabled', async ({umbraco 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.BlockGrid")?.value; - expect(blockListValue).toBeTruthy(); + const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value; + expect(blockGridValue).toBeTruthy(); await umbracoUi.content.doesPropertyContainValue(propertyInBlock, inputText); }); + +test('can add an invariant 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.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.clickSaveButtonForContent(); + + // Assert + await umbracoUi.content.isSuccessStateVisibleForSaveButton(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText); + const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value; + expect(blockGridValue).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add a variant block element with variant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + await umbracoApi.language.createDanishLanguage(); + 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.clickSaveButtonForContent(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.isSuccessStateVisibleForSaveButton(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText); + const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value; + expect(blockGridValue).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); + await umbracoApi.language.ensureNameNotExists('Danish'); +}); + +test('can add a variant block element with invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockGridWithRTEElement'; + await umbracoApi.language.createDanishLanguage(); + 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.clickSaveButtonForContent(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.isSuccessStateVisibleForSaveButton(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText); + const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value; + expect(blockGridValue).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); + await umbracoApi.language.ensureNameNotExists('Danish'); +}); \ No newline at end of file diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockList/ContentWithBlockList.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockList/ContentWithBlockList.spec.ts index 8626684d54..2c253a1b00 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockList/ContentWithBlockList.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockList/ContentWithBlockList.spec.ts @@ -1,4 +1,4 @@ -import {ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers'; +import {ConstantHelper, test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; const contentName = 'TestContent'; @@ -260,3 +260,108 @@ test('can add a block element with inline editing mode enabled', async ({umbraco const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value; expect(blockListValue).toBeTruthy(); }); + +test('can add an invariant block element with 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.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.isSuccessStateVisibleForSaveButton(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText); + const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value; + expect(blockListValue).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); +}); + +test('can add a variant block element with variant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + await umbracoApi.language.createDanishLanguage(); + 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.clickSaveButtonForContent(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.isSuccessStateVisibleForSaveButton(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText); + const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value; + expect(blockListValue).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); + await umbracoApi.language.ensureNameNotExists('Danish'); +}); + +test('can add a variant block element with invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => { + // Arrange + const inputText = 'This is block test'; + const customRTEDataTypeName = 'TestRTETiptap'; + const customElementTypeName = 'BlockListWithRTEElement'; + await umbracoApi.language.createDanishLanguage(); + 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.clickSaveButtonForContent(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.isSuccessStateVisibleForSaveButton(); + const contentData = await umbracoApi.document.getByName(contentName); + expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText); + const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value; + expect(blockListValue).toBeTruthy(); + + // Clean + await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName); + await umbracoApi.documentType.ensureNameNotExists(customElementTypeName); + await umbracoApi.language.ensureNameNotExists('Danish'); +});