explaingit

nightwatchjs/nightwatch

11,946JavaScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Nightwatch is a JavaScript testing framework that runs end-to-end browser tests, component tests, API tests, visual regression checks, and mobile app tests all from one tool using Node.js and WebDriver.

Mindmap

mindmap
  root((Nightwatch))
    Test Types
      End-to-end browser
      Component testing
      API testing
      Visual regression
      Mobile apps
    Tech Stack
      Node.js
      WebDriver
      Appium
    Setup
      npm wizard
      Auto config
      Example tests
    Audience
      JS developers
      QA engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Write automated browser tests that navigate your web app, click buttons, fill forms, and verify the right content appears.

USE CASE 2

Test React, Vue, Angular, or Storybook components in isolation without running the full application.

USE CASE 3

Run visual regression tests to catch unintended layout changes between releases by comparing screenshots.

USE CASE 4

Test native iOS or Android apps using the same framework as your browser tests, connected via Appium.

Tech stack

JavaScriptNode.jsWebDriverAppium

Getting it running

Difficulty · easy Time to first run · 30min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Nightwatch is a testing framework for JavaScript applications, built around the idea that you should be able to run all the different kinds of automated tests your project needs from a single tool. It runs on Node.js and communicates with real browsers using an established web standard called WebDriver, meaning your tests interact with Chrome, Firefox, Safari, and others the same way a real user would. The main category of tests it handles is end-to-end testing: scripted sequences that open a browser, navigate to a page, click things, fill in forms, and check that the right content appears. Beyond that, version 3 added support for testing individual UI components in isolation for React, Vue, Angular, and Storybook projects. It also covers API testing (sending HTTP requests and checking responses), visual regression testing (comparing screenshots to catch unintended layout changes), and accessibility testing using a plugin that checks for compliance with web accessibility guidelines. Mobile is also covered. Nightwatch connects to Appium, a separate tool, to run tests against native iOS and Android apps on simulators or real devices. The same framework handles both desktop browser tests and mobile app tests, so you do not need to maintain two separate testing setups. Getting started involves running one npm command from your project directory. It launches a setup wizard that asks which browsers you are targeting, where your tests will live, and what the base URL of your application is, then generates the configuration automatically. Example tests are copied into the project so you have something to run right away. Nightwatch was originally created by an independent consultancy in Oslo and later became part of BrowserStack, a company that provides cloud-based browser and device testing infrastructure. The project is open source under the MIT license.

Copy-paste prompts

Prompt 1
Set up Nightwatch in my Node.js project to run end-to-end tests on Chrome and Firefox, walk me through the npm command and what the setup wizard will ask.
Prompt 2
Write a Nightwatch test that opens a login page, fills in the email and password fields, clicks submit, and verifies the dashboard heading appears.
Prompt 3
Configure Nightwatch to run visual regression tests and alert me when the layout of my homepage changes between deployments.
Prompt 4
Help me add Nightwatch component tests for a React component that renders a button and verify it shows the correct label when a prop is passed.
Prompt 5
Set up Nightwatch mobile testing for an Android app using Appium alongside my existing browser test suite, show me the config and an example test.
Open on GitHub → Explain another repo

← nightwatchjs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.