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. 17
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  2. 2
      tests/playwright/tests/columnMenuOperations.spec.ts

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

@ -44,6 +44,7 @@ export class ColumnPageObject extends BasePage {
timeFormat = '',
insertAfterColumnTitle,
insertBeforeColumnTitle,
isPrimaryValue = false,
}: {
title: string;
type?: string;
@ -60,9 +61,16 @@ export class ColumnPageObject extends BasePage {
timeFormat?: string;
insertBeforeColumnTitle?: string;
insertAfterColumnTitle?: string;
isPrimaryValue?: boolean;
}) {
if (insertBeforeColumnTitle) {
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();
} else if (insertAfterColumnTitle) {
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();
}
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();
if (isPrimaryValue) {
await expect(this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field")')).toHaveCount(0);
return;
}
await this.waitForResponse({
uiAction: this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field"):visible').click(),
requestUrlPathToMatch: 'api/v1/db/meta/views',
@ -386,7 +399,7 @@ export class ColumnPageObject extends BasePage {
)
.first()
.isVisible();
// close sort menu
await this.grid.toolbar.clickSort();
}

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

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

Loading…
Cancel
Save