Book Image

Node.js Blueprints

By : Krasimir Stefanov Tsonev
Book Image

Node.js Blueprints

By: Krasimir Stefanov Tsonev

Overview of this book

Table of Contents (19 chapters)
Node.js Blueprints
About the Author
About the Reviewers

Testing with DalekJS

So far we learned how to test our JavaScript code. After that, we found out how to write user interface tests with Phantom.js. All these are really helpful, but it will be even better if we are able to run a real browser and control it. With DalekJS, this is possible. It's a really nice Node.js module that comes with a command-line interface tool and submodules for major browsers such as Google Chrome, Firefox, and Internet Explorer.

Let's see how everything works and install the command-line tool of DalekJS using the following command:

npm install -g dalek-cli

After running the preceding command, we will have the dalek command set up in our terminal. Let's copy the files used in the PhantomJS test and replace framework.js with a package.json file. We will also rename tests/phantom.js to tests/dalek.js. So, the following is the new file structure:

The application we will use will be the same. DalekJS supports several browsers, including Google Chrome, so we will use it...