test: improve navigateTo on users-page

This commit is contained in:
Jakub P
2025-05-04 00:19:11 +02:00
parent 2ebe05e55a
commit c6b919f183
3 changed files with 14 additions and 4 deletions

View File

@@ -24,6 +24,16 @@ export class AdminUsersPage extends AuthenticatedPage {
}
async navigateTo() {
await this.profileMenuButton.click();
await Promise.all([this.adminMenuItem.click(), this.isMounted()]);
if (await this.usersLoader.isVisible()) {
await this.usersLoader.waitFor({
state: 'detached',
});
}
}
async navigateToAndWaitForUsers() {
await this.profileMenuButton.click();
await Promise.all([
this.page.waitForResponse(

View File

@@ -195,7 +195,7 @@ test.describe('Role management page', () => {
});
await test.step('Change the role the user has', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.navigateToAndWaitForUsers();
await adminUsersPage.usersLoader.waitFor({
state: 'detached',
});
@@ -264,7 +264,7 @@ test.describe('Role management page', () => {
});
await test.step('Delete this user', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.navigateToAndWaitForUsers();
const row = await adminUsersPage.findUserPageWithEmail(
'user-delete-role-test@automatisch.io'
);

View File

@@ -100,7 +100,7 @@ test.describe('User management page', () => {
});
await test.step('Delete the created user', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.navigateToAndWaitForUsers();
await adminUsersPage.findUserPageWithEmail(testUser.email);
const userRow = await adminUsersPage.getUserRowByEmail(testUser.email);
await adminUsersPage.clickDeleteUser(userRow);
@@ -198,7 +198,7 @@ test.describe('User management page', () => {
});
await test.step('Try editing the second user to have the email of the first user', async () => {
await adminUsersPage.navigateTo();
await adminUsersPage.navigateToAndWaitForUsers();
await adminUsersPage.findUserPageWithEmail(user2.email);
let userRow = await adminUsersPage.getUserRowByEmail(user2.email);
await adminUsersPage.clickEditUser(userRow);