Allow to setup 'skip-js-error' option only for specified pages.
Use case: The tested site contains parts (ad blocks, external service pages and etc.) that have js errors and cannot be controlled by test writer.
We need a conditional behavior for this case:
- for uncontrolled pages need to skip js errors.
- for other pages need to handle js errors.
So, we need a way to setup 'skip-js-error' option only for specified pages.
Based on https://stackoverflow.com/questions/52031129/skip-js-errors-on-specific-test-cases
Perhaps instead of at the page level it could be done using the test controller:
t.ignoreJSErrors(true / false)
Yes it seems to me this comes up somewhat regularly (#2033, #3747). In our case there is some ad-script on a 3rd party page that throws an error. And this means we have to set --skip-js-error for all tests. This is really sad, since:
- we have to hope that errors get caught still by also breaking functionality
- we have one less incentive for developers to handle errors properly
Hello @bxt,
Thank you for sharing your scenario with us. We will take it into account when we are ready to implement this feature.
Exactly the same problem as @bxt
Other than that having many small wholes in TC (new tab opening, visibility checking...) because of that not able to write stable and efficient tests.
We would also appreciate to get this new feature.
Need this too. Hammerhead is super flakey already with our application's ajax calls. Now we have a thirdparty JS window that does a window.setTimeout which causes to hammerhead to blow up. We have no way to trap the error without disabling it for all of our tests.
@alienintheheights Could you describe your case in greater detail? Does your test lead to any exceptions in Hammerhead scripts?
This would also help us. A few of my test cases involve validating I can visit another site which often has a ton of JS errors. Being able to skip JS errors for a single test would be convenient.
Took like two years to decide that this is a very interesting feature ? we can tell from @bxt that much people would need it.
Hi @gothraven
We confirm that this a good extension of the skip-j-error feature. But it's not what we plan to implement in the near future. At present, we are working on two large features: Capability to perform testing in multiple browser windows and Selector Debug Panel. After these features are implemented, we will concentrate our resources on other features.
@miherlosev is there any way I can help with this small feature ?
@gothraven, You can submit your PR with this feature implementation.
Guys,
There is an example that demonstrates how to extend the built-in error tracking functionality and skip JavaScript errors by a predicate function.
This would be great to be able to overwrite the default config value within a particular test - we have issues loading certain external js files related to analytics within some pages owned by other teams which causes problems when doing a smoke test of our micro frontend.
Hi @rushby
Thank you for sharing this use case. You can use a workaround until this feature is implemented.
Hello,
We are also running into this with third party sites. It would be nice to set skipjserrors = true via the controller in a step in a test. Right now, it's just a global setting.
Same here, we have a specific test that throws an error which we have no control to (external script), now we need skip all js errors for all our tests. Would be really great if we could enable this option only on one test!
Would really appreciate this as well. My hesitancy in skipping javascript errors globally is that my tests would miss something I need to see. Being able to set this by page or even by individual test would be incredibly helpful. Thank you!!
Hi @jmosley5,
Thank you for your opinion. This feature has a high priority for us, and it is in our roadmap. You can use a workaround until this feature is implemented.
Release v2.0.0-rc.1 addresses this.
Release v2.0.0-rc.1 addresses this.