-
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 the Content tests with Radiobox and Tags datatype (#16909)
* Added Content tests with Radiobox data type - not done * Removed Content test with Tags property editor * Added Content tests with Radiobox datatype * Added Content tests with Tags data type * Created content with data type via API * Bumped version of test helper * Make all Content tests run in the pipeline * Make all smoke tests run in the pipeline
- Loading branch information
1 parent
fd10060
commit 20087c8
Showing
5 changed files
with
183 additions
and
35 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
87 changes: 87 additions & 0 deletions
87
tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithRadiobox.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,87 @@ | ||
import { ConstantHelper, test, AliasHelper } from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const contentName = 'TestContent'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Radiobox'; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); | ||
|
||
test('can create content with the radiobox data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Draft'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoUi.goToBackOffice(); | ||
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.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
test('can publish content with the radiobox data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Published'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
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.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
test('can create content with the custom radiobox data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const customDataTypeName = 'CustomRadiobox'; | ||
const optionValues = ['testOption1', 'testOption2']; | ||
const customDataTypeId = await umbracoApi.dataType.createRadioboxDataType(customDataTypeName, optionValues); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.chooseRadioboxOption(optionValues[0]); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values[0].alias).toEqual(AliasHelper.toAlias(customDataTypeName)); | ||
expect(contentData.values[0].value).toEqual(optionValues[0]); | ||
|
||
// Clean | ||
await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); | ||
}); | ||
|
85 changes: 85 additions & 0 deletions
85
tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithTags.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,85 @@ | ||
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const contentName = 'TestContent'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Tags'; | ||
const tagsName = ['testTag1', 'testTag2']; | ||
|
||
test.beforeEach(async ({umbracoApi, umbracoUi}) => { | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoUi.goToBackOffice(); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); | ||
|
||
test('can create content with one tag', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Draft'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
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.clickPlusIconButton(); | ||
await umbracoUi.content.enterTag(tagsName[0]); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values[0].value).toEqual([tagsName[0]]); | ||
}); | ||
|
||
test('can publish content with multiple tags', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Published'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickPlusIconButton(); | ||
await umbracoUi.content.enterTag(tagsName[0]); | ||
await umbracoUi.content.enterTag(tagsName[1]); | ||
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.variants[0].state).toBe(expectedState); | ||
expect(contentData.values[0].value).toEqual(tagsName); | ||
}); | ||
|
||
test('can remove a tag in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDocumentWithTags(contentName, documentTypeId, [tagsName[0]]); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.removeTagByName(tagsName[0]); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|