Skip to content
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

V14 Added acceptance tests for Data Type - p2 #15873

Merged
merged 92 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
ca4b1ac
Added tests for Multi URL Picker
nhudinh0309 Feb 22, 2024
603257f
Added tests for Multiple Media Picker
nhudinh0309 Feb 22, 2024
fe702c9
Added tests for RichTextEditor - not done
nhudinh0309 Feb 22, 2024
715e539
Added tests for Richtext Editor
nhudinh0309 Feb 23, 2024
96dbd57
Added tests for Content Picker
nhudinh0309 Feb 23, 2024
422336c
Added tests for Tags
nhudinh0309 Feb 23, 2024
cd5bd0a
Fixed the tests for Approved Color
nhudinh0309 Mar 12, 2024
4cdf877
Added tests for Checkbox list
nhudinh0309 Mar 12, 2024
5a591b6
Fixed tests for DataTypeFolder
nhudinh0309 Mar 12, 2024
891f4b8
Fixed tests for DatePicker due to api changes
nhudinh0309 Mar 12, 2024
bda4cbd
Added tests for Dropdown
nhudinh0309 Mar 12, 2024
558c205
Fixed tests for ImageCropper due to ui changes
nhudinh0309 Mar 12, 2024
36c49ec
Added tests for List View
nhudinh0309 Mar 12, 2024
497e3b4
Added tests for Multiple Media Picker
nhudinh0309 Mar 12, 2024
548d65a
Added tests for RichTextEditor
nhudinh0309 Mar 12, 2024
87ac845
Added tests for Radiobox
nhudinh0309 Mar 12, 2024
648311c
Added tests for True false
nhudinh0309 Mar 12, 2024
d3c4d1d
Added tests for Upload
nhudinh0309 Mar 12, 2024
f2d20c8
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Mar 12, 2024
eb79704
Bumped version of test helper
nhudinh0309 Mar 13, 2024
a5043af
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Mar 13, 2024
156b996
Bumped version
nhudinh0309 Mar 13, 2024
7008a60
Fixed code format
nhudinh0309 Mar 13, 2024
98565d9
Removed hard waits
nhudinh0309 Apr 10, 2024
3565fa3
Updated tests for Template and Partial View - not done
nhudinh0309 Apr 10, 2024
4321eb6
Merge branch 'v14/dev' into v14/QA/add-missing-acceptance-tests
nhudinh0309 Apr 10, 2024
4a9b961
Added insert section tests
nhudinh0309 Apr 10, 2024
06350d2
Used defaultTemplateContent to avoid duplicate code
nhudinh0309 Apr 10, 2024
1549100
Added insert section tests
nhudinh0309 Apr 11, 2024
ed44bf1
Added missing tests for Partial View
nhudinh0309 Apr 15, 2024
12740b8
Added missing tests for Scripts
nhudinh0309 Apr 15, 2024
4e70daa
Added missing tests for Stylesheet
nhudinh0309 Apr 15, 2024
11c91e9
Added missing tests for Template
nhudinh0309 Apr 15, 2024
99dd782
Changed method's name due to test helper changes
nhudinh0309 Apr 15, 2024
433a5c9
Added skip tests
nhudinh0309 Apr 15, 2024
83872dc
Merge branch 'v14/dev' into v14/QA/add-missing-acceptance-tests
nhudinh0309 Apr 16, 2024
9ddde02
Bumped version of test helper
nhudinh0309 Apr 16, 2024
03fa571
Reversed waits
nhudinh0309 Apr 16, 2024
9b31240
Changed createThreeDotsButton to createButton due to UI changes
nhudinh0309 Apr 16, 2024
d9d5156
Removed List View - Members tests as the UI changes
nhudinh0309 Apr 16, 2024
25a6b8a
Added more waits
nhudinh0309 Apr 16, 2024
b46ebf7
Removed unnecessary waits
nhudinh0309 Apr 16, 2024
c909de0
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Apr 16, 2024
dd0d66b
Merge branch 'v14/QA/add-missing-acceptance-tests' into v14/QA/data-t…
nhudinh0309 Apr 16, 2024
eaa8819
Added and removed skip tests
nhudinh0309 Apr 16, 2024
8b30a65
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Apr 23, 2024
e3efa30
Fixed and added missing tests
nhudinh0309 Apr 23, 2024
46ef687
Changed name of test file for Media Picker, Image Media Picker, Multi…
nhudinh0309 Apr 29, 2024
03e7dc8
Updated and added missing tests for Data Types
nhudinh0309 Apr 29, 2024
36d9795
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Apr 29, 2024
eb0ba8f
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Apr 29, 2024
6e36b00
Bumped version of test helper
nhudinh0309 Apr 29, 2024
4ef2c39
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 May 6, 2024
768e083
Changed configuration of smokeTest to make all DataType tests run in …
nhudinh0309 May 6, 2024
1483f2f
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 May 14, 2024
4f31b85
Added skip for all tests of Numeric as there is no configuration now
nhudinh0309 May 14, 2024
16e8304
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 May 27, 2024
a1a9e1b
Removed test.describle
nhudinh0309 May 27, 2024
a65792c
Change syntax of smoke tag
nhudinh0309 May 27, 2024
cfc8825
Removed duplicate code
nhudinh0309 May 27, 2024
4c6d4f4
Added the tests that avoid the minimum value is greater than the maxi…
nhudinh0309 May 27, 2024
3761f23
Added the tests that avoid the min height value is greater than the m…
nhudinh0309 May 27, 2024
5e8ed3d
Added test for adding available block to RTE
nhudinh0309 May 27, 2024
965169f
Remove skip and add more tests
nhudinh0309 May 27, 2024
e4321df
Merge remote-tracking branch 'origin/v14/dev' into v14/QA/data-types-…
nhudinh0309 May 27, 2024
5b0b681
Added tests for create an empty data type
nhudinh0309 May 28, 2024
b4cf910
Fixed the create data type tests
nhudinh0309 May 28, 2024
7889248
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 May 28, 2024
7db35cc
Added tests for changing setting a data type
nhudinh0309 May 28, 2024
add43b5
Updated the test for creating a new data type
nhudinh0309 May 29, 2024
697d69d
Added skip tests due to UI changes
nhudinh0309 May 29, 2024
7ced89e
Skipped unhappy tests as the front-end is not ready
nhudinh0309 May 29, 2024
91b5aad
Changed the way to create a new stylesheet
nhudinh0309 May 29, 2024
47b4f1f
Updated method names due to test helpers changes
nhudinh0309 May 29, 2024
b0a1244
Bumped version of test helper
nhudinh0309 May 29, 2024
1a75d9a
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 May 29, 2024
2eeb7dd
Updated expected result
nhudinh0309 May 29, 2024
f2dcfbf
Updated method name due to UI changes
nhudinh0309 May 29, 2024
f96300d
Bumped version of test helper
nhudinh0309 May 29, 2024
647c991
Bumped version of test helper
nhudinh0309 May 30, 2024
30df65b
Fixed add start node tests
nhudinh0309 May 30, 2024
cd339b7
Added skip tests
nhudinh0309 May 30, 2024
94eda2d
Updated the expected result
nhudinh0309 May 30, 2024
29427e4
Fixed add layout tests
nhudinh0309 May 30, 2024
b799b0f
Added more waits
nhudinh0309 May 30, 2024
a47dae2
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 May 31, 2024
aeafbe2
Add skip tests
nhudinh0309 May 31, 2024
3682aee
Merge branch 'v14/dev' into v14/QA/data-types-tests
nhudinh0309 Jun 4, 2024
39fdc38
Removed , in the objects and renamed some tests
nhudinh0309 Jun 5, 2024
8cfb2f1
Added tests for updating the option
nhudinh0309 Jun 5, 2024
469869f
Fixed naming and removed unnecessary commas
andr317c Jun 6, 2024
a58f95c
Update tests/Umbraco.Tests.AcceptanceTest/package.json
nhudinh0309 Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/Umbraco.Tests.AcceptanceTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "npx playwright test DefaultConfig",
"all": "npx playwright test",
"createTest": "node createTest.js",
"smokeTest": "npx playwright test DefaultConfig --grep \"@smoke\""
"smokeTest": "npx playwright test DataType"
nhudinh0309 marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@playwright/test": "^1.43",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {expect} from "@playwright/test";

const dataTypeName = 'Approved Color';
let dataTypeDefaultData = null;
let dataTypeData = null;
const colorValue = '#ffffff';
const colorLabel = 'TestColor';
let dataTypeData = null;
const colorValue = 'ffffff';
const colorLabel = '';

test.beforeEach(async ({umbracoUi, umbracoApi}) => {
await umbracoUi.goToBackOffice();
Expand Down Expand Up @@ -42,8 +42,7 @@ test('can include label', async ({umbracoApi, umbracoUi}) => {
expect(dataTypeData.values).toEqual(expectedDataTypeValues);
});

//TODO: Remove skip when the frontend is ready
test.skip('can add color', async ({umbracoApi, umbracoUi}) => {
test('can add color', async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedDataTypeValues = [
{
Expand All @@ -63,16 +62,15 @@ test.skip('can add color', async ({umbracoApi, umbracoUi}) => {
await umbracoUi.dataType.goToDataType(dataTypeName);

// Act
await umbracoUi.dataType.addColor(colorValue, colorLabel);
await umbracoUi.dataType.addColor(colorValue);
await umbracoUi.dataType.clickSaveButton();

// Assert
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
expect(dataTypeData.values).toEqual(expectedDataTypeValues);
});

// TODO: remove .skip when the frontend is able to display the added color. Currently the added colors are not displayed after reloading page
test.skip('can remove color', async ({umbracoApi, umbracoUi}) => {
test('can remove color', async ({umbracoApi, umbracoUi}) => {
// Arrange
const removedDataTypeValues = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import {test} from '@umbraco/playwright-testhelpers';
nhudinh0309 marked this conversation as resolved.
Show resolved Hide resolved
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);
});
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);
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import {expect} from "@playwright/test";

const dataTypeName = 'TestDataType';
const editorAlias = 'Umbraco.DateTime';
const editorAlias = 'Umbraco.ColorPicker';
const propertyEditorName = 'Color Picker';

test.beforeEach(async ({umbracoApi, umbracoUi}) => {
await umbracoApi.dataType.ensureNameNotExists(dataTypeName);
Expand All @@ -20,14 +21,16 @@ test('can create a data type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi})
await umbracoUi.dataType.clickCreateButton();
await umbracoUi.dataType.clickNewDataTypeThreeDotsButton();
await umbracoUi.dataType.enterDataTypeName(dataTypeName);
await umbracoUi.dataType.clickSelectAPropertyEditorButton();
await umbracoUi.dataType.selectAPropertyEditor(propertyEditorName);
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeTruthy();
});

test('can update a data type name', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
test('can rename a data type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const wrongDataTypeName = 'Wrong Data Type';
await umbracoApi.dataType.ensureNameNotExists(wrongDataTypeName);
Expand All @@ -44,7 +47,7 @@ test('can update a data type name', {tag: '@smoke'}, async ({umbracoApi, umbraco
expect(await umbracoApi.dataType.doesNameExist(wrongDataTypeName)).toBeFalsy();
});

test.skip('can delete a data type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
test('can delete a data type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.dataType.create(dataTypeName, editorAlias, []);
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeTruthy();
Expand All @@ -58,7 +61,7 @@ test.skip('can delete a data type', {tag: '@smoke'}, async ({umbracoApi, umbraco
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeFalsy();
});

test.skip('can change Property Editor in a data type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
test('can change property editor in a data type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const updatedEditorName = 'Text Area';
const updatedEditorAlias = 'Umbraco.TextArea';
Expand All @@ -70,7 +73,7 @@ test.skip('can change Property Editor in a data type', {tag: '@smoke'}, async ({
// Act
await umbracoUi.dataType.goToDataType(dataTypeName);
await umbracoUi.dataType.clickChangeButton();
await umbracoUi.dataType.selectPropertyEditorUIByName(updatedEditorName);
await umbracoUi.dataType.selectAPropertyEditor(updatedEditorName);
await umbracoUi.dataType.clickSaveButton();

// Assert
Expand All @@ -79,3 +82,36 @@ test.skip('can change Property Editor in a data type', {tag: '@smoke'}, async ({
expect(dataTypeData.editorAlias).toBe(updatedEditorAlias);
expect(dataTypeData.editorUiAlias).toBe(updatedEditorUiAlias);
});

test('cannot create a data type without selecting the property editor', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Act
await umbracoUi.dataType.clickActionsMenuAtRoot();
await umbracoUi.dataType.clickCreateButton();
await umbracoUi.dataType.clickNewDataTypeThreeDotsButton();
await umbracoUi.dataType.enterDataTypeName(dataTypeName);
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isFailedStateButtonVisible();
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeFalsy();
});

test('can change settings', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedDataTypeValues = {
alias: "useLabel",
value: true
};
await umbracoApi.dataType.create(dataTypeName, editorAlias, []);
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeTruthy();

// Act
await umbracoUi.dataType.goToDataType(dataTypeName);
await umbracoUi.dataType.clickIncludeLabelsSlider();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
expect(dataTypeData.values).toContainEqual(expectedDataTypeValues);
});
Loading
Loading