At Kounta we take the quality control of our product very seriously. Businesses depend on our cloud platform to work as expected all day, every day. So we use a mix of manual and automated testing for new features and regression testing.
We have tried many automation platforms, including Behat, Ghostlab and most recently Nightwatch. All of the tools we have tried have had strengths and weaknesses but it looks like we will settle with Nightwatch. It’s major strengths for us being that it is…
- Very easy for QA that have little to no engineering experience to write tests
- It is extremely flexible so we can use it with BrowserStack and TestRail.
Where is this going?
If you’ve done web automation before you’ve likely run into the same challenges everyone else has; something that should be — in theory — intrinsically fast, simple and linear starts to get slow, complex and devious very quickly. Unpredictable AJAX, I’m looking at you!
The nasty way to handle this is to add enough sleep time for elements to load between every step of your scripts; automation tests are slow enough that they don’t need to spend even more time sleeping.
Nightwatch provides a waitForElementPresent()so that you only have to wait the minimum amount of time for things to be ready before safely proceeding. This is a good step up, but it still requires a lot of extra code to prevent the scripts from being brittle.
Now we get to the real time waster…
Writing the tests is a balance between guess work and past experience. When you run the script if an element isn’t present, isn’t what or where you expect it to be, or any of the other issues that could go wrong, the runner loves to print a fail message and close the browser. After far too many
pause() have been clumsily used everywhere to try and see what it’s doing you’ve ultimately spent a lot of time writing and automated test that should be much easier. It would be great if we could step through it like a debugger.
Well now we can! Sort of. Here is the gist of it (pun intended). It is a drop in replacement for
waitForElementPresent() and will pause the execution of the test with a Continue button:
It may not be winning any design awards (perhaps you could prettify it for the good of all?) but it does provide a lot more productivity when creating and maintaining sticky situations in your tests.
Originally published at http://elliot.land on December 18, 2015.