Getting started with nightwatch.js

Can someone provide me with a detailed explanation of how to set up the night view and start writing browser tests? I searched for such information on the Internet and could not find it. The nightwatch.js website had good information about the various nightwatch command line commands, but not the actual creation of the nightwatch project that I came across.

In particular, I do not have a good understanding of the various files that come with the nightwatch installation, and how I should use them.

+8
source share
5 answers

Walkthrough for Beginners

We needed an updated, well-studied and maintained Nightwatch tutorial for our team, so we wrote one: https://github.com/dwyl/learn-nightwatch

Codeship Dependency Status devDependency Status contributions welcome

We (strongly) recommend that you use the nightwatch.conf.js ( .js ) file to configure Nightwatch because (unlike the .json file) it allows you to disable comments on your fellow developers (i.e. avoid "WTF "moments through communication) and develop your configuration using variables and functions as needed.

In addition, we prefer to install Nightwatch (and its necessary dependencies) locally , so that it clearly indicates what is required to start the project and which versions we use.

Using the selenium-download module will download the latest versions of Selenium Standalone Server and Chromedriver (both necessary to run the basic Nightwatch test) for your OS and means that you will work faster .

Instead of including the entire 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!

+11
source share

You need the basic two things :

  • The nightwatch.json file in the root directory of your project
  • And the nightwatch installed ( npm install -g nightwatch ).

After that, you use it on the command line as described in the documentation here , and it will automatically capture your nightwatch.json file and run your tests based on default test_setting .

I discovered a problem to add the nightwatch init command, so setting up the nightwatch.json file nightwatch.json easier.

Further reading

+4
source share

You can go through this step-by-step method to better understand
Nightwatch.js Part 1
Nightwatch.js Part 2

0
source share

one big problem for users is "doesn’t work on an account 1-2-3".

therefore, we find many, many times our entire Internet :)

and.

1) night mode is set (by .rpm, .deb, npm, loaded). no questions

2) handled by the execution of "nightwatch" on the CLI

3), but where is the wunderbar example ????????????? of course on the internet!

4) from my bad memory and the list of directories in a simple test: - create a directory - create 2 dirs in a directory:

  • bin for web drivers (add chrome recorder, selenium-server-standalone at least)

  • tests for tests

5) we need this simple config - nightwatch.json in the directory (use any simple access)

6) create-copy-paste any simple test in the test directory (it is the only one on the planet :)

7) everything, run in the directory by CLI: nightwatch

do you only need this? for the first time, before the testimony of the documentation ?;)

-one
source share
 $ npm install -g yo $ npm install -g generator-selenium-nightwatch $ yo selenium-nightwatch $ npm install $ npm test 
-3
source share

All Articles