test: add change own user data test

This commit is contained in:
Jakub P.
2024-09-24 18:42:30 +02:00
parent c8dae9ea9a
commit 55ebe2cc0b
5 changed files with 126 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ export class AuthenticatedPage extends BasePage {
super(page);
this.profileMenuButton = this.page.getByTestId('profile-menu-button');
this.logoutMenuItem = this.page.getByTestId('logout-item');
this.adminMenuItem = this.page.getByRole('menuitem', { name: 'Admin' });
this.userInterfaceDrawerItem = this.page.getByTestId(
'user-interface-drawer-link'
@@ -18,4 +19,9 @@ export class AuthenticatedPage extends BasePage {
this.typographyLogo = this.page.getByTestId('typography-logo');
this.customLogo = this.page.getByTestId('custom-logo');
}
async logout() {
await this.profileMenuButton.click();
await this.logoutMenuItem.click();
}
}

View File

@@ -35,7 +35,7 @@ exports.test = test.extend({
userInterfacePage: async ({ page }, use) => {
await use(new UserInterfacePage(page));
},
...adminFixtures
...adminFixtures,
});
exports.publicTest = test.extend({
@@ -49,21 +49,18 @@ exports.publicTest = test.extend({
await use(loginPage);
},
acceptInvitationPage: async ({ page }, use) => {
const acceptInvitationPage = new AcceptInvitation(page);
await use(acceptInvitationPage);
},
adminSetupPage: async ({ page }, use) => {
const adminSetupPage = new AdminSetupPage(page);
await use(adminSetupPage);
},
adminCreateUserPage: async ({page}, use) => {
adminCreateUserPage: async ({ page }, use) => {
const adminCreateUserPage = new AdminCreateUserPage(page);
await use(adminCreateUserPage);
}
},
});
expect.extend({

View File

@@ -0,0 +1,21 @@
const { AuthenticatedPage } = require('./authenticated-page');
export class MyProfilePage extends AuthenticatedPage {
constructor(page) {
super(page);
this.fullName = this.page.locator('[name="fullName"]');
this.email = this.page.locator('[name="email"]');
this.newPassword = this.page.locator('[name="password"]');
this.passwordConfirmation = this.page.locator('[name="confirmPassword"]');
this.updateProfileButton = this.page.getByTestId('update-profile-button');
this.settingsMenuItem = this.page.getByRole('menuitem', {
name: 'Settings',
});
}
async navigateTo() {
await this.profileMenuButton.click();
await this.settingsMenuItem.click();
}
}