Browse Source

fix(playwright): Added PW tests to verify that photo upload works on formshare and on attachment cell on grid

pull/4538/head
Muhammed Mustafa 2 years ago
parent
commit
93dcbb82b0
  1. BIN
      tests/playwright/fixtures/sampleFiles/sampleImage.jpeg
  2. 1
      tests/playwright/pages/Dashboard/Form/index.ts
  3. 2
      tests/playwright/pages/SharedForm/index.ts
  4. 9
      tests/playwright/tests/columnAttachments.spec.ts
  5. 29
      tests/playwright/tests/viewForm.spec.ts

BIN
tests/playwright/fixtures/sampleFiles/sampleImage.jpeg

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

1
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;

2
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',
});

9
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',

29
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();
});
});

Loading…
Cancel
Save