Reputation: 121
I'm currently trying to run a nightwatch test by passing in the conf.js file via the --config tag. The conf.js file is in the directory below where the nightwatch command will be run from. Looks like this
.
└── project root
├── tests
├── bin
└── selenium.jar
└── chromedriver
└── other
└── nightwatch.conf.js
├── custom-assertions
Relative part of the conf.js file looks like this
"src_folders" : [
"../tests"
],
"custom_commands_path" : "custom-commands",
"selenium": {
"start_process": true,
"server_path": "../bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver" : "../bin/chromedriver"
}
},
The problem i'm having is if I try to run the test from project root with
nightwatch --config other/nightwatch.conf.js --verbose
I get the following error
Starting selenium server... There was an error while starting the
Selenium server:
Error: Unable to access jarfile ../bin/selenium.jar
However, if I run it from the other folder and don't specify the --config (because i'm running it from the folder where the conf lives) it works fine. So i'm thinking i'm doing something wrong but I don't know what. Anyone any ideas?
Other info -
Let me know if I can provide any other info. Thanks Ally
edit changed 'run project from root' to 'run project from project root'
Upvotes: 0
Views: 415
Reputation: 961
You need to adjust your config code to run based on the directory of the package.json
or gulpfile.js
. Try adjusting your code to the following
"src_folders" : [
"tests"
],
"custom_commands_path" : "custom-commands",
"selenium": {
"start_process": true,
"server_path": "bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver" : "bin/chromedriver"
}
},
Upvotes: 1