Skip to content

Commit edeac44

Browse files
authored
V15 QA Added acceptance tests for Create options (#18314)
* Added tests for document type create option * Renamed and added tests for document type create options * Added tests for data type create options * Added tests for media type create options * Fixed tests to create media type folder * Bumped version * Make all Create option tests run in the pipeline
1 parent a7bd578 commit edeac44

File tree

6 files changed

+411
-17
lines changed

6 files changed

+411
-17
lines changed

tests/Umbraco.Tests.AcceptanceTest/package-lock.json

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Umbraco.Tests.AcceptanceTest/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"testSqlite": "npx playwright test DefaultConfig --grep-invert \"Users\"",
1010
"all": "npx playwright test",
1111
"createTest": "node createTest.js",
12-
"smokeTest": "npx playwright test DefaultConfig --grep \"@smoke\"",
12+
"smokeTest": "npx playwright test DefaultConfig/Settings/DocumentType/DocumentTypeCollectionWorkspace DefaultConfig/Settings/MediaType/MediaTypeCollectionWorkspace DefaultConfig/DataType/DataTypeCollectionWorkspace",
1313
"smokeTestSqlite": "npx playwright test DefaultConfig --grep \"@smoke\" --grep-invert \"Users\""
1414
},
1515
"devDependencies": {
@@ -20,8 +20,8 @@
2020
"typescript": "^4.8.3"
2121
},
2222
"dependencies": {
23-
"@umbraco/json-models-builders": "^2.0.28",
24-
"@umbraco/playwright-testhelpers": "^15.0.18",
23+
"@umbraco/json-models-builders": "^2.0.29",
24+
"@umbraco/playwright-testhelpers": "^15.0.20",
2525
"camelize": "^1.0.0",
2626
"dotenv": "^16.3.1",
2727
"node-fetch": "^2.6.7"
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import {NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers';
2+
import {expect} from "@playwright/test";
3+
4+
const dataTypeName = 'TestDataType';
5+
const dataTypeFolderName = 'TestDataTypeFolder';
6+
7+
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
8+
await umbracoApi.dataType.ensureNameNotExists(dataTypeName);
9+
await umbracoApi.dataType.ensureNameNotExists(dataTypeFolderName);
10+
await umbracoUi.goToBackOffice();
11+
await umbracoUi.dataType.goToSettingsTreeItem('Data Types');
12+
});
13+
14+
test.afterEach(async ({umbracoApi}) => {
15+
await umbracoApi.dataType.ensureNameNotExists(dataTypeName);
16+
await umbracoApi.dataType.ensureNameNotExists(dataTypeFolderName);
17+
});
18+
19+
test('can create a data type using create options', async ({umbracoApi, umbracoUi}) => {
20+
// Arrange
21+
await umbracoUi.dataType.clickDataTypesMenu();
22+
23+
// Act
24+
await umbracoUi.dataType.clickCreateActionWithOptionName('Data Type');
25+
await umbracoUi.dataType.enterDataTypeName(dataTypeName);
26+
await umbracoUi.dataType.clickSelectAPropertyEditorButton();
27+
await umbracoUi.dataType.selectAPropertyEditor('Text Box');
28+
await umbracoUi.dataType.clickSaveButton();
29+
30+
// Assert
31+
await umbracoUi.dataType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
32+
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeTruthy();
33+
// Check if the created data type is displayed in the collection view and has correct icon
34+
await umbracoUi.dataType.clickDataTypesMenu();
35+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveName(dataTypeName);
36+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveIcon(dataTypeName, 'icon-autofill');
37+
});
38+
39+
test('can create a data type folder using create options', async ({umbracoApi, umbracoUi}) => {
40+
// Arrange
41+
await umbracoUi.dataType.clickDataTypesMenu();
42+
43+
// Act
44+
await umbracoUi.dataType.clickCreateActionWithOptionName('Folder');
45+
await umbracoUi.dataType.enterFolderName(dataTypeFolderName);
46+
await umbracoUi.dataType.clickConfirmCreateFolderButton();
47+
48+
// Assert
49+
await umbracoUi.dataType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
50+
expect(await umbracoApi.dataType.doesNameExist(dataTypeFolderName)).toBeTruthy();
51+
// Check if the created data type is displayed in the collection view and has correct icon
52+
await umbracoUi.dataType.clickDataTypesMenu();
53+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveName(dataTypeFolderName);
54+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveIcon(dataTypeFolderName, 'icon-folder');
55+
});
56+
57+
test('can create a data type in a folder using create options', async ({umbracoApi, umbracoUi}) => {
58+
// Arrange
59+
await umbracoApi.dataType.createFolder(dataTypeFolderName);
60+
await umbracoUi.dataType.goToDataType(dataTypeFolderName);
61+
62+
// Act
63+
await umbracoUi.dataType.clickCreateActionWithOptionName('Data Type');
64+
await umbracoUi.dataType.enterDataTypeName(dataTypeName);
65+
await umbracoUi.dataType.clickSelectAPropertyEditorButton();
66+
await umbracoUi.dataType.selectAPropertyEditor('Text Box');
67+
await umbracoUi.dataType.clickSaveButton();
68+
69+
// Assert
70+
await umbracoUi.dataType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
71+
expect(await umbracoApi.dataType.doesNameExist(dataTypeName)).toBeTruthy();
72+
// Check if the created data type is displayed in the collection view and has correct icon
73+
await umbracoUi.dataType.goToDataType(dataTypeFolderName);
74+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveName(dataTypeName);
75+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveIcon(dataTypeName, 'icon-autofill');
76+
});
77+
78+
test('can create a data type folder in a folder using create options', async ({umbracoApi, umbracoUi}) => {
79+
// Arrange
80+
const childFolderName = 'Test Child Folder';
81+
await umbracoApi.dataType.ensureNameNotExists(childFolderName);
82+
await umbracoApi.dataType.createFolder(dataTypeFolderName);
83+
await umbracoUi.dataType.goToDataType(dataTypeFolderName);
84+
85+
// Act
86+
await umbracoUi.dataType.clickCreateActionWithOptionName('Folder');
87+
await umbracoUi.dataType.enterFolderName(childFolderName);
88+
await umbracoUi.dataType.clickConfirmCreateFolderButton();
89+
90+
// Assert
91+
await umbracoUi.dataType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
92+
expect(await umbracoApi.dataType.doesNameExist(childFolderName)).toBeTruthy();
93+
// Check if the created data type is displayed in the collection view and has correct icon
94+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveName(childFolderName);
95+
await umbracoUi.dataType.doesCollectionTreeItemTableRowHaveIcon(childFolderName, 'icon-folder');
96+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
import {ConstantHelper, NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers';
2+
import {expect} from '@playwright/test';
3+
4+
const documentTypeName = 'TestDocumentType';
5+
const documentFolderName = 'TestDocumentTypeFolder';
6+
7+
test.beforeEach(async ({umbracoUi, umbracoApi}) => {
8+
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
9+
await umbracoApi.documentType.ensureNameNotExists(documentFolderName);
10+
await umbracoUi.goToBackOffice();
11+
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);
12+
});
13+
14+
test.afterEach(async ({umbracoApi}) => {
15+
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
16+
await umbracoApi.documentType.ensureNameNotExists(documentFolderName);
17+
});
18+
19+
test('can create a document type using create options', async ({umbracoApi, umbracoUi}) => {
20+
// Arrange
21+
await umbracoUi.documentType.clickDocumentTypesMenu();
22+
23+
// Act
24+
await umbracoUi.documentType.clickCreateActionWithOptionName('Document Type');
25+
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
26+
await umbracoUi.documentType.clickSaveButton();
27+
28+
// Assert
29+
await umbracoUi.documentType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
30+
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
31+
// Check if the created document type is displayed in the collection view and has correct icon
32+
await umbracoUi.documentType.clickDocumentTypesMenu();
33+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentTypeName);
34+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentTypeName, 'icon-document');
35+
});
36+
37+
test('can create a document type with a template using create options', async ({umbracoApi, umbracoUi}) => {
38+
// Arrange
39+
await umbracoApi.template.ensureNameNotExists(documentTypeName);
40+
await umbracoUi.documentType.clickDocumentTypesMenu();
41+
42+
// Act
43+
await umbracoUi.documentType.clickCreateActionWithOptionName('Document Type with Template');
44+
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
45+
await umbracoUi.documentType.clickSaveButton();
46+
47+
// Assert
48+
// Checks if both the success notification for document Types and the template are visible
49+
await umbracoUi.documentType.doesSuccessNotificationsHaveCount(2);
50+
// Checks if the documentType contains the template
51+
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
52+
const templateData = await umbracoApi.template.getByName(documentTypeName);
53+
expect(documentTypeData.allowedTemplates[0].id).toEqual(templateData.id);
54+
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
55+
// Check if the created document type is displayed in the collection view and has correct icon
56+
await umbracoUi.documentType.clickDocumentTypesMenu();
57+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentTypeName);
58+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentTypeName, 'icon-document-html');
59+
60+
// Clean
61+
await umbracoApi.template.ensureNameNotExists(documentTypeName);
62+
});
63+
64+
test('can create a element type using create options', async ({umbracoApi, umbracoUi}) => {
65+
// Arrange
66+
await umbracoUi.documentType.clickDocumentTypesMenu();
67+
68+
// Act
69+
await umbracoUi.documentType.clickCreateActionWithOptionName('Element Type');
70+
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
71+
await umbracoUi.documentType.clickSaveButton();
72+
73+
// Assert
74+
await umbracoUi.documentType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
75+
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
76+
// Checks if the isElement is true
77+
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
78+
expect(documentTypeData.isElement).toBeTruthy();
79+
// Check if the created document type is displayed in the collection view and has correct icon
80+
await umbracoUi.documentType.clickDocumentTypesMenu();
81+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentTypeName);
82+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentTypeName, 'icon-plugin');
83+
});
84+
85+
test('can create a document type folder using create options', async ({umbracoApi, umbracoUi}) => {
86+
// Arrange
87+
await umbracoUi.documentType.clickDocumentTypesMenu();
88+
89+
// Act
90+
await umbracoUi.documentType.clickCreateActionWithOptionName('Folder');
91+
await umbracoUi.documentType.enterFolderName(documentFolderName);
92+
await umbracoUi.documentType.clickCreateFolderButton();
93+
94+
// Assert
95+
await umbracoUi.documentType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
96+
const folder = await umbracoApi.documentType.getByName(documentFolderName);
97+
expect(folder.name).toBe(documentFolderName);
98+
// Check if the created document type folder is displayed in the collection view and has correct icon
99+
await umbracoUi.documentType.clickDocumentTypesMenu();
100+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentFolderName);
101+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentFolderName, 'icon-folder');
102+
});
103+
104+
test('can create a document type in a folder using create options', async ({umbracoApi, umbracoUi}) => {
105+
// Arrange
106+
await umbracoApi.documentType.createFolder(documentFolderName);
107+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
108+
109+
// Act
110+
await umbracoUi.documentType.clickCreateActionWithOptionName('Document Type');
111+
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
112+
await umbracoUi.documentType.clickSaveButton();
113+
114+
// Assert
115+
await umbracoUi.documentType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
116+
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
117+
// Check if the created document type is displayed in the collection view and has correct icon
118+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
119+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentTypeName);
120+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentTypeName, 'icon-document');
121+
});
122+
123+
test('can create a document type with a template in a folder using create options', async ({umbracoApi, umbracoUi}) => {
124+
// Arrange
125+
await umbracoApi.template.ensureNameNotExists(documentTypeName);
126+
await umbracoApi.documentType.createFolder(documentFolderName);
127+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
128+
129+
// Act
130+
await umbracoUi.documentType.clickCreateActionWithOptionName('Document Type with Template');
131+
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
132+
await umbracoUi.documentType.clickSaveButton();
133+
134+
// Assert
135+
// Checks if both the success notification for document Types and the template are visible
136+
await umbracoUi.documentType.doesSuccessNotificationsHaveCount(2);
137+
// Checks if the documentType contains the template
138+
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
139+
const templateData = await umbracoApi.template.getByName(documentTypeName);
140+
expect(documentTypeData.allowedTemplates[0].id).toEqual(templateData.id);
141+
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
142+
// Check if the created document type is displayed in the collection view and has correct icon
143+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
144+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentTypeName);
145+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentTypeName, 'icon-document-html');
146+
147+
// Clean
148+
await umbracoApi.template.ensureNameNotExists(documentTypeName);
149+
});
150+
151+
test('can create a element type in a folder using create options', async ({umbracoApi, umbracoUi}) => {
152+
// Arrange
153+
await umbracoApi.documentType.createFolder(documentFolderName);
154+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
155+
156+
// Act
157+
await umbracoUi.documentType.clickCreateActionWithOptionName('Element Type');
158+
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
159+
await umbracoUi.documentType.clickSaveButton();
160+
161+
// Assert
162+
await umbracoUi.documentType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
163+
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
164+
// Checks if the isElement is true
165+
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
166+
expect(documentTypeData.isElement).toBeTruthy();
167+
// Check if the created document type is displayed in the collection view and has correct icon
168+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
169+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(documentTypeName);
170+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(documentTypeName, 'icon-plugin');
171+
});
172+
173+
test('can create a document type folder in a folder using create options', async ({umbracoApi, umbracoUi}) => {
174+
// Arrange
175+
const childFolderName = 'Test Child Folder';
176+
await umbracoApi.documentType.ensureNameNotExists(childFolderName);
177+
await umbracoApi.documentType.createFolder(documentFolderName);
178+
await umbracoUi.documentType.goToDocumentType(documentFolderName);
179+
180+
// Act
181+
await umbracoUi.documentType.clickCreateActionWithOptionName('Folder');
182+
await umbracoUi.documentType.enterFolderName(childFolderName);
183+
await umbracoUi.documentType.clickCreateFolderButton();
184+
185+
// Assert
186+
await umbracoUi.documentType.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
187+
const folder = await umbracoApi.documentType.getByName(childFolderName);
188+
expect(folder.name).toBe(childFolderName);
189+
// Check if the created document type folder is displayed in the collection view and has correct icon
190+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveName(childFolderName);
191+
await umbracoUi.documentType.doesCollectionTreeItemTableRowHaveIcon(childFolderName, 'icon-folder');
192+
193+
// Clean
194+
await umbracoApi.documentType.ensureNameNotExists(childFolderName);
195+
});

0 commit comments

Comments
 (0)