Files
nocodb/tests/playwright/pages/Dashboard/Grid/columnHeader.ts
Raju Udava b2134c0ff9 test: sync
Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
2023-08-31 15:38:24 +05:30

47 lines
1.3 KiB
TypeScript

import { GridPage } from '../Grid';
import BasePage from '../../Base';
import { expect, Locator } from '@playwright/test';
export class ColumnHeaderPageObject extends BasePage {
readonly grid: GridPage;
readonly btn_addColumn: Locator;
readonly btn_selectAll: Locator;
constructor(grid: GridPage) {
super(grid.rootPage);
this.grid = grid;
this.btn_addColumn = this.get().locator(`.nc-grid-add-edit-column`);
this.btn_selectAll = this.get().locator(`[data-testid="nc-check-all"]`);
}
get() {
return this.rootPage.locator('.nc-grid-header');
}
async getColumnHeader({ title }: { title: string }) {
return this.get().locator(`th[data-title="${title}"]`);
}
async getColumnHeaderContextMenu({ title }: { title: string }) {
return (await this.getColumnHeader({ title })).locator(`.nc-ui-dt-dropdown`);
}
async verifyLockMode() {
// add column button
await expect(this.btn_addColumn).toBeVisible({ visible: false });
// column header context menu
expect(await this.get().locator('.nc-ui-dt-dropdown').count()).toBe(0);
}
async verifyCollaborativeMode() {
// add column button
await expect(this.btn_addColumn).toBeVisible({ visible: true });
// column header context menu
expect(await this.get().locator('.nc-ui-dt-dropdown').count()).toBeGreaterThan(1);
}
}