Browse Source

test: retry logic for attach verification

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5046/head
Raju Udava 1 year ago
parent
commit
9241023ef3
  1. 22
      tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts
  2. 1
      tests/playwright/tests/columnAttachments.spec.ts

22
tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts

@ -48,15 +48,21 @@ export class AttachmentCellPageObject extends BasePage {
}
async verifyFileCount({ index, columnHeader, count }: { index: number; columnHeader: string; count: number }) {
const attachments = await this.get({ index, columnHeader }).locator(
'.nc-cell > .nc-attachment-cell > .flex > .nc-attachment'
);
// retry below logic for 5 times, with 1 second delay
let retryCount = 0;
while (retryCount < 5) {
const attachments = await this.get({ index, columnHeader }).locator('.nc-attachment');
console.log(await attachments.count());
if ((await attachments.count()) === count) {
break;
}
retryCount++;
await this.rootPage.waitForTimeout(1000);
console.log(await attachments.count());
expect(await attachments.count()).toBe(count);
// attachments should be of count 'count'
// await expect(await attachments.count()).toBe(count);
if (retryCount === 5) {
expect(await attachments.count()).toBe(count);
}
}
}
async expandModalClose() {

1
tests/playwright/tests/columnAttachments.spec.ts

@ -138,7 +138,6 @@ test.describe('Attachment column', () => {
columnHeader: 'testAttach',
filePath: twoFileArray,
});
await dashboard.rootPage.waitForTimeout(2000);
await dashboard.grid.cell.attachment.verifyFileCount({
index: 1,
columnHeader: 'testAttach',

Loading…
Cancel
Save