0
votes

I am not able to execute a simple test in protractor with mocha, typescript and chai. I get the below error: "Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves."

After the browser.get() line is executed, the page opens and closes abruptly with the above error. I do not have any other line executing after this, as i wanted this to be executed first successfully.

I have tried to put browser.sleep() as well, no luck. I have tried all options mentioned in all similar issues (different timeouts here and there) none works. My package.json has: Protractor version : 7.0.0, Mocha: 8.1.3, typescript: 3.4.3, jasmine:3.6.1, @types/.. all latest versions, chai and chai-as-promised

I am also using async/await.

I am stuck with this for more than 2 weeks now. Please help with ideas.

Thanks in advance!!!

1
Please post your test code. But if you "do not have any other line executing" maybe this is the error, you need to cal done(). But, share your code to get a better know about the problem. - J.F.
Hello J.F, thanks for the response. I studied and it seems i need to put my mochaopts under test folder for it to recognize, not sure though, but will try it tomorrow and give a response here, as my vm got stuck. else will post code. Also i tried with done options as well, none worked. - BKS

1 Answers

0
votes

Got my vm today, and found out that mochaOpts was spelled wrong in my config, it was spelt as mochaopts, which was the issue, because of which timeout was not getting considered. After i changed the spelling, timeout error didnt come and test passed. thought of sharing it, as we might end up doing this unknowingly.

thank you!!!! have a good learning.