Main Content

Getting Started With Nightwatch.js For Automated Testing

Nightwatch.js is an easy to use Node.js based End-to-End (E2E) testing solution for browser based apps and websites. Practically speaking, this means you can write JavaScript that will visit and test your website in various browsers. It does this by using the W3C WebDriver API to run an actual browser on your system and perform tasks on DOM elements.

As part of the JavaScript Modernization Initiative, Nightwatch.js has been added to Drupal core (v8.6) as the new standard framework for both unit and functional testing of JavaScript. Now you can use Nightwatch.js to both ensure changes to the system do not break expected functionality, as well as write tests for your contributed modules and themes. Like other testing frameworks, you can include Nightwatch.js into your build process helping to ensure regressions rarely make their way into production.

In this session we'll look at the following topics:

* How to get started using Nightwatch.js on its own (off the Drupal island)
* How to run tests included in Drupal core
* How to include your own tests in modules and themes
* Overview of leveraging 3rd-party services to execute our tests in a wide range of browsers and systems
* Getting screenshots and videos of your tests as they run

By the end of this session you should be very familiar with the capabilities of Nightwatch.js, how you can use it for functional testing of any website (including your Drupal sites), as well as use it for unit testing your contributions to Drupal.

Intended Audience

Developers who are interested in learning to write practical functional tests for any website or browser based application would benefit from this session.

Skill Levels

This session is suitable for intermediate and advanced developers. Knowing Drupal is not a requirement because Nightwatch.js is off-the-island technology.

 

Login to Register