Browse Source

test: fix field and link locators

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5332/head
mertmit 1 year ago
parent
commit
3467884f19
  1. 2
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  2. 15
      tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts

2
tests/playwright/pages/Dashboard/common/Cell/index.ts

@ -280,7 +280,7 @@ export class CellPageObject extends BasePage {
async unlinkVirtualCell({ index, columnHeader }: CellProps) { async unlinkVirtualCell({ index, columnHeader }: CellProps) {
const cell = this.get({ index, columnHeader }); const cell = this.get({ index, columnHeader });
await cell.click(); await cell.click();
await cell.locator('.nc-icon.unlink-icon').first().click(); await cell.locator('.unlink-icon').first().click();
} }
async verifyRoleAccess(param: { role: string }) { async verifyRoleAccess(param: { role: string }) {

15
tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts

@ -97,16 +97,7 @@ export class ToolbarFieldsPage extends BasePage {
} }
async getFieldsTitles() { async getFieldsTitles() {
let fields: string[] = await this.rootPage.locator(`.nc-grid-header`).allInnerTexts(); let fields: string[] = await this.rootPage.locator(`.nc-grid-header .name`).allTextContents();
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 !== '');
return fields; return fields;
} }
@ -114,8 +105,8 @@ export class ToolbarFieldsPage extends BasePage {
await this.toolbar.clickFields(); await this.toolbar.clickFields();
const { from, to } = param; const { from, to } = param;
const [fromStack, toStack] = await Promise.all([ const [fromStack, toStack] = await Promise.all([
this.get().locator(`.nc-icon.cursor-move`).nth(from), this.get().locator(`.cursor-move`).nth(from),
this.get().locator(`.nc-icon.cursor-move`).nth(to), this.get().locator(`.cursor-move`).nth(to),
]); ]);
await fromStack.dragTo(toStack); await fromStack.dragTo(toStack);

Loading…
Cancel
Save