Files
nocodb/tests/playwright/pages/Dashboard/ProjectView/index.ts
Pranav C a0d87c5a4b Nc feat/user management (#9219)
* feat: api changes for user management

* refactor: gift banner behaviour change

* feat: user management api and ui changes

* feat: introduce invited_by info

* test: verify roles by checking datasource tab since access settings page will be available for all users now

* feat: allow owner role update only if there is more than one owner exist

* fix: role update behaviour correction

* fix: base owner invite issue

* fix: reload user roles state on changing roles of active user

* refactor: show disabled button if not avail

* refactor: hide dropdown and action menu options based on roles

* refactor: migration file name

* refactor: disable or hide option based on number of owners

* refactor: hide user list in shared base

* fix: review correction
2024-08-14 16:42:30 +05:30

66 lines
2.3 KiB
TypeScript

import { expect, Locator } from '@playwright/test';
import { DashboardPage } from '..';
import BasePage from '../../Base';
import { DataSourcePage } from './DataSourcePage';
import { TablesViewPage } from './TablesViewPage';
import { AccessSettingsPage } from './AccessSettingsPage';
export class ProjectViewPage extends BasePage {
readonly dashboard: DashboardPage;
// sub components
readonly dataSources: DataSourcePage;
readonly tables: TablesViewPage;
readonly accessSettings: AccessSettingsPage;
// assets
readonly tab_allTables: Locator;
readonly tab_dataSources: Locator;
readonly tab_accessSettings: Locator;
readonly btn_addNewTable: Locator;
readonly btn_importData: Locator;
readonly btn_addNewDataSource: Locator;
readonly btn_share: Locator;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
this.tables = new TablesViewPage(this);
this.dataSources = new DataSourcePage(this);
this.accessSettings = new AccessSettingsPage(this);
this.tab_allTables = this.get().locator('[data-testid="proj-view-tab__all-tables"]');
this.tab_dataSources = this.get().locator('[data-testid="proj-view-tab__data-sources"]');
this.tab_accessSettings = this.get().locator('[data-testid="proj-view-tab__access-settings"]');
this.btn_addNewTable = this.get().locator('[data-testid="proj-view-btn__add-new-table"]');
this.btn_importData = this.get().locator('[data-testid="proj-view-btn__import-data"]');
this.btn_addNewDataSource = this.get().locator('.nc-btn-new-datasource');
this.btn_share = this.get().locator('[data-testid="share-base-button"]');
}
get() {
return this.dashboard.get().locator('.nc-base-view-tab');
}
async verifyAccess(role: string) {
await this.get().waitFor({ state: 'visible' });
// provide time for tabs to appear
await this.rootPage.waitForTimeout(1000);
expect(await this.tab_allTables.isVisible()).toBeTruthy();
if (role.toLowerCase() === 'creator' || role.toLowerCase() === 'owner') {
await this.tab_accessSettings.waitFor({ state: 'visible' });
expect(await this.tab_dataSources.isVisible()).toBeTruthy();
} else {
expect(await this.tab_dataSources.isVisible()).toBeFalsy();
}
await this.tables.verifyAccess(role);
}
}