Skip to content

Commit 4a37f06

Browse files
committed
2 parents 300f507 + 345afd2 commit 4a37f06

File tree

2 files changed

+213
-3
lines changed

2 files changed

+213
-3
lines changed

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockGrid/ContentWithBlockGrid.spec.ts

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,112 @@ test('can add a block element with inline editing mode enabled', async ({umbraco
308308
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
309309
const contentData = await umbracoApi.document.getByName(contentName);
310310
expect(contentData.values[0].value.contentData[0].values[0].value).toEqual(inputText);
311-
const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value;
312-
expect(blockListValue).toBeTruthy();
311+
const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value;
312+
expect(blockGridValue).toBeTruthy();
313313
await umbracoUi.content.doesPropertyContainValue(propertyInBlock, inputText);
314314
});
315+
316+
test('can add an invariant block element with an invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => {
317+
// Arrange
318+
const inputText = 'This is block test';
319+
const customRTEDataTypeName = 'TestRTETiptap';
320+
const customElementTypeName = 'BlockGridWithRTEElement';
321+
const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName);
322+
const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId);
323+
const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true);
324+
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
325+
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
326+
await umbracoUi.goToBackOffice();
327+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
328+
329+
// Act
330+
await umbracoUi.content.goToContentWithName(contentName);
331+
await umbracoUi.content.clickAddBlockElementButton();
332+
await umbracoUi.content.clickTextButtonWithName(customElementTypeName);
333+
await umbracoUi.content.enterRTETipTapEditor(inputText);
334+
await umbracoUi.content.clickCreateModalButton();
335+
await umbracoUi.content.clickSaveButtonForContent();
336+
337+
// Assert
338+
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
339+
const contentData = await umbracoApi.document.getByName(contentName);
340+
expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText);
341+
const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value;
342+
expect(blockGridValue).toBeTruthy();
343+
344+
// Clean
345+
await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName);
346+
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
347+
});
348+
349+
test('can add a variant block element with variant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => {
350+
// Arrange
351+
const inputText = 'This is block test';
352+
const customRTEDataTypeName = 'TestRTETiptap';
353+
const customElementTypeName = 'BlockGridWithRTEElement';
354+
await umbracoApi.language.createDanishLanguage();
355+
const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName);
356+
const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId);
357+
const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true);
358+
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true);
359+
await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US');
360+
await umbracoUi.goToBackOffice();
361+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
362+
363+
// Act
364+
await umbracoUi.content.goToContentWithName(contentName);
365+
await umbracoUi.content.clickAddBlockElementButton();
366+
await umbracoUi.content.clickTextButtonWithName(customElementTypeName);
367+
await umbracoUi.content.enterRTETipTapEditor(inputText);
368+
await umbracoUi.content.clickCreateModalButton();
369+
await umbracoUi.content.clickSaveButtonForContent();
370+
await umbracoUi.content.clickSaveButton();
371+
372+
// Assert
373+
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
374+
const contentData = await umbracoApi.document.getByName(contentName);
375+
expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText);
376+
const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value;
377+
expect(blockGridValue).toBeTruthy();
378+
379+
// Clean
380+
await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName);
381+
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
382+
await umbracoApi.language.ensureNameNotExists('Danish');
383+
});
384+
385+
test('can add a variant block element with invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => {
386+
// Arrange
387+
const inputText = 'This is block test';
388+
const customRTEDataTypeName = 'TestRTETiptap';
389+
const customElementTypeName = 'BlockGridWithRTEElement';
390+
await umbracoApi.language.createDanishLanguage();
391+
const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName);
392+
const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId);
393+
const customDataTypeId = await umbracoApi.dataType.createBlockGridWithPermissions(customDataTypeName, customElementTypeId, true, true);
394+
const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true);
395+
await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US');
396+
await umbracoUi.goToBackOffice();
397+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
398+
399+
// Act
400+
await umbracoUi.content.goToContentWithName(contentName);
401+
await umbracoUi.content.clickAddBlockElementButton();
402+
await umbracoUi.content.clickTextButtonWithName(customElementTypeName);
403+
await umbracoUi.content.enterRTETipTapEditor(inputText);
404+
await umbracoUi.content.clickCreateModalButton();
405+
await umbracoUi.content.clickSaveButtonForContent();
406+
await umbracoUi.content.clickSaveButton();
407+
408+
// Assert
409+
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
410+
const contentData = await umbracoApi.document.getByName(contentName);
411+
expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText);
412+
const blockGridValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value;
413+
expect(blockGridValue).toBeTruthy();
414+
415+
// Clean
416+
await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName);
417+
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
418+
await umbracoApi.language.ensureNameNotExists('Danish');
419+
});

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/BlockList/ContentWithBlockList.spec.ts

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

