Javascript Automated Testing October 12, 2016
Posted by kevinbe71 in Chrome, Firefox, Javascript, Testing, Web Development.Tags: automation, chai, es6, jasmine, Javascript, mocha, selenium, Testing
add a comment
I’ve just spent the last week exploring various options for automated testing using Javascript. It was a fairly painful process so I thought this may be good to write a blog post about to save someone that pain…
Here are the options that I looked at (released software only… there are some interesting products on the horizon like cypress.io etc. if you like the bleeding edge):
- Selenium + Jasmine (with jasmine-node to allow ES6)
- Nightwatch.js
- Nightmare
- Webdriver.io
I couldn’t get Selenium + Jasmine to run reliably- it kept on hitting the timeout (or perhaps not completing the test?). I explored many options for overriding the timeout and none of them worked. I wasted 2 days exploring this so I really felt that I gave it a fair shake.
Nightwatch.js – I’ll admit that I can’t recall what the issue was with Nightwatch.js… perhaps it just didn’t do things the way we needed it to.
Nightmare uses Electron so it has a similar approach to PhantomJS based testing. This doesn’t work for our use cases- we want to automate execution in 3 browsers (Firefox, Chrome and Microsoft Edge).
Webdriver.io was the last option I tried. This turned out to be the one that worked the best… but only after a bit of learning. The secret was using the synchronous version and pairing it with mocha and chai.
Hopefully this will help someone else… let me know in the comments if you’ve found a better option or if you reached the same conclusion.