Browse Source

fix(test): pw test fail issue

pull/7478/head
Ramesh Mane 8 months ago
parent
commit
2144dcc8fa
  1. 1
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  2. 18
      tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts
  3. 3
      tests/playwright/tests/db/columns/columnMenuOperations.spec.ts
  4. 3
      tests/playwright/tests/db/columns/columnRelationalExtendedTests.spec.ts
  5. 33
      tests/playwright/tests/db/features/metaLTAR.spec.ts
  6. 6
      tests/playwright/tests/db/views/viewGridShare.spec.ts

1
tests/playwright/pages/Dashboard/Grid/Column/index.ts

@ -455,6 +455,7 @@ export class ColumnPageObject extends BasePage {
// close sort menu // close sort menu
await this.grid.toolbar.clickSort(); await this.grid.toolbar.clickSort();
await this.rootPage.waitForTimeout(100);
} }
async resize(param: { src: string; dst: string }) { async resize(param: { src: string; dst: string }) {

18
tests/playwright/pages/Dashboard/common/Toolbar/Fields.ts

@ -19,16 +19,34 @@ export class ToolbarFieldsPage extends BasePage {
title, title,
isLocallySaved, isLocallySaved,
validateResponse = true, validateResponse = true,
checked,
}: { }: {
title: string; title: string;
isLocallySaved?: boolean; isLocallySaved?: boolean;
validateResponse?: boolean; validateResponse?: boolean;
checked?: boolean;
}) { }) {
await this.toolbar.clickFields(); await this.toolbar.clickFields();
// hack // hack
await this.rootPage.waitForTimeout(100); await this.rootPage.waitForTimeout(100);
if (checked !== undefined) {
// toggle only if input checked value is not equal to given checked value
await this.get()
.locator(`[data-testid="nc-fields-menu-${title}"]`)
.locator('.nc-switch')
.scrollIntoViewIfNeeded();
const isChecked = await this.get()
.locator(`[data-testid="nc-fields-menu-${title}"]`)
.locator('.nc-switch')
.isChecked();
if ((checked && isChecked) || (!checked && !isChecked)) {
await this.toolbar.clickFields();
return;
}
}
const toggleColumn = () => const toggleColumn = () =>
this.get().locator(`[data-testid="nc-fields-menu-${title}"]`).locator('.nc-switch').click(); this.get().locator(`[data-testid="nc-fields-menu-${title}"]`).locator('.nc-switch').click();

3
tests/playwright/tests/db/columns/columnMenuOperations.spec.ts

@ -85,6 +85,7 @@ test.describe('Column menu operations', () => {
insertAfterColumnTitle: 'Title', insertAfterColumnTitle: 'Title',
}); });
await dashboard.grid.toolbar.fields.toggle({ title: 'Actors', isLocallySaved: false, checked: true });
await dashboard.grid.column.create({ await dashboard.grid.column.create({
title: 'InsertAfterColumn1', title: 'InsertAfterColumn1',
type: 'SingleLineText', type: 'SingleLineText',
@ -104,6 +105,7 @@ test.describe('Column menu operations', () => {
isDisplayValue: true, isDisplayValue: true,
}); });
await dashboard.grid.toolbar.fields.toggle({ title: 'Actors', isLocallySaved: false, checked: true });
await dashboard.grid.column.create({ await dashboard.grid.column.create({
title: 'InsertBeforeColumn1', title: 'InsertBeforeColumn1',
type: 'SingleLineText', type: 'SingleLineText',
@ -121,6 +123,7 @@ test.describe('Column menu operations', () => {
isDisplayValue: true, isDisplayValue: true,
}); });
await dashboard.grid.toolbar.fields.toggle({ title: 'Actors', isLocallySaved: false, checked: true });
await dashboard.grid.column.hideColumn({ await dashboard.grid.column.hideColumn({
title: 'Actors', title: 'Actors',
}); });

3
tests/playwright/tests/db/columns/columnRelationalExtendedTests.spec.ts

@ -63,8 +63,8 @@ test.describe('Relational Columns', () => {
///////////// Belongs to ///////////// Belongs to
// //
await dashboard.treeView.openTable({ title: 'City' }); await dashboard.treeView.openTable({ title: 'City' });
await dashboard.grid.toolbar.fields.toggle({ title: 'Country', isLocallySaved: false, checked: true });
const countryList = [['Spain'], ['Saudi Arabia']]; const countryList = [['Spain'], ['Saudi Arabia']];
for (let i = 0; i < countryList.length; i++) { for (let i = 0; i < countryList.length; i++) {
await dashboard.grid.cell.verifyVirtualCell({ await dashboard.grid.cell.verifyVirtualCell({
@ -79,6 +79,7 @@ test.describe('Relational Columns', () => {
///////////// Many to many ///////////// Many to many
// //
await dashboard.treeView.openTable({ title: 'Actor' }); await dashboard.treeView.openTable({ title: 'Actor' });
await dashboard.grid.toolbar.fields.toggle({ title: 'Films', isLocallySaved: false, checked: true });
const filmList = [ const filmList = [
[ [
'ACADEMY DINOSAUR', 'ACADEMY DINOSAUR',

33
tests/playwright/tests/db/features/metaLTAR.spec.ts

@ -111,6 +111,7 @@ test.describe.serial('Test table', () => {
parentId: tables[0].id, parentId: tables[0].id,
childId: tables[1].id, childId: tables[1].id,
type: 'hm', type: 'hm',
view_id: tables[0].views[0].id,
}); });
await api.dbTableColumn.create(tables[1].id, { await api.dbTableColumn.create(tables[1].id, {
uidt: UITypes.Links, uidt: UITypes.Links,
@ -119,6 +120,7 @@ test.describe.serial('Test table', () => {
parentId: tables[1].id, parentId: tables[1].id,
childId: tables[2].id, childId: tables[2].id,
type: 'hm', type: 'hm',
view_id: tables[1].views[0].id,
}); });
// TableA <mm> TableD <mm> TableE // TableA <mm> TableD <mm> TableE
@ -129,6 +131,7 @@ test.describe.serial('Test table', () => {
parentId: tables[0].id, parentId: tables[0].id,
childId: tables[3].id, childId: tables[3].id,
type: 'mm', type: 'mm',
view_id: tables[0].views[0].id,
}); });
await api.dbTableColumn.create(tables[3].id, { await api.dbTableColumn.create(tables[3].id, {
uidt: UITypes.Links, uidt: UITypes.Links,
@ -137,6 +140,7 @@ test.describe.serial('Test table', () => {
parentId: tables[3].id, parentId: tables[3].id,
childId: tables[4].id, childId: tables[4].id,
type: 'mm', type: 'mm',
view_id: tables[3].views[0].id,
}); });
// TableA <hm> TableA : self relation // TableA <hm> TableA : self relation
@ -147,6 +151,7 @@ test.describe.serial('Test table', () => {
parentId: tables[0].id, parentId: tables[0].id,
childId: tables[0].id, childId: tables[0].id,
type: 'hm', type: 'hm',
view_id: tables[0].views[0].id,
}); });
// TableA <mm> TableA : self relation // TableA <mm> TableA : self relation
@ -157,8 +162,36 @@ test.describe.serial('Test table', () => {
parentId: tables[0].id, parentId: tables[0].id,
childId: tables[0].id, childId: tables[0].id,
type: 'mm', type: 'mm',
view_id: tables[0].views[0].id,
}); });
const hiddenLinksTableColumns = [
{
tableName: 'Table1',
columns: ['Table0'],
},
{
tableName: 'Table2',
columns: ['Table1'],
},
{
tableName: 'Table3',
columns: ['Table0s'],
},
{
tableName: 'Table4',
columns: ['Table3s'],
},
];
// Unhide links columns
for (const table of hiddenLinksTableColumns) {
await dashboard.treeView.openTable({ title: table.tableName });
for (const column of table.columns) {
await dashboard.grid.toolbar.fields.toggle({ title: column, isLocallySaved: false, checked: true });
}
}
// Add links // Add links
// TableA <hm> TableB <hm> TableC // TableA <hm> TableB <hm> TableC
// Link every record in tableA to 3 records in tableB // Link every record in tableA to 3 records in tableB

6
tests/playwright/tests/db/views/viewGridShare.spec.ts

@ -128,6 +128,9 @@ test.describe('Shared view', () => {
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'Address' }); await dashboard.treeView.openTable({ title: 'Address' });
// Unhide City column
await dashboard.grid.toolbar.fields.toggle({ title: 'City', isLocallySaved: false, checked: true });
// hide column // hide column
await dashboard.grid.toolbar.fields.toggle({ title: 'Address2' }); await dashboard.grid.toolbar.fields.toggle({ title: 'Address2' });
await dashboard.grid.toolbar.fields.toggle({ title: 'Stores' }); await dashboard.grid.toolbar.fields.toggle({ title: 'Stores' });
@ -168,7 +171,6 @@ test.describe('Shared view', () => {
{ title: 'Address', isVisible: true }, { title: 'Address', isVisible: true },
{ title: 'Address2', isVisible: false }, { title: 'Address2', isVisible: false },
{ title: 'District', isVisible: true }, { title: 'District', isVisible: true },
{ title: 'City', isVisible: true },
{ title: 'PostalCode', isVisible: true }, { title: 'PostalCode', isVisible: true },
{ title: 'Phone', isVisible: true }, { title: 'Phone', isVisible: true },
{ title: 'LastUpdate', isVisible: true }, { title: 'LastUpdate', isVisible: true },
@ -225,7 +227,7 @@ test.describe('Shared view', () => {
await sharedPage.grid.toolbar.clickFilter(); await sharedPage.grid.toolbar.clickFilter();
} }
await sharedPage.grid.toolbar.fields.toggle({ title: 'LastUpdate', isLocallySaved: true }); await sharedPage.grid.toolbar.fields.toggle({ title: 'LastUpdate', isLocallySaved: true });
expectedColumns[6].isVisible = false; expectedColumns[5].isVisible = false;
// verify new sort & filter criteria // verify new sort & filter criteria
for (const column of expectedColumns) { for (const column of expectedColumns) {

Loading…
Cancel
Save