From 1be7d6a6da088b85bda28f92f33f433fb2c982d2 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Wed, 24 Jul 2024 07:23:27 +0000 Subject: [PATCH] tests: update attachments tests --- .../Dashboard/common/Cell/AttachmentCell.ts | 17 +++++++++++++++-- .../playwright/tests/db/views/viewForm.spec.ts | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts b/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts index b0df2e13d7..e41e5ad52e 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts +++ b/tests/playwright/pages/Dashboard/common/Cell/AttachmentCell.ts @@ -52,9 +52,22 @@ export class AttachmentCellPageObject extends BasePage { await this.rootPage.waitForTimeout(750); } - async removeFile({ attIndex, index, columnHeader }: { attIndex: number; index?: number; columnHeader: string }) { + async removeFile({ + attIndex, + index, + columnHeader, + skipElemClick, + }: { + attIndex: number; + index?: number; + columnHeader: string; + skipElemClick?: boolean; + }) { await this.get({ index, columnHeader }).scrollIntoViewIfNeeded(); - await this.get({ index, columnHeader }).click({ position: { x: 1, y: 1 } }); + + if (!skipElemClick) { + await this.get({ index, columnHeader }).click({ position: { x: 1, y: 1 } }); + } await this.get({ index, columnHeader }).locator('.nc-attachment-item').nth(attIndex).hover(); await this.get({ index, columnHeader }) diff --git a/tests/playwright/tests/db/views/viewForm.spec.ts b/tests/playwright/tests/db/views/viewForm.spec.ts index 2f66edb011..1719da3ae9 100644 --- a/tests/playwright/tests/db/views/viewForm.spec.ts +++ b/tests/playwright/tests/db/views/viewForm.spec.ts @@ -1366,6 +1366,7 @@ test.describe('Form view: field validation', () => { await sharedForm.cell.attachment.removeFile({ columnHeader: 'Attachment', attIndex: 0, + skipElemClick: true, }); await sharedForm.cell.attachment.addFile({ @@ -1414,6 +1415,7 @@ test.describe('Form view: field validation', () => { await surveyForm.cell.attachment.removeFile({ columnHeader: 'Attachment', attIndex: 0, + skipElemClick: true, }); await surveyForm.cell.attachment.addFile({