Closed Sly777 closed 9 years ago
Could you run grunt nightwatch --verbose
and paste the output here?
Hi @pateketrueke, result is below.
Running tasks: e2eTest
Running "e2eTest" task
Running "nightwatch" task Reading ../../StaticWeb/nightwatchSettings.json...OK Parsing ../../StaticWeb/nightwatchSettings.json...OK
Custom JSON-file: ../../StaticWeb/nightwatchSettings.json Task options {"standalone":true,"jar_path":null,"jar_url":"http://selenium-release.storage.go ogleapis.com/2.44/selenium-server-standalone-2.44.0.jar","jar_version":"2.44.0", "config_path":"../../StaticWeb/nightwatchSettings.json"} Using already downloaded Selenium from C:\grunt-nightwatch\selenium-server-standalone-2.44.0.jar Starting selenium server... started - PID: 5284 Fatal error: Cannot read property '1' of null
Execution Time (2015-03-02 07:42:24 UTC) loading tasks 10ms █ 1% nightwatch 1.5s ███████████████████████████████████████████████ 99% Total 1.5s
Have you tried Nightwatch standalone for running your tests before?
@pateketrueke yeah. It works standalone but not with grunt. i tried the sample of grunt-nightwatch also it doesn't work too.
@pateketrueke This is closed, but has it made it into the master (and subsequently the NPM module)? Using NPM on my project, and if the above actually fixes this issue, it'd be great if it were included in all distributions.
Thanks!
EDIT: I see the fix in the source from NPM, but I am getting the same error as described above... I'll continue looking, but may add a new issue.
I ran into this issue with 0.4.6, if I have config_path in options
Can you paste your output using the --verbose
please?
Running tasks: nightwatch
Running "nightwatch" task Reading c:\Users\mxx\main\client/nightwatch.json...OK Parsing c:\Users\mxx\main\client/nightwatch.json...OK Reading ./nightwatch.json...OK Parsing ./nightwatch.json...OK
Custom JSON-file: ./nightwatch.json Task options {"standalone":false,"jar_path":null,"jar_url":"http://selenium-release.storage.g oogleapis.com/{x}.{y}/selenium-server-standalone-{x}.{y}.{z}.jar","jar_version": "2.45.0","config_path":"./nightwatch.json"} Settings for default {"src_folders":["src\test\selenium\spec"],"output_folder":"test_reports\sele nium","test_settings":{"default":{"silent":true,"output":true,"launch_url":"http ://localhost:3002/","selenium_port":4444,"selenium_host":"localhost","screenshot s":{"enabled":false,"path":"."},"desiredCapabilities":{"browserName":"firefox"," javascriptEnabled":true,"acceptSslCerts":false}},"chrome":{"desiredCapabilities" :{"browserName":"chrome","javascriptEnabled":true,"acceptSslCerts":false}}},"cus tom_commands_path":".","custom_assertions_path":".","page_objects_path":".","glo bals_path":".","selenium":{"start_process":true,"server_path":"selenium-server-s tandalone-2.45.0.jar","log_path":".","host":"localhost","port":4444,"cli_args":{ "webdriver.chrome.driver":".","webdriver.ie.driver":"."}}} Fatal error: Cannot read property '1' of null
Gruntfile configuration
nightwatch: {
options: {
config_path: './nightwatch.json'
},
hub: {
config_path: './nightwatch-hub.json'
}
}
No error if I comment out config_path. It picks up the default nightwatch.json
nightwatch: {
options: {
//config_path: './nightwatch.json'
},
hub: {
config_path: './nightwatch-hub.json'
}
}
Actually grunt-nightwatch
will always pick up the nightwatch.json
file in the current working directory.
Try to rename your file and try with config_path
again.
Same error after changing to use nightwatch-hub.json
Running tasks: nightwatch
Running "nightwatch" task Reading c:\Users\hyau\mcs\mcs_platform-ui\main\client/nightwatch.json...OK Parsing c:\Users\hyau\mcs\mcs_platform-ui\main\client/nightwatch.json...OK Reading ./nightwatch-hub.json...OK Parsing ./nightwatch-hub.json...OK
Custom JSON-file: ./nightwatch-hub.json Task options {"standalone":false,"jar_path":null,"jar_url":"http://selenium-release.storage.g oogleapis.com/{x}.{y}/selenium-server-standalone-{x}.{y}.{z}.jar","jar_version": "2.45.0","config_path":"./nightwatch-hub.json"} Settings for default {"src_folders":["src\test\selenium\spec"],"output_folder":"test_reports\sele nium","test_settings":{"default":{"silent":true,"output":true,"launch_url":"http ://localhost:3002/","selenium_port":4444,"selenium_host":"abc.xxx.c om","screenshots":{"enabled":false,"path":"."},"desiredCapabilities":{"browserNa me":"firefox","javascriptEnabled":true,"acceptSslCerts":false}},"chrome":{"desir edCapabilities":{"browserName":"chrome","javascriptEnabled":true,"acceptSslCerts ":false}}},"custom_commands_path":".","custom_assertions_path":".","page_objects _path":".","globals_path":".","selenium":{"start_process":false,"server_path":"s elenium-server-standalone-2.45.0.jar","log_path":".","host":"localhost","port":4 444,"cli_args":{"webdriver.chrome.driver":".","webdriver.ie.driver":"."}}} Fatal error: Cannot read property '1' of null
Fine without grunt
$ nightwatch -c ./nightwatch-hub.json
Running: Demo test Google ✔ Element
was visible after 448 milliseconds. ✔ Element <button[name=btnG]> was visible after 215 milliseconds. ✔ Testing if element <#main> contains text: "Night Watch".OK. 3 assertions passed. (1m 36s / 96887ms)
I'm not sure, but you can try this?
config_path: path.resolve('./nightwatch-hub.json')
If that works then the grunt
task isn't resolving the config_path
before apply other path-related fixes.
(Please note I am on Windows)
Running tasks: nightwatch
Running "nightwatch" task Reading c:\Users\mxx\main\client/nightwatch.json...OK Parsing c:\Users\mxx\main\client/nightwatch.json...OK Reading c:\Users\mxx\main\client\nightwatch-hub.json...OK Parsing c:\Users\mxx\main\client\nightwatch-hub.json...OK
Custom JSON-file: c:\Users\mxx\main\client\nightwatch-hub.json Task options {"standalone":false,"jar_path":null,"jar_url":"http://selenium-release.storage.g oogleapis.com/{x}.{y}/selenium-server-standalone-{x}.{y}.{z}.jar","jar_version": "2.45.0","config_path":"c:\Users\mxx\main\client\nig htwatch-hub.json"} Settings for default {"src_folders":["src\test\selenium\spec"],"output_folder":"test_reports\sele nium","test_settings":{"default":{"silent":true,"output":true,"launch_url":"http ://localhost:3002/","selenium_port":4444,"selenium_host":"abc.xxx.c om","screenshots":{"enabled":false,"path":"."},"desiredCapabilities":{"browserNa me":"firefox","javascriptEnabled":true,"acceptSslCerts":false}},"chrome":{"desir edCapabilities":{"browserName":"chrome","javascriptEnabled":true,"acceptSslCerts ":false}}},"custom_commands_path":".","custom_assertions_path":".","page_objects _path":".","globals_path":".","selenium":{"start_process":false,"server_path":"s elenium-server-standalone-2.45.0.jar","log_path":".","host":"localhost","port":4 444,"cli_args":{"webdriver.chrome.driver":".","webdriver.ie.driver":"."}}} Fatal error: Cannot read property '1' of null
I'm having the same issue when I try to setup grunt-nightwatch to use the nightwatch.json file.
I get the following error
module.js:338 throw err; ^ Fatal error: Cannot read property '1' of null
@Sly777, I fixed my issue. it's nothing to do with grunt-nightwatch. Just want to check with you if you have a nightwatch installed as part of your dependency or dev-dependency, or it's just installed globally?
_I wanted to shrinkwrap my packages and when I executed that command I got a warning message stating missing a dependency night watch for grunt-nightwatch. I had night watch installed globally but for some reason grunt-nightwatch is looking for nightwatch inside node_modules, after installing the package and removing the configpath from my options the grunt nightwach task executed without any errors
Check if this solution works for you.
Still noticing this. "Fatal error: Cannot read property '1' of null" when I specify the config. Default is fine, just fyi =) Thanks for writing this!
@ryan-schroeder @vchouhan Cannot read property '1' of null was fixed with https://github.com/gextech/grunt-nightwatch/commit/2ce088193d3a6f56b23f28d07120be5aa77a4d27, it was an error while printing an error :)
Really the bug was fixed? I have this issue.
@DiegoTonini are you testing the latest versions?
Please share the code you're using.
Hi,
Today, i added it to my gruntfile but it always give error. I cannot find why give this error.
'Starting selenium server... started - PID: 11340 Fatal error: Cannot read property '1' of null'.
Nightwatch.json
gruntfile setting
grunt version: 0.4.5 grunt-cli version: 0.1.13
nightwatch & grunt-nightwatch: last version