• Stars
    star
    11,787
  • Rank 2,787 (Top 0.06 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 13 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack

Nightwatch.js

npm Node.js CI codecov Discord

Nightwatch.js Logo

Homepage โ€ข Developer Guide โ€ข API Reference โ€ข About โ€ข Blog

Nightwatch is an integrated testing framework powered by Node.js and using the W3C Webdriver API. It is a complete testing solution developed at BrowserStack and which can be used for:

โ˜‘๏ธ end-to-end testing of web applications and websites

โ˜‘๏ธ component testing in isolation (React / Vue / Storybook / Angular)

โ˜‘๏ธ Node.js unit, visual regression testing, accessibility testing & API testing

โ˜‘๏ธ Native mobile app testing on Android & iOS

๐Ÿš€ Nightwatch v3

What's New | Release Notes | Discussions

Nightwatch v3 is an all new generation that has been built around these three pillars:

  • Developer Experience : The entire experience from getting started, to writing and debugging tests, has been redesigned for speed, stability, and consistent non-flaky results.

  • Mobile first: Test your web or native, iOS and Android, mobile applications on simulators, real mobile devices or a cloud grid like BrowserStack.

  • One test automation framework: Run all types of tests from unit, component, and E2E to API, visual, and accessibility with a single framework.

The Nightwatch v3 is not just a new version, itโ€™s the result of months of engineering effort to reimagine test automation for the future. Try it out in 60 seconds and see it in action.

โš™๏ธ Get started in 60 seconds

1. Install Nightwatch from NPM

From your existing project's root dir:

npm init nightwatch@latest

or, if you want to initialize a new project:

npm init nightwatch@latest ./path/to/new/project

nightwatch-cli-gif

2. Answer a few questions about your preferred setup:

  • What is your Language - Test Runner setup?
  • Where do you want to run your e2e tests?
  • Where you'll be testing on?
  • Where do you plan to keep your end-to-end tests?
  • What is the base_url of your project?

Nightwatch will do the entire setup for you based on your answers.

3. Run a Demo Test:

Nightwatch comes with a few examples, which are automatically copied to your Nightwatch project during the setup and can also be used as boilerplate to write your own tests on top of them.

You can follow the instructions given at the end of the setup to run your first test with Nightwatch.

image


Nightwatch mobile app testing

Nightwatch enables automation testing of native mobile applications via Appium. It combines the robustness of Appium with the enhanced developer experience provided by Nightwatch. It enables end-to-end functional testing of native mobile apps on Android and iOS devices. Try it now

Go beyond E2E

With Nightwatch you can test components in isolation by mounting them in the browser. Nightwatch 2 added support for component testing for popular web frameworks such as

  1. React
  2. VueJS
  3. Angular
  4. Storybook

Nightwatch unit tests

The tests for Nightwatch are written using Mocha.

  1. Clone the project

    git clone https://github.com/nightwatchjs/nightwatch.git
    
    # change directory
    cd nightwatch
    
    # install the dependencies
    npm install
  2. Run tests

    To run the complete test suite:

    npm test

    To check test coverage, run the command:

    npm run mocha-coverage

    and then open the generated coverage/index.html file in your browser.

See Unit testing guide for more details.

Other types of testing

Nightwatch v3 introduces visual regression testing as an in-house plugin. The plugin takes care of

  1. Capturing screenshots
  2. Comparison with baseline to highlight visual differences
  3. Report to review the differences
  4. Approve the changes

VRT can be done on real desktop & mobile browsers. Also, VRT can be run on components as part of component testing as well.

API testing is now available with Nightwatch v3. The following functionality can be achieved with API testing

  1. Request assertions
  2. Response assertions
  3. Viewing API tests in the HTML report
  4. Mock server

Nightwatch v3 packages the aXe-core package developed by Deque Systems as a plugin. It enables 90 different types of accessibility tests for WCAG compliance.

๐Ÿฆ‰ About Nightwatch

Nightwatch was initially built by @pineviewlabs - an independent software consultancy based in Oslo, Norway, with help from contributors. In mid 2021, Nightwatch has become a part of the @BrowserStack family and it is being developed further at the BrowserStack Open-source Program Office. Read more on our blog.

Contributing

We welcome any and all contributions from the community which can help improve Nightwatch. Please check out CONTRIBUTING.md for more extensive contributing guidelines.

Licence

MIT

More Repositories

1

nightwatch-docs

Source for https://nightwatchjs.org website
EJS
93
star
2

nightwatch-website-tests

Example Nightwatch.js tests used to test the documentation website - https://nightwatchjs.org
JavaScript
13
star
3

vite-plugin-nightwatch

Component testing plugin that integrates Vite with Nightwatch.js. Supports Vue and React components.
JavaScript
13
star
4

nightwatch-chrome-recorder

Generate Nightwatch Tests from Google Chrome DevTools Recorder
TypeScript
12
star
5

nightwatch-circleci

JavaScript
10
star
6

nightwatch-schematics

Add Nightwatchjs to an Angular CLI project
TypeScript
8
star
7

nightwatch-browserstack-demo

This project runs an end-to-end test which demonstrates using the Browserstack cloud testing service with Nightwatch.js
JavaScript
5
star
8

nightwatch-storybook-plugin

Automatically integrate Storybook and run stories directly with Nightwatch
JavaScript
5
star
9

cucumberjs-boilerplate

Boilerplate code to run Nightwatch tests with Cucumber
JavaScript
5
star
10

nightwatch-vscode

Run Nightwatch tests in Visual Studio Code
TypeScript
5
star
11

nightwatch-recorder-extension

Nightwatch extension for Devtools that allows you to export tests directly from the recorder panel.
JavaScript
4
star
12

nightwatch-plugin-browserstack

Official @nightwatchjs plugin to integrate with Browserstack Local
JavaScript
4
star
13

nightwatch-inspector

Nightwatch Selector Playground that allows you to tests command directly from the browser
JavaScript
4
star
14

create-nightwatch

Nightwatch.js init command tool to setup everything up in no time using npm init nightwatch
JavaScript
4
star
15

performance_benchmarking

In this repo, we will benchmark the performance between Nightwatch & other frameworks
TypeScript
3
star
16

appium-nightwatch-examples

JavaScript
3
star
17

nightwatch-examples

Nightwatch 2 boilerplate project which runs the bundled examples in Github Actions against Google Chrome (using Xvfb)
JavaScript
3
star
18

nightwatch-plugin-vue

Nightwatch plugin which adds support for Vue component testing using the Vite dev server. Requires Nightwatch 2.3+
JavaScript
3
star
19

html-reporter

Nightwatch HTML Reporter
TypeScript
3
star
20

nightwatch-plugin-angular

Component testing support for Angular
HTML
2
star
21

nightwatch-plugin-nx

TypeScript
2
star
22

jest-environment-nightwatch

Nightwatch.js environment for Jest
JavaScript
1
star
23

nightwatch-typescript-boilerplate

JavaScript
1
star
24

nightwatch-plugin-react

Nightwatch plugin which adds support for React component testing using the Vite dev server. Requires Nightwatch 2.3+
JavaScript
1
star
25

nightwatch-plugin-apitesting

Run api tests in Nightwatch via the @nightwatch/apitesting plugin
JavaScript
1
star
26

nightwatch-www

EJS
1
star