Book Image

Node.js By Example

Book Image

Node.js By Example

Overview of this book

Table of Contents (18 chapters)
Node.js By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing with DalekJS


DalekJS is an open source UI testing tool that is written entirely in JavaScript. It acts as a test runner. It has its own API to perform user interface interactions. A very interesting feature of DalekJS is that it works with different browsers. It is capable of running tests in PhantomJS and popular browsers such as Chrome, Safari, Firefox, and Internet Explorer. It uses a WebDriver JSON-Wire protocol to communicate with these browsers and basically control what goes on in them.

Installing DalekJS

First, we need to install DalekJS's command-line tool. It is distributed as a Node.js package. So, the following command will download the necessary files:

npm install dalek-cli -g

When the process finishes, we can run the dalek command in our terminal. The next step is to add the dalekjs module in our dependencies. This is the package that summons the tool's API. So, two more lines are needed in the package.json file:

{
  ...
  "dependencies": {
    "dalekjs": "0.0.9",
   ...