-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V14 Added Content tests with various data types (#16809)
* Added Content tests with content picker * Removed the test for content picker * Added Content tests with the default content picker * Added more Content tests with Content Picker data type * Added the Content tests with Dropdown * Added Content tests with Image Cropper * Updated upload file method due to test helper changes * Added Content tests with Image Cropper * Added Content tests with Image Cropper data type * Added Content tests with Media Picker data type * Updated Media tests due to ui helper changes * Bumped version of test helper and json builder * Make all Content tests run in pipeline - should remove it before merging * Fixed the name of tests * Updated the tests for Media Picker in Content section * Added the Content tests with Multiple Media Picker * Updated the Content test with Content Picker due to the test helper changes * Bumped version of test helper * Fixed the failing tests for Content * Removed Image Cropper test in this branch * Added more waits * Added smoke tags * Make smoke tests run in the pipeline
- Loading branch information
1 parent
b61b71e
commit 4f62746
Showing
11 changed files
with
528 additions
and
63 deletions.
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 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
This file contains 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
This file contains 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
This file contains 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
173 changes: 173 additions & 0 deletions
173
...Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithContentPicker.spec.ts
This file contains 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,173 @@ | ||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const contentName = 'TestContent'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Content Picker'; | ||
const contentPickerDocumentTypeName = 'DocumentTypeForContentPicker'; | ||
const contentPickerName = 'TestContentPicker'; | ||
let contentPickerDocumentTypeId = ''; | ||
|
||
test.beforeEach(async ({umbracoApi, umbracoUi}) => { | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
contentPickerDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(contentPickerDocumentTypeName); | ||
await umbracoUi.goToBackOffice(); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentPickerName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.documentType.ensureNameNotExists(contentPickerDocumentTypeName); | ||
}); | ||
|
||
test('can create content with the content picker datatype', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.addContentPicker(contentPickerName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.doesSuccessNotificationsHaveCount(1); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values[0].value).toEqual(contentPickerId); | ||
}); | ||
|
||
test('can publish content with the content picker data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.addContentPicker(contentPickerName); | ||
await umbracoUi.content.clickSaveAndPublishButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.doesSuccessNotificationsHaveCount(2); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values[0].value).toEqual(contentPickerId); | ||
}); | ||
|
||
test('can open content picker in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const customDataTypeName = 'CustomContentPicker'; | ||
const customDataTypeId = await umbracoApi.dataType.createContentPickerDataTypeWithShowOpenButton(customDataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); | ||
await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.addContentPicker(contentPickerName); | ||
|
||
// Assert | ||
await umbracoUi.content.isOpenButtonVisibleInContentPicker(contentPickerName); | ||
await umbracoUi.content.clickContentPickerOpenButton(contentPickerName); | ||
await umbracoUi.content.isNodeOpenForContentPicker(contentPickerName); | ||
|
||
// Clean | ||
await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); | ||
}); | ||
|
||
test('can choose start node for the content picker in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const customDataTypeName = 'CustomContentPicker'; | ||
const childContentPickerDocumentTypeName = 'ChildDocumentTypeForContentPicker'; | ||
const childContentPickerName = 'TestChildContentPicker'; | ||
await umbracoApi.documentType.ensureNameNotExists(childContentPickerDocumentTypeName); | ||
const childContentPickerDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childContentPickerDocumentTypeName); | ||
const contentPickerDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(contentPickerName, childContentPickerDocumentTypeId); | ||
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId); | ||
await umbracoApi.document.createDefaultDocumentWithParent(childContentPickerName, childContentPickerDocumentTypeId, contentPickerId); | ||
// Create a custom content picker with start node | ||
const customDataTypeId = await umbracoApi.dataType.createContentPickerDataTypeWithStartNode(customDataTypeName, contentPickerId); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.clickChooseButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isContentNameVisible(childContentPickerName); | ||
await umbracoUi.content.isContentNameVisible(contentPickerName, false); | ||
|
||
// Clean | ||
await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); | ||
await umbracoApi.document.ensureNameNotExists(childContentPickerName); | ||
}); | ||
|
||
test.skip('can ignore user start node for the content picker in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const customDataTypeName = 'CustomContentPicker'; | ||
const childContentPickerDocumentTypeName = 'ChildDocumentTypeForContentPicker'; | ||
const childContentPickerName = 'TestChildContentPicker'; | ||
await umbracoApi.documentType.ensureNameNotExists(childContentPickerDocumentTypeName); | ||
const childContentPickerDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childContentPickerDocumentTypeName); | ||
const contentPickerDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(contentPickerName, childContentPickerDocumentTypeId); | ||
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId); | ||
await umbracoApi.document.createDefaultDocumentWithParent(childContentPickerName, childContentPickerDocumentTypeId, contentPickerId); | ||
// Create a custom content picker with the setting "ignore user start node" is enable | ||
const customDataTypeId = await umbracoApi.dataType.createContentPickerDataTypeWithIgnoreUserStartNodes(customDataTypeName, contentPickerId); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.clickChooseButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isContentNameVisible(childContentPickerName); | ||
await umbracoUi.content.isContentNameVisible(contentPickerName); | ||
|
||
// Clean | ||
await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); | ||
await umbracoApi.document.ensureNameNotExists(childContentPickerName); | ||
}); | ||
|
||
test('can remove content picker in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId); | ||
await umbracoApi.document.createDocumentWithContentPicker(contentName, documentTypeId, contentPickerId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.openContent(contentName); | ||
await umbracoUi.content.removeContentPicker(contentPickerName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
Oops, something went wrong.