Files
nocodb/tests/playwright/pages/Dashboard/ProjectView/AccessSettingsPage.ts
Pranav C e790abdbaf refactor: rename project and base
- Rename `Project`  => `Base`
- Rename `Base` => `Source`
- Remove `db` from data/meta api endpoints
- Add backward compatibility for old apis
- Migrations for renaming table and columns

Signed-off-by: Pranav C <pranavxc@gmail.com>
2023-10-02 23:52:18 +05:30

46 lines
1.6 KiB
TypeScript

import BasePage from '../../Base';
import { ProjectViewPage } from './index';
export class AccessSettingsPage extends BasePage {
readonly baseView: ProjectViewPage;
constructor(baseView: ProjectViewPage) {
super(baseView.rootPage);
this.baseView = baseView;
}
get() {
return this.rootPage.locator('.nc-access-settings-view');
}
async setRole(email: string, role: string, networkValidation = true) {
await this.get().locator('.nc-collaborators-list-row').nth(0).waitFor({ state: 'visible' });
const userCount = await this.get().locator('.nc-collaborators-list-row').count();
for (let i = 0; i < userCount; i++) {
const user = this.get().locator('.nc-collaborators-list-row').nth(i);
const userEmail = (await user.locator('.email').innerText()).split('\n')[1];
if (userEmail === email) {
const roleDropdown = user.locator('.nc-collaborator-role-select');
const selectedRole = await user.locator('.nc-collaborator-role-select .badge-text').innerText();
await roleDropdown.click();
const menu = this.rootPage.locator('.nc-role-select-dropdown:visible');
const clickClbk = () => menu.locator(`.nc-role-select-${role.toLowerCase()}:visible`).last().click();
if (networkValidation && !selectedRole.includes(role)) {
await this.waitForResponse({
uiAction: clickClbk,
requestUrlPathToMatch: '/users',
httpMethodsToMatch: ['POST'],
});
} else {
await this.rootPage.waitForTimeout(500);
}
break;
}
}
}
}