Home > Net >  Timeout Issue in Automating ReactJS Application
Timeout Issue in Automating ReactJS Application

Time:11-09

I am using Javascript Test Framework Mocha and Chai to automate a ReactJS application. I have created the testcases. I have issue with this.timeout(...). It was working when I give the timeout value as 30000 or 60000 when I am executing the single testcase. But sometimes it fails and in that case I have to increase the timeout value. When I am executing the same as a whole which has 100 testcases, still I am getting timeout error as

"timeout of 60000ms exceeded. Ensure the done() callback is being called in this test"

So I am keep on increasing the timeout value to 200000 and still sometimes I used to get the Timeout error. Please provide some suggestions.

describe("Test Suite1", function () {
     it("Testcase1", function() {
           this.timeout(200000);

      })
})

Thanks in advance

CodePudding user response:

While there are many approches to solve this but it seems that you should disable the timeouts completely and to do that you can use this.timeout(0) this will totally disable the timeouts in the test runs and With async tests, if you disable timeouts via this.timeout(0) and then do not call done(), your test will exit silently. You just have to make sure that you have conditions in your code that prevent tests to run for forever.

More info about the timeouts in mocha is mentioned here in the documentation. https://mochajs.org/#timeouts

  • Related