Browse Source

test: checkbox filter corrections

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5106/head
Raju Udava 2 years ago
parent
commit
c561b3a1ee
  1. 15
      tests/playwright/pages/Dashboard/TreeView.ts
  2. 18
      tests/playwright/tests/filters.spec.ts

15
tests/playwright/pages/Dashboard/TreeView.ts

@ -36,7 +36,15 @@ export class TreeViewPage extends BasePage {
// assumption: first view rendered is always GRID // assumption: first view rendered is always GRID
// //
async openTable({ title, mode = 'standard' }: { title: string; mode?: string }) { async openTable({
title,
mode = 'standard',
networkResponse = true,
}: {
title: string;
mode?: string;
networkResponse?: boolean;
}) {
if ((await this.get().locator('.active.nc-project-tree-tbl').count()) > 0) { if ((await this.get().locator('.active.nc-project-tree-tbl').count()) > 0) {
if ((await this.get().locator('.active.nc-project-tree-tbl').innerText()) === title) { if ((await this.get().locator('.active.nc-project-tree-tbl').innerText()) === title) {
// table already open // table already open
@ -44,6 +52,7 @@ export class TreeViewPage extends BasePage {
} }
} }
if (networkResponse === true) {
await this.waitForResponse({ await this.waitForResponse({
uiAction: this.get().locator(`.nc-project-tree-tbl-${title}`).click(), uiAction: this.get().locator(`.nc-project-tree-tbl-${title}`).click(),
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
@ -51,6 +60,10 @@ export class TreeViewPage extends BasePage {
responseJsonMatcher: json => json.pageInfo, responseJsonMatcher: json => json.pageInfo,
}); });
await this.dashboard.waitForTabRender({ title, mode }); await this.dashboard.waitForTabRender({ title, mode });
} else {
await this.get().locator(`.nc-project-tree-tbl-${title}`).click();
await this.rootPage.waitForTimeout(3000);
}
} }
async createTable({ title, skipOpeningModal }: { title: string; skipOpeningModal?: boolean }) { async createTable({ title, skipOpeningModal }: { title: string; skipOpeningModal?: boolean }) {

18
tests/playwright/tests/filters.spec.ts

@ -69,7 +69,7 @@ async function verifyFilter(param: {
return; return;
} }
await toolbar.clickFilter(); await toolbar.clickFilter({ networkValidation: false });
await toolbar.filter.add({ await toolbar.filter.add({
columnTitle: param.column, columnTitle: param.column,
opType: param.opType, opType: param.opType,
@ -77,7 +77,7 @@ async function verifyFilter(param: {
isLocallySaved: false, isLocallySaved: false,
dataType: param?.dataType, dataType: param?.dataType,
}); });
await toolbar.clickFilter(); await toolbar.clickFilter({ networkValidation: false });
// verify filtered rows // verify filtered rows
await validateRowArray({ await validateRowArray({
@ -85,7 +85,7 @@ async function verifyFilter(param: {
}); });
// Reset filter // Reset filter
await toolbar.filter.reset(); await toolbar.filter.reset({ networkValidation: false });
} }
// Number based filters // Number based filters
@ -607,7 +607,7 @@ test.describe('Filter Tests: Select based', () => {
test.describe('Filter Tests: AddOn', () => { test.describe('Filter Tests: AddOn', () => {
async function addOnFilterTest(dataType) { async function addOnFilterTest(dataType) {
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'addOnTypes' }); await dashboard.treeView.openTable({ title: 'addOnTypes', networkResponse: false });
// Enable NULL & EMPTY filters // Enable NULL & EMPTY filters
await dashboard.gotoSettings(); await dashboard.gotoSettings();
@ -654,6 +654,11 @@ test.describe('Filter Tests: AddOn', () => {
title: 'Id', title: 'Id',
uidt: UITypes.ID, uidt: UITypes.ID,
}, },
{
column_name: 'SingleLineText',
title: 'SingleLineText',
uidt: UITypes.SingleLineText,
},
{ {
column_name: 'Checkbox', column_name: 'Checkbox',
title: 'Checkbox', title: 'Checkbox',
@ -672,7 +677,8 @@ test.describe('Filter Tests: AddOn', () => {
const rowAttributes = []; const rowAttributes = [];
for (let i = 0; i < 400; i++) { for (let i = 0; i < 400; i++) {
const row = { const row = {
Checkbox: rowMixedValue(columns[1], i), SingleLineText: rowMixedValue(columns[1], i),
Checkbox: rowMixedValue(columns[2], i),
}; };
rowAttributes.push(row); rowAttributes.push(row);
} }
@ -712,7 +718,7 @@ test.describe('Filter Tests: Toggle button', () => {
test('Filter: Toggle NULL & EMPTY button', async () => { test('Filter: Toggle NULL & EMPTY button', async () => {
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'Country' }); await dashboard.treeView.openTable({ title: 'Country', networkResponse: false });
// Verify filter options // Verify filter options
await verifyFilterOperatorList({ await verifyFilterOperatorList({

Loading…
Cancel
Save