-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error handling #81
Comments
What is the status on this issue? |
+1 on adding an It'd be really great not to have to call |
I ended up in the same situation and after hours of digging into this package code, I finally found the solution. We can capture the errors from WITHIN the extension by using the import {PuppeteerRunnerExtension, Step, getSelectorType, selectorToPElementSelector} from "@puppeteer/replay"
class ScreenshotExtension extends PuppeteerRunnerExtension {
async runStep(step: Step, flow: UserFlow) {
try {
await super.runStep(step, flow)
} catch (error) {
let message = 'Unknown Error'
if (error instanceof Error) message = error.message
if (message.includes('waitForElement timed out')) {
throw new Error(`The selector(s) ${step.selectors.join()} is either not present or took too long to render.`)
}
throw new Error(message)
}
}
}
export default ScreenshotExtension; |
For example, should the hooks like afterEach/afterAll be invoked when an error happens? I think it'd be expected if they are still invoked on errors.
The text was updated successfully, but these errors were encountered: