Files
Umbraco-CMS/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Users/Permissions/UserGroup/ContentStartNodes.spec.ts
Nhu Dinh e8f2bb33d7 E2E: QA Fixed the failing tests due to the recent UI changes (#20576)
* Added skip tag for the failing tests due to the issues and added waits for the flaky tests

* Commentted code as the reference items displays randomly

* Bumped version

* Added more waits to avoid the flaky tests

* Updated tests for setting culture and hostnames since the first content already has the default domain

* Fixed flaky tests

* Updated tests since the reload step is flaky

* Added more waits for the flaky tests in Windows

* Need to publish first document before set domain for second document

* Make permission tests run in the pipeline

* Added step to ensure the rollback action is completed

* Reverted npm command

* Added skip tag for the permission tests

* Fixed test for the culture and hostname permission

* Removed waits as it is includes in test helper

* Fixed test for adding a media in RTE Tiptap property editor

* Updated test helper function to avoid the flaky tests releated to block

* Added more waits to ensure image uploaded

* Bumped version

* Bumped version

* Reverted

* Reverted code

* Bumped version of test helper

* Bumped version

* Reverted code

* Added more waits to avoid flaky tests

* Added more waits

* Updated nightly pipeline: remove v17/dev, run different app setting tests by default and not run Relation Type in Linux as they are too flaky

* Added more waits

* Added npm command for testWindows

* Added more waits after creating a folder
2025-11-05 15:54:09 +07:00

94 lines
5.0 KiB
TypeScript

import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
const testUser = ConstantHelper.testUserCredentials;
let testUserCookieAndToken = {cookie: "", accessToken: "", refreshToken: ""};
const userGroupName = 'TestUserGroup';
let userGroupId = null;
const rootDocumentTypeName = 'RootDocumentType';
const childDocumentTypeOneName = 'ChildDocumentTypeOne';
const childDocumentTypeTwoName = 'ChildDocumentTypeTwo';
let childDocumentTypeOneId = null;
let childDocumentTypeTwoId = null;
let rootDocumentTypeId = null;
const rootDocumentName = 'RootDocument';
const childDocumentOneName = 'ChildDocumentOne';
const childDocumentTwoName = 'ChildDocumentTwo';
let rootDocumentId = null;
let childDocumentOneId = null;
test.beforeEach(async ({umbracoApi}) => {
await umbracoApi.documentType.ensureNameNotExists(rootDocumentTypeName);
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeOneName);
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeTwoName);
await umbracoApi.user.ensureNameNotExists(testUser.name);
await umbracoApi.userGroup.ensureNameNotExists(userGroupName);
childDocumentTypeOneId = await umbracoApi.documentType.createDefaultDocumentType(childDocumentTypeOneName);
childDocumentTypeTwoId = await umbracoApi.documentType.createDefaultDocumentType(childDocumentTypeTwoName);
rootDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedTwoChildNodes(rootDocumentTypeName, childDocumentTypeOneId, childDocumentTypeTwoId);
rootDocumentId = await umbracoApi.document.createDefaultDocument(rootDocumentName, rootDocumentTypeId);
childDocumentOneId = await umbracoApi.document.createDefaultDocumentWithParent(childDocumentOneName, childDocumentTypeOneId, rootDocumentId);
await umbracoApi.document.createDefaultDocumentWithParent(childDocumentTwoName, childDocumentTypeTwoId, rootDocumentId);
});
test.afterEach(async ({umbracoApi}) => {
// Ensure we are logged in to admin
await umbracoApi.loginToAdminUser(testUserCookieAndToken.cookie, testUserCookieAndToken.accessToken, testUserCookieAndToken.refreshToken);
await umbracoApi.documentType.ensureNameNotExists(rootDocumentTypeName);
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeOneName);
await umbracoApi.documentType.ensureNameNotExists(childDocumentTypeTwoName);
await umbracoApi.userGroup.ensureNameNotExists(userGroupName);
});
test('can see root start node and children', async ({umbracoApi, umbracoUi}) => {
// Arrange
userGroupId = await umbracoApi.userGroup.createUserGroupWithDocumentStartNode(userGroupName, rootDocumentId);
await umbracoApi.user.setUserPermissions(testUser.name, testUser.email, testUser.password, userGroupId);
testUserCookieAndToken = await umbracoApi.user.loginToUser(testUser.name, testUser.email, testUser.password);
await umbracoUi.goToBackOffice();
// Act
await umbracoUi.userGroup.goToSection(ConstantHelper.sections.content, false);
// Assert
await umbracoUi.content.isContentInTreeVisible(rootDocumentName);
await umbracoUi.content.openContentCaretButtonForName(rootDocumentName);
await umbracoUi.content.isChildContentInTreeVisible(rootDocumentName, childDocumentOneName);
await umbracoUi.content.isChildContentInTreeVisible(rootDocumentName, childDocumentTwoName);
});
// Skip this test due to this issue: https://github.com/umbraco/Umbraco-CMS/issues/20505
test.skip('can see parent of start node but not access it', async ({umbracoApi, umbracoUi}) => {
// Arrange
userGroupId = await umbracoApi.userGroup.createUserGroupWithDocumentStartNode(userGroupName, childDocumentOneId);
await umbracoApi.user.setUserPermissions(testUser.name, testUser.email, testUser.password, userGroupId);
testUserCookieAndToken = await umbracoApi.user.loginToUser(testUser.name, testUser.email, testUser.password);
await umbracoUi.goToBackOffice();
// Act
await umbracoUi.userGroup.goToSection(ConstantHelper.sections.content, false);
// Assert
await umbracoUi.content.isContentInTreeVisible(rootDocumentName);
await umbracoUi.content.goToContentWithName(rootDocumentName);
await umbracoUi.content.doesDocumentWorkspaceHaveText('Access denied');
await umbracoUi.content.openContentCaretButtonForName(rootDocumentName);
await umbracoUi.content.isChildContentInTreeVisible(rootDocumentName, childDocumentOneName);
await umbracoUi.content.isChildContentInTreeVisible(rootDocumentName, childDocumentTwoName, false);
});
test('can not see any content when no start nodes specified', async ({umbracoApi, umbracoUi}) => {
// Arrange
userGroupId = await umbracoApi.userGroup.createSimpleUserGroupWithContentSection(userGroupName);
await umbracoApi.user.setUserPermissions(testUser.name, testUser.email, testUser.password, userGroupId);
testUserCookieAndToken = await umbracoApi.user.loginToUser(testUser.name, testUser.email, testUser.password);
await umbracoUi.goToBackOffice();
// Act
await umbracoUi.userGroup.goToSection(ConstantHelper.sections.content, false);
// Assert
await umbracoUi.content.isDocumentTreeEmpty();
});