Browse Source

fix: updsate test

nc-expand-rows
DarkPhoenix2704 2 months ago
parent
commit
f4588f2c91
  1. 20
      packages/nc-gui/components/dlg/ExpandTable.vue
  2. 31
      tests/playwright/pages/Dashboard/Grid/ExpandTable.ts
  3. 3
      tests/playwright/pages/Dashboard/Grid/index.ts
  4. 8
      tests/playwright/tests/db/features/keyboardShortcuts.spec.ts

20
packages/nc-gui/components/dlg/ExpandTable.vue

@ -23,6 +23,11 @@ onKeyDown('esc', () => {
dialogShow.value = false dialogShow.value = false
emit('update:modelValue', false) emit('update:modelValue', false)
}) })
const close = () => {
dialogShow.value = false
emit('cancel')
}
</script> </script>
<template> <template>
@ -40,11 +45,7 @@ onKeyDown('esc', () => {
</div> </div>
</div> </div>
</template> </template>
<div class="flex flex-col mt-1"> <div data-testid="nc-expand-table-modal" class="flex flex-col mt-1">
<div v-if="(affectedRows ?? 0) > 0" class="mb-2">
The data you pasted will update {{ affectedRows }} records in subsequent pages.
</div>
<div v-if="(rows ?? 0) > 0" class="mb-4"> <div v-if="(rows ?? 0) > 0" class="mb-4">
To fit your pasted data into the table, we need to add To fit your pasted data into the table, we need to add
<span class="font-semibold text-gray-800"> {{ rows }} more records. </span> <span class="font-semibold text-gray-800"> {{ rows }} more records. </span>
@ -52,6 +53,7 @@ onKeyDown('esc', () => {
<a-radio-group v-if="(rows ?? 0) > 0" v-model:value="expand"> <a-radio-group v-if="(rows ?? 0) > 0" v-model:value="expand">
<a-radio <a-radio
data-testid="nc-table-expand-yes"
:style="{ :style="{
display: 'flex', display: 'flex',
height: '30px', height: '30px',
@ -66,6 +68,7 @@ onKeyDown('esc', () => {
</div> </div>
</a-radio> </a-radio>
<a-radio <a-radio
data-testid="nc-table-expand-no"
:style="{ :style="{
display: 'flex', display: 'flex',
height: '30px', height: '30px',
@ -81,7 +84,12 @@ onKeyDown('esc', () => {
<div class="flex flex-row justify-end gap-x-2"> <div class="flex flex-row justify-end gap-x-2">
<div class="flex gap-2 items-center"> <div class="flex gap-2 items-center">
<NcButton type="primary" size="small" @click="updateExpand"> <NcButton data-testid="nc-table-expand-cancel" type="secondary" size="small" @click="close">
{{ $t('labels.cancel') }}
</NcButton>
</div>
<div class="flex gap-2 items-center">
<NcButton data-testid="nc-table-expand" type="primary" size="small" @click="updateExpand">
{{ $t('labels.continue') }} {{ $t('labels.continue') }}
</NcButton> </NcButton>
</div> </div>

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

3
tests/playwright/pages/Dashboard/Grid/index.ts

@ -14,6 +14,7 @@ import { WorkspaceMenuObject } from '../common/WorkspaceMenu';
import { GroupPageObject } from './Group'; import { GroupPageObject } from './Group';
import { ColumnHeaderPageObject } from './columnHeader'; import { ColumnHeaderPageObject } from './columnHeader';
import { AggregaionBarPage } from './AggregationBar'; import { AggregaionBarPage } from './AggregationBar';
import { ExpandTablePageObject } from './ExpandTable';
export class GridPage extends BasePage { export class GridPage extends BasePage {
readonly dashboard: DashboardPage; readonly dashboard: DashboardPage;
@ -32,6 +33,7 @@ export class GridPage extends BasePage {
readonly rowPage: RowPageObject; readonly rowPage: RowPageObject;
readonly groupPage: GroupPageObject; readonly groupPage: GroupPageObject;
readonly aggregationBar: AggregaionBarPage; readonly aggregationBar: AggregaionBarPage;
readonly expandTableOverlay: ExpandTablePageObject;
readonly btn_addNewRow: Locator; readonly btn_addNewRow: Locator;
@ -52,6 +54,7 @@ export class GridPage extends BasePage {
this.rowPage = new RowPageObject(this); this.rowPage = new RowPageObject(this);
this.groupPage = new GroupPageObject(this); this.groupPage = new GroupPageObject(this);
this.aggregationBar = new AggregaionBarPage(this); this.aggregationBar = new AggregaionBarPage(this);
this.expandTableOverlay = new ExpandTablePageObject(this);
this.btn_addNewRow = this.get().locator('.nc-grid-add-new-cell'); this.btn_addNewRow = this.get().locator('.nc-grid-add-new-cell');
} }

8
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'); await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v');
// reload page // reload page
await dashboard.rootPage.reload(); // await dashboard.rootPage.reload();
await page.waitForTimeout(500);
// verify copied data // verify copied data
for (let i = 1; i <= 5; i++) { for (let i = 1; i <= 5; i++) {
@ -450,8 +451,11 @@ test.describe('Clipboard support', () => {
await grid.cell.click({ index: 4, columnHeader: 'SingleLineText' }); await grid.cell.click({ index: 4, columnHeader: 'SingleLineText' });
await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v'); await page.keyboard.press((await grid.isMacOs()) ? 'Meta+v' : 'Control+v');
await page.waitForTimeout(2000);
await grid.expandTableOverlay.upsert();
// reload page // reload page
await dashboard.rootPage.reload(); // await dashboard.rootPage.reload();
// verify copied data // verify copied data
for (let i = 4; i <= 5; i++) { for (let i = 4; i <= 5; i++) {

Loading…
Cancel
Save