Skip to content

Commit 4af9b1e

Browse files
authored
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
1 parent b4e97ea commit 4af9b1e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {NotificationConstantHelper, test} from '@umbraco/playwright-testhelpers';
2+
3+
const userPassword = '0123456789';
4+
let testUserCookieAndToken = {cookie: "", accessToken: "", refreshToken: ""};
5+
6+
test.afterEach(async ({umbracoApi}) => {
7+
// Ensure we are logged in to admin
8+
await umbracoApi.loginToAdminUser(testUserCookieAndToken.cookie, testUserCookieAndToken.accessToken, testUserCookieAndToken.refreshToken);
9+
});
10+
11+
const userGroups = ['Administrators', 'Editors', 'Sensitive data', 'Translators', 'Writers'];
12+
for (const userGroup of userGroups) {
13+
test(`${userGroup} user can access the user profile and change the password`, async ({umbracoApi, umbracoUi}) => {
14+
// Arrange
15+
const crypto = require('crypto');
16+
const userName = 'TestUser' + crypto.randomUUID();
17+
const userEmail = userName + '@test.com';
18+
const newPassword = 'TestNewPassword';
19+
const userGroupData = await umbracoApi.userGroup.getByName(userGroup);
20+
const userId = await umbracoApi.user.createDefaultUser(userName, userEmail, [userGroupData.id]);
21+
await umbracoApi.user.updatePassword(userId, userPassword);
22+
testUserCookieAndToken = await umbracoApi.user.loginToUser(userName, userEmail, userPassword);
23+
await umbracoUi.goToBackOffice();
24+
await umbracoUi.currentUserProfile.waitForNetworkToBeIdle();
25+
26+
// Act
27+
await umbracoUi.currentUserProfile.clickCurrentUserAvatarButton();
28+
await umbracoUi.currentUserProfile.isErrorNotificationVisible(false);
29+
await umbracoUi.currentUserProfile.clickChangePasswordButton();
30+
await umbracoUi.currentUserProfile.changePassword(userPassword, newPassword);
31+
32+
// Assert
33+
await umbracoUi.currentUserProfile.doesSuccessNotificationHaveText(NotificationConstantHelper.success.passwordChanged);
34+
});
35+
}

0 commit comments

Comments
 (0)