From 37f45eb46e3ce4a60ce98ad27d253b3bbd5c8e7b Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 14 Oct 2022 21:00:46 +0530 Subject: [PATCH] test: ltar unlink Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../pages/Dashboard/Grid/Cell/index.ts | 12 ++++ .../tests/linkToAnotherRecord.spec.ts | 60 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/scripts/playwright/pages/Dashboard/Grid/Cell/index.ts b/scripts/playwright/pages/Dashboard/Grid/Cell/index.ts index 6bda707d8e..66bd616b7a 100644 --- a/scripts/playwright/pages/Dashboard/Grid/Cell/index.ts +++ b/scripts/playwright/pages/Dashboard/Grid/Cell/index.ts @@ -129,4 +129,16 @@ export class CellPageObject extends BasePage { expect(await chips.nth(i).textContent()).toBe(value[i]); } } + + async unlinkVirtualCell({ + index, + columnHeader, + }: { + index: number; + columnHeader: string; + }) { + const cell = this.get({ index, columnHeader }); + await cell.click(); + await cell.locator(".nc-icon.unlink-icon").click(); + } } diff --git a/scripts/playwright/tests/linkToAnotherRecord.spec.ts b/scripts/playwright/tests/linkToAnotherRecord.spec.ts index 7d99120742..c2199b3d37 100644 --- a/scripts/playwright/tests/linkToAnotherRecord.spec.ts +++ b/scripts/playwright/tests/linkToAnotherRecord.spec.ts @@ -114,5 +114,65 @@ test.describe("LTAR create & update", () => { type: "text", }); await dashboard.expandedForm.save(); + + const expected = [ + [["1a"], ["1b"], ["1c"]], + [["1a"], ["1b"], ["1c"]], + [["1a"], ["1b"], ["1c"]], + ]; + const colHeaders = ["Sheet1", "Sheet1 List", "Link2-1hm"]; + + // verify LTAR cell values + for (let i = 0; i < expected.length; i++) { + for (let j = 0; j < expected[i].length; j++) { + await dashboard.grid.cell.verifyVirtualCell({ + index: j, + columnHeader: colHeaders[i], + count: 1, + value: expected[i][j], + }); + } + } + + await dashboard.closeTab({ title: "Sheet2" }); + await dashboard.treeView.openTable({ title: "Sheet1" }); + + const expected2 = [ + [["2a"], ["2b"], ["2c"]], + [["2a"], ["2b"], ["2c"]], + [["2a"], ["2b"], ["2c"]], + ]; + const colHeaders2 = ["Link1-2hm", "Link1-2mm", "Sheet2"]; + + // verify LTAR cell values + for (let i = 0; i < expected2.length; i++) { + for (let j = 0; j < expected2[i].length; j++) { + await dashboard.grid.cell.verifyVirtualCell({ + index: j, + columnHeader: colHeaders2[i], + count: 1, + value: expected2[i][j], + }); + } + } + + // verify LTAR cell values + for (let i = 0; i < expected2.length; i++) { + for (let j = 0; j < expected2[i].length; j++) { + await dashboard.grid.cell.unlinkVirtualCell({ + index: j, + columnHeader: colHeaders2[i], + }); + } + } + + // delete columns + await dashboard.grid.column.delete({ title: "Link1-2hm" }); + await dashboard.grid.column.delete({ title: "Link1-2mm" }); + await dashboard.grid.column.delete({ title: "Sheet2" }); + + // delete table + await dashboard.treeView.deleteTable({ title: "Sheet1" }); + await dashboard.treeView.deleteTable({ title: "Sheet2" }); }); });