I'm testing functionality that includes redirecting to an external page which I do not control. This page is throwing errors causing the test to fail.
Is there a way to ignore js errors for one specific test only? (I want errors on my site to cause a test fail)
TestCafe tests fail when a page yields a JavaScript error. Use the -e ( --skip-js-errors ) option to ignore JavaScript errors during the test run.
What is it? Check your page for JavaScript errors. These errors may prevent users from properly viewing your pages and impact their user experience. Sites with poor user experience tend to rank worse in search engine results. Checkup.
There are two types of JavaScript error: Syntax Error: Occurs when there is a mistake in the way the code is written; for example, a typo or missing character. Runtime error: Occurs when the script is unable to complete its instructions; for example, if a specified object cannot be found.
At present, TestCafe does not allow to do this. I've created a proposal in TestCafe repository for your use case. Track it to be aware about progress.
UPDATE:
There is an example that demonstrates how to extend the built-in error tracking functionality and skip JavaScript errors by a predicate function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With