From 24fa96601647321ebcb80ec7cb5c4d2acbaaddef Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Tue, 9 Sep 2025 14:30:28 +0200 Subject: [PATCH 1/6] Added test --- .../RichTextEditor/ContentWithTiptap.spec.ts | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts index 1b83e2a2f65e..416118070b1d 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts @@ -1,4 +1,4 @@ -import {ConstantHelper, test} from '@umbraco/playwright-testhelpers'; +import {AliasHelper, ConstantHelper, test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; const contentName = 'TestContent'; @@ -85,3 +85,52 @@ test('can publish content with RTE Tiptap property editor', async ({umbracoApi, expect(contentData.variants[0].state).toBe(expectedState); expect(contentData.values[0].value.markup).toEqual('

' + inputText + '

'); }); + +// test for regression issue: https://github.com/umbraco/Umbraco-CMS/issues/19763 +test('can save a variant content node after removing embedded block in RTE', async ({umbracoApi, umbracoUi}) => { + // Arrange + // Language + const danishIsoCode = 'da'; + await umbracoApi.language.createDanishLanguage(); + + // Content Names + const englishContentName = 'English Content'; + const danishContentName = 'Danish Content'; + + // Element Type + const elementTypeName = 'Default Element Type'; + const elementTypeGroupName = 'Content'; + const elementTypeDataTypeName = 'Textstring'; + const elementTypeDataType = await umbracoApi.dataType.getByName(elementTypeDataTypeName); + + // Rich Text Editor + const richTextEditorDataTypeName = 'Rich Text Editor with a block'; + + const elementTypeId = await umbracoApi.documentType.createDefaultElementTypeWithVaryByCulture(elementTypeName, elementTypeGroupName, elementTypeDataTypeName, elementTypeDataType.id, true, false); + const richTextEditorId = await umbracoApi.dataType.createRichTextEditorWithABlock(richTextEditorDataTypeName, elementTypeId); + const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, richTextEditorDataTypeName, richTextEditorId, 'TestGroup', true, false); + const cultures = [{isoCode: 'en-US', name: englishContentName}, {isoCode: 'da', name: danishContentName}]; + await umbracoApi.document.createDocumentWithMultipleVariantsWithSharedProperty(contentName, documentTypeId, AliasHelper.toAlias(richTextEditorDataTypeName), 'Umbraco.RichText', cultures, ''); + await umbracoUi.goToBackOffice(); + await umbracoUi.content.goToSection(ConstantHelper.sections.content); + await umbracoUi.content.goToContentWithName(englishContentName); + + // Act + await umbracoUi.content.clickInsertBlockButton(); + await umbracoUi.content.clickLinkWithName(elementTypeName); + await umbracoUi.content.clickCreateModalButton(); + await umbracoUi.content.clickSaveButtonForContent(); + await umbracoUi.content.clickSaveButton(); + await umbracoUi.content.clearTipTapEditor(); + await umbracoUi.content.clickSaveButtonForContent(); + await umbracoUi.content.clickSaveButton(); + + // Assert + await umbracoUi.content.isErrorNotificationVisible(false); + + // Clean + await umbracoApi.documentType.ensureNameNotExists(documentTypeName); + await umbracoApi.documentType.ensureNameNotExists(elementTypeName); + await umbracoApi.dataType.ensureNameNotExists(richTextEditorDataTypeName); + await umbracoApi.language.ensureIsoCodeNotExists(danishIsoCode); +}); From a760a41d2dc9c3c833e700cb51f1b146b22aea79 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Tue, 23 Sep 2025 08:31:16 +0200 Subject: [PATCH 2/6] Finished up test --- .../Content/RichTextEditor/ContentWithTiptap.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts index 416118070b1d..dec79bc69e36 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts @@ -121,12 +121,16 @@ test('can save a variant content node after removing embedded block in RTE', asy await umbracoUi.content.clickCreateModalButton(); await umbracoUi.content.clickSaveButtonForContent(); await umbracoUi.content.clickSaveButton(); + // Wait a bit for the save to complete + await umbracoUi.waitForTimeout(1000); await umbracoUi.content.clearTipTapEditor(); await umbracoUi.content.clickSaveButtonForContent(); await umbracoUi.content.clickSaveButton(); // Assert await umbracoUi.content.isErrorNotificationVisible(false); + await umbracoUi.content.waitForContentToBeCreated(); + expect(await umbracoApi.document.doesNameExist(englishContentName)).toBeTruthy(); // Clean await umbracoApi.documentType.ensureNameNotExists(documentTypeName); From f579b21a6fdd28d38468677b63a6f37f3a6afaf2 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Wed, 24 Sep 2025 08:34:35 +0200 Subject: [PATCH 3/6] Updated tests --- .../Content/RichTextEditor/ContentWithTiptap.spec.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts index dec79bc69e36..bd00251b1e3d 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts @@ -86,26 +86,23 @@ test('can publish content with RTE Tiptap property editor', async ({umbracoApi, expect(contentData.values[0].value.markup).toEqual('

' + inputText + '

'); }); -// test for regression issue: https://github.com/umbraco/Umbraco-CMS/issues/19763 +// This is a test for the regression issue #19763 test('can save a variant content node after removing embedded block in RTE', async ({umbracoApi, umbracoUi}) => { // Arrange // Language const danishIsoCode = 'da'; await umbracoApi.language.createDanishLanguage(); - // Content Names const englishContentName = 'English Content'; const danishContentName = 'Danish Content'; - // Element Type const elementTypeName = 'Default Element Type'; const elementTypeGroupName = 'Content'; const elementTypeDataTypeName = 'Textstring'; const elementTypeDataType = await umbracoApi.dataType.getByName(elementTypeDataTypeName); - // Rich Text Editor const richTextEditorDataTypeName = 'Rich Text Editor with a block'; - + const textStringValue = 'Block Content'; const elementTypeId = await umbracoApi.documentType.createDefaultElementTypeWithVaryByCulture(elementTypeName, elementTypeGroupName, elementTypeDataTypeName, elementTypeDataType.id, true, false); const richTextEditorId = await umbracoApi.dataType.createRichTextEditorWithABlock(richTextEditorDataTypeName, elementTypeId); const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, richTextEditorDataTypeName, richTextEditorId, 'TestGroup', true, false); @@ -118,11 +115,13 @@ test('can save a variant content node after removing embedded block in RTE', asy // Act await umbracoUi.content.clickInsertBlockButton(); await umbracoUi.content.clickLinkWithName(elementTypeName); + await umbracoUi.content.enterTextstring(textStringValue); await umbracoUi.content.clickCreateModalButton(); await umbracoUi.content.clickSaveButtonForContent(); await umbracoUi.content.clickSaveButton(); // Wait a bit for the save to complete - await umbracoUi.waitForTimeout(1000); + const contentData = await umbracoApi.document.getByName(englishContentName); + expect(contentData.values[0].value.blocks.contentData[0].values[0].value).toBe(textStringValue); await umbracoUi.content.clearTipTapEditor(); await umbracoUi.content.clickSaveButtonForContent(); await umbracoUi.content.clickSaveButton(); From f6c6cd163274133b755a7aad61805528bbe3fe1b Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Wed, 24 Sep 2025 09:59:37 +0200 Subject: [PATCH 4/6] Removed comment --- .../Content/RichTextEditor/ContentWithTiptap.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts index bd00251b1e3d..fc39dacff658 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts @@ -119,7 +119,6 @@ test('can save a variant content node after removing embedded block in RTE', asy await umbracoUi.content.clickCreateModalButton(); await umbracoUi.content.clickSaveButtonForContent(); await umbracoUi.content.clickSaveButton(); - // Wait a bit for the save to complete const contentData = await umbracoApi.document.getByName(englishContentName); expect(contentData.values[0].value.blocks.contentData[0].values[0].value).toBe(textStringValue); await umbracoUi.content.clearTipTapEditor(); From d1ecb3f1c3aa10806473657bfdfeb3f4de919b91 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Wed, 24 Sep 2025 09:59:45 +0200 Subject: [PATCH 5/6] Updated testCommand --- tests/Umbraco.Tests.AcceptanceTest/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/package.json b/tests/Umbraco.Tests.AcceptanceTest/package.json index 3a3c6971a5b9..622d1bad8c31 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package.json @@ -9,7 +9,8 @@ "testSqlite": "npx playwright test DefaultConfig --grep-invert \"Users\"", "all": "npx playwright test", "createTest": "node createTest.js", - "smokeTest": "npx playwright test DefaultConfig --grep \"@smoke\"", + "smokeTest": "npx playwright test DefaultConfig --grep \"can save a variant content node after removing embedded block in RTE\"", + "smokerTest": "npx playwright test DefaultConfig --grep \"@smoke\"", "smokeTestSqlite": "npx playwright test DefaultConfig --grep \"@smoke\" --grep-invert \"Users\"", "releaseTest": "npx playwright test DefaultConfig --grep \"@release\"" }, From ae3ce1364e3d78eb6f0f4eb944982c7b0a577e66 Mon Sep 17 00:00:00 2001 From: Andreas Zerbst Date: Wed, 24 Sep 2025 11:12:32 +0200 Subject: [PATCH 6/6] Reverted smokeTest --- tests/Umbraco.Tests.AcceptanceTest/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/package.json b/tests/Umbraco.Tests.AcceptanceTest/package.json index 622d1bad8c31..3a3c6971a5b9 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package.json @@ -9,8 +9,7 @@ "testSqlite": "npx playwright test DefaultConfig --grep-invert \"Users\"", "all": "npx playwright test", "createTest": "node createTest.js", - "smokeTest": "npx playwright test DefaultConfig --grep \"can save a variant content node after removing embedded block in RTE\"", - "smokerTest": "npx playwright test DefaultConfig --grep \"@smoke\"", + "smokeTest": "npx playwright test DefaultConfig --grep \"@smoke\"", "smokeTestSqlite": "npx playwright test DefaultConfig --grep \"@smoke\" --grep-invert \"Users\"", "releaseTest": "npx playwright test DefaultConfig --grep \"@release\"" },