Browse Source

test: primary value insert before and hide tests

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5060/head
mertmit 2 years ago
parent
commit
0d35c21ea6
  1. 15
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  2. 2
      tests/playwright/tests/columnMenuOperations.spec.ts

15
tests/playwright/pages/Dashboard/Grid/Column/index.ts

@ -44,6 +44,7 @@ export class ColumnPageObject extends BasePage {
timeFormat = '', timeFormat = '',
insertAfterColumnTitle, insertAfterColumnTitle,
insertBeforeColumnTitle, insertBeforeColumnTitle,
isPrimaryValue = false,
}: { }: {
title: string; title: string;
type?: string; type?: string;
@ -60,9 +61,16 @@ export class ColumnPageObject extends BasePage {
timeFormat?: string; timeFormat?: string;
insertBeforeColumnTitle?: string; insertBeforeColumnTitle?: string;
insertAfterColumnTitle?: string; insertAfterColumnTitle?: string;
isPrimaryValue?: boolean;
}) { }) {
if (insertBeforeColumnTitle) { if (insertBeforeColumnTitle) {
await this.grid.get().locator(`th[data-title="${insertBeforeColumnTitle}"] .nc-ui-dt-dropdown`).click(); await this.grid.get().locator(`th[data-title="${insertBeforeColumnTitle}"] .nc-ui-dt-dropdown`).click();
if (isPrimaryValue) {
await expect(this.rootPage.locator('li[role="menuitem"]:has-text("Insert Before")')).toHaveCount(0);
return;
}
await this.rootPage.locator('li[role="menuitem"]:has-text("Insert Before"):visible').click(); await this.rootPage.locator('li[role="menuitem"]:has-text("Insert Before"):visible').click();
} else if (insertAfterColumnTitle) { } else if (insertAfterColumnTitle) {
await this.grid.get().locator(`th[data-title="${insertAfterColumnTitle}"] .nc-ui-dt-dropdown`).click(); await this.grid.get().locator(`th[data-title="${insertAfterColumnTitle}"] .nc-ui-dt-dropdown`).click();
@ -313,9 +321,14 @@ export class ColumnPageObject extends BasePage {
await this.grid.get().locator(`th[data-title="${expectedTitle}"]`).isVisible(); await this.grid.get().locator(`th[data-title="${expectedTitle}"]`).isVisible();
} }
async hideColumn({ title }: { title: string }) { async hideColumn({ title, isPrimaryValue = false }: { title: string; isPrimaryValue?: boolean }) {
await this.grid.get().locator(`th[data-title="${title}"] .nc-ui-dt-dropdown`).click(); await this.grid.get().locator(`th[data-title="${title}"] .nc-ui-dt-dropdown`).click();
if (isPrimaryValue) {
await expect(this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field")')).toHaveCount(0);
return;
}
await this.waitForResponse({ await this.waitForResponse({
uiAction: this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field"):visible').click(), uiAction: this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field"):visible').click(),
requestUrlPathToMatch: 'api/v1/db/meta/views', requestUrlPathToMatch: 'api/v1/db/meta/views',

2
tests/playwright/tests/columnMenuOperations.spec.ts

@ -91,6 +91,7 @@ test.describe('Column menu operations', () => {
title: 'InsertBeforeColumn', title: 'InsertBeforeColumn',
type: 'SingleLineText', type: 'SingleLineText',
insertBeforeColumnTitle: 'Title', insertBeforeColumnTitle: 'Title',
isPrimaryValue: true,
}); });
await dashboard.grid.column.create({ await dashboard.grid.column.create({
@ -107,6 +108,7 @@ test.describe('Column menu operations', () => {
await dashboard.grid.column.hideColumn({ await dashboard.grid.column.hideColumn({
title: 'Title', title: 'Title',
isPrimaryValue: true,
}); });
await dashboard.grid.column.hideColumn({ await dashboard.grid.column.hideColumn({

Loading…
Cancel
Save