Search code examples
javascriptangularservice-workere2e-testingtestcafe

Simulate no internet connection in testcafe tests


We have an SPA with service worker enabled. We needed to create an automated test to see if normal functions still work during offline/no internet connection. Our e2e test platform is testcafe and we've got no idea how to let testcafe do this.

Please guide us to a path on how this can be done.


Solution

  • TestCafe does not provide any API to simulate offline mode. However, your idea sounds interesting as some browsers have a similar offline option out of the box. I recommend that you file your request at TestCafe GitHub repo. I'll update this answer when this feature is available if any.