To control the order (and also to use a common module for authentication) I used a "main" test module and imported the tests in the order I wanted:
Inside main.test.js
// import test modules
const first = require('./first.test.js');
const second = require('./second.test.js');
module.exports = {
before(){
// login, etc.
},
'first': (browser) => {
first.run(browser);
},
'second': (browser) => {
second.run(browser);
},
}
and in first.test.js
var tests = {
'google': (browser) => {
browser.url('https://google.com';
},
'cnn': (browser) => {
browser.url('https://cnn.com';
}
};
module.exports = {
// allow nightwatch to run test module only inside _main
'@disabled': true,
'run': (browser) => {
// call all functions inside tests
Object.values(tests)
.filter(f => typeof f === 'function')
.forEach(f => f(browser));
}
};
--testcase
. I suppose you could just run them one-at-a-time using that. – Gestapo