0

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!

Smriti
  • 1,552
  • 3
  • 15
  • 29
  • Is there a way to collect output of PhantomJS's [page.onError](http://phantomjs.org/api/webpage/handler/on-error.html) callback? Also - is PhantomJS the latest version? – Vaviloff Jan 30 '17 at 10:51
  • @Vaviloff: i am not able to launch application (running against localhost). I get a blank see. phantomjs page.onError gives: "You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your production build." – Smriti Feb 09 '17 at 14:13

0 Answers0