V16 QA Added acceptance tests for the 'create document' user permission (#19770)

* Remove skip

* Added tests for creating and updating content

* Removed skip because the issue is fixed

* Updated assertion steps for the update document user permission

* Bumped version

* Added release tag

---------

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
This commit is contained in:
Nhu Dinh
2025-07-22 20:57:32 +07:00
committed by GitHub
parent b722c0d72d
commit 6a5b1a76cc
5 changed files with 47 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
"hasInstallScript": true,
"dependencies": {
"@umbraco/json-models-builders": "^2.0.37",
"@umbraco/playwright-testhelpers": "^16.0.28",
"@umbraco/playwright-testhelpers": "^16.0.29",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"node-fetch": "^2.6.7"
@@ -66,9 +66,9 @@
}
},
"node_modules/@umbraco/playwright-testhelpers": {
"version": "16.0.28",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-16.0.28.tgz",
"integrity": "sha512-l0RDfiXjQAtN2ykg7IX6ZSSW8GGLBm9RFO8WjsnRKAh7gZkH8+0DJdhx573m5bfZE6xa33TgyzIg9x+m/42/Lw==",
"version": "16.0.29",
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-16.0.29.tgz",
"integrity": "sha512-Zk0Ip2rZO0T15mbjQqu9SXI9TFckja/Y4KpHCRzwRgTbkDKr9pT7TENCcvegymVX2GpH6Cs9fu7OPvUABLK9cg==",
"dependencies": {
"@umbraco/json-models-builders": "2.0.37",
"node-fetch": "^2.6.7"

View File

@@ -21,7 +21,7 @@
},
"dependencies": {
"@umbraco/json-models-builders": "^2.0.37",
"@umbraco/playwright-testhelpers": "^16.0.28",
"@umbraco/playwright-testhelpers": "^16.0.29",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"node-fetch": "^2.6.7"

View File

@@ -195,6 +195,7 @@ test('can create content with create permission enabled', async ({umbracoApi, um
// Assert
await umbracoUi.content.waitForContentToBeCreated();
expect(await umbracoApi.document.doesNameExist(testDocumentName)).toBeTruthy();
await umbracoUi.content.isDocumentReadOnly(true);
});
test('can not create content with create permission disabled', async ({umbracoApi, umbracoUi}) => {
@@ -353,10 +354,10 @@ test('can update content with update permission enabled', async ({umbracoApi, um
// Assert
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
expect(await umbracoApi.document.doesNameExist(testDocumentName)).toBeTruthy();
expect(await umbracoApi.document.doesNameExist(rootDocumentName)).toBeFalsy();
});
// TODO: the permission for update is not working, it is always enabled.
test.skip('can not update content with update permission disabled', async ({umbracoApi, umbracoUi}) => {
test('can not update content with update permission disabled', async ({umbracoApi, umbracoUi}) => {
// Arrange
userGroupId = await umbracoApi.userGroup.createUserGroupWithUpdatePermission(userGroupName, false);
await umbracoApi.user.setUserPermissions(testUser.name, testUser.email, testUser.password, userGroupId);
@@ -365,9 +366,11 @@ test.skip('can not update content with update permission disabled', async ({umbr
// Act
await umbracoUi.content.goToSection(ConstantHelper.sections.content, false);
await umbracoUi.content.goToContentWithName(rootDocumentName);
// Assert
await umbracoUi.content.isActionsMenuForNameVisible(rootDocumentName, false);
await umbracoUi.content.isDocumentReadOnly(true);
});
// Needs create permission to be enabled to duplicate content
@@ -627,3 +630,35 @@ test('can not see delete button in content for userGroup with delete permission
await umbracoUi.content.isPermissionInActionsMenuVisible('Delete…', false);
await umbracoUi.content.isPermissionInActionsMenuVisible('Create…', true);
});
test('can create and update content with permission enabled', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const updatedDocumentName = testDocumentName + ' Updated';
userGroupId = await umbracoApi.userGroup.createUserGroupWithCreateAndUpdateDocumentPermission(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();
await umbracoUi.content.goToSection(ConstantHelper.sections.content, false);
// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateActionMenuOption();
await umbracoUi.content.chooseDocumentType(rootDocumentTypeName);
await umbracoUi.content.enterContentName(testDocumentName);
await umbracoUi.content.clickSaveButton();
// Assert
await umbracoUi.content.waitForContentToBeCreated();
expect(await umbracoApi.document.doesNameExist(testDocumentName)).toBeTruthy();
// Update the content
await umbracoUi.content.goToContentWithName(testDocumentName);
await umbracoUi.content.isDocumentReadOnly(false);
await umbracoUi.content.enterContentName(updatedDocumentName);
await umbracoUi.content.clickSaveButton();
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
expect(await umbracoApi.document.doesNameExist(updatedDocumentName)).toBeTruthy();
await umbracoUi.content.doesDocumentHaveName(updatedDocumentName);
// Cleanup
await umbracoApi.document.ensureNameNotExists(updatedDocumentName);
});

View File

@@ -89,12 +89,10 @@ test('cannot edit property values without UI write permission', async ({umbracoA
await umbracoUi.content.isPropertyEditorUiWithNameReadOnly('text-box');
});
// Remove .skip when the front-end is ready.
// Issue link: https://github.com/umbraco/Umbraco-CMS/issues/19395
test.skip('can edit property values with UI write permission', async ({umbracoApi, umbracoUi}) => {
test('can edit property values with UI write permission', async ({umbracoApi, umbracoUi}) => {
// Arrange
const updatedText = 'Updated test text';
userGroupId = await umbracoApi.userGroup.createUserGroupWithUpdatePermissionAndWritePropertyValuePermission(userGroupName, true, false);
userGroupId = await umbracoApi.userGroup.createUserGroupWithUpdatePermissionAndWritePropertyValuePermission(userGroupName, true, true);
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();

View File

@@ -178,13 +178,16 @@ test('can update a specific content with update permission enabled', async ({umb
// Act
await umbracoUi.content.goToContentWithName(firstDocumentName);
await umbracoUi.content.isDocumentReadOnly(false);
await umbracoUi.content.enterContentName(testDocumentName);
await umbracoUi.content.clickSaveButton();
// Assert
await umbracoUi.content.isSuccessStateVisibleForSaveButton();
expect(await umbracoApi.document.doesNameExist(testDocumentName)).toBeTruthy();
await umbracoUi.content.goToContentWithName(secondDocumentName);
await umbracoUi.content.isActionsMenuForNameVisible(secondDocumentName, false);
await umbracoUi.content.isDocumentReadOnly(true);
});
test('can duplicate a specific content with duplicate permission enabled', async ({umbracoApi, umbracoUi}) => {