* Updated block list tests as the “Add Block” button is hidden after reaching the maximum limit. * Updated validation option due to UI changes * Updated tests for current user profile as waitForNetworkToBeIdle() is removed * Fixed flaky tests * Bumped version * Updated tests for current user profile * Bumped version
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
import {ConstantHelper, 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.isBackOfficeMainVisible();
|
|
|
|
// 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);
|
|
});
|
|
} |