Browse Source

fix: test corrections

nc-expand-rows
DarkPhoenix2704 2 months ago
parent
commit
b728d1535f
  1. 18
      packages/nc-gui/composables/useMultiSelect/index.ts
  2. 16
      tests/playwright/pages/Dashboard/Grid/ExpandTable.ts
  3. 1
      tests/playwright/tests/db/general/cellSelection.spec.ts

18
packages/nc-gui/composables/useMultiSelect/index.ts

@ -856,13 +856,21 @@ export function useMultiSelect(
const totalRowsBeforeActiveCell = (page - 1) * pageSize + activeCell.row
const availableRowsToUpdate = Math.max(0, totalRows - totalRowsBeforeActiveCell)
const rowsToAdd = Math.max(0, selectionRowCount - (totalRows - totalRowsBeforeActiveCell))
const unreffedData = unref(data).slice(activeCell.row, activeCell.row + selectionRowCount)
const totalRowsToPaste = clipboardMatrix.length
const rowsToAdd = Math.max(0, totalRowsToPaste - availableRowsToUpdate)
const rowsInCurrentPage = unref(data).length
const recordsUpdatedInCurrentPage = Math.min(selectionRowCount, rowsInCurrentPage - activeCell.row)
const recordsUpdatedInSubsequentPages = Math.max(0, availableRowsToUpdate - recordsUpdatedInCurrentPage)
const unreffedData = unref(data).slice(
activeCell.row,
activeCell.row + Math.min(totalRowsToPaste, rowsInCurrentPage - activeCell.row),
)
const recordsUpdatedInCurrentPage = Math.min(rowsInCurrentPage - activeCell.row, availableRowsToUpdate, totalRowsToPaste)
const recordsUpdatedInSubsequentPages = Math.min(
availableRowsToUpdate - recordsUpdatedInCurrentPage,
totalRowsToPaste - recordsUpdatedInCurrentPage,
)
let options = {
continue: false,

16
tests/playwright/pages/Dashboard/Grid/ExpandTable.ts

@ -9,23 +9,23 @@ export class ExpandTablePageObject extends BasePage {
this.grid = grid;
}
async getExpandTable() {
return this.rootPage.getByTestId('nc-expand-table-modal');
}
async upsert() {
const expandTableModal = await this.getExpandTable();
const expandTableModal = this.rootPage.getByTestId('nc-expand-table-modal');
await expandTableModal.isVisible();
await expandTableModal.getByTestId('nc-table-expand-yes').click();
await expandTableModal.getByTestId('nc-table-expand').click();
await this.rootPage.getByTestId('nc-table-expand').click();
}
async updateOnly() {
const expandTableModal = await this.getExpandTable();
const expandTableModal = this.rootPage.getByTestId('nc-expand-table-modal');
await expandTableModal.isVisible();
await expandTableModal.getByTestId('nc-table-expand-no').click();
await expandTableModal.getByTestId('nc-table-expand').click();
await this.rootPage.getByTestId('nc-table-expand').click();
}
}

1
tests/playwright/tests/db/general/cellSelection.spec.ts

@ -21,6 +21,7 @@ test.describe('Verify cell selection', () => {
test('Suite-1', async () => {
// #1 when range is selected, it has correct number of selected cells
await dashboard.treeView.openTable({ title: 'Customer' });
await grid.selectRange({
start: { index: 0, columnHeader: 'FirstName' },
end: { index: 2, columnHeader: 'Email' },

Loading…
Cancel
Save