|
|
@ -33,23 +33,14 @@ export default abstract class BasePage { |
|
|
|
debug?: boolean; |
|
|
|
debug?: boolean; |
|
|
|
debugKey?: string; |
|
|
|
debugKey?: string; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const [res] = await Promise.all([ |
|
|
|
const waitForResponsePromise = this.rootPage.waitForResponse(async res => { |
|
|
|
this.rootPage.waitForResponse( |
|
|
|
let isResJsonMatched = true; |
|
|
|
res => |
|
|
|
if (responseJsonMatcher) { |
|
|
|
res.url().includes(requestUrlPathToMatch) && |
|
|
|
try { |
|
|
|
res.status() === 200 && |
|
|
|
isResJsonMatched = responseJsonMatcher(await res.json()); |
|
|
|
httpMethodsToMatch.includes(res.request().method()) |
|
|
|
} catch (e) { |
|
|
|
), |
|
|
|
return false; |
|
|
|
uiAction(), |
|
|
|
} |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// handle JSON matcher if provided
|
|
|
|
|
|
|
|
let isResJsonMatched = true; |
|
|
|
|
|
|
|
if (responseJsonMatcher) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
isResJsonMatched = responseJsonMatcher(res.json()); |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
isResJsonMatched = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (debug) { |
|
|
|
if (debug) { |
|
|
|