Browse Source

test: fix field and link locators

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5332/head
mertmit 2 years 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) {
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 }) {

15
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);

Loading…
Cancel
Save