From 00e5fe9b819d8af58731841e931847877be4687a Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 29 Jun 2024 05:17:21 +0000 Subject: [PATCH 1/5] test: insert filter wait again --- tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 31102f4d41..8a228cbee1 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -135,7 +135,7 @@ export class ToolbarFilterPage extends BasePage { // TODO: Integrated the draft filter logic here as well, since when we add a filter its not saved till all // its values are filled - skipWaitingResponse = true; + // skipWaitingResponse = true; const selectedField = await getTextExcludeIconText( this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item').first() From a2883f81255a650c0eccbc23d0d5fd0bf3751438 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 29 Jun 2024 05:17:21 +0000 Subject: [PATCH 2/5] test: dont wait for filter rsp for first filter --- .../pages/Dashboard/common/Toolbar/Filter.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 8a228cbee1..7001df86de 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -131,19 +131,18 @@ export class ToolbarFilterPage extends BasePage { openModal?: boolean; skipWaitingResponse?: boolean; }) { - if (!openModal) await this.get().locator(`button:has-text("Add Filter")`).first().click(); + const filterCount = await this.get().locator('.nc-filter-wrapper').count(); - // TODO: Integrated the draft filter logic here as well, since when we add a filter its not saved till all - // its values are filled - // skipWaitingResponse = true; + if (!openModal) await this.get().locator(`button:has-text("Add Filter")`).first().click(); const selectedField = await getTextExcludeIconText( this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item').first() ); + if (selectedField !== title) { await this.rootPage.locator('.nc-filter-field-select').last().click(); - if (skipWaitingResponse) { + if (skipWaitingResponse || filterCount === 0) { await this.rootPage .locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') .locator(`div[label="${title}"]:visible`) @@ -168,7 +167,7 @@ export class ToolbarFilterPage extends BasePage { await this.rootPage.locator('.nc-filter-operation-select').click(); // first() : filter list has >, >= - if (skipWaitingResponse) { + if (skipWaitingResponse || filterCount === 0) { await this.rootPage .locator('.nc-dropdown-filter-comp-op') .locator(`.ant-select-item:has-text("${operation}")`) @@ -197,7 +196,7 @@ export class ToolbarFilterPage extends BasePage { await this.rootPage.locator('.nc-filter-sub_operation-select').click(); // first() : filter list has >, >= - if (skipWaitingResponse) { + if (skipWaitingResponse || filterCount === 0) { await this.rootPage .locator('.nc-dropdown-filter-comp-sub-op') .locator(`.ant-select-item:has-text("${subOperation}")`) From 7b7e3270b1764fde21d461091ecb3197535b2cd0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 29 Jun 2024 05:17:21 +0000 Subject: [PATCH 3/5] test: considerations for open modal scenario --- .../pages/Dashboard/common/Toolbar/Filter.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 7001df86de..a668d3a8a3 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -131,18 +131,22 @@ export class ToolbarFilterPage extends BasePage { openModal?: boolean; skipWaitingResponse?: boolean; }) { - const filterCount = await this.get().locator('.nc-filter-wrapper').count(); + if (!openModal) { + await this.get().locator(`button:has-text("Add Filter")`).first().click(); + } - if (!openModal) await this.get().locator(`button:has-text("Add Filter")`).first().click(); + const filterCount = await this.get().locator('.nc-filter-wrapper').count(); const selectedField = await getTextExcludeIconText( this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item').first() ); + console.log('filterCount', filterCount); + if (selectedField !== title) { await this.rootPage.locator('.nc-filter-field-select').last().click(); - if (skipWaitingResponse || filterCount === 0) { + if (skipWaitingResponse || filterCount === 1) { await this.rootPage .locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') .locator(`div[label="${title}"]:visible`) @@ -167,7 +171,7 @@ export class ToolbarFilterPage extends BasePage { await this.rootPage.locator('.nc-filter-operation-select').click(); // first() : filter list has >, >= - if (skipWaitingResponse || filterCount === 0) { + if (skipWaitingResponse || filterCount === 1) { await this.rootPage .locator('.nc-dropdown-filter-comp-op') .locator(`.ant-select-item:has-text("${operation}")`) @@ -196,7 +200,7 @@ export class ToolbarFilterPage extends BasePage { await this.rootPage.locator('.nc-filter-sub_operation-select').click(); // first() : filter list has >, >= - if (skipWaitingResponse || filterCount === 0) { + if (skipWaitingResponse || filterCount === 1) { await this.rootPage .locator('.nc-dropdown-filter-comp-sub-op') .locator(`.ant-select-item:has-text("${subOperation}")`) From aa2be0cd8f7e9e390081b1d25cd3c5b64944d24e Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 29 Jun 2024 05:17:21 +0000 Subject: [PATCH 4/5] test: multi select filter fix --- .../pages/Dashboard/common/Toolbar/Filter.ts | 58 +++++++++++++++---- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index a668d3a8a3..f3be8b1010 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -312,10 +312,22 @@ export class ToolbarFilterPage extends BasePage { // eslint-disable-next-line no-case-declarations const v = value.split(','); for (let i = 0; i < v.length; i++) { - await this.rootPage - .locator(`.nc-dropdown-multi-select-cell`) - .locator(`[data-testid="select-option-MultiSelect-filter"].nc-select-option-MultiSelect-${v[i]}`) - .click(); + if (skipWaitingResponse) { + await this.rootPage + .locator(`.nc-dropdown-multi-select-cell`) + .locator(`[data-testid="select-option-MultiSelect-filter"].nc-select-option-MultiSelect-${v[i]}`) + .click(); + } else { + await this.waitForResponse({ + uiAction: async () => + await this.rootPage + .locator(`.nc-dropdown-multi-select-cell`) + .locator(`[data-testid="select-option-MultiSelect-filter"].nc-select-option-MultiSelect-${v[i]}`) + .click(), + httpMethodsToMatch: ['GET'], + requestUrlPathToMatch: `/api/v1/db/data/noco/`, + }); + } } break; case UITypes.SingleSelect: @@ -330,16 +342,40 @@ export class ToolbarFilterPage extends BasePage { const val = value.split(','); if (val.length > 1) { for (let i = 0; i < val.length; i++) { + if (skipWaitingResponse) { + await this.rootPage + .locator(`.nc-dropdown-multi-select-cell`) + .locator(`.nc-select-option-SingleSelect-${val[i]}`) + .click(); + } else { + await this.waitForResponse({ + uiAction: async () => + await this.rootPage + .locator(`.nc-dropdown-multi-select-cell`) + .locator(`.nc-select-option-SingleSelect-${val[i]}`) + .click(), + httpMethodsToMatch: ['GET'], + requestUrlPathToMatch: `/api/v1/db/data/noco/`, + }); + } + } + } else { + if (skipWaitingResponse) { await this.rootPage - .locator(`.nc-dropdown-multi-select-cell`) - .locator(`.nc-select-option-SingleSelect-${val[i]}`) + .locator(`.nc-dropdown-single-select-cell`) + .locator(`.nc-select-option-${title}-${value}`) .click(); + } else { + await this.waitForResponse({ + uiAction: async () => + await this.rootPage + .locator(`.nc-dropdown-single-select-cell`) + .locator(`.nc-select-option-${title}-${value}`) + .click(), + httpMethodsToMatch: ['GET'], + requestUrlPathToMatch: `/api/v1/db/data/noco/`, + }); } - } else { - await this.rootPage - .locator(`.nc-dropdown-single-select-cell`) - .locator(`.nc-select-option-${title}-${value}`) - .click(); } break; case UITypes.User: From ddc8cdcd453da6a8d76b41b54b0f4b16283aafc7 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 29 Jun 2024 05:17:21 +0000 Subject: [PATCH 5/5] Update Filter.ts --- tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index f3be8b1010..562be6c99a 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -141,8 +141,6 @@ export class ToolbarFilterPage extends BasePage { this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item').first() ); - console.log('filterCount', filterCount); - if (selectedField !== title) { await this.rootPage.locator('.nc-filter-field-select').last().click();