mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
257 lines
7.9 KiB
257 lines
7.9 KiB
2 years ago
|
import { DashboardPage } from '../pages/Dashboard';
|
||
|
import { ProjectsPage } from '../pages/ProjectsPage';
|
||
|
import { NcContext } from '../setup';
|
||
2 years ago
|
import { isMysql, isPg } from '../setup/db';
|
||
2 years ago
|
|
||
|
// normal fields
|
||
2 years ago
|
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',
|
||
2 years ago
|
};
|
||
|
|
||
|
// links/ computed fields
|
||
2 years ago
|
const recordsVirtualCells = {
|
||
|
Duration: '00:01',
|
||
2 years ago
|
Done: true,
|
||
2 years ago
|
Date: '2022-05-31',
|
||
2 years ago
|
Rating: 1,
|
||
2 years ago
|
Actor: ['Actor1', 'Actor2'],
|
||
|
'Status (from Actor)': ['Todo', 'In progress'],
|
||
|
RollUp: '128',
|
||
|
Computation: '4.04',
|
||
|
Producer: ['P1', 'P2'],
|
||
2 years ago
|
};
|
||
|
|
||
2 years ago
|
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',
|
||
2 years ago
|
];
|
||
|
|
||
2 years ago
|
const quickVerify = async ({
|
||
|
dashboard,
|
||
|
airtableImport,
|
||
|
context,
|
||
|
}: {
|
||
|
dashboard: DashboardPage;
|
||
|
airtableImport?: boolean;
|
||
|
context: NcContext;
|
||
|
}) => {
|
||
|
await dashboard.treeView.openTable({ title: 'Film' });
|
||
2 years ago
|
|
||
|
// 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] });
|
||
|
}
|
||
|
|
||
|
// Verify cells
|
||
|
// normal cells
|
||
2 years ago
|
for (const [key, value] of Object.entries(recordCells)) {
|
||
2 years ago
|
await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: key, value });
|
||
|
}
|
||
|
|
||
|
// checkbox
|
||
2 years ago
|
await dashboard.grid.cell.checkbox.verifyChecked({ index: cellIndex, columnHeader: 'Done' });
|
||
2 years ago
|
|
||
|
// duration
|
||
2 years ago
|
await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: 'Duration', value: recordsVirtualCells.Duration });
|
||
2 years ago
|
|
||
|
// rating
|
||
2 years ago
|
await dashboard.grid.cell.rating.verify({
|
||
|
index: cellIndex,
|
||
|
columnHeader: 'Rating',
|
||
|
rating: recordsVirtualCells.Rating,
|
||
|
});
|
||
2 years ago
|
|
||
|
// LinkToAnotherRecord
|
||
2 years ago
|
await dashboard.grid.cell.verifyVirtualCell({
|
||
|
index: cellIndex,
|
||
|
columnHeader: 'Actor',
|
||
2 years ago
|
value: isMysql(context) || isPg(context) ? ['Actor1'] : recordsVirtualCells.Actor,
|
||
2 years ago
|
});
|
||
2 years ago
|
|
||
|
// 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] });
|
||
|
|
||
2 years ago
|
if (!airtableImport) {
|
||
2 years ago
|
// RollUp
|
||
2 years ago
|
await dashboard.grid.cell.verify({ index: cellIndex, columnHeader: 'RollUp', value: recordsVirtualCells.RollUp });
|
||
|
|
||
2 years ago
|
// Computation
|
||
2 years ago
|
await dashboard.grid.cell.verify({
|
||
|
index: cellIndex,
|
||
|
columnHeader: 'Computation',
|
||
|
value: recordsVirtualCells.Computation,
|
||
|
});
|
||
|
|
||
2 years ago
|
// LinkToAnotherRecord
|
||
2 years ago
|
await dashboard.grid.cell.verifyVirtualCell({
|
||
|
index: cellIndex,
|
||
|
columnHeader: 'Producer',
|
||
|
value: recordsVirtualCells.Producer,
|
||
|
});
|
||
2 years ago
|
}
|
||
|
|
||
|
// Verify form
|
||
2 years ago
|
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' });
|
||
2 years ago
|
await dashboard.form.verifyFieldsIsEditable({ index: 0 });
|
||
2 years ago
|
await dashboard.form.verifyAfterSubmitMsg({ msg: 'Thank you for submitting the form!' });
|
||
2 years ago
|
await dashboard.form.verifyAfterSubmitMenuState({
|
||
|
emailMe: false,
|
||
|
showBlankForm: true,
|
||
|
submitAnotherForm: true,
|
||
|
});
|
||
|
|
||
2 years ago
|
await dashboard.treeView.openTable({ title: 'Actor' });
|
||
2 years ago
|
|
||
2 years ago
|
if (!airtableImport) {
|
||
2 years ago
|
// Verify webhooks
|
||
|
await dashboard.grid.toolbar.clickActions();
|
||
2 years ago
|
await dashboard.grid.toolbar.actions.click('Webhooks');
|
||
|
|
||
2 years ago
|
await dashboard.webhookForm.openForm({
|
||
|
index: 0,
|
||
|
});
|
||
2 years ago
|
await dashboard.webhookForm.verifyForm({
|
||
|
title: 'Webhook-1',
|
||
|
hookEvent: 'After Insert',
|
||
|
notificationType: 'URL',
|
||
|
urlMethod: 'POST',
|
||
|
url: 'http://localhost:9090/hook',
|
||
|
condition: false,
|
||
|
});
|
||
2 years ago
|
await dashboard.webhookForm.goBackFromForm();
|
||
2 years ago
|
|
||
2 years ago
|
await dashboard.webhookForm.openForm({
|
||
|
index: 1,
|
||
|
});
|
||
2 years ago
|
await dashboard.webhookForm.verifyForm({
|
||
|
title: 'Webhook-2',
|
||
|
hookEvent: 'After Update',
|
||
|
notificationType: 'URL',
|
||
|
urlMethod: 'POST',
|
||
|
url: 'http://localhost:9090/hook',
|
||
|
condition: false,
|
||
|
});
|
||
2 years ago
|
await dashboard.webhookForm.goBackFromForm();
|
||
2 years ago
|
|
||
2 years ago
|
await dashboard.webhookForm.openForm({
|
||
|
index: 2,
|
||
|
});
|
||
2 years ago
|
await dashboard.webhookForm.verifyForm({
|
||
|
title: 'Webhook-3',
|
||
|
hookEvent: 'After Delete',
|
||
|
notificationType: 'URL',
|
||
|
urlMethod: 'POST',
|
||
|
url: 'http://localhost:9090/hook',
|
||
|
condition: false,
|
||
|
});
|
||
|
|
||
2 years ago
|
await dashboard.webhookForm.close();
|
||
|
}
|
||
|
|
||
|
// Verify pagination
|
||
|
await dashboard.grid.verifyActivePage({ page: '1' });
|
||
2 years ago
|
await dashboard.grid.clickPagination({ page: '>' });
|
||
2 years ago
|
await dashboard.grid.verifyActivePage({ page: '2' });
|
||
2 years ago
|
await dashboard.grid.clickPagination({ page: '<' });
|
||
2 years ago
|
await dashboard.grid.verifyActivePage({ page: '1' });
|
||
|
|
||
2 years ago
|
await dashboard.viewSidebar.openView({ title: 'Filter&Sort' });
|
||
2 years ago
|
|
||
|
// Verify Fields, Filter & Sort
|
||
2 years ago
|
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' });
|
||
2 years ago
|
|
||
|
// Verify Fields
|
||
|
await dashboard.grid.toolbar.clickFields();
|
||
2 years ago
|
await dashboard.grid.toolbar.fields.verify({ title: 'Name', checked: true });
|
||
|
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 });
|
||
2 years ago
|
|
||
|
// Verify Sort
|
||
|
await dashboard.grid.toolbar.clickSort();
|
||
2 years ago
|
await dashboard.grid.toolbar.sort.verify({ index: 0, column: 'Name', direction: 'A → Z' });
|
||
2 years ago
|
|
||
|
// Verify Filter
|
||
|
await dashboard.grid.toolbar.clickFilter();
|
||
2 years ago
|
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' });
|
||
2 years ago
|
|
||
2 years ago
|
if (!airtableImport) {
|
||
2 years ago
|
// Verify views
|
||
|
// todo: Wait for 800ms, issue related to vue router
|
||
|
await dashboard.rootPage.waitForTimeout(800);
|
||
2 years ago
|
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' });
|
||
|
|
||
2 years ago
|
// verify BT relation
|
||
2 years ago
|
await dashboard.grid.cell.verifyVirtualCell({ index: 0, columnHeader: 'FilmRead', value: ['Movie-1'] });
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
if (airtableImport) {
|
||
2 years ago
|
// Delete project
|
||
|
await dashboard.clickHome();
|
||
|
const projectsPage = new ProjectsPage(dashboard.rootPage);
|
||
2 years ago
|
await projectsPage.deleteProject({ title: context.project.title, withoutPrefix: true });
|
||
2 years ago
|
}
|
||
2 years ago
|
};
|
||
2 years ago
|
|
||
2 years ago
|
export { quickVerify };
|