TestProject Forum
Powered by leading experts in the test automation community

Run Nightwatch tests in a particular order?

I wrote a few tests with nightwatchjs.

Some of the tests should run only after the register/login tests have run.

Is it possible to run a few tests in any order I can dictate pre-run ?

Nightwatch runs each test within a particular file in order, so what you could do is put every test in the same file, in the order you wish them to run.

Nightwatch runs each test file in alphabetical order.

You could use this to your advantage by giving each test file with a number specifying the order you want them to be run in.
e.g. if you have 2 test files, Init.js and Demo.js, and you obiously want Init.js to run first, you could change the names of the files to 01Init.js and 02Demo.js. This will make Nightwatch run the files in the order you want.

Thanks for the help Oren