From 4af9b1e156736862dbebf635649b4b9eb75dcf49 Mon Sep 17 00:00:00 2001 From: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com> Date: Tue, 7 Oct 2025 16:17:58 +0700 Subject: [PATCH] User Profile: QA Add acceptance tests for the regression issue #18084 (#20329) * Added tests for changing own password * Updated tests for current user profile * Bumped version * Make CurrentUserProfile tests run in the pipeline * Added step to ensure the error notification toast not displays * Reverted npm command --- .../Users/CurrentUserProfile.spec.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Users/CurrentUserProfile.spec.ts diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Users/CurrentUserProfile.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Users/CurrentUserProfile.spec.ts new file mode 100644 index 0000000000..6d9faa4089 --- /dev/null +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Users/CurrentUserProfile.spec.ts @@ -0,0 +1,35 @@ +import {NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers'; + +const userPassword = '0123456789'; +let testUserCookieAndToken = {cookie: "", accessToken: "", refreshToken: ""}; + +test.afterEach(async ({umbracoApi}) => { + // Ensure we are logged in to admin + await umbracoApi.loginToAdminUser(testUserCookieAndToken.cookie, testUserCookieAndToken.accessToken, testUserCookieAndToken.refreshToken); +}); + +const userGroups = ['Administrators', 'Editors', 'Sensitive data', 'Translators', 'Writers']; +for (const userGroup of userGroups) { + test(`${userGroup} user can access the user profile and change the password`, async ({umbracoApi, umbracoUi}) => { + // Arrange + const crypto = require('crypto'); + const userName = 'TestUser' + crypto.randomUUID(); + const userEmail = userName + '@test.com'; + const newPassword = 'TestNewPassword'; + const userGroupData = await umbracoApi.userGroup.getByName(userGroup); + const userId = await umbracoApi.user.createDefaultUser(userName, userEmail, [userGroupData.id]); + await umbracoApi.user.updatePassword(userId, userPassword); + testUserCookieAndToken = await umbracoApi.user.loginToUser(userName, userEmail, userPassword); + await umbracoUi.goToBackOffice(); + await umbracoUi.currentUserProfile.waitForNetworkToBeIdle(); + + // Act + await umbracoUi.currentUserProfile.clickCurrentUserAvatarButton(); + await umbracoUi.currentUserProfile.isErrorNotificationVisible(false); + await umbracoUi.currentUserProfile.clickChangePasswordButton(); + await umbracoUi.currentUserProfile.changePassword(userPassword, newPassword); + + // Assert + await umbracoUi.currentUserProfile.doesSuccessNotificationHaveText(NotificationConstantHelper.success.passwordChanged); + }); +} \ No newline at end of file