Browse Source

Merge pull request #8521 from nocodb/test/fix-user-field-test

test: fix user field filter test
pull/8528/head
Pranav C 4 months ago committed by GitHub
parent
commit
aaffd2e70c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      tests/playwright/pages/Account/Users.ts
  2. 3
      tests/playwright/pages/Base.ts
  3. 16
      tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts
  4. 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(); await this.inviteUserModal.locator(`.nc-user-roles`).click();
const userRoleModal = this.rootPage.locator(`.nc-dropdown-user-role`); const userRoleModal = this.rootPage.locator(`.nc-dropdown-user-role`);
await userRoleModal.locator(`.nc-role-option:has-text("${role}")`).click(); 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' }); 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 // 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 }) { async verifyToast({ message }: { message: string }) {
await this.rootPage.locator('.ant-message .ant-message-notice-content', { hasText: message }).last().isVisible(); 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 }) { async verifyErrorMessage({ message }: { message: RegExp }) {

16
tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts

@ -328,11 +328,17 @@ export class ToolbarFilterPage extends BasePage {
const v = value.split(','); const v = value.split(',');
for (let i = 0; i < v.length; i++) { for (let i = 0; i < v.length; i++) {
await this.rootPage const selectUser = () =>
.locator(`.nc-dropdown-user-select-cell`) this.rootPage
.getByTestId('select-option-User-filter') .locator(`.nc-dropdown-user-select-cell`)
.getByText(v[i]) .getByTestId('select-option-User-filter')
.click({ force: true }); .getByText(v[i])
.click({ force: true });
await this.waitForResponse({
uiAction: selectUser,
httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/db/data/noco/`,
});
} }
} }
break; break;

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

Loading…
Cancel
Save