Linden Crandall 5075f5c5d8
Some checks are pending
Automatisch Backend Tests / test (push) Waiting to run
Automatisch CI / linter (push) Waiting to run
Automatisch CI / start-backend-server (push) Waiting to run
Automatisch CI / start-backend-worker (push) Waiting to run
Automatisch CI / build-web (push) Waiting to run
Automatisch UI Tests / test (push) Waiting to run
commit upstream files
2025-02-06 04:14:18 +09:00

40 lines
1.1 KiB
JavaScript

const { faker } = require('@faker-js/faker');
const { AuthenticatedPage } = require('../authenticated-page');
faker.seed(9002);
export class AdminEditUserPage extends AuthenticatedPage {
screenshot = '/admin/edit-user';
/**
* @param {import('@playwright/test').Page} page
*/
constructor(page) {
super(page);
this.fullNameInput = page.getByTestId('full-name-input');
this.emailInput = page.getByTestId('email-input');
this.roleInput = page.getByTestId('roleId-autocomplete');
this.updateButton = page.getByTestId('update-button');
this.pageTitle = page.getByTestId('edit-user-title');
this.fieldError = page.locator('p[id$="-helper-text"]');
}
/**
* @param {string} fullName
*/
async waitForLoad(fullName) {
return await this.page.waitForFunction((fullName) => {
// eslint-disable-next-line no-undef
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(),
};
}
}