I have around 450 assorted specs written in Jasmine (async & sync) in my codebase. Karma is the test runner which I use for running the tests on a headless chrome browser. Whenever I run the tests as a whole, a few of the tests fail because of the following error:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. When I run these failing tests individually, they pass without any problem.
On every test run (all tests), the failing tests are different i.e., sometimes, async test A and B fails in the first test run and in the second test run, async test C and D fails.
I clearly see that the problem is always with the Async tests, but how do I fix this issue properly. I tried increasing the timeout in the configuration, it does work sometimes but the tests start failing again with the same async timeout error after a few runs. Currently, I have the timeout at 160000 ms.
How can I fix this problem?
Thanks