Browse Source

fix(test): incorrect Base.ts

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

25
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( 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) {

Loading…
Cancel
Save