Browse Source

fix(test): Integrated all the tests with sqlite

pull/4278/head
Muhammed Mustafa 2 years ago
parent
commit
5636ac6597
  1. 19
      scripts/playwright/fixtures/expectedDataSqlite.txt
  2. 4
      scripts/playwright/pages/Dashboard/common/Toolbar/index.ts
  3. 3
      scripts/playwright/tests/baseShare.spec.ts
  4. 4
      scripts/playwright/tests/columnFormula.spec.ts
  5. 54
      scripts/playwright/tests/erd.spec.ts
  6. 3
      scripts/playwright/tests/import.spec.ts
  7. 41
      scripts/playwright/tests/metaSync.spec.ts
  8. 6
      scripts/playwright/tests/rolesCreate.spec.ts
  9. 140
      scripts/playwright/tests/viewGridShare.spec.ts
  10. 25
      scripts/playwright/tests/viewKanban.spec.ts

19
scripts/playwright/fixtures/expectedDataSqlite.txt

@ -0,0 +1,19 @@
Address,District,PostalCode,Phone,Customer List,Staff List,City,Staff List1
1013 Tabuk Boulevard," ",96203," ",2,,Kanchrapara,
1168 Najafabad Parkway," ",40301," ",1,,Kabul,
1294 Firozabad Drive," ",70618," ",2,,Pingxiang,
1342 Abha Boulevard," ",10714," ",2,,Bucuresti,
1368 Maracabo Boulevard," ",32716," ",2,,South Hill,
1427 Tabuk Place," ",31342," ",2,,Cape Coral,
1519 Santiago de los Caballeros Loop," ",22025," ",2,,Mwene-Ditu,
1661 Abha Drive," ",14400," ",1,,Pudukkottai,
17 Kabul Boulevard," ",38594," ",1,,Nagareyama,
1838 Tabriz Lane," ",1195," ",1,,Dhaka,
1888 Kabul Drive," ",20936," ",1,,Ife,
1892 Nabereznyje Telny Lane," ",28396," ",2,,Tafuna,
1993 Tabuk Lane," ",64221," ",2,,Tambaram,
217 Botshabelo Place," ",49521," ",2,,Davao,
381 Kabul Way," ",87272," ",2,,Hsichuh,
44 Najafabad Way," ",61391," ",2,,Donostia-San Sebastin,
48 Maracabo Place," ",1570," ",1,,Talavera,
669 Firozabad Loop," ",92265," ",1,,al-Ayn,

4
scripts/playwright/pages/Dashboard/common/Toolbar/index.ts

