diff --git a/tests/playwright/fixtures/sampleFiles/sampleImage.jpeg b/tests/playwright/fixtures/sampleFiles/sampleImage.jpeg new file mode 100644 index 0000000000..9e88102c07 Binary files /dev/null and b/tests/playwright/fixtures/sampleFiles/sampleImage.jpeg differ diff --git a/tests/playwright/pages/Dashboard/Form/index.ts b/tests/playwright/pages/Dashboard/Form/index.ts index 2f44e06a5d..b04ac3326f 100644 --- a/tests/playwright/pages/Dashboard/Form/index.ts +++ b/tests/playwright/pages/Dashboard/Form/index.ts @@ -7,6 +7,7 @@ export class FormPage extends BasePage { readonly dashboard: DashboardPage; readonly toolbar: ToolbarPage; + // todo: All the locator should be private readonly addAllButton: Locator; readonly removeAllButton: Locator; readonly submitButton: Locator; diff --git a/tests/playwright/pages/SharedForm/index.ts b/tests/playwright/pages/SharedForm/index.ts index 6aa548a9af..0079bde67d 100644 --- a/tests/playwright/pages/SharedForm/index.ts +++ b/tests/playwright/pages/SharedForm/index.ts @@ -16,7 +16,7 @@ export class SharedFormPage extends BasePage { async submit() { await this.waitForResponse({ - uiAction: this.get().locator('[data-testid="shared-form-submit-button"]').click(), + uiAction: this.get().getByTestId('shared-form-submit-button').click(), httpMethodsToMatch: ['POST'], requestUrlPathToMatch: '/rows', }); diff --git a/tests/playwright/tests/columnAttachments.spec.ts b/tests/playwright/tests/columnAttachments.spec.ts index 475c07fb14..f4ef56049e 100644 --- a/tests/playwright/tests/columnAttachments.spec.ts +++ b/tests/playwright/tests/columnAttachments.spec.ts @@ -31,6 +31,15 @@ test.describe('Attachment column', () => { columnHeader: 'testAttach', }); } + await dashboard.grid.cell.attachment.addFile({ + index: 7, + columnHeader: 'testAttach', + filePath: `${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`, + }); + await dashboard.grid.cell.attachment.verifyFile({ + index: 7, + columnHeader: 'testAttach', + }); await dashboard.viewSidebar.createFormView({ title: 'Form 1', diff --git a/tests/playwright/tests/viewForm.spec.ts b/tests/playwright/tests/viewForm.spec.ts index 2f96356f9b..734f73bfc0 100644 --- a/tests/playwright/tests/viewForm.spec.ts +++ b/tests/playwright/tests/viewForm.spec.ts @@ -3,6 +3,7 @@ import { DashboardPage } from '../pages/Dashboard'; import { SettingTab } from '../pages/Dashboard/Settings'; import setup from '../setup'; import { FormPage } from '../pages/Dashboard/Form'; +import { SharedFormPage } from '../pages/SharedForm'; // todo: Move most of the ui actions to page object and await on the api response test.describe('Form view', () => { @@ -201,4 +202,32 @@ test.describe('Form view', () => { }); await dashboard.settings.close(); }); + + test('Form share, verify attachment file', async () => { + await dashboard.treeView.createTable({ title: 'New' }); + + await dashboard.grid.column.create({ + title: 'Attachment', + type: 'Attachment', + }); + + await dashboard.viewSidebar.createFormView({ title: 'NewForm' }); + await dashboard.form.toolbar.clickShareView(); + const formLink = await dashboard.form.toolbar.shareView.getShareLink(); + + await dashboard.rootPage.goto(formLink); + + const sharedForm = new SharedFormPage(dashboard.rootPage); + await sharedForm.cell.attachment.addFile({ + columnHeader: 'Attachment', + filePath: `${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`, + }); + await sharedForm.cell.fillText({ + columnHeader: 'Title', + text: 'Text', + }); + + await sharedForm.submit(); + await sharedForm.verifySuccessMessage(); + }); });