Browse Source

test: retry logic for cell access & page reload wait

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/6229/head
Raju Udava 1 year ago
parent
commit
6ee8a666c7
  1. 17
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  2. 4
      tests/playwright/tests/db/views/viewGridShare.spec.ts

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

@ -300,19 +300,30 @@ export class CellPageObject extends BasePage {
if (type === 'bt') {
const chips = cell.locator('.chips > .chip');
await expect(await chips.count()).toBe(count);
expect(await chips.count()).toBe(count);
for (let i = 0; i < value.length; ++i) {
await chips.nth(i).locator('.name').waitFor({ state: 'visible' });
await chips.nth(i).locator('.name').scrollIntoViewIfNeeded();
await expect(await chips.nth(i).locator('.name')).toHaveText(value[i]);
await expect(chips.nth(i).locator('.name')).toHaveText(value[i]);
}
return;
}
// verify chip count & contents
if (count) {
await expect(await cell.innerText()).toContain(`${count} ${count === 1 ? options.singular : options.plural}`);
const expectedText = `${count} ${count === 1 ? options.singular : options.plural}`;
let retryCount = 0;
while (retryCount < 5) {
const receivedText = await linkText.innerText();
if (receivedText.includes(expectedText)) {
break;
}
retryCount++;
// add delay of 100ms
await this.rootPage.waitForTimeout(100 * retryCount);
}
expect(await cell.innerText()).toContain(expectedText);
}
if (verifyChildList) {

4
tests/playwright/tests/db/views/viewGridShare.spec.ts

@ -98,6 +98,8 @@ test.describe('Shared view', () => {
await dashboard.goto();
await page.reload();
// kludge: wait for 3 seconds to avoid flaky test
await page.waitForTimeout(5000);
await dashboard.treeView.openTable({ title: 'Film' });
await dashboard.grid.toolbar.clickGroupBy();
@ -106,6 +108,8 @@ test.describe('Shared view', () => {
await page.goto(sharedLink);
await page.reload();
// kludge: wait for 3 seconds to avoid flaky test
await page.waitForTimeout(5000);
await sharedPage.grid.cell.verify({ index: 0, columnHeader: 'Title', value: 'ZORRO ARK' });
});

Loading…
Cancel
Save