Browse Source

test: insert before

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5363/head
Raju Udava 1 year ago
parent
commit
ea93000130
  1. 14
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  2. 1
      tests/playwright/tests/columnMenuOperations.spec.ts

14
tests/playwright/pages/Dashboard/Grid/Column/index.ts

@ -182,8 +182,6 @@ export class ColumnPageObject extends BasePage {
await this.save(); await this.save();
// verify column inserted after the target column
if (insertAfterColumnTitle) {
const headersText = []; const headersText = [];
const locator = this.grid.get().locator(`th`); const locator = this.grid.get().locator(`th`);
const count = await locator.count(); const count = await locator.count();
@ -192,19 +190,15 @@ export class ColumnPageObject extends BasePage {
const text = await getTextExcludeIconText(header); const text = await getTextExcludeIconText(header);
headersText.push(text); headersText.push(text);
} }
// verify column inserted after the target column
if (insertAfterColumnTitle) {
expect(headersText[headersText.findIndex(title => title.startsWith(insertAfterColumnTitle)) + 1]).toBe(title); expect(headersText[headersText.findIndex(title => title.startsWith(insertAfterColumnTitle)) + 1]).toBe(title);
} }
// verify column inserted before the target column // verify column inserted before the target column
if (insertBeforeColumnTitle) { if (insertBeforeColumnTitle) {
const headersText = await this.grid.get().locator(`th`).allTextContents(); expect(headersText[headersText.findIndex(title => title.startsWith(insertBeforeColumnTitle)) - 1]).toBe(title);
await expect(
this.grid
.get()
.locator(`th`)
.nth(headersText.findIndex(title => title.startsWith(insertBeforeColumnTitle)) - 1)
).toHaveText(title);
} }
} }

1
tests/playwright/tests/columnMenuOperations.spec.ts

@ -66,6 +66,7 @@ test.describe('Column menu operations', () => {
} }
await dashboard.closeTab({ title: 'Film' }); await dashboard.closeTab({ title: 'Film' });
}); });
test('Insert after', async () => { test('Insert after', async () => {
await dashboard.treeView.openTable({ title: 'Film' }); await dashboard.treeView.openTable({ title: 'Film' });

Loading…
Cancel
Save