From f4588f2c91b9608ab4dd85db174c846bec22b6b0 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 11 Oct 2024 16:17:47 +0000 Subject: [PATCH] fix: updsate test --- .../nc-gui/components/dlg/ExpandTable.vue | 20 ++++++++---- .../pages/Dashboard/Grid/ExpandTable.ts | 31 +++++++++++++++++++ .../playwright/pages/Dashboard/Grid/index.ts | 3 ++ .../db/features/keyboardShortcuts.spec.ts | 8 +++-- 4 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 tests/playwright/pages/Dashboard/Grid/ExpandTable.ts diff --git a/packages/nc-gui/components/dlg/ExpandTable.vue b/packages/nc-gui/components/dlg/ExpandTable.vue index 9fe7a43d5b..c72d48914a 100644 --- a/packages/nc-gui/components/dlg/ExpandTable.vue +++ b/packages/nc-gui/components/dlg/ExpandTable.vue @@ -23,6 +23,11 @@ onKeyDown('esc', () => { dialogShow.value = false emit('update:modelValue', false) }) + +const close = () => { + dialogShow.value = false + emit('cancel') +} -
-
- The data you pasted will update {{ affectedRows }} records in subsequent pages. -
- +
To fit your pasted data into the table, we need to add {{ rows }} more records. @@ -52,6 +53,7 @@ onKeyDown('esc', () => {
- + + {{ $t('labels.cancel') }} + +
+
+ {{ $t('labels.continue') }}
diff --git a/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts b/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts new file mode 100644 index 0000000000..c699e7e7c5 --- /dev/null +++ b/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts @@ -0,0 +1,31 @@ +import BasePage from '../../Base'; +import { GridPage } from './index'; + +export class ExpandTablePageObject extends BasePage { + readonly grid: GridPage; + + constructor(grid: GridPage) { + super(grid.rootPage); + this.grid = grid; + } + + async getExpandTable() { + return this.rootPage.getByTestId('nc-expand-table-modal'); + } + + async upsert() { + const expandTableModal = await this.getExpandTable(); + + await expandTableModal.getByTestId('nc-table-expand-yes').click(); + + await expandTableModal.getByTestId('nc-table-expand').click(); + } + + async updateOnly() { + const expandTableModal = await this.getExpandTable(); + + await expandTableModal.getByTestId('nc-table-expand-no').click(); + + await expandTableModal.getByTestId('nc-table-expand').click(); + } +} diff --git a/tests/playwright/pages/Dashboard/Grid/index.ts b/tests/playwright/pages/Dashboard/Grid/index.ts index 638a9898af..e82abad54e 100644 --- a/tests/playwright/pages/Dashboard/Grid/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/index.ts @@ -14,6 +14,7 @@ import { WorkspaceMenuObject } from '../common/WorkspaceMenu'; import { GroupPageObject } from './Group'; import { ColumnHeaderPageObject } from './columnHeader'; import { AggregaionBarPage } from './AggregationBar'; +import { ExpandTablePageObject } from './ExpandTable'; export class GridPage extends BasePage { readonly dashboard: DashboardPage; @@ -32,6 +33,7 @@ export class GridPage extends BasePage { readonly rowPage: RowPageObject; readonly groupPage: GroupPageObject; readonly aggregationBar: AggregaionBarPage; + readonly expandTableOverlay: ExpandTablePageObject; readonly btn_addNewRow: Locator; @@ -52,6 +54,7 @@ export class GridPage extends BasePage { this.rowPage = new RowPageObject(this); this.groupPage = new GroupPageObject(this); this.aggregationBar = new AggregaionBarPage(this); + this.expandTableOverlay = new ExpandTablePageObject(this); this.btn_addNewRow = this.get().locator('.nc-grid-add-new-cell'); } diff --git a/tests/playwright/tests/db/features/keyboardShortcuts.spec.ts b/tests/playwright/tests/db/features/keyboardShortcuts.spec.ts index 83f1c0e3a5..c98c6fccae 100644 --- a/tests/playwright/tests/db/features/keyboardShortcuts.spec.ts +++ b/tests/playwright/tests/db/features/keyboardShortcuts.spec.ts @@ -434,7 +434,8 @@ test.describe('Clipboard support', () => { await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v'); // reload page - await dashboard.rootPage.reload(); + // await dashboard.rootPage.reload(); + await page.waitForTimeout(500); // verify copied data for (let i = 1; i <= 5; i++) { @@ -450,8 +451,11 @@ test.describe('Clipboard support', () => { await grid.cell.click({ index: 4, columnHeader: 'SingleLineText' }); await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v'); + await page.waitForTimeout(2000); + + await grid.expandTableOverlay.upsert(); // reload page - await dashboard.rootPage.reload(); + // await dashboard.rootPage.reload(); // verify copied data for (let i = 4; i <= 5; i++) {