44
const contentName = 'TestContent';
@@ -260,3 +260,108 @@ test('can add a block element with inline editing mode enabled', async ({umbraco
260260
const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value;
261261
expect(blockListValue).toBeTruthy();
262262
});
263+
264+
test('can add an invariant block element with invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => {
265+
// Arrange
266+
const inputText = 'This is block test';
267+
const customRTEDataTypeName = 'TestRTETiptap';
268+
const customElementTypeName = 'BlockListWithRTEElement';
269+
const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName);
270+
const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId);
271+
const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true);
272+
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
273+
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
274+
await umbracoUi.goToBackOffice();
275+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
276+
277+
// Act
278+
await umbracoUi.content.goToContentWithName(contentName);
279+
await umbracoUi.content.clickAddBlockElementButton();
280+
await umbracoUi.content.clickTextButtonWithName(customElementTypeName);
281+
await umbracoUi.content.enterRTETipTapEditor(inputText);
282+
await umbracoUi.content.clickCreateModalButton();
283+
await umbracoUi.content.clickSaveButton();
284+
285+
// Assert
286+
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
287+
const contentData = await umbracoApi.document.getByName(contentName);
288+
expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText);
289+
const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value;
290+
expect(blockListValue).toBeTruthy();
291+
292+
// Clean
293+
await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName);
294+
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
295+
});
296+
297+
test('can add a variant block element with variant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => {
298+
// Arrange
299+
const inputText = 'This is block test';
300+
const customRTEDataTypeName = 'TestRTETiptap';
301+
const customElementTypeName = 'BlockListWithRTEElement';
302+
await umbracoApi.language.createDanishLanguage();
303+
const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName);
304+
const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId);
305+
const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true);
306+
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true);
307+
await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US');
308+
await umbracoUi.goToBackOffice();
309+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
310+
311+
// Act
312+
await umbracoUi.content.goToContentWithName(contentName);
313+
await umbracoUi.content.clickAddBlockElementButton();
314+
await umbracoUi.content.clickTextButtonWithName(customElementTypeName);
315+
await umbracoUi.content.enterRTETipTapEditor(inputText);
316+
await umbracoUi.content.clickCreateModalButton();
317+
await umbracoUi.content.clickSaveButtonForContent();
318+
await umbracoUi.content.clickSaveButton();
319+
320+
// Assert
321+
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
322+
const contentData = await umbracoApi.document.getByName(contentName);
323+
expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText);
324+
const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value;
325+
expect(blockListValue).toBeTruthy();
326+
327+
// Clean
328+
await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName);
329+
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
330+
await umbracoApi.language.ensureNameNotExists('Danish');
331+
});
332+
333+
test('can add a variant block element with invariant RTE Tiptap in the content', async ({umbracoApi, umbracoUi}) => {
334+
// Arrange
335+
const inputText = 'This is block test';
336+
const customRTEDataTypeName = 'TestRTETiptap';
337+
const customElementTypeName = 'BlockListWithRTEElement';
338+
await umbracoApi.language.createDanishLanguage();
339+
const customRTEDataTypeId = await umbracoApi.dataType.createDefaultTiptapDataType(customRTEDataTypeName);
340+
const customElementTypeId = await umbracoApi.documentType.createDefaultElementType(customElementTypeName, groupName, customRTEDataTypeName, customRTEDataTypeId);
341+
const customDataTypeId = await umbracoApi.dataType.createBlockListDataTypeWithABlock(customDataTypeName, customElementTypeId, true, true);
342+
const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId, 'testGroup', true);
343+
await umbracoApi.document.createDefaultDocumentWithCulture(contentName, documentTypeId, 'en-US');
344+
await umbracoUi.goToBackOffice();
345+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
346+
347+
// Act
348+
await umbracoUi.content.goToContentWithName(contentName);
349+
await umbracoUi.content.clickAddBlockElementButton();
350+
await umbracoUi.content.clickTextButtonWithName(customElementTypeName);
351+
await umbracoUi.content.enterRTETipTapEditor(inputText);
352+
await umbracoUi.content.clickCreateModalButton();
353+
await umbracoUi.content.clickSaveButtonForContent();
354+
await umbracoUi.content.clickSaveButton();
355+
356+
// Assert
357+
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
358+
const contentData = await umbracoApi.document.getByName(contentName);
359+
expect(contentData.values[0].value.contentData[0].values[0].value.markup).toContain(inputText);
360+
const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value;
361+
expect(blockListValue).toBeTruthy();
362+
363+
// Clean
364+
await umbracoApi.dataType.ensureNameNotExists(customRTEDataTypeName);
365+
await umbracoApi.documentType.ensureNameNotExists(customElementTypeName);
366+
await umbracoApi.language.ensureNameNotExists('Danish');
367+
});

0 commit comments

Comments
 (0)