test: introuce test fix, select role by exact name

This commit is contained in:
kasia.oczkowska
2024-01-19 13:06:35 +00:00
committed by Kasia
parent d3da62c04a
commit 9f7dee3baa
2 changed files with 3 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ export class AdminRolesPage extends AuthenticatedPage {
await this.roleDrawerLink.click(); await this.roleDrawerLink.click();
await this.isMounted(); await this.isMounted();
await this.rolesLoader.waitFor({ await this.rolesLoader.waitFor({
state: 'detached' state: 'detached',
}); });
} }
@@ -43,9 +43,7 @@ export class AdminRolesPage extends AuthenticatedPage {
state: 'detached', state: 'detached',
}); });
return this.roleRow.filter({ return this.roleRow.filter({
has: this.page.getByTestId('role-name').filter({ has: this.page.getByTestId('role-name').getByText(name, { exact: true }),
hasText: name,
}),
}); });
} }

View File

@@ -197,7 +197,7 @@ test.describe('Role management page', () => {
await adminCreateUserPage.passwordInput.fill('sample'); await adminCreateUserPage.passwordInput.fill('sample');
await adminCreateUserPage.roleInput.click(); await adminCreateUserPage.roleInput.click();
await adminCreateUserPage.page await adminCreateUserPage.page
.getByRole('option', { name: 'Delete Role' }) .getByRole('option', { name: 'Delete Role', exact: true })
.click(); .click();
await adminCreateUserPage.createButton.click(); await adminCreateUserPage.createButton.click();
await adminUsersPage.snackbar.waitFor({ await adminUsersPage.snackbar.waitFor({