Tiptap: QA Added acceptance tests for regression issue #19763 (#20226)

* Added test

* Finished up test

* Updated tests

* Removed comment

* Updated testCommand

* Reverted smokeTest
This commit is contained in:
Andreas Zerbst
2025-09-24 13:05:00 +02:00
committed by GitHub
parent 6001d94f50
commit a8cdba6e70

View File

@@ -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,54 @@ 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('<p>' + inputText + '</p>');
});
// 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);
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.enterTextstring(textStringValue);
await umbracoUi.content.clickCreateModalButton();
await umbracoUi.content.clickSaveButtonForContent();
await umbracoUi.content.clickSaveButton();
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();
// Assert
await umbracoUi.content.isErrorNotificationVisible(false);
await umbracoUi.content.waitForContentToBeCreated();
expect(await umbracoApi.document.doesNameExist(englishContentName)).toBeTruthy();
// Clean
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoApi.documentType.ensureNameNotExists(elementTypeName);
await umbracoApi.dataType.ensureNameNotExists(richTextEditorDataTypeName);
await umbracoApi.language.ensureIsoCodeNotExists(danishIsoCode);
});