From ea93000130fc93a7f048089464377115f2fc9651 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sun, 26 Mar 2023 07:22:24 +0530 Subject: [PATCH] test: insert before Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../pages/Dashboard/Grid/Column/index.ts | 26 +++++++------------ .../tests/columnMenuOperations.spec.ts | 1 + 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/tests/playwright/pages/Dashboard/Grid/Column/index.ts b/tests/playwright/pages/Dashboard/Grid/Column/index.ts index cba1868a70..3ca90f1f5d 100644 --- a/tests/playwright/pages/Dashboard/Grid/Column/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/Column/index.ts @@ -182,29 +182,23 @@ export class ColumnPageObject extends BasePage { await this.save(); + const headersText = []; + const locator = this.grid.get().locator(`th`); + const count = await locator.count(); + for (let i = 0; i < count; i++) { + const header = locator.nth(i); + const text = await getTextExcludeIconText(header); + headersText.push(text); + } + // verify column inserted after the target column if (insertAfterColumnTitle) { - const headersText = []; - const locator = this.grid.get().locator(`th`); - const count = await locator.count(); - for (let i = 0; i < count; i++) { - const header = locator.nth(i); - const text = await getTextExcludeIconText(header); - headersText.push(text); - } expect(headersText[headersText.findIndex(title => title.startsWith(insertAfterColumnTitle)) + 1]).toBe(title); } // verify column inserted before the target column if (insertBeforeColumnTitle) { - const headersText = await this.grid.get().locator(`th`).allTextContents(); - - await expect( - this.grid - .get() - .locator(`th`) - .nth(headersText.findIndex(title => title.startsWith(insertBeforeColumnTitle)) - 1) - ).toHaveText(title); + expect(headersText[headersText.findIndex(title => title.startsWith(insertBeforeColumnTitle)) - 1]).toBe(title); } } diff --git a/tests/playwright/tests/columnMenuOperations.spec.ts b/tests/playwright/tests/columnMenuOperations.spec.ts index 01a4e016bf..429d9cf5d7 100644 --- a/tests/playwright/tests/columnMenuOperations.spec.ts +++ b/tests/playwright/tests/columnMenuOperations.spec.ts @@ -66,6 +66,7 @@ test.describe('Column menu operations', () => { } await dashboard.closeTab({ title: 'Film' }); }); + test('Insert after', async () => { await dashboard.treeView.openTable({ title: 'Film' });