Browse Source

fix(playwright): waitForResponse

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
476600ddd5
  1. 7
      tests/playwright/pages/Base.ts

7
tests/playwright/pages/Base.ts

@ -29,11 +29,11 @@ export default abstract class BasePage {
responseJsonMatcher?: ResponseSelector;
}) {
const waitForResponsePromise = this.rootPage.waitForResponse(
res => {
async res => {
let isResJsonMatched = true;
if (responseJsonMatcher) {
try {
isResJsonMatched = responseJsonMatcher(res.json());
isResJsonMatched = responseJsonMatcher(await res.json());
} catch (e) {
return false;
}
@ -50,8 +50,7 @@ export default abstract class BasePage {
}
);
await uiAction();
await waitForResponsePromise;
await Promise.all([uiAction(), waitForResponsePromise]);
}
async attachFile({ filePickUIAction, filePath }: { filePickUIAction: Promise<any>; filePath: string[] }) {

Loading…
Cancel
Save