Nightwatch.js is an automated end-to-end testing framework for web applications and websites. It is written in Node.js and uses the W3C WebDriver API (formerly Selenium WebDriver) for interacting with various browsers. It is a complete testing solution that aims to simplify writing tests. Nightwatch can also be used for writing Node.js unit and integration tests. Some of its features are:
- Quick Setup
- Built-in Test Runner
- Clean Syntax
- Supports both CSS & XPath
- Supports Continuous Integration
- Built-in Test Case Reporting
- Inbuilt Page Object Model
- Run all or specific tests using Tags.
- Supports cloud services like Saucelabs, Browserstack, etc.
- Extendible command and assertion library
I came to know about Nightwatch JS some years back and I have been using it on and off since then, both for work and for my personal projects. My favorite feature of Nightwatch JS are custom commands and inbuilt support for page object model. This makes life so much easier when you are writing New tests.
Listed below are a few blogs that I have written explaining the different features and capabilities of Nightwatch. Every blog includes a working example (a test script automating a scenario) with a detailed explanation. Do check it out. Also, don’t forget to check out the Github repo if you want to skip to the good part 🙂
Keyboard and Mouse Events in Nightwatch JS
Nightwatch JS provides inbuilt API methods to simulate Keyboard and Mouse events. In the article,...
How to loop(iterate) over multiple elements in Nightwatch JS
In this article, we will discuss in detail on how we can iterate over multiple elements in...
How to handle Multiple Browser Windows in Nightwatch JS
Nightwatch JS provides api methods .windowHandles() and .switchWindow() to handle multiple browser...
How to add Tags to Nightwatch Tests
Nightwatch JS provides a very easy and straight forward way to apply tags to tests. The tags are...
How to upload and download a file in Nightwatch JS
In this article, we will discuss how we can upload and download a file in Nightwatch JS and...
API Testing in Nightwatch JS
Nightwatch JS doesn't provide any out of the box solution for API testing. Hence we would need...
How to handle Shadow DOM in Nightwatch JS
Nightwatch JS doesn't provide any out-of-the-box solution to handle shadow doms, hence we will use...
How to handle simple and nested iframes in Nightwatch JS
Nightwatch JS provides two API commands to handle iframes. frame() changes focus to another frame...
Page Object Model in Nightwatch JS
Page Object Model is a design pattern that focuses on making a Test Automation Framework...
How to create HTML reports in Nightwatch JS
There are a lot of ways you can create HTML reports in Nightwatch JS, but the one I liked the most...
Different ways to take screenshots with Nightwatch JS
In this article, we will look into the different ways in which we can take screenshots with...
Nightwatch JS – How to prevent tests from skipping if one test fails
Have you ever faced a situation where you have 50 test cases in a single JS file and say suppose...
How to Execute Tests in Multiple Browsers Parallelly with Nightwatch JS
In this article, we will explore how we can execute test cases simultaneously on multiple...
Getting Started with Nightwatch JS – Writing your First Test
In this post, we would be writing and executing a simple test. If you're unsure of how to set up...
Getting Started with Nightwatch JS – Installation
Nightwatch.js is an automated testing framework for web applications and websites, written in...