Browse Source

test: insert before

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

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

@ -182,29 +182,23 @@ export class ColumnPageObject extends BasePage {
await this.save(); 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 // verify column inserted after the target column
if (insertAfterColumnTitle) { 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); 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