Currently, I am in the process of developing a web application that enables me to execute Nightwatch tests through a visual interface. At this point, I have successfully been able to run all my tests using a post request from my web app utilizing the Nightwatch Programmatic API. My query pertains to whether it is possible for me to specify the folder containing the tests I wish to execute through a post request. Below is the relevant portion of my code, Thank you.
router.post('/exec', function (req, res) {
Nightwatch.cli(function (argv) {
argv.config = 'nightwatch.conf.js';
argv.source= 'folder of tests i want to run';
const runner = Nightwatch.CliRunner(argv);
runner
.setup()
.startWebDriver()
.then(() => {
return runner.runTests()
})
.then(() => {
return runner.stopWebDriver()
})
.catch(err => console.error(err));
});
})