Hi All,
I am using Nightwatch along with Gulp to run my tests. Right now I am running my test with the command "gulp local:e2e" or "gulp preprod:e2e".
When i run this command it runs all the test files inside test folder.
What I want to is the ability to run only a single test file if I want to ,something like this "gulp local:e2e <<testfilename.js>>
Here is how my nightwatch.json and gulpfile.js files are configured.
What changes should I make to my nightwatch,json and what type of new tasks should i add to my gulpfile.js to achieve what i desire.
Please help.
nightwatch.json
{
"src_folders": ["tests"],
"output_folder": "reports",
"custom_commands_path": "",
"custom_assertions_path": "",
"page_objects_path": "",
"globals_path": "",
"selenium" : {
"start_process" : true,
"server_path" : "./node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.47.1.jar",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "drivers/chromedriver",
"webdriver.ie.driver" : ""
}
},
"test_settings": {
"chrome": {
"selenium_port": 4444,
"globals": {
"platform": "desktop"
},
"screenshots": {
"enabled": true,
"on_failure": true,
"on_error": true,
"path": "screenshots/chrome"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"local": {
"selenium_port": 4444,
"selenium_host": "127.0.0.1",
"globals": {
"platform": "desktop"
},
"screenshots": {
"enabled": true,
"on_failure": true,
"on_error": true,
"path": "screenshots/chrome"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
gulpfile.js
var gulp = require('gulp'),
nightwatch = require('gulp-nightwatch');
gulp.task('test:e2e', function() {
process.env.seleniumon = 'cloud'
return gulp.src('')
.pipe(nightwatch({
configFile: 'nightwatch.json',
cliArgs: ['--env chrome']
}));
});
gulp.task('local:e2e', function() {
process.env.seleniumon = 'local'
return gulp.src('')
.pipe(nightwatch({
configFile: 'nightwatch.json',
cliArgs: ['--env local']
}));
});