@ -94,7 +94,7 @@ export class ToolbarPage extends BasePage {
await this.get().locator(`.nc-toolbar-btn.nc-add-new-row-btn`).click();
}
async clickDownload(type: string, verificationFile: string) {
async clickDownload(type: string, verificationFile = 'expectedData.txt') {
await this.get().locator(`.nc-toolbar-btn.nc-actions-menu-btn`).click();
const [download] = await Promise.all([
@ -111,7 +111,7 @@ export class ToolbarPage extends BasePage {
await download.saveAs('./output/at.txt');
// verify downloaded content against expected content
const expectedData = fs.readFileSync('./fixtures/expectedData.txt', 'utf8');
const expectedData = fs.readFileSync(`./fixtures/${verificationFile}`, 'utf8');
const file = fs.readFileSync('./output/at.txt', 'utf8');
await expect(file).toEqual(expectedData);
}

3
scripts/playwright/tests/baseShare.spec.ts

@ -77,7 +77,8 @@ test.describe('Shared base', () => {
password: 'Password123.',
withoutPrefix: true,
});
await projectPage.openProject({ title: 'externalREST' });
await projectPage.openProject({ title: context.project.title, withoutPrefix: true });
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.inviteTeamButton.click();

4
scripts/playwright/tests/columnFormula.spec.ts

@ -1,6 +1,7 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import setup from '../setup';
import { isSqlite } from '../setup/db';
// Add formula to be verified here & store expected results for 5 rows
// Column data from City table (Sakila DB)
@ -87,6 +88,9 @@ test.describe('Virtual Columns', () => {
// verify different formula's
for (let i = 1; i < formulaData.length; i++) {
// Sqlite does not support log function
if (isSqlite(context) && formulaData[i].formula.includes('LOG(')) continue;
await dashboard.grid.column.openEdit({
title: 'NC_MATH_0',
type: 'Formula',

54
scripts/playwright/tests/erd.spec.ts

@ -15,7 +15,6 @@ import { SettingsErdPage } from '../pages/Dashboard/Settings/Erd';
test.describe('Erd', () => {
let dashboard: DashboardPage;
let context: any;
let project: any;
let sakilaTables, sakilaSqlViews;
test.slow();
@ -24,7 +23,6 @@ test.describe('Erd', () => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
project = context.project;
if (isPg(context)) {
sakilaTables = pgSakilaTables;
sakilaSqlViews = pgSakilaSqlViews;
@ -32,8 +30,8 @@ test.describe('Erd', () => {
sakilaTables = mysqlSakilaTables;
sakilaSqlViews = mysqlSakilaSqlViews;
} else if (isSqlite(context)) {
sakilaTables = mysqlSakilaTables.map(tableName => `${project.prefix}${tableName}`);
sakilaSqlViews = sqliteSakilaSqlViews.map(viewName => `${project.prefix}${viewName}`);
sakilaTables = mysqlSakilaTables;
sakilaSqlViews = sqliteSakilaSqlViews;
}
});
@ -83,13 +81,13 @@ test.describe('Erd', () => {
// Verify Actor table
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}actor`,
tableName: `actor`,
columns: actorTableColumn,
});
// Verify Payment table
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}payment`,
tableName: `payment`,
columns: isPg(context) ? pgPaymentTableColumns : mysqlPaymentTableColumns,
});
@ -100,11 +98,11 @@ test.describe('Erd', () => {
await erd.clickShowJunctionTableNames();
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}actor`,
tableName: `actor`,
columns: actorLTARColumns,
});
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}payment`,
tableName: `payment`,
columns: paymentLTARColumns,
});
@ -113,11 +111,11 @@ test.describe('Erd', () => {
await erd.clickShowPkAndFk();
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}actor`,
tableName: `actor`,
columns: actorNonPkFkColumns,
});
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}payment`,
tableName: `payment`,
columns: isPg(context) ? pgPaymentNonPkFkColumns : paymentNonPkFkColumns,
});
@ -146,13 +144,13 @@ test.describe('Erd', () => {
// Verify ActorInfo SQL View
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}sales_by_store`,
tableName: `sales_by_store`,
columns: salesByStoreColumns,
});
await erd.clickShowSqlViews(); // disable sql views
await erd.verifyNodeDoesNotExist({ tableName: `${isSqlite(context) ? project.prefix : ''}store` });
await erd.verifyNodeDoesNotExist({ tableName: `store` });
// // Verify MM tables
await erd.clickShowMMTables();
@ -166,12 +164,12 @@ test.describe('Erd', () => {
rectangleCount: isPg(context) ? 48 : 30,
});
await erd.verifyNode({ tableName: `${isSqlite(context) ? project.prefix : ''}store` });
await erd.verifyNode({ tableName: `store` });
// Verify show junction table names
await erd.clickShowJunctionTableNames();
await erd.verifyJunctionTableLabel({
tableName: `${isSqlite(context) ? project.prefix : ''}film_actor`,
tableName: `film_actor`,
tableTitle: 'filmactor',
});
});
@ -182,33 +180,33 @@ test.describe('Erd', () => {
// Verify tables with default config
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columns: ['country_id', 'country', 'last_update', 'city_list'],
});
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}city`,
tableName: `city`,
columns: ['city_id', 'city', 'country_id', 'last_update', 'country', 'address_list'],
});
// Verify with PK/FK disabled
await erd.clickShowPkAndFk();
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columns: ['country', 'last_update', 'city_list'],
});
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}city`,
tableName: `city`,
columns: ['city', 'last_update', 'country', 'address_list'],
});
// Verify with all columns disabled
await erd.clickShowColumnNames();
await erd.verifyColumns({ tableName: `${isSqlite(context) ? project.prefix : ''}country`, columns: ['city_list'] });
await erd.verifyColumns({ tableName: `country`, columns: ['city_list'] });
await erd.verifyColumns({
tableName: `${isSqlite(context) ? project.prefix : ''}city`,
tableName: `city`,
columns: ['country', 'address_list'],
});
@ -222,7 +220,7 @@ test.describe('Erd', () => {
// Verify in Settings ERD and table ERD
await openSettingsErd();
await dashboard.settings.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columnName: 'test_column',
});
await dashboard.settings.close();
@ -231,7 +229,7 @@ test.describe('Erd', () => {
await dashboard.grid.toolbar.clickActions();
await dashboard.grid.toolbar.actions.click('ERD View');
await dashboard.grid.toolbar.actions.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columnName: 'test_column',
});
await dashboard.grid.toolbar.actions.erd.close();
@ -245,7 +243,7 @@ test.describe('Erd', () => {
// Verify in Settings ERD and table ERD
await openSettingsErd();
await dashboard.settings.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columnName: 'new_test_column',
});
await dashboard.settings.close();
@ -254,7 +252,7 @@ test.describe('Erd', () => {
await dashboard.grid.toolbar.clickActions();
await dashboard.grid.toolbar.actions.click('ERD View');
await dashboard.grid.toolbar.actions.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columnName: 'new_test_column',
});
await dashboard.grid.toolbar.actions.erd.close();
@ -264,7 +262,7 @@ test.describe('Erd', () => {
// Verify in Settings ERD and table ERD
await openSettingsErd();
await dashboard.settings.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columnNameShouldNotExist: 'new_test_column',
});
await dashboard.settings.close();
@ -278,7 +276,7 @@ test.describe('Erd', () => {
await dashboard.grid.toolbar.clickActions();
await dashboard.grid.toolbar.actions.click('ERD View');
await dashboard.grid.toolbar.actions.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}country`,
tableName: `country`,
columnNameShouldNotExist: 'new_test_column',
});
await dashboard.grid.toolbar.actions.erd.close();
@ -288,7 +286,7 @@ test.describe('Erd', () => {
// Verify in Settings ERD and table ERD
await openSettingsErd();
await dashboard.settings.erd.verifyNode({
tableName: `${isSqlite(context) ? project.prefix : ''}Test`,
tableName: `Test`,
});
await dashboard.settings.close();
@ -296,7 +294,7 @@ test.describe('Erd', () => {
await dashboard.treeView.deleteTable({ title: 'Test' });
await openSettingsErd();
await dashboard.settings.erd.verifyNodeDoesNotExist({
tableName: `${isSqlite(context) ? project.prefix : ''}Test`,
tableName: `Test`,
});
// Verify that `show mm table` option disabled will not trigger easter in ERD options

3
scripts/playwright/tests/import.spec.ts

@ -3,6 +3,7 @@ import { airtableApiBase, airtableApiKey } from '../constants';
import { DashboardPage } from '../pages/Dashboard';
import { quickVerify } from '../quickTests/commonTest';
import setup from '../setup';
import { isSqlite } from '../setup/db';
test.describe('Import', () => {
let dashboard: DashboardPage;
@ -48,7 +49,7 @@ test.describe('Import', () => {
result: expected,
});
const recordCells = { Number: '1', Float: '1.10', Text: 'abc' };
const recordCells = { Number: '1', Float: isSqlite(context) ? '1.1' : '1.10', Text: 'abc' };
for (const [key, value] of Object.entries(recordCells)) {
await dashboard.grid.cell.verify({

41
scripts/playwright/tests/metaSync.spec.ts

@ -10,7 +10,6 @@ test.describe('Meta sync', () => {
let settings: SettingsPage;
let context: NcContext;
let dbExec;
let projectPrefix;
test.beforeEach(async ({ page }) => {
context = await setup({ page });
@ -25,8 +24,6 @@ test.describe('Meta sync', () => {
dbExec = mysqlExec;
break;
}
projectPrefix = isSqlite(context) ? context.project.prefix : '';
});
test('Meta sync', async () => {
@ -35,18 +32,18 @@ test.describe('Meta sync', () => {
await dashboard.gotoSettings();
await settings.selectTab({ tab: SettingTab.ProjectMetadata });
await dbExec(`CREATE TABLE ${projectPrefix}table1 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`);
await dbExec(`CREATE TABLE ${projectPrefix}table2 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`);
await dbExec(`CREATE TABLE table1 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`);
await dbExec(`CREATE TABLE table2 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
index: 16,
model: `${projectPrefix}table1`,
model: `table1`,
state: 'New table',
});
await settings.metaData.verifyRow({
index: 17,
model: `${projectPrefix}table2`,
model: `table2`,
state: 'New table',
});
@ -64,9 +61,9 @@ test.describe('Meta sync', () => {
if (!isSqlite(context)) {
// Add relation
await dbExec(`ALTER TABLE ${projectPrefix}table1 ADD INDEX fk1_idx (col1 ASC) VISIBLE`);
await dbExec(`ALTER TABLE table1 ADD INDEX fk1_idx (col1 ASC) VISIBLE`);
await dbExec(
`ALTER TABLE ${projectPrefix}table1 ADD CONSTRAINT fk1 FOREIGN KEY (col1) REFERENCES ${projectPrefix}table2 (id) ON DELETE NO ACTION ON UPDATE NO ACTION`
`ALTER TABLE table1 ADD CONSTRAINT fk1 FOREIGN KEY (col1) REFERENCES table2 (id) ON DELETE NO ACTION ON UPDATE NO ACTION`
);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
@ -84,8 +81,8 @@ test.describe('Meta sync', () => {
});
// Remove relation
await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP FOREIGN KEY fk1`);
await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP INDEX fk1_idx`);
await dbExec(`ALTER TABLE table1 DROP FOREIGN KEY fk1`);
await dbExec(`ALTER TABLE table1 DROP INDEX fk1_idx`);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
index: 16,
@ -105,8 +102,8 @@ test.describe('Meta sync', () => {
// Add column
await dbExec(
isSqlite(context)
? `ALTER TABLE ${projectPrefix}table1 ADD COLUMN newCol TEXT NULL`
: `ALTER TABLE ${projectPrefix}table1 ADD COLUMN newCol VARCHAR(45) NULL AFTER id`
? `ALTER TABLE table1 ADD COLUMN newCol TEXT NULL`
: `ALTER TABLE table1 ADD COLUMN newCol VARCHAR(45) NULL AFTER id`
);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
@ -126,8 +123,8 @@ test.describe('Meta sync', () => {
// Edit column
await dbExec(
isSqlite(context)
? `ALTER TABLE ${projectPrefix}table1 RENAME COLUMN newCol TO newColName`
: `ALTER TABLE ${projectPrefix}table1 CHANGE COLUMN newCol newColName VARCHAR(45) NULL DEFAULT NULL`
? `ALTER TABLE table1 RENAME COLUMN newCol TO newColName`
: `ALTER TABLE table1 CHANGE COLUMN newCol newColName VARCHAR(45) NULL DEFAULT NULL`
);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
@ -147,7 +144,7 @@ test.describe('Meta sync', () => {
// Delete column
// todo: Add for sqlite
if (!isSqlite(context)) {
await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP COLUMN newColName`);
await dbExec(`ALTER TABLE table1 DROP COLUMN newColName`);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
index: 16,
@ -165,17 +162,17 @@ test.describe('Meta sync', () => {
}
// Delete table
await dbExec(`DROP TABLE ${projectPrefix}table1`);
await dbExec(`DROP TABLE ${projectPrefix}table2`);
await dbExec(`DROP TABLE table1`);
await dbExec(`DROP TABLE table2`);
await settings.metaData.clickReload();
await settings.metaData.verifyRow({
index: 16,
model: `${projectPrefix}table1`,
model: `table1`,
state: 'Table removed',
});
await settings.metaData.verifyRow({
index: 17,
model: `${projectPrefix}table2`,
model: `table2`,
state: 'Table removed',
});
@ -209,10 +206,10 @@ test.describe('Meta sync', () => {
test('Hide, filter, sort', async () => {
await dbExec(
`CREATE TABLE ${projectPrefix}table1 (id INT NOT NULL, col1 INT NULL, col2 INT NULL, col3 INT NULL, col4 INT NULL, PRIMARY KEY (id))`
`CREATE TABLE table1 (id INT NOT NULL, col1 INT NULL, col2 INT NULL, col3 INT NULL, col4 INT NULL, PRIMARY KEY (id))`
);
await dbExec(
`INSERT INTO ${projectPrefix}table1 (id, col1, col2, col3, col4) VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5), (6,6,6,6,6), (7,7,7,7,7), (8,8,8,8,8), (9,9,9,9,9);`
`INSERT INTO table1 (id, col1, col2, col3, col4) VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5), (6,6,6,6,6), (7,7,7,7,7), (8,8,8,8,8), (9,9,9,9,9);`
);
await dashboard.gotoSettings();

6
scripts/playwright/tests/rolesCreate.spec.ts

@ -113,7 +113,11 @@ test.describe('User roles', () => {
password: 'Password123.',
});
await projectsPage.openProject({ title: 'externalREST', waitForAuthTab: roleDb[roleIdx].role === 'creator' });
await projectsPage.openProject({
title: context.project.title,
waitForAuthTab: roleDb[roleIdx].role === 'creator',
withoutPrefix: true,
});
// close 'Team & Auth' tab
if (roleDb[roleIdx].role === 'creator') {

140
scripts/playwright/tests/viewGridShare.spec.ts

@ -1,12 +1,12 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import setup from '../setup';
import { isSqlite } from '../setup/db';
test.describe('Shared view', () => {
let dashboard: DashboardPage;
let context: any;
let mainPageLink: string;
let sharedLink: string;
test.beforeEach(async ({ page }) => {
@ -46,8 +46,6 @@ test.describe('Shared view', () => {
isLocallySaved: false,
});
mainPageLink = page.url();
// share with password disabled, download enabled
await dashboard.grid.toolbar.clickShareView();
sharedLink = await dashboard.grid.toolbar.shareView.getShareLink();
@ -79,38 +77,16 @@ test.describe('Shared view', () => {
await sharedPage.grid.column.verify(column);
}
const expectedRecords = [
{ index: 0, columnHeader: 'Address', value: '1013 Tabuk Boulevard' },
{
index: 1,
columnHeader: 'Address',
value: '1892 Nabereznyje Telny Lane',
},
{ index: 2, columnHeader: 'Address', value: '1993 Tabuk Lane' },
{ index: 0, columnHeader: 'District', value: 'West Bengali' },
{ index: 1, columnHeader: 'District', value: 'Tutuila' },
{ index: 2, columnHeader: 'District', value: 'Tamil Nadu' },
{ index: 0, columnHeader: 'PostalCode', value: '96203' },
{ index: 1, columnHeader: 'PostalCode', value: '28396' },
{ index: 2, columnHeader: 'PostalCode', value: '64221' },
{ index: 0, columnHeader: 'Phone', value: '158399646978' },
{ index: 1, columnHeader: 'Phone', value: '478229987054' },
{ index: 2, columnHeader: 'Phone', value: '648482415405' },
];
const expectedRecordsByDb = isSqlite(context) ? sqliteExpectedRecords : expectedRecords;
// verify order of records (original sort & filter)
for (const record of expectedRecords) {
for (const record of expectedRecordsByDb) {
await sharedPage.grid.cell.verify(record);
}
const expectedVirtualRecords = [
{ index: 0, columnHeader: 'Customer List', count: 1, value: ['2'] },
{ index: 1, columnHeader: 'Customer List', count: 1, value: ['2'] },
{ index: 0, columnHeader: 'City', count: 1, value: ['Kanchrapara'] },
{ index: 1, columnHeader: 'City', count: 1, value: ['Tafuna'] },
];
const expectedVirtualRecordsByDb = isSqlite(context) ? sqliteExpectedVirtualRecords : expectedVirtualRecords;
// verify virtual records
for (const record of expectedVirtualRecords) {
for (const record of expectedVirtualRecordsByDb) {
await sharedPage.grid.cell.verifyVirtualCell(record);
}
@ -127,12 +103,15 @@ test.describe('Shared view', () => {
isAscending: true,
isLocallySaved: true,
});
await sharedPage.grid.toolbar.filter.addNew({
columnTitle: 'District',
value: 'Ta',
opType: 'is like',
isLocallySaved: true,
});
if (!isSqlite(context)) {
await sharedPage.grid.toolbar.filter.addNew({
columnTitle: 'District',
value: 'Ta',
opType: 'is like',
isLocallySaved: true,
});
}
await sharedPage.grid.toolbar.fields.toggle({ title: 'LastUpdate', isLocallySaved: true });
expectedColumns[6].isVisible = false;
@ -141,23 +120,9 @@ test.describe('Shared view', () => {
await sharedPage.grid.column.verify(column);
}
const expectedRecords2 = [
{ index: 0, columnHeader: 'Address', value: '1661 Abha Drive' },
{ index: 1, columnHeader: 'Address', value: '1993 Tabuk Lane' },
{ index: 2, columnHeader: 'Address', value: '381 Kabul Way' },
{ index: 0, columnHeader: 'District', value: 'Tamil Nadu' },
{ index: 1, columnHeader: 'District', value: 'Tamil Nadu' },
{ index: 2, columnHeader: 'District', value: 'Taipei' },
{ index: 0, columnHeader: 'PostalCode', value: '14400' },
{ index: 1, columnHeader: 'PostalCode', value: '64221' },
{ index: 2, columnHeader: 'PostalCode', value: '87272' },
{ index: 0, columnHeader: 'Phone', value: '270456873752' },
{ index: 1, columnHeader: 'Phone', value: '648482415405' },
{ index: 2, columnHeader: 'Phone', value: '55477302294' },
];
const expectedRecordsByDb2 = isSqlite(context) ? sqliteExpectedRecords2 : expectedRecords2;
// verify order of records (original sort & filter)
for (const record of expectedRecords2) {
for (const record of expectedRecordsByDb2) {
await sharedPage.grid.cell.verify(record);
}
@ -167,7 +132,10 @@ test.describe('Shared view', () => {
**/
// verify download
await sharedPage.grid.toolbar.clickDownload('Download as CSV', './expectedData.txt');
await sharedPage.grid.toolbar.clickDownload(
'Download as CSV',
isSqlite(context) ? 'expectedDataSqlite.txt' : 'expectedData.txt'
);
});
test('Shared view: password', async ({ page }) => {
@ -235,3 +203,69 @@ test.describe('Shared view', () => {
});
});
});
const expectedRecords = [
{ index: 0, columnHeader: 'Address', value: '1013 Tabuk Boulevard' },
{
index: 1,
columnHeader: 'Address',
value: '1892 Nabereznyje Telny Lane',
},
{ index: 2, columnHeader: 'Address', value: '1993 Tabuk Lane' },
{ index: 0, columnHeader: 'District', value: 'West Bengali' },
{ index: 1, columnHeader: 'District', value: 'Tutuila' },
{ index: 2, columnHeader: 'District', value: 'Tamil Nadu' },
{ index: 0, columnHeader: 'PostalCode', value: '96203' },
{ index: 1, columnHeader: 'PostalCode', value: '28396' },
{ index: 2, columnHeader: 'PostalCode', value: '64221' },
{ index: 0, columnHeader: 'Phone', value: '158399646978' },
{ index: 1, columnHeader: 'Phone', value: '478229987054' },
{ index: 2, columnHeader: 'Phone', value: '648482415405' },
];
const sqliteExpectedRecords = [
{ index: 0, columnHeader: 'Address', value: '217 Botshabelo Place' },
{ index: 1, columnHeader: 'Address', value: '17 Kabul Boulevard' },
{ index: 2, columnHeader: 'Address', value: '1888 Kabul Drive' },
{ index: 0, columnHeader: 'PostalCode', value: '49521' },
{ index: 1, columnHeader: 'PostalCode', value: '38594' },
{ index: 2, columnHeader: 'PostalCode', value: '20936' },
];
const expectedRecords2 = [
{ index: 0, columnHeader: 'Address', value: '1661 Abha Drive' },
{ index: 1, columnHeader: 'Address', value: '1993 Tabuk Lane' },
{ index: 2, columnHeader: 'Address', value: '381 Kabul Way' },
{ index: 0, columnHeader: 'District', value: 'Tamil Nadu' },
{ index: 1, columnHeader: 'District', value: 'Tamil Nadu' },
{ index: 2, columnHeader: 'District', value: 'Taipei' },
{ index: 0, columnHeader: 'PostalCode', value: '14400' },
{ index: 1, columnHeader: 'PostalCode', value: '64221' },
{ index: 2, columnHeader: 'PostalCode', value: '87272' },
{ index: 0, columnHeader: 'Phone', value: '270456873752' },
{ index: 1, columnHeader: 'Phone', value: '648482415405' },
{ index: 2, columnHeader: 'Phone', value: '55477302294' },
];
const sqliteExpectedRecords2 = [
{ index: 0, columnHeader: 'Address', value: '1013 Tabuk Boulevard' },
{ index: 1, columnHeader: 'Address', value: '1168 Najafabad Parkway' },
{ index: 2, columnHeader: 'Address', value: '1294 Firozabad Drive' },
{ index: 0, columnHeader: 'PostalCode', value: '96203' },
{ index: 1, columnHeader: 'PostalCode', value: '40301' },
{ index: 2, columnHeader: 'PostalCode', value: '70618' },
];
const expectedVirtualRecords = [
{ index: 0, columnHeader: 'Customer List', count: 1, value: ['2'] },
{ index: 1, columnHeader: 'Customer List', count: 1, value: ['2'] },
{ index: 0, columnHeader: 'City', count: 1, value: ['Kanchrapara'] },
{ index: 1, columnHeader: 'City', count: 1, value: ['Tafuna'] },
];
const sqliteExpectedVirtualRecords = [
{ index: 0, columnHeader: 'Customer List', count: 1, value: ['2'] },
{ index: 1, columnHeader: 'Customer List', count: 1, value: ['1'] },
{ index: 0, columnHeader: 'City', count: 1, value: ['Davao'] },
{ index: 1, columnHeader: 'City', count: 1, value: ['Nagareyama'] },
];

25
scripts/playwright/tests/viewKanban.spec.ts

@ -3,6 +3,9 @@ import { DashboardPage } from '../pages/Dashboard';
import { ToolbarPage } from '../pages/Dashboard/common/Toolbar';
import setup from '../setup';
import { isSqlite } from '../setup/db';
const filmRatings = ['G', 'PG', 'PG-13', 'R', 'NC-17'];
test.describe('View', () => {
let dashboard: DashboardPage, toolbar: ToolbarPage;
@ -12,13 +15,28 @@ test.describe('View', () => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
toolbar = toolbar = dashboard.kanban.toolbar;
});
test('Kanban', async () => {
// close 'Team & Auth' tab
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'Film' });
if (isSqlite(context)) {
await dashboard.grid.column.openEdit({ title: 'Rating' });
await dashboard.grid.column.selectType({ type: 'SingleSelect' });
let count = 0;
for (const rating of filmRatings) {
await dashboard.grid.column.selectOption.addOption({
index: count,
option: rating,
skipColumnModal: true,
});
count = count + 1;
}
await dashboard.grid.column.save();
}
});
test('Kanban', async () => {
await dashboard.viewSidebar.createKanbanView({
title: 'Film Kanban',
});
@ -150,9 +168,6 @@ test.describe('View', () => {
test('Kanban view operations', async () => {
test.slow();
// close 'Team & Auth' tab
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'Film' });
await dashboard.viewSidebar.createKanbanView({
title: 'Film Kanban',

Loading…
Cancel
Save