fix(e2e): update expect to web-first assertion, wait for edit form to load

This commit is contained in:
QAComet
2024-03-18 10:32:56 -06:00
parent f3d20ab769
commit ad144206dd
4 changed files with 22 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ export class AdminEditUserPage extends AuthenticatedPage {
/**
* @param {import('@playwright/test').Page} page
*/
constructor (page) {
constructor(page) {
super(page);
this.fullNameInput = page.getByTestId('full-name-input');
this.emailInput = page.getByTestId('email-input');
@@ -18,10 +18,20 @@ export class AdminEditUserPage extends AuthenticatedPage {
this.pageTitle = page.getByTestId('edit-user-title');
}
generateUser () {
/**
* @param {string} fullName
*/
async waitForLoad(fullName) {
return await this.page.waitForFunction((fullName) => {
const el = document.querySelector("[data-test='full-name-input']");
return el && el.value === fullName;
}, fullName);
}
generateUser() {
return {
fullName: faker.person.fullName(),
email: faker.internet.email(),
}
};
}
}
}

View File

@@ -37,6 +37,7 @@ export class LoginPage extends BasePage {
password = LoginPage.defaultPassword
) {
await this.page.goto(this.path);
await this.emailTextField.waitFor({ state: 'visible' });
await this.emailTextField.fill(email);
await this.passwordTextField.fill(password);