Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

--skip-js-errors on specific test cases

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)

like image 946
ioseph Avatar asked Aug 27 '18 00:08

ioseph


People also ask

How do I skip JavaScript errors in TestCafe?

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 JS error test?

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.

Why do JavaScript errors occur?

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.


1 Answers

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.

like image 50
mlosev Avatar answered Sep 18 '22 00:09

mlosev