Nightwatch is an automated testing framework that provides an end-to-end testing solution for web-based apps. It uses the W3C WebDriver API (it was called Selenium WebDriver formerly) behind the scenes to open the web browser to perform operations and assertions on DOM elements. It is a great tool if you want to use a browser to test your Nuxt apps. But before using it in a Nuxt app, let's use it on its own in the following steps to write some simple tests so that you have a basic idea of how it works:
- Install Nightwatch via npm and save it to the devDependencies option in the package.json file:
$ npm i nightwatch --save-dev
- Install GeckoDriver via npm and also save it to the devDependencies option in the package.json file:
$ npm install geckodriver --save-dev
Nightwatch relies on WebDriver, so we need to install a specific WebDriver server depending on your target browser – for example, if you want to write tests against Firefox only, then you will...