diff --git a/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts b/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts index 37b41ff83c..52ad7fcdb8 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts +++ b/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() { diff --git a/tests/playwright/tests/columnAttachments.spec.ts b/tests/playwright/tests/columnAttachments.spec.ts index fba2c41aa7..cd88220172 100644 --- a/tests/playwright/tests/columnAttachments.spec.ts +++ b/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',