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] 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: