Browse Source

test: fix account user mgmt handling

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/8521/head
Raju Udava 4 months ago
parent
commit
2266159d45
  1. 7
      tests/playwright/pages/Account/Users.ts
  2. 3
      tests/playwright/pages/Base.ts
  3. 6
      tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts

7
tests/playwright/pages/Account/Users.ts

@ -46,7 +46,12 @@ export class AccountUsersPage extends BasePage {
await this.inviteUserModal.locator(`.nc-user-roles`).click();
const userRoleModal = this.rootPage.locator(`.nc-dropdown-user-role`);
await userRoleModal.locator(`.nc-role-option:has-text("${role}")`).click();
await this.inviteUserModal.locator(`button:has-text("Invite")`).click();
const inviteAction = () => this.inviteUserModal.locator(`button:has-text("Invite")`).click();
await this.waitForResponse({
uiAction: inviteAction,
httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `api/v1/users`,
});
await this.verifyToast({ message: 'Successfully added user' });
// TODO: Wait on the invite api and get the invite url a better way as we are not waiting if the url is reflected in the UI

3
tests/playwright/pages/Base.ts

@ -14,6 +14,9 @@ export default abstract class BasePage {
async verifyToast({ message }: { message: string }) {
await this.rootPage.locator('.ant-message .ant-message-notice-content', { hasText: message }).last().isVisible();
// ensure that the toast is removed from the DOM
// await this.rootPage.waitForSelector('.ant-message .ant-message-notice-content', { state: 'hidden' });
}
async verifyErrorMessage({ message }: { message: RegExp }) {

6
tests/playwright/tests/db/usersAccounts/accountUserManagement.spec.ts

@ -66,7 +66,7 @@ test.describe('User roles', () => {
test('Invite user, update role and delete user', async () => {
test.slow();
await accountUsersPage.goto({ waitForResponse: false });
await accountUsersPage.goto({ waitForResponse: true });
// invite user
for (let i = 0; i < roleDb.length; i++) {
@ -78,7 +78,7 @@ test.describe('User roles', () => {
}
await signupAndVerify(0);
await accountUsersPage.goto({ waitForResponse: false });
await accountUsersPage.goto({ waitForResponse: true });
await signupAndVerify(1);
await dashboard.signOut();
@ -88,7 +88,7 @@ test.describe('User roles', () => {
withoutPrefix: true,
});
await accountUsersPage.goto({ waitForResponse: false });
await accountUsersPage.goto({ waitForResponse: true });
// change role
for (let i = 0; i < roleDb.length; i++) {
await accountUsersPage.updateRole({

Loading…
Cancel
Save