This repository was archived by the owner on Jun 11, 2021. It is now read-only.
This repository was archived by the owner on Jun 11, 2021. It is now read-only.
Timeout errors #46
Closed
Description
For reference, see microsoft/playwright#2031
This piece of code will not work when running inside Jest:
const playwright = require('playwright');
try {
await page.waitForSelector('.foo');
} catch (e) {
if (e instanceof playwright.errors.TimeoutError) {
// Do something if this is a timeout.
}
} else {
console.log(err);
}
}
It is possible that the TimeoutError is a different instance because Jest test cases is run inside a vm context, whereas PlaywrightRunnerE2E runs in Node.js.
This does work:
if (err.name === 'TimeoutError')
Note: Have not tested this with playwright-runner, but just assuming this is a problem here as well since it was with jest-playwright.
Metadata
Metadata
Assignees
Labels
No labels