-
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 acceptance tests for Data Type - p2 (#15873)
* Added tests for Multi URL Picker * Added tests for Multiple Media Picker * Added tests for RichTextEditor - not done * Added tests for Richtext Editor * Added tests for Content Picker * Added tests for Tags * Fixed the tests for Approved Color * Added tests for Checkbox list * Fixed tests for DataTypeFolder * Fixed tests for DatePicker due to api changes * Added tests for Dropdown * Fixed tests for ImageCropper due to ui changes * Added tests for List View * Added tests for Multiple Media Picker * Added tests for RichTextEditor * Added tests for Radiobox * Added tests for True false * Added tests for Upload * Bumped version of test helper * Bumped version * Fixed code format * Removed hard waits * Updated tests for Template and Partial View - not done * Added insert section tests * Used defaultTemplateContent to avoid duplicate code * Added insert section tests * Added missing tests for Partial View * Added missing tests for Scripts * Added missing tests for Stylesheet * Added missing tests for Template * Changed method's name due to test helper changes * Added skip tests * Bumped version of test helper * Reversed waits * Changed createThreeDotsButton to createButton due to UI changes * Removed List View - Members tests as the UI changes * Added more waits * Removed unnecessary waits * Added and removed skip tests * Fixed and added missing tests * Changed name of test file for Media Picker, Image Media Picker, Multiple Media Picker and Multiple Image Media Picker * Updated and added missing tests for Data Types * Bumped version of test helper * Changed configuration of smokeTest to make all DataType tests run in the pipeline. It should remove before merging * Added skip for all tests of Numeric as there is no configuration now * Removed test.describle * Change syntax of smoke tag * Removed duplicate code * Added the tests that avoid the minimum value is greater than the maximum value * Added the tests that avoid the min height value is greater than the max height value * Added test for adding available block to RTE * Remove skip and add more tests * Added tests for create an empty data type * Fixed the create data type tests * Added tests for changing setting a data type * Updated the test for creating a new data type * Added skip tests due to UI changes * Skipped unhappy tests as the front-end is not ready * Changed the way to create a new stylesheet * Updated method names due to test helpers changes * Bumped version of test helper * Updated expected result * Updated method name due to UI changes * Bumped version of test helper * Bumped version of test helper * Fixed add start node tests * Added skip tests * Updated the expected result * Fixed add layout tests * Added more waits * Add skip tests * Removed , in the objects and renamed some tests * Added tests for updating the option * Fixed naming and removed unnecessary commas * Update tests/Umbraco.Tests.AcceptanceTest/package.json Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> --------- Co-authored-by: Andreas Zerbst <andr317c@live.dk> Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
- Loading branch information
1 parent
ebf7702
commit 71199b3
Showing
20 changed files
with
1,448 additions
and
198 deletions.
There are no files selected for viewing
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
98 changes: 98 additions & 0 deletions
98
tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/DataType/CheckboxList.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,98 @@ | ||
import {test} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const dataTypeName = 'Checkbox list'; | ||
let dataTypeDefaultData = null; | ||
let dataTypeData = null; | ||
|
||
test.beforeEach(async ({umbracoUi, umbracoApi}) => { | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.dataType.goToSettingsTreeItem('Data Types'); | ||
dataTypeDefaultData = await umbracoApi.dataType.getByName(dataTypeName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
if (dataTypeDefaultData !== null) { | ||
await umbracoApi.dataType.update(dataTypeDefaultData.id, dataTypeDefaultData); | ||
} | ||
}); | ||
|
||
test('can add option', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const optionName = 'Test option'; | ||
const expectedDataTypeValues = [ | ||
{ | ||
"alias": "items", | ||
"value": [optionName] | ||
} | ||
]; | ||
// Remove all existing options | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
dataTypeData.values = []; | ||
await umbracoApi.dataType.update(dataTypeData.id, dataTypeData); | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.clickAddOptionButton(); | ||
await umbracoUi.dataType.enterOptionName(optionName); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toEqual(expectedDataTypeValues); | ||
}); | ||
|
||
test('can remove option', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const removedOptionName = 'Removed Option'; | ||
const removedOptionValues = [ | ||
{ | ||
"alias": "items", | ||
"value": [removedOptionName] | ||
} | ||
]; | ||
// Remove all existing options and add an option to remove | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
dataTypeData.values = removedOptionValues; | ||
await umbracoApi.dataType.update(dataTypeData.id, dataTypeData); | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.removeOptionByName(removedOptionName); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toEqual([]); | ||
}); | ||
|
||
test('can update option', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const optionName = 'Test option'; | ||
const updatedOptionName = 'Updated option'; | ||
const optionValues = [ | ||
{ | ||
"alias": "items", | ||
"value": [optionName] | ||
} | ||
]; | ||
const expectedOptionValues = [ | ||
{ | ||
"alias": "items", | ||
"value": [updatedOptionName] | ||
} | ||
]; | ||
// Remove all existing options and add an option to update | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
dataTypeData.values = optionValues; | ||
await umbracoApi.dataType.update(dataTypeData.id, dataTypeData); | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.enterOptionName(updatedOptionName); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toEqual(expectedOptionValues); | ||
}); |
122 changes: 122 additions & 0 deletions
122
tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/DataType/ContentPicker.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,122 @@ | ||
import {test} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const dataTypeName = 'Content Picker'; | ||
let dataTypeDefaultData = null; | ||
let dataTypeData = null; | ||
|
||
test.beforeEach(async ({umbracoUi, umbracoApi}) => { | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.dataType.goToSettingsTreeItem('Data Types'); | ||
dataTypeDefaultData = await umbracoApi.dataType.getByName(dataTypeName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
if (dataTypeDefaultData !== null) { | ||
await umbracoApi.dataType.update(dataTypeDefaultData.id, dataTypeDefaultData); | ||
} | ||
}); | ||
|
||
test('can show open button', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedDataTypeValues = { | ||
"alias": "showOpenButton", | ||
"value": true | ||
}; | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.clickShowOpenButtonSlider(); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toContainEqual(expectedDataTypeValues); | ||
}); | ||
|
||
test('can ignore user start nodes', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedDataTypeValues = { | ||
"alias": "ignoreUserStartNodes", | ||
"value": true | ||
}; | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.clickIgnoreUserStartNodesSlider(); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toContainEqual(expectedDataTypeValues); | ||
}); | ||
|
||
test('can add start node', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
// Create content | ||
const documentTypeName = 'TestDocumentType'; | ||
const contentName = 'TestStartNode'; | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
const contentId = await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
expect(await umbracoApi.document.doesExist(contentId)).toBeTruthy(); | ||
|
||
const expectedDataTypeValues = { | ||
"alias": "startNodeId", | ||
"value": contentId | ||
}; | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.clickChooseButton(); | ||
await umbracoUi.dataType.addContentStartNode(contentName); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toContainEqual(expectedDataTypeValues); | ||
|
||
// Clean | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); | ||
|
||
test('can remove start node', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
// Create content | ||
const documentTypeName = 'TestDocumentType'; | ||
const contentName = 'TestStartNode'; | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
const contentId = await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
expect(await umbracoApi.document.doesExist(contentId)).toBeTruthy(); | ||
|
||
const expectedDataTypeValues = { | ||
"alias": "startNodeId", | ||
"value": "" | ||
} | ||
const removedDataTypeValues = [{ | ||
"alias": "startNodeId", | ||
"value": contentId | ||
}]; | ||
|
||
// Remove all existing values and add a start node to remove | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
dataTypeData.values = removedDataTypeValues; | ||
await umbracoApi.dataType.update(dataTypeData.id, dataTypeData); | ||
await umbracoUi.dataType.goToDataType(dataTypeName); | ||
|
||
// Act | ||
await umbracoUi.dataType.removeContentStartNode(contentName); | ||
await umbracoUi.dataType.clickSaveButton(); | ||
|
||
// Assert | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
expect(dataTypeData.values).toContainEqual(expectedDataTypeValues); | ||
|
||
// Clean | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); |
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
Oops, something went wrong.