Hi there,
You can define tearDown or setUp methods as globals but they won't automatically be made available inside the test specs, yet. I think I intended to do this but it got lost. So for now you can define them like this in your nightwatch.json:
Per each environment:
globals.js
module.exports = {
setUp : function(client) {
...
},
tearDown : function() {
...
}
};
nightwatch.json{
"default" : {
"globals" : "./lib/globals.js"
}
}
Per all environments:globals.jsmodule.exports = {
'default' : {
setUp : function(client) {
...
},
tearDown : function() {
...
}
}
};
nightwatch.json{
"globals_path" : "./lib/globals.js"
}
And then inside your test spec you're have them available as this.client.globals.setUp and tearDown respectively. I'm afraid that's all you can do for now, I'll try to add the automatic loading as well in a next version.