diff --git a/tests/playwright/pages/Base.ts b/tests/playwright/pages/Base.ts index 4aeed1e144..783f6c51ca 100644 --- a/tests/playwright/pages/Base.ts +++ b/tests/playwright/pages/Base.ts @@ -49,7 +49,7 @@ export default abstract class BasePage { ]); } - async attachFile({ filePickUIAction, filePath }: { filePickUIAction: Promise; filePath: string }) { + async attachFile({ filePickUIAction, filePath }: { filePickUIAction: Promise; filePath: string[] }) { const [fileChooser] = await Promise.all([ // It is important to call waitForEvent before click to set up waiting. this.rootPage.waitForEvent('filechooser'), diff --git a/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts b/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts index 9e186aa862..34ffc416be 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts +++ b/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts @@ -18,7 +18,10 @@ export class AttachmentCellPageObject extends BasePage { return this.get({ index, columnHeader }).locator('[data-testid="attachment-cell-file-picker-button"]').click(); } - async addFile({ index, columnHeader, filePath }: { index?: number; columnHeader: string; filePath: string }) { + // filePath: to attach multiple files, pass an array of file paths + // e.g. ['path/to/file1', 'path/to/file2'] + // + async addFile({ index, columnHeader, filePath }: { index?: number; columnHeader: string; filePath: string[] }) { const attachFileAction = this.get({ index, columnHeader }) .locator('[data-testid="attachment-cell-file-picker-button"]') .click(); diff --git a/tests/playwright/tests/columnAttachments.spec.ts b/tests/playwright/tests/columnAttachments.spec.ts index f4ef56049e..3a378bd9e2 100644 --- a/tests/playwright/tests/columnAttachments.spec.ts +++ b/tests/playwright/tests/columnAttachments.spec.ts @@ -20,7 +20,7 @@ test.describe('Attachment column', () => { }); for (let i = 4; i <= 6; i++) { - const filepath = `${process.cwd()}/fixtures/sampleFiles/${i}.json`; + const filepath = [`${process.cwd()}/fixtures/sampleFiles/${i}.json`]; await dashboard.grid.cell.attachment.addFile({ index: i, columnHeader: 'testAttach', @@ -34,7 +34,7 @@ test.describe('Attachment column', () => { await dashboard.grid.cell.attachment.addFile({ index: 7, columnHeader: 'testAttach', - filePath: `${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`, + filePath: [`${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`], }); await dashboard.grid.cell.attachment.verifyFile({ index: 7, @@ -60,7 +60,7 @@ test.describe('Attachment column', () => { }); await sharedForm.cell.attachment.addFile({ columnHeader: 'testAttach', - filePath: `${process.cwd()}/fixtures/sampleFiles/1.json`, + filePath: [`${process.cwd()}/fixtures/sampleFiles/1.json`], }); await sharedForm.submit(); await sharedForm.verifySuccessMessage();