Browse Source

test: lookup, rollup

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3848/head
Raju Udava 2 years ago committed by Muhammed Mustafa
parent
commit
236f37879c
  1. 41
      scripts/playwright/pages/Dashboard/Grid/Column/index.ts
  2. 56
      scripts/playwright/tests/lookupRollup.spec.ts

41
scripts/playwright/pages/Dashboard/Grid/Column/index.ts

@ -21,10 +21,16 @@ export class ColumnPageObject extends BasePage {
title,
type = "SingleLineText",
formula = "",
childTable = "",
childColumn = "",
rollupType = "",
}: {
title: string;
type?: string;
formula?: string;
childTable?: string;
childColumn?: string;
rollupType?: string;
}) {
await this.grid.get().locator(".nc-column-add").click();
await this.rootPage.waitForTimeout(500);
@ -52,6 +58,41 @@ export class ColumnPageObject extends BasePage {
case "Formula":
await this.get().locator(".nc-formula-input").fill(formula);
break;
case "Lookup":
await this.get().locator(".ant-select-single").nth(1).click();
await this.rootPage
.locator(`.ant-select-item`, {
hasText: childTable,
})
.click();
await this.get().locator(".ant-select-single").nth(2).click();
await this.rootPage
.locator(`.ant-select-item`, {
hasText: childColumn,
})
.click();
break;
case "Rollup":
await this.get().locator(".ant-select-single").nth(1).click();
await this.rootPage
.locator(`.ant-select-item`, {
hasText: childTable,
})
.click();
await this.get().locator(".ant-select-single").nth(2).click();
await this.rootPage
.locator(`.nc-dropdown-relation-column >> .ant-select-item`, {
hasText: childColumn,
})
.click();
await this.get().locator(".ant-select-single").nth(3).click();
await this.rootPage
.locator(`.nc-dropdown-rollup-function >> .ant-select-item`, {
hasText: rollupType,
})
.nth(0)
.click();
break;
default:
break;
}

56
scripts/playwright/tests/lookupRollup.spec.ts

@ -0,0 +1,56 @@
import { test } from "@playwright/test";
import { DashboardPage } from "../pages/Dashboard";
import setup from "../setup";
test.describe.only("Virtual columns", () => {
let dashboard: DashboardPage;
let context: any;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
});
test("Lookup", async () => {
// close 'Team & Auth' tab
// await dashboard.closeTab({ title: "Team & Auth" });
const pinCode = ["4166", "77459", "41136", "8268", "33463"];
const cityCount = ["1", "3", "1", "2", "1"];
await dashboard.treeView.openTable({ title: "City" });
// Create LookUp column
await dashboard.grid.column.create({
title: "Lookup",
type: "Lookup",
childTable: "Address List",
childColumn: "PostalCode",
});
for (let i = 0; i < pinCode.length; i++) {
await dashboard.grid.cell.verify({
index: i,
columnHeader: "Lookup",
value: pinCode[i],
});
}
await dashboard.closeTab({ title: "City" });
await dashboard.treeView.openTable({ title: "Country" });
// Create Rollup column
await dashboard.grid.column.create({
title: "Rollup",
type: "Rollup",
childTable: "City List",
childColumn: "City",
rollupType: "count",
});
for (let i = 0; i < pinCode.length; i++) {
await dashboard.grid.cell.verify({
index: i,
columnHeader: "Rollup",
value: cityCount[i],
});
}
await dashboard.closeTab({ title: "Country" });
});
});
Loading…
Cancel
Save