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 QA Added document type acceptance test #16211

Merged
merged 33 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c30b7be
Added tests
andr317c Feb 26, 2024
2e7f05b
Added the rest of the tests
andr317c Feb 26, 2024
21c36b8
Merge remote-tracking branch 'origin/v14/dev' into v14/QA/document-ty…
andr317c Feb 27, 2024
f3f2e57
Few changes to failing test
andr317c Feb 28, 2024
ac7a3db
Added tests for folders
andr317c Feb 28, 2024
049d0be
More cleanup
andr317c Feb 29, 2024
d27c112
Merge remote-tracking branch 'origin/v14/dev' into v14/QA/document-ty…
andr317c Apr 16, 2024
1bcec98
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Apr 24, 2024
7e4552f
Updates
andr317c Apr 24, 2024
c84278b
Fixed tests
andr317c Apr 24, 2024
ece9291
Merge remote-tracking branch 'origin/v14/dev' into v14/QA/document-ty…
andr317c Apr 30, 2024
88eeab7
More documentType fixes
andr317c Apr 30, 2024
6c953fb
Fixed test
andr317c May 1, 2024
b910d42
Cleaned up
andr317c May 1, 2024
c2f5060
Merge remote-tracking branch 'origin/v14/dev' into v14/QA/document-ty…
andr317c May 2, 2024
480c62c
Cleaned
andr317c May 2, 2024
a98894a
Bumped version of testHelpers
andr317c May 2, 2024
97606bd
Added @smoke in the define to test all our tests
andr317c May 2, 2024
bef8bd8
Updated version
andr317c May 14, 2024
e1000e6
Merge branch 'v14/dev' into v14/QA/document-type-test
andr317c May 14, 2024
f709412
Added smoke tags
andr317c May 14, 2024
67b2bc4
Merge remote-tracking branch 'origin/v14/QA/document-type-test' into …
andr317c May 14, 2024
c566a5e
Remove reload
andr317c May 14, 2024
2116f73
Merge branch 'refs/heads/v14/dev' into v14/QA/document-type-test
andr317c May 17, 2024
1e60a0f
Added clean
andr317c May 20, 2024
ba500cf
Updates from comments, not done
andr317c May 21, 2024
f70d1c3
Added smoke tag
andr317c May 21, 2024
6ddcfe9
Uncommented test.describe
andr317c May 21, 2024
aa40cc3
Bumped version
andr317c May 21, 2024
ccf3b0c
Added semicolon
andr317c May 22, 2024
4b7e703
Split documentType tests into more files
andr317c May 22, 2024
473acc1
Bumped version
andr317c May 22, 2024
aa01e31
Removed test describe and fixed indentation
andr317c May 23, 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
8 changes: 4 additions & 4 deletions tests/Umbraco.Tests.AcceptanceTest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/Umbraco.Tests.AcceptanceTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@umbraco/json-models-builders": "^2.0.5",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.46",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.49",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"faker": "^4.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import {AliasHelper, ConstantHelper, test} from '@umbraco/playwright-testhelpers';
import {expect} from '@playwright/test';

const documentTypeName = 'TestDocumentType';

test.beforeEach(async ({umbracoUi, umbracoApi}) => {
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoUi.goToBackOffice();
});

test.afterEach(async ({umbracoApi}) => {
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
});

test('can create a document type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);

// Act
await umbracoUi.documentType.clickActionsMenuAtRoot();
await umbracoUi.documentType.clickCreateButton();
await umbracoUi.documentType.clickCreateDocumentTypeButton();
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
await umbracoUi.documentType.clickSaveButton();

// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
await umbracoUi.documentType.reloadTree('Document Types');
await umbracoUi.documentType.isDocumentTreeItemVisible(documentTypeName);
});

test('can create a document type with a template', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);
await umbracoApi.template.ensureNameNotExists(documentTypeName);

// Act
await umbracoUi.documentType.clickActionsMenuAtRoot();
await umbracoUi.documentType.clickCreateButton();
await umbracoUi.documentType.clickCreateDocumentTypeWithTemplateButton();
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
await umbracoUi.documentType.clickSaveButton();

// Assert
// Checks if both the success notification for document Types and teh template are visible
await umbracoUi.documentType.doesSuccessNotificationsHaveCount(2);
// Checks if the documentType contains the template
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
const templateData = await umbracoApi.template.getByName(documentTypeName);
expect(documentTypeData.allowedTemplates[0].id).toEqual(templateData.id);
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();

// Clean
await umbracoApi.template.ensureNameNotExists(documentTypeName);
});

test('can create a element type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);

// Act
await umbracoUi.documentType.clickActionsMenuAtRoot();
await umbracoUi.documentType.clickCreateButton();
await umbracoUi.documentType.clickCreateElementTypeButton();
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
await umbracoUi.documentType.clickSaveButton();

// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
// Checks if the isElement is true
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
expect(documentTypeData.isElement).toBeTruthy();
});

test('can rename a document type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const wrongName = 'NotADocumentTypeName';
await umbracoApi.documentType.ensureNameNotExists(wrongName);
await umbracoApi.documentType.createDefaultDocumentType(wrongName);
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);

// Act
await umbracoUi.documentType.goToDocumentType(wrongName);
await umbracoUi.documentType.enterDocumentTypeName(documentTypeName);
await umbracoUi.documentType.clickSaveButton();

// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
await umbracoUi.documentType.isDocumentTreeItemVisible(wrongName, false);
await umbracoUi.documentType.isDocumentTreeItemVisible(documentTypeName);
});

test('can update the alias for a document type', async ({umbracoApi, umbracoUi}) => {
// Arrange
const oldAlias = AliasHelper.toAlias(documentTypeName);
const newAlias = 'newDocumentTypeAlias';
await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
const documentTypeDataOld = await umbracoApi.documentType.getByName(documentTypeName);
expect(documentTypeDataOld.alias).toBe(oldAlias);
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);

// Act
await umbracoUi.documentType.goToDocumentType(documentTypeName);
await umbracoUi.documentType.enterAliasName(newAlias);
await umbracoUi.documentType.clickSaveButton();

// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
await umbracoUi.documentType.isDocumentTreeItemVisible(documentTypeName, true);
const documentTypeDataNew = await umbracoApi.documentType.getByName(documentTypeName);
expect(documentTypeDataNew.alias).toBe(newAlias);
});

test('can add an icon for a document type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const bugIcon = 'icon-bug';
await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);

// Act
await umbracoUi.documentType.goToDocumentType(documentTypeName);
await umbracoUi.documentType.updateIcon(bugIcon);
await umbracoUi.documentType.clickSaveButton();

// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
expect(documentTypeData.icon).toBe(bugIcon);
await umbracoUi.documentType.isDocumentTreeItemVisible(documentTypeName, true);
});

test('can delete a document type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
await umbracoApi.documentType.createDefaultDocumentType(documentTypeName);
await umbracoUi.documentType.goToSection(ConstantHelper.sections.settings);
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();

// Act
await umbracoUi.documentType.clickRootFolderCaretButton();
await umbracoUi.documentType.clickActionsMenuForDocumentType(documentTypeName);
await umbracoUi.documentType.clickDeleteExactButton();
await umbracoUi.documentType.clickConfirmToDeleteButton();

// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeFalsy();
});
Loading
Loading