test: improve tests execution time

This commit is contained in:
Jakub P.
2024-12-06 09:17:21 +01:00
parent b8da721e39
commit f83deac469
19 changed files with 591 additions and 506 deletions

View File

@@ -56,8 +56,10 @@ export class AdminApplicationSettingsPage extends AuthenticatedPage {
}
async expectSuccessSnackbarToBeVisible() {
await expect(this.successSnackbar).toHaveCount(1);
await this.successSnackbar.click();
await expect(this.successSnackbar).toHaveCount(0);
const snackbars = await this.successSnackbar.all();
for (const snackbar of snackbars) {
await expect(await snackbar.getAttribute('data-snackbar-variant')).toBe('success');
await snackbar.click();
}
}
}

View File

@@ -1,3 +1,5 @@
import { expect } from '@playwright/test';
const { AuthenticatedPage } = require('../authenticated-page');
const { RoleConditionsModal } = require('./role-conditions-modal');
@@ -16,6 +18,7 @@ export class AdminCreateRolePage extends AuthenticatedPage {
this.executionRow = page.getByTestId('Execution-permission-row');
this.flowRow = page.getByTestId('Flow-permission-row');
this.pageTitle = page.getByTestId('create-role-title');
this.permissionsCatalog = page.getByTestId('permissions-catalog');
}
/**
@@ -104,4 +107,8 @@ export class AdminCreateRolePage extends AuthenticatedPage {
throw new Error(`${subject} does not have action ${action}`);
}
}
async waitForPermissionsCatalogToVisible() {
await expect(this.permissionsCatalog).toBeVisible();
}
}

View File

@@ -14,8 +14,12 @@ export class AdminCreateUserPage extends AuthenticatedPage {
this.roleInput = page.getByTestId('role.id-autocomplete');
this.createButton = page.getByTestId('create-button');
this.pageTitle = page.getByTestId('create-user-title');
this.invitationEmailInfoAlert = page.getByTestId('invitation-email-info-alert');
this.acceptInvitationLink = page.getByTestId('invitation-email-info-alert').getByRole('link');
this.invitationEmailInfoAlert = page.getByTestId(
'invitation-email-info-alert'
);
this.acceptInvitationLink = page
.getByTestId('invitation-email-info-alert')
.getByRole('link');
}
seed(seed) {

View File

@@ -95,7 +95,6 @@ export class AdminUsersPage extends AuthenticatedPage {
});
}
const rowLocator = await this.getUserRowByEmail(email);
console.log('rowLocator.count', email, await rowLocator.count());
if ((await rowLocator.count()) === 1) {
return rowLocator;
}

View File

@@ -51,10 +51,20 @@ export class BasePage {
};
}
async closeSnackbar() {
await this.snackbar.click();
}
async closeSnackbarAndWaitUntilDetached() {
const snackbar = await this.snackbar;
await snackbar.click();
await snackbar.waitFor({ state: 'detached' });
}
/**
* Closes all snackbars, should be replaced later
*/
async closeSnackbar() {
async closeAllSnackbars() {
const snackbars = await this.snackbar.all();
for (const snackbar of snackbars) {
await snackbar.click();