Skip to content

Commit a8cdba6

Browse files
authored
Tiptap: QA Added acceptance tests for regression issue #19763 (#20226)
* Added test * Finished up test * Updated tests * Removed comment * Updated testCommand * Reverted smokeTest
1 parent 6001d94 commit a8cdba6

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/RichTextEditor/ContentWithTiptap.spec.ts

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
1+
import {AliasHelper, ConstantHelper, test} from '@umbraco/playwright-testhelpers';
22
import {expect} from "@playwright/test";
33

44
const contentName = 'TestContent';
@@ -85,3 +85,54 @@ test('can publish content with RTE Tiptap property editor', async ({umbracoApi,
8585
expect(contentData.variants[0].state).toBe(expectedState);
8686
expect(contentData.values[0].value.markup).toEqual('<p>' + inputText + '</p>');
8787
});
88+
89+
// This is a test for the regression issue #19763
90+
test('can save a variant content node after removing embedded block in RTE', async ({umbracoApi, umbracoUi}) => {
91+
// Arrange
92+
// Language
93+
const danishIsoCode = 'da';
94+
await umbracoApi.language.createDanishLanguage();
95+
// Content Names
96+
const englishContentName = 'English Content';
97+
const danishContentName = 'Danish Content';
98+
// Element Type
99+
const elementTypeName = 'Default Element Type';
100+
const elementTypeGroupName = 'Content';
101+
const elementTypeDataTypeName = 'Textstring';
102+
const elementTypeDataType = await umbracoApi.dataType.getByName(elementTypeDataTypeName);
103+
// Rich Text Editor
104+
const richTextEditorDataTypeName = 'Rich Text Editor with a block';
105+
const textStringValue = 'Block Content';
106+
const elementTypeId = await umbracoApi.documentType.createDefaultElementTypeWithVaryByCulture(elementTypeName, elementTypeGroupName, elementTypeDataTypeName, elementTypeDataType.id, true, false);
107+
const richTextEditorId = await umbracoApi.dataType.createRichTextEditorWithABlock(richTextEditorDataTypeName, elementTypeId);
108+
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, richTextEditorDataTypeName, richTextEditorId, 'TestGroup', true, false);
109+
const cultures = [{isoCode: 'en-US', name: englishContentName}, {isoCode: 'da', name: danishContentName}];
110+
await umbracoApi.document.createDocumentWithMultipleVariantsWithSharedProperty(contentName, documentTypeId, AliasHelper.toAlias(richTextEditorDataTypeName), 'Umbraco.RichText', cultures, '');
111+
await umbracoUi.goToBackOffice();
112+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
113+
await umbracoUi.content.goToContentWithName(englishContentName);
114+
115+
// Act
116+
await umbracoUi.content.clickInsertBlockButton();
117+
await umbracoUi.content.clickLinkWithName(elementTypeName);
118+
await umbracoUi.content.enterTextstring(textStringValue);
119+
await umbracoUi.content.clickCreateModalButton();
120+
await umbracoUi.content.clickSaveButtonForContent();
121+
await umbracoUi.content.clickSaveButton();
122+
const contentData = await umbracoApi.document.getByName(englishContentName);
123+
expect(contentData.values[0].value.blocks.contentData[0].values[0].value).toBe(textStringValue);
124+
await umbracoUi.content.clearTipTapEditor();
125+
await umbracoUi.content.clickSaveButtonForContent();
126+
await umbracoUi.content.clickSaveButton();
127+
128+
// Assert
129+
await umbracoUi.content.isErrorNotificationVisible(false);
130+
await umbracoUi.content.waitForContentToBeCreated();
131+
expect(await umbracoApi.document.doesNameExist(englishContentName)).toBeTruthy();
132+
133+
// Clean
134+
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
135+
await umbracoApi.documentType.ensureNameNotExists(elementTypeName);
136+
await umbracoApi.dataType.ensureNameNotExists(richTextEditorDataTypeName);
137+
await umbracoApi.language.ensureIsoCodeNotExists(danishIsoCode);
138+
});

0 commit comments

Comments
 (0)