diff --git a/scripts/playwright/pages/TreeView.ts b/scripts/playwright/pages/TreeView.ts index f2a7072e20..77924f754c 100644 --- a/scripts/playwright/pages/TreeView.ts +++ b/scripts/playwright/pages/TreeView.ts @@ -16,6 +16,10 @@ export class TreeViewPage { return this.page.locator(".nc-treeview-container");; } + async focusTable({ title }: { title: string }) { + await this.get().locator(`.nc-project-tree-tbl-${title}`).focus(); + } + async openTable({ title }: { title: string }) { await this.get().locator(`.nc-project-tree-tbl-${title}`).click(); } @@ -36,10 +40,14 @@ export class TreeViewPage { .waitFor({ state: "hidden" }); } - async verifyTableExists({ title }: { title: string }) { + async verifyTable({ title, index }: { title: string; index?: number }) { await expect( this.get().locator(`.nc-project-tree-tbl-${title}`) ).toBeVisible(); + + if(index) { + expect(await this.get().locator('.nc-tbl-title').nth(index)).toHaveText(title); + } } async verifyTableDoesNotExist({ title }: { title: string }) { diff --git a/scripts/playwright/tests/tableOperations.spec.ts b/scripts/playwright/tests/tableOperations.spec.ts index 6dcc5e5eac..4ca8f1015e 100644 --- a/scripts/playwright/tests/tableOperations.spec.ts +++ b/scripts/playwright/tests/tableOperations.spec.ts @@ -14,9 +14,9 @@ test.describe('Table Operations', () => { settings = new SettingsPage(page); }) - test('Create, and delete table, verify in audit tab, and rename City table', async () => { + test('Create, and delete table, verify in audit tab, rename City table and reorder tables', async () => { await dashboard.treeView.createTable({title: "tablex"}); - await dashboard.treeView.verifyTableExists({title: "tablex"}); + await dashboard.treeView.verifyTable({title: "tablex"}); await dashboard.treeView.deleteTable({title: "tablex"}); await dashboard.treeView.verifyTableDoesNotExist({title: "tablex"}); @@ -28,14 +28,15 @@ test.describe('Table Operations', () => { await settings.close(); await dashboard.treeView.renameTable({title: "City", newTitle: "Cityx"}); - await dashboard.treeView.verifyTableExists({title: "Cityx"}); - }); + await dashboard.treeView.verifyTable({title: "Cityx"}); - test('Table drag and drop re order', async () => { + await dashboard.treeView.focusTable({title: "Actor"}); + await dashboard.treeView.verifyTable({title: "Actor", index: 0}); await dashboard.treeView.reorderTables({ - sourceTable: "City", - destinationTable: "Country" - }) - }) + sourceTable: "Actor", + destinationTable: "Address" + }); + await dashboard.treeView.verifyTable({title: "Address", index: 0}); + }); });