From 3467884f197ff3275e1a9aaff90d09f781b3da6e Mon Sep 17 00:00:00 2001 From: mertmit Date: Sat, 25 Mar 2023 12:21:32 +0300 Subject: [PATCH] test: fix field and link locators Signed-off-by: mertmit --- .../pages/Dashboard/common/Cell/index.ts | 2 +- .../pages/Dashboard/common/Toolbar/Fields.ts | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Cell/index.ts b/tests/playwright/pages/Dashboard/common/Cell/index.ts index f74d7ef50f..3fc20abc18 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/index.ts +++ b/tests/playwright/pages/Dashboard/common/Cell/index.ts @@ -280,7 +280,7 @@ export class CellPageObject extends BasePage { async unlinkVirtualCell({ index, columnHeader }: CellProps) { const cell = this.get({ index, columnHeader }); await cell.click(); - await cell.locator('.nc-icon.unlink-icon').first().click(); + await cell.locator('.unlink-icon').first().click(); } async verifyRoleAccess(param: { role: string }) { diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts index 395f501d61..e27450133d 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts @@ -97,16 +97,7 @@ export class ToolbarFieldsPage extends BasePage { } async getFieldsTitles() { - let fields: string[] = await this.rootPage.locator(`.nc-grid-header`).allInnerTexts(); - - fields = fields[0].split('\n'); - // for each entry in fields, remove \n, \t, and \r - fields = fields.map(field => field.replace(/[\n\t\r]/g, '')); - // remove first entry, which is the row number - fields.shift(); - // remove empty strings from array - fields = fields.filter(field => field !== ''); - + let fields: string[] = await this.rootPage.locator(`.nc-grid-header .name`).allTextContents(); return fields; } @@ -114,8 +105,8 @@ export class ToolbarFieldsPage extends BasePage { await this.toolbar.clickFields(); const { from, to } = param; const [fromStack, toStack] = await Promise.all([ - this.get().locator(`.nc-icon.cursor-move`).nth(from), - this.get().locator(`.nc-icon.cursor-move`).nth(to), + this.get().locator(`.cursor-move`).nth(from), + this.get().locator(`.cursor-move`).nth(to), ]); await fromStack.dragTo(toStack);