From 9f1737c512fbf3a7f4c2bddb0f253ec747bbe09b Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 17 Jun 2023 17:34:03 +0800 Subject: [PATCH] fix(playwright): remove timeout --- tests/playwright/pages/Base.ts | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/tests/playwright/pages/Base.ts b/tests/playwright/pages/Base.ts index 67659cf747..862a13a6d7 100644 --- a/tests/playwright/pages/Base.ts +++ b/tests/playwright/pages/Base.ts @@ -28,27 +28,22 @@ export default abstract class BasePage { httpMethodsToMatch?: string[]; responseJsonMatcher?: ResponseSelector; }) { - const waitForResponsePromise = this.rootPage.waitForResponse( - res => { - let isResJsonMatched = true; - if (responseJsonMatcher) { - try { - isResJsonMatched = responseJsonMatcher(res.json()); - } catch (e) { - return false; - } + const waitForResponsePromise = this.rootPage.waitForResponse(res => { + let isResJsonMatched = true; + if (responseJsonMatcher) { + try { + isResJsonMatched = responseJsonMatcher(res.json()); + } catch (e) { + return false; } - - return ( - res.request().url().includes(requestUrlPathToMatch) && - httpMethodsToMatch.includes(res.request().method()) && - isResJsonMatched - ); - }, - { - timeout: 100000, } - ); + + return ( + res.request().url().includes(requestUrlPathToMatch) && + httpMethodsToMatch.includes(res.request().method()) && + isResJsonMatched + ); + }); await uiAction(); await waitForResponsePromise;