I want to write some javascript code in nightwatch. I know that it need to call .execute() function but I want to separate into different file and calls from main file.
Please help me on this. Thanks.
You can do this.
test.js
module.exports = 'alert("Hello")'
main.js
const test = require('./test.js')
module.exports = {
'Test' : function (browser) {
browser
.url('https://google.com')
.execute(test)
}
}