V14 Added acceptance test for Document Blueprint (#16563)

* Added tests for Document blueprints

* Fixed the failing tests for Partial View

* Updated tests for Document Blueprints

* Fixed the delete document blueprints tests

* Fixed method name due to the test helpers changes

* Fix arrange steps

* Bumped version of test helpers

* Removed 's' in the file name

* Removed the step to reload tree

* Fixed comments

* Removed test.describe before merging
This commit is contained in:
Nhu Dinh
2024-06-07 11:33:36 +02:00
committed by GitHub
parent b04e4d7586
commit d5176d668d
9 changed files with 121 additions and 26 deletions

View File

@@ -7,8 +7,8 @@
"name": "acceptancetest",
"hasInstallScript": true,
"dependencies": {
"@umbraco/json-models-builders": "^2.0.5",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.58",
"@umbraco/json-models-builders": "^2.0.6",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.59",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"faker": "^4.1.0",
@@ -146,9 +146,9 @@
"integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg=="
},
"node_modules/@umbraco/playwright-testhelpers": {
"version": "2.0.0-beta.58",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.58.tgz",
"integrity": "sha512-2iEWLMtyZpjP/ia/H6cSh97WAxNQie8kFITvfy06arXjHjVmxH6WQRp6Te6hz2eb3L8oPorbCKqyWOxKRsK2zg==",
"version": "2.0.0-beta.59",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.59.tgz",
"integrity": "sha512-/RugczuhuvzepvT7be6qHkP50ThKOxfHnpYeQc0/PMZM8fk/DX6GpPUC050oI0NqW/QRXAL4Ue9EUK6iTV/+DQ==",
"dependencies": {
"@umbraco/json-models-builders": "2.0.6",
"camelize": "^1.0.0",

View File

@@ -21,8 +21,8 @@
"wait-on": "^7.2.0"
},
"dependencies": {
"@umbraco/json-models-builders": "^2.0.5",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.58",
"@umbraco/json-models-builders": "^2.0.6",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.59",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"faker": "^4.1.0",

View File

@@ -0,0 +1,95 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
import {expect} from "@playwright/test";
const documentBlueprintName = 'TestDocumentBlueprints';
const documentTypeName = 'DocumentTypeForBlueprint';
let documentTypeId = '';
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
await umbracoApi.documentBlueprint.ensureNameNotExists(documentBlueprintName);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
documentTypeId = await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
await umbracoUi.goToBackOffice();
});
test.afterEach(async ({umbracoApi}) => {
await umbracoApi.documentBlueprint.ensureNameNotExists(documentBlueprintName);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
});
test('can create a document blueprint from the settings menu', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
await umbracoUi.documentBlueprint.clickActionsMenuAtRoot();
await umbracoUi.documentBlueprint.clickCreateDocumentBlueprintButton();
await umbracoUi.documentBlueprint.clickTextButtonWithName(documentTypeName);
await umbracoUi.documentBlueprint.enterDocumentBlueprintName(documentBlueprintName);
await umbracoUi.documentBlueprint.clickSaveButton();
// Assert
await umbracoUi.documentBlueprint.isSuccessNotificationVisible();
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(documentBlueprintName, true);
});
test('can rename a document blueprint', async ({umbracoApi, umbracoUi}) => {
// Arrange
const wrongDocumentBlueprintName = 'Wrong Document Blueprint';
await umbracoApi.documentBlueprint.ensureNameNotExists(wrongDocumentBlueprintName);
await umbracoApi.documentBlueprint.createDefaultDocumentBlueprint(wrongDocumentBlueprintName, documentTypeId);
expect(await umbracoApi.documentBlueprint.doesNameExist(wrongDocumentBlueprintName)).toBeTruthy();
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
await umbracoUi.documentBlueprint.goToDocumentBlueprint(wrongDocumentBlueprintName);
await umbracoUi.documentBlueprint.enterDocumentBlueprintName(documentBlueprintName);
await umbracoUi.documentBlueprint.clickSaveButton();
// Assert
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
expect(await umbracoApi.documentBlueprint.doesNameExist(wrongDocumentBlueprintName)).toBeFalsy();
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(documentBlueprintName, true, false);
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(wrongDocumentBlueprintName, false, false);
});
test('can delete a document blueprint', async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.documentBlueprint.createDefaultDocumentBlueprint(documentBlueprintName, documentTypeId);
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
await umbracoUi.documentBlueprint.goToSection(ConstantHelper.sections.settings);
// Act
await umbracoUi.documentBlueprint.reloadDocumentBlueprintsTree();
await umbracoUi.documentBlueprint.clickActionsMenuForDocumentBlueprints(documentBlueprintName);
await umbracoUi.documentBlueprint.clickDeleteMenuButton();
await umbracoUi.documentBlueprint.clickConfirmToDeleteButton();
// Assert
await umbracoUi.documentBlueprint.isSuccessNotificationVisible();
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeFalsy();
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(documentBlueprintName, false, false);
});
test('can create a document blueprint from the content menu', async ({umbracoApi, umbracoUi}) => {
// Arrange
const documentTypeName = 'DocumentTypeForContent';
const documentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeName);
await umbracoApi.document.createDefaultDocument(documentBlueprintName, documentTypeId);
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
// Act
await umbracoUi.content.clickActionsMenuForContent(documentBlueprintName);
await umbracoUi.content.clickCreateDocumentBlueprintButton();
await umbracoUi.content.clickSaveModalButton();
// Assert
await umbracoUi.content.isSuccessNotificationVisible();
expect(await umbracoApi.documentBlueprint.doesNameExist(documentBlueprintName)).toBeTruthy();
await umbracoUi.documentBlueprint.goToSettingsTreeItem('Document Blueprints');
await umbracoUi.documentBlueprint.isDocumentBlueprintRootTreeItemVisible(documentBlueprintName, true);
// Clean
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
});

