Files
nocodb/tests/playwright/quickTests/commonTest.ts
Anbarasu 04f49c13d8 feat: infinite scroll (#9403)
* feat: infinite scroll wip

* feat: implement column create

* feat: improve scroll performance and minor bugs

* fix: optimize cache clear fix: preserver selected items from cache clear

* feat: add keyboard support

* fix: get rid of unwanted data

* feat: infinite scroll

* fix: reload visible data

* fix: rowIndex Sync

* fix: row height fix

* fix: performance issues

* fix: small issues

* fix: stablize scrolling

* fix: scroll fails to load new data

* fix: best part is no part remove bunch of manual handling and move to computedProperty

* fix: load data as chunks instead of offset

* fix: deboucne 500 ms

* feat: safe chunk clearing

* feat: working infinite table(wip)

* fix: handle delete selected range of rows

* fix: update types

* fix: nuxt warnings

* fix: table fixes

* feat: undo-redo support for infiniteTable

* fix: fix addEmptyRow

* fix: groupby fixes

* fix: refactor visibleDtaa computed

* fix: cache clear

* fix: invalid offset error

* fix: add empty row elem

* fix: rows not loading at end

* fix: refactor

* fix: more tests passing

* fix: perf optimizations

* fix: couple tests

* fix: row height tests

* fix: row height tests

* fix: row height tests

* fix: sync row comment count

* fix: fixes

* fix: lot of tests

* fix: update the row placeholder columns size calculation

* fix: update the totalRows on loadData

* fix: tests when count is 0

* fix: hide placeholder if rowHeight is small

* fix: not required imo as infinite scroll is implemented

* fix: links tests

* fix: filter tests

* fix: insert after test fix: Row: Create, Update, Delete fix: Row height fix: Create column tests

* fix: error, timezone bug fix: shared view data not loading after 100

* fix: ignore shifting. this fixes errors in rows, which has some mandatory required cells

* fix: keyboardShortcuts test

* fix: project collaboration test

* fix: increase local cache fix: records empty on switching to full screen mode fix: links issue on new records

* fix: row and col margin for improved data rendering

* fix: addEmptyRow to table bottom

* fix: update gridShare test fix: shared view grid feat: new count endpoint public

* fix: undo-redo test failing

* fix: bulkUpdate chore: disabled bulkUpdate tests for now

* fix: slow searchBtn

* fix: limit max selection

* fix: limit selection to 100

* fix: initial chunk load to 100

* fix: couple fixes

* fix: couple fixes

* fix: row expand

* fix: scrollto Top and scrollTo Bottom on Shift Cmd Down/Up

* fix: drop support for cmd A

* fix: failing tests

* fix: error on clicking resize col

* fix: premature fetching

* fix: deleteSelected not working properly

* fix: test build

* fix: test build

* fix: throttled 500

* fix: scroll related issues fix: added transitions

* fix: scroll related issues

* fix: decrease col margin

* fix: increase local cache and update Buffer

* fix: decrease throttle

* fix: improve scroll performance

* fix: improve scroll performance

* fix: improve scroll performance

* fix: fixes

* feat: beta toggle show

* feat: beta toggle show

* fix: hold scroll action

* fix: sync visible data reloadVisibleDataHook

* fix: refactor useBetaFeatureToggle fix: useMultiSelect in table

* fix: dynamically reduce margin while loading records

* fix: some bugs

* fix: data loading in infinitescroll

* fix: shared view and search issues

* feat: betaToggles menu

* fix: scroll showing up in aggregation

* fix: text

* fix: implement shifting in addEmptyRow

* fix: calculate slices on rowHeight modified

* fix: keep invalid cells until another row selected

* fix: remove row if filter gets failed

* fix: update styles

* fix: move filter handling to nocodb-sdk

* fix: user field filter

* fix: sort order

* fix:user field sorting

* fix: update virtual cols

* fix: updated sort handling

* fix: updated sort handling

* fix: updated sort handling for bulkUpdate and undo-redo

* fix: unit tests

* fix: deleteSelectedRecords fails

* fix: chunkstates errors

* fix: sort bugs

* fix: scroll position

* fix: delete selectedrange of records

* fix: improved chunk management

* fix: sync toggle states across tabs

* fix: sync between tabs

* fix: limit issues

* fix: update issues

* fix: zIndex

* fix: minor fixes

* fix: cmd arrow issue

* fix: bulkdelete index issues

* fix: empty rows at top

* fix: queue add new record behaviour

* fix: resolve rowObj addEmptyRow

* fix: typo

* fix: clear indexes

* fix: reload if width is zero

* fix: manual handling

* fix: remove console

* fix: prefetch when scroll from below

* fix: refactor fixes

* fix:undo-redo with sort

---------

Co-authored-by: mertmit <mertmit99@gmail.com>
2024-11-08 11:38:47 +05:30

254 lines
7.7 KiB
TypeScript

import { DashboardPage } from '../pages/Dashboard';
import { NcContext } from '../setup';
import { isMysql, isPg } from '../setup/db';
// normal fields
const recordCells = {
Name: 'Movie-1',
Notes: 'Good',
Status: 'Todo',
Tags: 'Jan',
Phone: '123123123',
Email: 'a@b.com',
URL: 'www.a.com',
Number: '1',
Value: '$1.00',
Percent: '0.01',
};
// links/ computed fields
const recordsVirtualCells = {
Duration: '00:01',
Done: true,
Date: '2022-05-31',
Rating: 1,
Actor: ['Actor1', 'Actor2'],
'Status (from Actor)': ['Todo', 'In progress'],
RollUp: '128',
Computation: '4.04',
Producer: ['P1', 'P2'],
};
const tn = ['Film', 'Actor', 'Producer'];
const cn = [
'Name',
'Notes',
'Status',
'Tags',
'Done',
'Date',
'Phone',
'Email',
'URL',
'Number',
'Percent',
'Duration',
'Rating',
'Actor',
'Status (from Actor)',
'RollUp',
'Computation',
'Producer',
];
const quickVerify = async ({
dashboard,
airtableImport,
context,
}: {
dashboard: DashboardPage;
airtableImport?: boolean;
context: NcContext;
}) => {
await dashboard.treeView.openTable({ title: 'Film' });
// Verify tables
for (let i = 0; i < tn.length; i++) {
await dashboard.treeView.verifyTable({ title: tn[i] });
}
let cellIndex = 0;
let columnCount = cn.length;
if (airtableImport) {
cellIndex = 2;
columnCount -= 3;
}
for (let i = 0; i < columnCount; i++) {
await dashboard.grid.column.verify({ title: cn[i], scroll: true });
}
// Verify cells
// normal cells
for (const [index, [key, value]] of Object.entries(recordCells).entries()) {
if (index === 0) {
await dashboard.grid.cell.get({ index: index, columnHeader: key }).click();
}
await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: key, value });
}
// checkbox
await dashboard.grid.cell.checkbox.verifyChecked({ index: cellIndex, columnHeader: 'Done' });
// duration
await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: 'Duration', value: recordsVirtualCells.Duration });
// rating
await dashboard.grid.cell.rating.verify({
index: cellIndex,
columnHeader: 'Rating',
rating: recordsVirtualCells.Rating,
});
// Links
await dashboard.grid.cell.verifyVirtualCell({
index: cellIndex,
columnHeader: 'Actor',
value: isMysql(context) || isPg(context) ? ['Actor1'] : recordsVirtualCells.Actor,
});
// Status (from Actor)
// todo: Find a way to verify only the elements that are passed in
// await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: "Status (from Actor)", value: recordsVirtualCells["Status (from Actor)"][0] });
if (!airtableImport) {
// RollUp
await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: 'RollUp', value: recordsVirtualCells.RollUp });
// Computation
await dashboard.grid.cell.verify({
index: cellIndex,
columnHeader: 'Computation',
value: recordsVirtualCells.Computation,
});
// Links
await dashboard.grid.cell.verifyVirtualCell({
index: cellIndex,
columnHeader: 'Producer',
value: recordsVirtualCells.Producer,
});
}
// Verify form
await dashboard.viewSidebar.openView({ title: 'FormTitle' });
await dashboard.form.verifyHeader({ title: 'FormTitle', subtitle: 'FormDescription' });
await dashboard.form.verifyFormFieldLabel({ index: 0, label: 'DisplayName' });
await dashboard.form.verifyFormFieldHelpText({ index: 0, helpText: 'HelpText' });
await dashboard.form.verifyFieldsIsEditable({ index: 0 });
await dashboard.form.verifyAfterSubmitMsg({ msg: 'Thank you for submitting the form!' });
await dashboard.form.verifyAfterSubmitMenuState({
emailMe: false,
showBlankForm: true,
submitAnotherForm: true,
});
await dashboard.treeView.openTable({ title: 'Actor' });
if (!airtableImport) {
// Verify webhooks
await dashboard.grid.toolbar.clickActions();
await dashboard.grid.toolbar.actions.click('Webhooks');
await dashboard.webhookForm.openForm({
index: 0,
});
await dashboard.webhookForm.verifyForm({
title: 'Webhook-1',
hookEvent: 'After Insert',
notificationType: 'URL',
urlMethod: 'POST',
url: 'http://localhost:9090/hook',
condition: false,
});
await dashboard.webhookForm.goBackFromForm();
await dashboard.webhookForm.openForm({
index: 1,
});
await dashboard.webhookForm.verifyForm({
title: 'Webhook-2',
hookEvent: 'After Update',
notificationType: 'URL',
urlMethod: 'POST',
url: 'http://localhost:9090/hook',
condition: false,
});
await dashboard.webhookForm.goBackFromForm();
await dashboard.webhookForm.openForm({
index: 2,
});
await dashboard.webhookForm.verifyForm({
title: 'Webhook-3',
hookEvent: 'After Delete',
notificationType: 'URL',
urlMethod: 'POST',
url: 'http://localhost:9090/hook',
condition: false,
});
await dashboard.webhookForm.close();
}
await dashboard.viewSidebar.openView({ title: 'Filter&Sort' });
// Verify Fields, Filter & Sort
await dashboard.grid.column.verify({ title: 'Name' });
await dashboard.grid.column.verify({ title: 'Notes' });
await dashboard.grid.column.verify({ title: 'Attachments', isVisible: false });
await dashboard.grid.column.verify({ title: 'Status' });
await dashboard.grid.column.verify({ title: 'Film' });
// Verify Fields
await dashboard.grid.toolbar.clickFields();
await dashboard.grid.toolbar.fields.verify({ title: 'Name' });
await dashboard.grid.toolbar.fields.verify({ title: 'Notes', checked: true });
await dashboard.grid.toolbar.fields.verify({ title: 'Attachments', checked: false });
await dashboard.grid.toolbar.fields.verify({ title: 'Status', checked: true });
await dashboard.grid.toolbar.fields.verify({ title: 'Film', checked: true });
// Verify Sort
await dashboard.grid.toolbar.clickSort();
await dashboard.grid.toolbar.sort.verify({ index: 0, column: 'Name', direction: 'A → Z' });
// Verify Filter
await dashboard.grid.toolbar.clickFilter();
await dashboard.grid.toolbar.filter.verify({ index: 0, column: 'Name', operator: 'is like', value: '1' });
await dashboard.grid.toolbar.filter.verify({ index: 1, column: 'Name', operator: 'is like', value: '2' });
if (!airtableImport) {
// Verify views
// todo: Wait for 800ms, issue related to vue router
await dashboard.rootPage.waitForTimeout(800);
await dashboard.treeView.openTable({ title: 'Producer' });
await dashboard.viewSidebar.verifyView({ index: 0, title: 'Grid view' });
await dashboard.viewSidebar.verifyView({ index: 1, title: 'Grid 2' });
await dashboard.viewSidebar.verifyView({ index: 2, title: 'Grid 3' });
await dashboard.viewSidebar.verifyView({ index: 3, title: 'Grid 4' });
await dashboard.viewSidebar.verifyView({ index: 4, title: 'Form' });
await dashboard.viewSidebar.verifyView({ index: 5, title: 'Form 2' });
await dashboard.viewSidebar.verifyView({ index: 6, title: 'Form 3' });
await dashboard.viewSidebar.verifyView({ index: 7, title: 'Form 4' });
await dashboard.viewSidebar.verifyView({ index: 8, title: 'Gallery' });
await dashboard.viewSidebar.verifyView({ index: 9, title: 'Gallery 2' });
await dashboard.viewSidebar.verifyView({ index: 10, title: 'Gallery 3' });
// verify BT relation
await dashboard.grid.cell.verifyVirtualCell({ index: 0, columnHeader: 'FilmRead', value: ['Movie-1'] });
}
if (airtableImport) {
// Delete default context base
// await dashboard.clickHome();
// const workspacePage = new WorkspacePage(dashboard.rootPage);
// await workspacePage.baseDelete({ title: context.base.title });
await dashboard.treeView.deleteProject({ title: context.base.title, context });
}
};
export { quickVerify };