Last Updated: February 25, 2016
·
329
· olehkuchuk

Easy functional testing with DalekJS

When your app become large , testing UI functionality can be not so easy as you can imagine it. And in some period you will want to automate this process.

Of course, you can use such cool tools like CasperJS and PhantomJS, but they are really extensive and do much more than simply testing.

Another way is to use DalekJS. Its built on top of CasperJS and gives you a really clean interface for tests , using chains.

Look on this code

module.exports = {
  'Amazon does its thing': function (test) {
      test
       .open('http://www.amazon.com/')
       .type('#twotabsearchtextbox', 'Blues Brothers VHS')
       .click('.nav-submit-input')
       .waitForElement('#result_0')
       .assert.text('#result_0 .newaps a span').is('The Blues Brothers')
       .done();
   }
};

How simple you can test your UI.
But this is not all cool stuff, DalekJS supports plugins of real browsers, so you can install chrome plugin.

$ npm install dalek-browser-chrome --save-dev

and than run your test

dalek test.js -b chrome

And you will see real user interaction.

More information on project website http://dalekjs.com/index.html