View File

@@ -84,9 +84,9 @@ test('can rename a partial view', {tag: '@smoke'}, async ({umbracoApi, umbracoUi
expect(await umbracoApi.partialView.doesNameExist(partialViewFileName)).toBeTruthy();
expect(await umbracoApi.partialView.doesNameExist(wrongPartialViewFileName)).toBeFalsy();
// Verify the old partial view is NOT displayed under the Partial Views section
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(wrongPartialViewFileName, false);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(wrongPartialViewFileName, false, false);
// Verify the new partial view is displayed under the Partial Views section
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(partialViewFileName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(partialViewFileName, true, false);
});
test('can update a partial view content', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {

View File

@@ -44,7 +44,7 @@ test('can delete a folder', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) =>
expect(await umbracoApi.partialView.doesFolderExist(folderName)).toBeFalsy();
// Verify the partial view folder is NOT displayed under the Partial Views section
await umbracoUi.partialView.clickRootFolderCaretButton();
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(folderName, false);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(folderName, false, false);
});
test('can place a partial view into folder', async ({umbracoApi, umbracoUi}) => {
@@ -67,9 +67,9 @@ test('can place a partial view into folder', async ({umbracoApi, umbracoUi}) =>
const childrenData = await umbracoApi.partialView.getChildren(folderPath);
expect(childrenData[0].name).toEqual(partialViewFileName);
// Verify the partial view is displayed in the folder under the Partial Views section
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(partialViewFileName, false);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(partialViewFileName, false, false);
await umbracoUi.partialView.clickCaretButtonForName(folderName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(partialViewFileName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(partialViewFileName, true, false);
});
test('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -89,7 +89,7 @@ test('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => {
const partialViewChildren = await umbracoApi.partialView.getChildren('/' + folderName);
expect(partialViewChildren[0].path).toBe('/' + folderName + '/' + childFolderName);
await umbracoUi.partialView.clickCaretButtonForName(folderName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(childFolderName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(childFolderName, true, false);
});
test('can create a folder in a folder in a folder', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
@@ -112,5 +112,5 @@ test('can create a folder in a folder in a folder', {tag: '@smoke'}, async ({umb
const partialViewChildren = await umbracoApi.partialView.getChildren('/' + folderName + '/' + childFolderName);
expect(partialViewChildren[0].path).toBe('/' + folderName + '/' + childFolderName + '/' + childOfChildFolderName);
await umbracoUi.partialView.clickCaretButtonForName(childFolderName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(childOfChildFolderName);
await umbracoUi.partialView.isPartialViewRootTreeItemVisibile(childOfChildFolderName, true, false);
});

View File

@@ -79,7 +79,7 @@ test('can delete a script', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) =>
// Assert
await umbracoUi.script.isSuccessNotificationVisible();
expect(await umbracoApi.script.doesNameExist(scriptName)).toBeFalsy();
await umbracoUi.script.isScriptRootTreeItemVisible(scriptName, false);
await umbracoUi.script.isScriptRootTreeItemVisible(scriptName, false, false);
});
test('can rename a script', async ({umbracoApi, umbracoUi}) => {

View File

@@ -40,7 +40,7 @@ test('can delete a folder', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) =>
// Assert
await umbracoUi.script.isSuccessNotificationVisible();
expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeFalsy();
await umbracoUi.script.isScriptRootTreeItemVisible(scriptFolderName, false);
await umbracoUi.script.isScriptRootTreeItemVisible(scriptFolderName, false, false);
});
test('can create a script in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -66,7 +66,7 @@ test('can create a script in a folder', async ({umbracoApi, umbracoUi}) => {
const scriptData = await umbracoApi.script.get(scriptChildren[0].path);
expect(scriptData.content).toBe(scriptContent);
await umbracoUi.stylesheet.clickCaretButtonForName(scriptFolderName);
await umbracoUi.script.isScriptRootTreeItemVisible(scriptName);
await umbracoUi.script.isScriptRootTreeItemVisible(scriptName, true, false);
});
test('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -86,7 +86,7 @@ test('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => {
const scriptChildren = await umbracoApi.script.getChildren('/' + scriptFolderName);
expect(scriptChildren[0].path).toBe('/' + scriptFolderName + '/' + childFolderName);
await umbracoUi.stylesheet.clickCaretButtonForName(scriptFolderName);
await umbracoUi.script.isScriptRootTreeItemVisible(childFolderName);
await umbracoUi.script.isScriptRootTreeItemVisible(childFolderName, true, false);
});
test('can create a folder in a folder in a folder', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
@@ -109,7 +109,7 @@ test('can create a folder in a folder in a folder', {tag: '@smoke'}, async ({umb
const scriptChildren = await umbracoApi.script.getChildren('/' + scriptFolderName + '/' + childFolderName);
expect(scriptChildren[0].path).toBe('/' + scriptFolderName + '/' + childFolderName + '/' + childOfChildFolderName);
await umbracoUi.stylesheet.clickCaretButtonForName(childFolderName);
await umbracoUi.script.isScriptRootTreeItemVisible(childOfChildFolderName);
await umbracoUi.script.isScriptRootTreeItemVisible(childOfChildFolderName, true, false);
});
test('can create a script in a folder in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -134,5 +134,5 @@ test('can create a script in a folder in a folder', async ({umbracoApi, umbracoU
const scriptChildren = await umbracoApi.script.getChildren('/' + scriptFolderName + '/' + childFolderName);
expect(scriptChildren[0].path).toBe('/' + scriptFolderName + '/' + childFolderName + '/' + scriptName);
await umbracoUi.stylesheet.clickCaretButtonForName(childFolderName);
await umbracoUi.script.isScriptRootTreeItemVisible(scriptName);
await umbracoUi.script.isScriptRootTreeItemVisible(scriptName, true, false);
});

View File

@@ -103,7 +103,7 @@ import {expect} from '@playwright/test';
// Assert
await umbracoUi.stylesheet.isSuccessNotificationVisible();
expect(await umbracoApi.stylesheet.doesNameExist(stylesheetName)).toBeFalsy();
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetName, false);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetName, false, false);
});
test('can rename a stylesheet', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {

View File

@@ -40,7 +40,7 @@ test('can delete a folder', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) =>
// Assert
await umbracoUi.stylesheet.isSuccessNotificationVisible();
expect(await umbracoApi.stylesheet.doesFolderExist(stylesheetFolderName)).toBeFalsy();
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetFolderName, false);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetFolderName, false, false);
});
test('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -60,7 +60,7 @@ test('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => {
const styleChildren = await umbracoApi.stylesheet.getChildren('/' + stylesheetFolderName);
expect(styleChildren[0].path).toBe('/' + stylesheetFolderName + '/' + childFolderName);
await umbracoUi.stylesheet.clickCaretButtonForName(stylesheetFolderName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(childFolderName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(childFolderName, true, false);
});
test('can create a folder in a folder in a folder', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
@@ -83,7 +83,7 @@ test('can create a folder in a folder in a folder', {tag: '@smoke'}, async ({umb
const styleChildren = await umbracoApi.stylesheet.getChildren('/' + stylesheetFolderName + '/' + childFolderName);
expect(styleChildren[0].path).toBe('/' + stylesheetFolderName + '/' + childFolderName + '/' + childOfChildFolderName);
await umbracoUi.stylesheet.clickCaretButtonForName(childFolderName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(childOfChildFolderName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(childOfChildFolderName, true, false);
});
test('can create a stylesheet in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -109,7 +109,7 @@ test('can create a stylesheet in a folder', async ({umbracoApi, umbracoUi}) => {
const stylesheetData = await umbracoApi.stylesheet.get(stylesheetChildren[0].path);
expect(stylesheetData.content).toBe(stylesheetContent);
await umbracoUi.stylesheet.clickCaretButtonForName(stylesheetFolderName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetName, true, false);
});
test('can create a stylesheet in a folder in a folder', async ({umbracoApi, umbracoUi}) => {
@@ -138,5 +138,5 @@ test('can create a stylesheet in a folder in a folder', async ({umbracoApi, umbr
const stylesheetData = await umbracoApi.stylesheet.get(stylesheetChildren[0].path);
expect(stylesheetData.content).toBe(stylesheetContent);
await umbracoUi.stylesheet.clickCaretButtonForName(childFolderName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetName);
await umbracoUi.stylesheet.isStylesheetRootTreeItemVisible(stylesheetName, true, false);
});