Can anyone provide me with a detailed explanation on how to setup nightwatch and start writing browser tests? I have searched for such information online and was unable to find it. The nightwatch.js website had good information about various nightwatch command line commands, but not about actually setting up a nightwatch project, which is what I am having trouble with.
Specifically, I do not have a good understanding of the various files that come with installation of nightwatch, and how I am supposed to use them.
We needed an up-to-date, well-researched and maintained tutorial for Nightwatch for our team so we wrote one: https://github.com/dwyl/learn-nightwatch
We (highly) recommend using a nightwatch.conf.js
(.js) file for configuring Nightwatch because (unlike a .json file) it allows you leave in-line comments to your fellow developers (i.e avoid "WTF" moments by communicating) and to evolve your configuration with variables & functions as needed.
Also, we prefer to install Nightwatch (and its required dependencies) locally so it's clear to everyone exactly what is required to run the project and which versions we are using.
Using the selenium-download
module will download the latest versions of Selenium Standalone Server and Chromedriver (both required to run a basic Nightwatch test) for your OS and means you will be up-and-running much faster.
Rather than including the whole tutorial here we invite you to Star/Fork it on GitHub: https://github.com/dwyl/learn-nightwatch#step-by-step-tutorial
Feedback / questions / updates / improvements are always welcome!
You need basiclly two things:
nightwatch.json
file in the root of your projectnightwatch
installed (npm install -g nightwatch
).After that you use it on the command line as described in the documentation here and it will automatically grab your nightwatch.json
file and run your tests based on the default
test_setting
.
I opened up an issue to add a nightwatch init
command, so the setup of the nightwatch.json
file is easier.
nightwatch.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With