Browse Source

fix(test): incorrect Base.ts

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
725031a9c5
  1. 19
      tests/playwright/pages/Base.ts

19
tests/playwright/pages/Base.ts

@ -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(
res =>
res.url().includes(requestUrlPathToMatch) &&
res.status() === 200 &&
httpMethodsToMatch.includes(res.request().method())
),
uiAction(),
]);
// handle JSON matcher if provided
let isResJsonMatched = true; let isResJsonMatched = true;
if (responseJsonMatcher) { if (responseJsonMatcher) {
try { try {
isResJsonMatched = responseJsonMatcher(res.json()); isResJsonMatched = responseJsonMatcher(await res.json());
} catch { } catch (e) {
isResJsonMatched = false; return false;
}
} }
if (debug) { if (debug) {

Loading…
Cancel
Save