System Testing Overview

Use Nightwatch.js for your system tests.

Nightwatch.js is a tool that automates user interaction for browser end-to-end tests. These system tests are written in Node.js and run against Selenium.

A. How Nightwatch.js Works

To perform the functionality that you specify in JavaScript, Nightwatch.js wraps around the Selenium browser automation tool.

Nightwatch.js allows you to write browser tests in JavaScript, which are then interpreted into Selenium WebDriver instructions. Selenium then executes its commands on the browser and returns their output.

Nightwatch.js Guide Read more about how Nightwatch.js works in the official Nightwatch.js guide.

The Nightwatch.js description of Selenium is adequate for these tests.

Selenium Documentation However, if you are curious, read more about how Selenium works in the official Selenium documentation.

Mobify has extended Nightwatch.js's functionality with a custom set of commands and assertions for Mobify-specific sites.

Mobify's Custom Nightwatch.js Commands and Assertions Browse the Mobify Custom Nightwatch.js Commands and Assertions API.

For example in this code snippet, the preview function is specific to Mobify.

module.exports = {
    'setUp': function(browser) {

B. How to Run Nightwatch.js Tests

Every Mobify project that has been created with the Adaptive Generator has an option to include Nightwatch.js in your local project.

a. Run Tests on Local Projects

Run tests on your local project in Terminal (OS X, Linux) or Command Prompt (Windows) to test the local version of the mobile site. Tests execute in the browser and results are output to the command line. This way, you see which element is being tested at a given time.

Learn how to Run Local Automated Tests Work through our Run Local Automated Tests with Nightwatch.js tutorial.

b. Run Tests on Uploaded Project Bundles

For automated tests on bundles that have already been uploaded, CircleCI provides our continuous integration. It runs tests automatically on code changes that have recently been pushed to the GitHub repository. The push passes with a green indicator check mark if all tests pass. You can set CircleCI to send you an email with the test results. It is also easy to add screenshots to the output if you need them.

Learn how to Run Continuous Integration Tests with CircleCI Work through our Add a Project for Integration Testing and Check Automated CircleCI Tests of Cloud Project Bundles tutorials.

Edit in GitHub