Getting Started With Nightwatch.js For Automated Testing

daggerhart

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.

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.

Learning Objectives

  • Get started using Nightwatch.js on its own (off the Drupal island)
  • Run Nightwatch.js tests included in Drupal core
  • Add custom tests to your modules and themes

Target Audience

Developers who are interested in writing practical automated tests for any website or browser based application.

Prerequisites

Attendees will get the moust of of this session if they are familiar with writing JavaScript for the browser, and executing JavaScript on the command line.

Track

Development & Coding

Tags

drupal 8
front-end development
javascript
testing

Experience Level

Intermediate

If no timezone is set on your profile, time is displayed in UTC.
Update your profile's timezone