-
Notifications
You must be signed in to change notification settings - Fork 2.9k
V16 QA Added acceptance tests for publishing with descendants #19262
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 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
58a965f
Added tests for publishing with descendants
nhudinh0309 a3c2799
Merge branch 'main' into v16/QA/publish-with-descendants-tests
nhudinh0309 8549ffa
Merge branch 'main' into v16/QA/publish-with-descendants-tests
nhudinh0309 ceea9e4
Bumped version
nhudinh0309 8e0118e
Merge branch 'main' into v16/QA/publish-with-descendants-tests
nhudinh0309 81544d9
Fixed comments
nhudinh0309 6ff5399
Merge branch 'main' into v16/QA/publish-with-descendants-tests
nhudinh0309 58e2f4d
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
203 changes: 203 additions & 0 deletions
203
...s/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/PublishWithDescendants.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,203 @@ | ||
| import {ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers'; | ||
| import {expect} from "@playwright/test"; | ||
|
|
||
| let documentTypeId = ''; | ||
| let childDocumentTypeId = ''; | ||
| let contentId = ''; | ||
| let dataTypeId = ''; | ||
| const contentName = 'TestContent'; | ||
| const childContentName = 'ChildContent'; | ||
| const documentTypeName = 'DocumentTypeForContent'; | ||
| const childDocumentTypeName = 'ChildDocumentType'; | ||
| const dataTypeName = 'Textstring'; | ||
| const contentText = 'This is test content text'; | ||
| const defaultLanguage = 'English (United States)'; | ||
| const danishLanguage = 'Danish'; | ||
|
|
||
| test.beforeEach(async ({umbracoApi}) => { | ||
| await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
| await umbracoApi.document.ensureNameNotExists(contentName); | ||
| await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeName); | ||
| const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
| dataTypeId = dataTypeData.id; | ||
| await umbracoApi.language.ensureIsoCodeNotExists('da'); | ||
| await umbracoApi.language.createDanishLanguage(); | ||
| }); | ||
|
|
||
| test.afterEach(async ({umbracoApi}) => { | ||
| await umbracoApi.language.ensureIsoCodeNotExists('da'); | ||
| await umbracoApi.document.ensureNameNotExists(contentName); | ||
| await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeName); | ||
| await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
| }); | ||
|
|
||
| test('can publish invariant content with descendants', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| childDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(childDocumentTypeName, dataTypeName, dataTypeId); | ||
| documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNodeAndDataType(documentTypeName, childDocumentTypeId, dataTypeName, dataTypeId); | ||
| contentId = await umbracoApi.document.createDocumentWithTextContent(contentName, documentTypeId, contentText, dataTypeName); | ||
| await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.goToContentWithName(contentName); | ||
| await umbracoUi.content.clickViewMoreOptionsButton(); | ||
| await umbracoUi.content.clickPublishWithDescendantsButton(); | ||
| // verify variant language | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveCount(1); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(defaultLanguage); | ||
| await umbracoUi.content.clickPublishWithDescendantsModalButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.publishWithDescendants); | ||
| await umbracoUi.content.isErrorNotificationVisible(false); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.variants[0].state).toBe('Published'); | ||
| expect(contentData.values[0].value).toBe(contentText); | ||
| const childContentData = await umbracoApi.document.getByName(childContentName); | ||
| expect(childContentData.variants[0].state).toBe('Draft'); | ||
| }); | ||
|
|
||
| test('can publish invariant content with descendants and include unpublished content items.', async ({umbracoApi, umbracoUi}) => { | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| // Arrange | ||
| childDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(childDocumentTypeName, dataTypeName, dataTypeId); | ||
| documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNodeAndDataType(documentTypeName, childDocumentTypeId, dataTypeName, dataTypeId); | ||
| contentId = await umbracoApi.document.createDocumentWithTextContent(contentName, documentTypeId, contentText, dataTypeName); | ||
| await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.goToContentWithName(contentName); | ||
| await umbracoUi.content.clickViewMoreOptionsButton(); | ||
| await umbracoUi.content.clickPublishWithDescendantsButton(); | ||
| // verify variant language | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveCount(1); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(defaultLanguage); | ||
| await umbracoUi.content.clickIncludeUnpublishedDescendantsToggle(); | ||
| await umbracoUi.content.clickPublishWithDescendantsModalButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.publishWithDescendants); | ||
| await umbracoUi.content.isErrorNotificationVisible(false); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.variants[0].state).toBe('Published'); | ||
| expect(contentData.values[0].value).toBe(contentText); | ||
| const childContentData = await umbracoApi.document.getByName(childContentName); | ||
| expect(childContentData.variants[0].state).toBe('Published'); | ||
| }); | ||
|
|
||
| test('can cancel to publish invariant content with descendants', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| childDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(childDocumentTypeName, dataTypeName, dataTypeId); | ||
| documentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNodeAndDataType(documentTypeName, childDocumentTypeId, dataTypeName, dataTypeId); | ||
| contentId = await umbracoApi.document.createDocumentWithTextContent(contentName, documentTypeId, contentText, dataTypeName); | ||
| await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.goToContentWithName(contentName); | ||
| await umbracoUi.content.clickViewMoreOptionsButton(); | ||
| await umbracoUi.content.clickPublishWithDescendantsButton(); | ||
| // verify variant language | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveCount(1); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(defaultLanguage); | ||
| await umbracoUi.content.clickCloseButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.isErrorNotificationVisible(false); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.variants[0].state).toBe('Draft'); | ||
| expect(contentData.values[0].value).toBe(contentText); | ||
| const childContentData = await umbracoApi.document.getByName(childContentName); | ||
| expect(childContentData.variants[0].state).toBe('Draft'); | ||
| }); | ||
|
|
||
| test('can publish variant content with descendants', async ({umbracoApi, umbracoUi}) => { | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| // Arrange | ||
| childDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(childDocumentTypeName, dataTypeName, dataTypeId); | ||
| documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithAllowedChildNodeAndInvariantPropertyEditor(documentTypeName, childDocumentTypeId, dataTypeName, dataTypeId); | ||
| contentId = await umbracoApi.document.createDocumentWithEnglishCultureAndTextContent(contentName, documentTypeId, contentText, dataTypeName); | ||
| await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.goToContentWithName(contentName); | ||
| await umbracoUi.content.clickViewMoreOptionsButton(); | ||
| await umbracoUi.content.clickPublishWithDescendantsButton(); | ||
| // verify variant language | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveCount(2); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(defaultLanguage); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(danishLanguage); | ||
| await umbracoUi.content.clickPublishWithDescendantsModalButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.publishWithDescendants); | ||
| await umbracoUi.content.isErrorNotificationVisible(false); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.variants[0].state).toBe('Published'); | ||
| expect(contentData.values[0].value).toBe(contentText); | ||
| const childContentData = await umbracoApi.document.getByName(childContentName); | ||
| expect(childContentData.variants[0].state).toBe('Draft'); | ||
| }); | ||
|
|
||
| test('can publish variant content with descendants and include unpublished content items.', async ({umbracoApi, umbracoUi}) => { | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| // Arrange | ||
| childDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(childDocumentTypeName, dataTypeName, dataTypeId); | ||
| documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithAllowedChildNodeAndInvariantPropertyEditor(documentTypeName, childDocumentTypeId, dataTypeName, dataTypeId); | ||
| contentId = await umbracoApi.document.createDocumentWithEnglishCultureAndTextContent(contentName, documentTypeId, contentText, dataTypeName); | ||
| await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.goToContentWithName(contentName); | ||
| await umbracoUi.content.clickViewMoreOptionsButton(); | ||
| await umbracoUi.content.clickPublishWithDescendantsButton(); | ||
| // verify variant language | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveCount(2); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(defaultLanguage); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(danishLanguage); | ||
| await umbracoUi.content.clickIncludeUnpublishedDescendantsToggle(); | ||
| await umbracoUi.content.clickPublishWithDescendantsModalButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.doesSuccessNotificationHaveText(NotificationConstantHelper.success.publishWithDescendants); | ||
| await umbracoUi.content.isErrorNotificationVisible(false); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.variants[0].state).toBe('Published'); | ||
| expect(contentData.values[0].value).toBe(contentText); | ||
| const childContentData = await umbracoApi.document.getByName(childContentName); | ||
| expect(childContentData.variants[0].state).toBe('Published'); | ||
| }); | ||
|
|
||
| test('can cancel to publish variant content with descendants', async ({umbracoApi, umbracoUi}) => { | ||
| // Arrange | ||
| childDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(childDocumentTypeName, dataTypeName, dataTypeId); | ||
| documentTypeId = await umbracoApi.documentType.createVariantDocumentTypeWithAllowedChildNodeAndInvariantPropertyEditor(documentTypeName, childDocumentTypeId, dataTypeName, dataTypeId); | ||
| contentId = await umbracoApi.document.createDocumentWithEnglishCultureAndTextContent(contentName, documentTypeId, contentText, dataTypeName); | ||
| await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); | ||
| await umbracoUi.goToBackOffice(); | ||
| await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
|
||
| // Act | ||
| await umbracoUi.content.goToContentWithName(contentName); | ||
| await umbracoUi.content.clickViewMoreOptionsButton(); | ||
| await umbracoUi.content.clickPublishWithDescendantsButton(); | ||
| // verify variant language | ||
|
nhudinh0309 marked this conversation as resolved.
Outdated
|
||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveCount(2); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(defaultLanguage); | ||
| await umbracoUi.content.doesDocumentVariantLanguageItemHaveName(danishLanguage); | ||
| await umbracoUi.content.clickCloseButton(); | ||
|
|
||
| // Assert | ||
| await umbracoUi.content.isErrorNotificationVisible(false); | ||
| const contentData = await umbracoApi.document.getByName(contentName); | ||
| expect(contentData.variants[0].state).toBe('Draft'); | ||
| expect(contentData.values[0].value).toBe(contentText); | ||
| const childContentData = await umbracoApi.document.getByName(childContentName); | ||
| expect(childContentData.variants[0].state).toBe('Draft'); | ||
| }); | ||
|
Check warning on line 203 in tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/PublishWithDescendants.spec.ts
|
||
Oops, something went wrong.
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.