Browse Source

fix(playwright): remove timeout

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
9f1737c512
  1. 33
      tests/playwright/pages/Base.ts

33
tests/playwright/pages/Base.ts

@ -28,27 +28,22 @@ export default abstract class BasePage {
httpMethodsToMatch?: string[]; httpMethodsToMatch?: string[];
responseJsonMatcher?: ResponseSelector; responseJsonMatcher?: ResponseSelector;
}) { }) {
const waitForResponsePromise = this.rootPage.waitForResponse( const waitForResponsePromise = this.rootPage.waitForResponse(res => {
res => { let isResJsonMatched = true;
let isResJsonMatched = true; if (responseJsonMatcher) {
if (responseJsonMatcher) { try {
try { isResJsonMatched = responseJsonMatcher(res.json());
isResJsonMatched = responseJsonMatcher(res.json()); } catch (e) {
} catch (e) { return false;
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 uiAction();
await waitForResponsePromise; await waitForResponsePromise;

Loading…
Cancel
Save