Add API Testing to your Nightwatch Test Automation
When the software being tested exposes REST API endpoints it can be more efficient to test the APIs directly instead of going through the UI.
Nightwatch was published in January 2014, initially created by Andrei Rusu as a tool to enable writing of automated UI tests in a straightforward way, and which will require as little configuration and additional libraries as possible.
Right after it was published, Nightwatch has seen steady growth and has now become one of the most popular Node.js end-to-end testing solutions for web applications and websites.
From the very first Github Issue opened by Evan You (creator of Vue.js) and seamless integration with the Vue.js framework, to being featured on the 2017 ThoughtWorks Technology Radar, Nightwatch has become an established household name in the wider automated testing industry.
Instead of building a highly flexible tool which supports a lot of plugins and customization we aim to deliver a tool that is packed with everything you need out of the box.
We believe that in order to write tests you should only focus on writing tests and not have to add multiple external plugins and dependencies. In our experience, this usually leads to increasingly more time spent on maintaining dependencies and solving configuration issues, instead of writing actual tests.
We do however provide mechanisms to extend the existing API commands and assertions when needed and you can also use Nightwatch programmatically if you wish. We also do our best to ensure that Nightwatch follows an industry agreed upon practice and we try to be compatible with other existing tools.
You can even write Node.js unit tests in Nightwatch to test your backend APIs. These tests are using the same assertion libraries and the same syntax and runner. We can even combine end-to-end tests with unit/integration tests in the same test run.
This version adds integrated support for the latest Microsoft Edge browser, improved parallelism support, and a few other features and improvements (such as making the API work with both chaining and promises).
We are working towards releasing the next major version which will be built on top of the Selenium Webdriver, which will be making test run significantly more stable and more reliable.
We'll also add a few new capabilities, such as support for Chrome Dev Tools Protocol, file uploads, and a new APIs.
Report any bugs or feature requests on GitHub. Please review the Contributing Guidelines before submitting a new issue.
Issues with the documentation, such as inconsistencies, typos or mistakes can be reported on the Docs Github repository.
If you'd like to contribute API command examples, you can do so by adding them in this folder: github.com/nightwatchjs/nightwatch-docs/tree/main/api/method. These are automatically built into the individual API command pages.
For example, the clearValue page is built out of: github.com/nightwatchjs/nightwatch-docs/blob/main/api/method/clearValue.md.
You're encouraged to ask any questions you might have regarding the usage of Nightwatch or its APIs on the Github Discussions page. For reporting bugs, please submit a new Bug report on Github. Feature requests are also welcome.
New contributors: please also have a look at these resources:
We have setup a new chat server on Discord where you can chat with Nightwatch team members and other
users.
Please use this link to get in:
https://discord.gg/SN8Da2X
We are on Twitter at @nightwatchjs where we post updates about releases and other type of announcements.
In addition, there is a StackOverflow Nightwatch.js tag at your disposal.
A curated list of articles, guides, and video tutorials from the wider Nightwatch community. Please note that the videos and articles listed here aren't created by the Nightwatch team and we cannot guarantee their full accuracy.
When the software being tested exposes REST API endpoints it can be more efficient to test the APIs directly instead of going through the UI.
This guide will show you step-by-step how to create a TypeScript-enabled Nightwatch automated test suite.
A complete video course on learning to automate web UI tests with Nightwatch from the Test Automation University.
A step-by-step guide on how to refactor Nightwatch test cases to use the Page Object model API and page commands.
Learn how to write automated accessibility tests using Nightwatch and the Axe accessibility tool. The tutorial will explain how to write assertions for web content accessibility guidelines and detect elements which are failing accessibility rules.
Nightwatch collaborator Domenico explains why end-to-end testing (and also other forms of testing) is an important topic to him. A good explanation of the testing pyramid concept and a good introduction to automated testing.
Domenico demonstrates how to run end-to-end tests with Nightwatch using the Browserstack cloud testing platform. You can find other Nightwatch-related coding videos on his Youtube channel.
An extented guide on how to improve the security of Express apps using Nightwatch.
A rundown of the main features, how it works, and capabilities of Nightwatch.
A good introductory article of the main features and capabilities of Nightwatch.
Percy.io engineer, David Jones, gives an introduction on how you can add Percy snapshots to your Nightwatch.js tests for automated visual testing.
Core JavaScript maintainer for popular Drupal CMS, Sally Young gives an account about integrating Nightwatch in Drupal 8.6.
The platform that powers the Firefox Public Data Report, a weekly public report on the activity, behavior, and hardware configuration of Firefox Desktop users. Built with React and using Nightwatch v1.2
AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. AWX is built in Python and uses Nightwatch v0.9.
Worldview is an interactive interface for browsing global, full-resolution satellite imagery. Built with React and using Nightwatch v0.9.
The WebRTC samples This is a collection of small samples demonstrating various parts of the WebRTC APIs. Uses Nightwatch v1.1.
Examples for running Nightwatch tests against BrowserStack Automate infrastructure. Uses Nightwatch v1.0
Feel free to tip us off about any articles or open source projects that we should list on this page.