Reputation: 320
When attempting to run my nightwatch project with npm run project_one
, I get this response.
There was an error while starting the test runner:
Error: Cannot read source folder: /Users/BenyJo/examples/tests
at /Users/BenyJo/node_modules/nightwatch/lib/runner/run.js:203:21
at /Users/BenyJo/node_modules/nightwatch/lib/runner/walk.js:97:18
at FSReqWrap.oncomplete (fs.js:153:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] project_one: `nightwatch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] project_one script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Whenever I use any nightwatch command using npm, I get the same error, my Nightwatch config is as follows:
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"selenium" : {
"start_process" : true,
"server_path" : "./bin/selenium_v360.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
I've noticed that in that error, there is no file called, there should be a nightwatch folder in there. /Users/BenyJo/examples/tests
Upvotes: 0
Views: 3112
Reputation: 31
['nightwatch', '--', '--group', "$testSuite", '--env', "$projectEnv"]
.
I've resolved the issue "Error: Cannot read source folder: /"
Executing the command in this two ways:
nightwatch -- --group testSuite --env nameEnv
npm run test -- --group testSuite --env nameEnv
nightwatch -- --test testsFile/testSuite --env default
npm run test -- --test testsFile/testSuite --env default
Keep in mind the double argument lines: "-- --group".
It resolved runner.js
in this way to Nightwatch execution
you can Replace the group or file test in your project and review the test Setting in nighwatch.json
to resolve the parameter --env
or -e
Upvotes: 3
Reputation: 166
Had the same problem, there was a typo in my config file name. It must be named "nightwatch.json" (mine was named "nightwatch.js").
Upvotes: 2