-
Notifications
You must be signed in to change notification settings - Fork 2.9k
V16 QA Added acceptance tests for creating a document using blueprint #19708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2fea748
Added tests for creating content using document blueprint
nhudinh0309 97fde57
Merge branch 'main' into v16/QA/blueprint-tests
nhudinh0309 71086df
Updated tests due to api helper for document blueprint changes
nhudinh0309 ecd67e3
Bumped version
nhudinh0309 659fdd8
Make all Blueprint tests runs in the pipeline
nhudinh0309 ec30091
Merge branch 'main' into v16/QA/blueprint-tests
nhudinh0309 f001422
Merge branch 'main' into v16/QA/blueprint-tests
nhudinh0309 cc2c830
Reverted npm command
nhudinh0309 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
...sts.AcceptanceTest/tests/DefaultConfig/Content/CreateContentFromDocumentBlueprint.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| import {AliasHelper, ConstantHelper, test} from '@umbraco/playwright-testhelpers'; | ||
| import {expect} from "@playwright/test"; | ||
|
|
||
| // Content | ||
| const contentName = 'TestContentFromBlueprint'; | ||
| const textContent = 'This is a block in document blueprint'; | ||
|
|
||
| // Document Type | ||
| const documentTypeName = 'TestDocumentTypeForContent'; | ||
| const groupName = 'TestGroup'; | ||
|
|
||
| // Document Blueprint | ||
| const documentBlueprintName = 'TestDocumentBlueprint'; | ||
| const documentBlueprintDanishName = 'TestDocumentBlueprint-DA'; | ||
|
|
||
| // ElementType | ||
| const elementGroupName = 'ElementGroup'; | ||
| const elementTypeName = 'TestElement'; | ||
| const richTextDataTypeUiAlias = 'Richtext editor'; | ||
| const elementDataTypeUiAlias = 'Umbraco.RichText'; | ||
| const elementPropertyName = 'TipTapProperty' | ||
|
|
||
| // DataType | ||
| const blockDataTypeName = 'TestBlockEditor'; | ||
|
|
||
| test.beforeEach(async ({umbracoApi}) => { | ||
| await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
| await umbracoApi.document.ensureNameNotExists(contentName); | ||
| await umbracoApi.documentBlueprint.ensureNameNotExists(documentBlueprintName); | ||
| }); | ||
|
|
||
| test.afterEach(async ({umbracoApi}) => { | ||
| await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
| await umbracoApi.document.ensureNameNotExists(contentName); | ||
| await umbracoApi.document.ensureNameNotExists(documentBlueprintName); | ||
| await umbracoApi.documentBlueprint.ensureNameNotExists(documentBlueprintName); | ||
| await umbracoApi.documentType.ensureNameNotExists(elementTypeName); | ||
| await umbracoApi.dataType.ensureNameNotExists(blockDataTypeName); | ||
| }); | ||
|
|
||
| test('can create content using an invariant document blueprint', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| const dataTypeName = 'Textstring'; | ||
| const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
| const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
| await umbracoApi.documentBlueprint.createDocumentBlueprintWithTextBoxValue(documentBlueprintName, documentTypeId, dataTypeName, textContent); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.clickActionsMenuAtRoot(); | ||
| await umbracoUi.content.clickCreateActionMenuOption(); | ||
| await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
| await umbracoUi.content.clickModalMenuItemWithName(documentBlueprintName); | ||
| await umbracoUi.content.clickSaveButtonForContent(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.waitForContentToBeCreated(); | ||
| expect(await umbracoApi.document.doesNameExist(documentBlueprintName)).toBeTruthy(); | ||
| const contentData = await umbracoApi.document.getByName(documentBlueprintName); | ||
| expect(contentData.values[0].value).toBe(textContent); | ||
| }); | ||
|
|
||
| test('can create content using a variant document blueprint', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| const dataTypeName = 'Textstring'; | ||
| await umbracoApi.language.createDanishLanguage(); | ||
| const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
| const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
| await umbracoApi.documentBlueprint.createDocumenBlueprintWithEnglishCultureAndDanishCultureAndTextBoxValue(documentBlueprintName, documentBlueprintDanishName, documentTypeId, dataTypeName, textContent); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.clickActionsMenuAtRoot(); | ||
| await umbracoUi.content.clickCreateActionMenuOption(); | ||
| await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
| await umbracoUi.content.clickModalMenuItemWithName(documentBlueprintName); | ||
| await umbracoUi.content.clickSaveButtonForContent(); | ||
| await umbracoUi.content.clickSaveButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.waitForContentToBeCreated(); | ||
| expect(await umbracoApi.document.doesNameExist(documentBlueprintName)).toBeTruthy(); | ||
| const contentData = await umbracoApi.document.getByName(documentBlueprintName); | ||
| expect(contentData.values[0].value).toBe(textContent); | ||
| expect(contentData.variants[0].name).toBe(documentBlueprintName); | ||
| expect(contentData.variants[1].name).toBe(documentBlueprintDanishName); | ||
|
|
||
| // Clean | ||
| await umbracoApi.language.ensureNameNotExists('Danish'); | ||
| }); | ||
|
|
||
| test('can create content with different name using an invariant document blueprint', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| const dataTypeName = 'Textstring'; | ||
| const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
| const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
| await umbracoApi.documentBlueprint.createDocumentBlueprintWithTextBoxValue(documentBlueprintName, documentTypeId, dataTypeName, textContent); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.clickActionsMenuAtRoot(); | ||
| await umbracoUi.content.clickCreateActionMenuOption(); | ||
| await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
| await umbracoUi.content.clickModalMenuItemWithName(documentBlueprintName); | ||
| await umbracoUi.content.enterContentName(contentName); | ||
| await umbracoUi.content.clickSaveButtonForContent(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.waitForContentToBeCreated(); | ||
| expect(await umbracoApi.document.doesNameExist(documentBlueprintName)).toBeFalsy(); | ||
| expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.values[0].value).toBe(textContent); | ||
| }); | ||
|
|
||
| test('can create content with different name using a variant document blueprint', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| const dataTypeName = 'Textstring'; | ||
| await umbracoApi.language.createDanishLanguage(); | ||
| const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
| const documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithInvariantPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
| await umbracoApi.documentBlueprint.createDocumenBlueprintWithEnglishCultureAndDanishCultureAndTextBoxValue(documentBlueprintName, documentBlueprintDanishName, documentTypeId, dataTypeName, textContent); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.clickActionsMenuAtRoot(); | ||
| await umbracoUi.content.clickCreateActionMenuOption(); | ||
| await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
| await umbracoUi.content.clickModalMenuItemWithName(documentBlueprintName); | ||
| await umbracoUi.content.enterContentName(contentName); | ||
| await umbracoUi.content.clickSaveButtonForContent(); | ||
| await umbracoUi.content.clickSaveButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.waitForContentToBeCreated(); | ||
| expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.values[0].value).toBe(textContent); | ||
| expect(contentData.variants[0].name).toBe(contentName); | ||
| expect(contentData.variants[1].name).toBe(documentBlueprintDanishName); | ||
|
|
||
| // Clean | ||
| await umbracoApi.language.ensureNameNotExists('Danish'); | ||
| }); | ||
|
|
||
| test('can create content using a document blueprint with block list', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| await umbracoApi.dataType.ensureNameNotExists(blockDataTypeName); | ||
| const tipTapDataType = await umbracoApi.dataType.getByName(richTextDataTypeUiAlias); | ||
| const tipTapDataTypeId = tipTapDataType.id; | ||
| const elementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, elementGroupName, elementPropertyName, tipTapDataTypeId); | ||
| await umbracoApi.documentBlueprint.createDefaultDocumentBlueprintWithABlockListEditorAndBlockWithValue(documentBlueprintName, documentTypeName, blockDataTypeName, elementTypeId, AliasHelper.toAlias(elementPropertyName), elementDataTypeUiAlias, textContent, groupName); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.clickActionsMenuAtRoot(); | ||
| await umbracoUi.content.clickCreateActionMenuOption(); | ||
| await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
| await umbracoUi.content.clickModalMenuItemWithName(documentBlueprintName); | ||
| await umbracoUi.content.clickSaveButtonForContent(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.waitForContentToBeCreated(); | ||
| expect(await umbracoApi.document.doesNameExist(documentBlueprintName)).toBeTruthy(); | ||
| const contentData = await umbracoApi.document.getByName(documentBlueprintName); | ||
| expect(contentData.values[0].value.contentData[0].values[0].value.markup).toEqual(textContent); | ||
| const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockList")?.value; | ||
| expect(blockListValue).toBeTruthy(); | ||
| }); | ||
|
|
||
| test('can create content using a document blueprint with block grid', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| await umbracoApi.dataType.ensureNameNotExists(blockDataTypeName); | ||
| const tipTapDataType = await umbracoApi.dataType.getByName(richTextDataTypeUiAlias); | ||
| const tipTapDataTypeId = tipTapDataType.id; | ||
| const elementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, elementGroupName, elementPropertyName, tipTapDataTypeId); | ||
| await umbracoApi.documentBlueprint.createDefaultDocumentBlueprintWithABlockGridEditorAndBlockWithValue(documentBlueprintName, documentTypeName, blockDataTypeName, elementTypeId, AliasHelper.toAlias(elementPropertyName), richTextDataTypeUiAlias, textContent); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.clickActionsMenuAtRoot(); | ||
| await umbracoUi.content.clickCreateActionMenuOption(); | ||
| await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
| await umbracoUi.content.clickModalMenuItemWithName(documentBlueprintName); | ||
| await umbracoUi.content.clickSaveButtonForContent(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.waitForContentToBeCreated(); | ||
| expect(await umbracoApi.document.doesNameExist(documentBlueprintName)).toBeTruthy(); | ||
| const contentData = await umbracoApi.document.getByName(documentBlueprintName); | ||
| expect(contentData.values[0].value.contentData[0].values[0].value.markup).toEqual(textContent); | ||
| const blockListValue = contentData.values.find(item => item.editorAlias === "Umbraco.BlockGrid")?.value; | ||
| expect(blockListValue).toBeTruthy(); | ||
| }); | ||
|
Check warning on line 200 in tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/CreateContentFromDocumentBlueprint.spec.ts
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.