I have just started node.js and wrote a simple script and was able to execute it in firefox and trying to run it in chrome browser.
Unable to run a test using chrome browser. Highlighted are sections that has chrome config and test execution commands.
Please let me know how to resolve it.
=====================================================
Here is my nightwatch.json . I have added chrome driver and highlighted the section.
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "commands",
"custom_assertions_path" : "",
"page_objects_path" : [
],
"test_workers" : {
"enabled": false,
"workers": 3
},
"globals_path" : "",
"selenium" : {
"start_process" : false,
"log_path" : "",
"host" : "docker",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "C:\Chromedriver\chromedriver.exe",
"webdriver.ie.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "docker",
"selenium_port" : 4444,
"selenium_host" : "docker",
"silent": true,
"screenshots" : {
"enabled" : true,
"path" : "screenshots"
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
}
}
}
}
i am executing test using this command
C:\root\src\test\selenium\nightwatch>node ./nightwatch -t tests\myTestOn
e.js -e chrome --verbose
=================================================
ERROR SyntaxError: C:\root\src\test\selenium\nightwatch\nightwatch.json:
Unexpected token
at Object.parse (native)
at Object.Module._extensions..json (module.js:430:27)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.CliRunner.readSettings (C:\apps\sm\root\src\test\selenium\nightwat
ch\node_modules\nightwatch\lib\runner\cli\clirunner.js:89:23)
at Object.CliRunner.setup (C:\apps\sm\root\src\test\selenium\nightwatch\node
_modules\nightwatch\lib\runner\cli\clirunner.js:49:8)
at Object.exports.runner (C:\apps\sm\root\src\test\selenium\nightwatch\node_
modules\nightwatch\lib\index.js:541:17)
at C:\apps\sm\root\src\test\selenium\nightwatch\node_modules\nightwatch\bin\
runner.js:9:16
ERROR There was an error while starting the test runner:
Error: No testing environment specified.
at Object.CliRunner.parseTestSettings (C:\apps\sm\root\src\test\selenium\nig
htwatch\node_modules\nightwatch\lib\runner\cli\clirunner.js:441:13)
at Object.CliRunner.setup (C:\apps\sm\root\src\test\selenium\nightwatch\node
_modules\nightwatch\lib\runner\cli\clirunner.js:51:8)
at Object.exports.runner (C:\apps\sm\root\src\test\selenium\nightwatch\node_
modules\nightwatch\lib\index.js:541:17)
at C:\apps\sm\root\src\test\selenium\nightwatch\node_modules\nightwatch\bin\
runner.js:9:16
at Object.exports.cli (C:\apps\sm\root\src\test\selenium\nightwatch\node_mod
ules\nightwatch\lib\index.js:535:5)
at Object.<anonymous> (C:\apps\sm\root\src\test\selenium\nightwatch\node_mod
ules\nightwatch\bin\runner.js:8:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)