I am using Nightwatch.js with phantomjs to run tests in headless mode.
There is a loading icon provided before any page loads.
Issue: Whenever I run tests locally using chrome browser, all tests work fine but when I run same tests in headless mode(using safari here,tried with chrome as well: same result), it just fails at the page with the 'loading' icon always as if the page never loaded completely.
My nightwatch.json looks as follows:
{
"src_folders": [
"test"
],
"output_folder": "./reports",
"page_objects_path": "pages",
"globals_path": "./globals.js",
"selenium": {
"start_process": true,
"server_path": "./node_modules/nightwatch/bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "./node_modules/nightwatch/bin/chromedriver",
}
},
"test_settings": {
"default": {
"silent": true,
"test_workers": true,
"detailed_output": true,
"launch_url": "http://localhost:3000",
"screenshots": {
"enabled": true,
"path": "./screenshots",
"on_error": true,
"on_failure": true
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"headlessMacOSSafari": {
"desiredCapabilities": {
"browserName": "phantomjs",
"javascriptEnabled": true,
"acceptSslCerts": true,
"phantomjs.page.settings.userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12",
"phantomjs.binary.path": "./node_modules/.bin/phantomjs"
}
}
}
}
I have a globals.js file which includes:
waitForConditionTimeout: 15000
which is 15 sec still the tests always fail in headless mode at the same 'loading' icon place but always passes when runs locally.
Any help would be appreciated!