Nightwatch: [question] How to see tests running in the browser?

Created on 1 Mar 2016  Â·  5Comments  Â·  Source: nightwatchjs/nightwatch

When I run nightwatch I do not see the browser window open. This makes it hard to see what the tests are doing and debug in the browser.

Most helpful comment

silent: true will make it silent ;-)

All 5 comments

What is your actual test settings? Which browser are you using?

Usually, if you start the selenium server and use a browser like chrome or internet explorer you should see what is happening.

I am running in chrome with this settings:

{
  "src_folders" : ["specs"],
  "output_folder" : "reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "./globals",

  "selenium" : {
    "start_process" : true,
    "server_path" : "bin/selenium-server-standalone-2.48.2.jar",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "",
      "webdriver.ie.driver" : ""
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://foo..
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    }
  }
}

I'm on OSx. The output only happens on the console. I can't recommend this to wider company unless I can see it running in the browser as our existing selenium solution does this.

silent: true will make it silent ;-)

Hello everyone,

I am having troubles as well seeing the browser. I trigger my tests and they pass (or fail) but never open a browser window... Here you have my nightwatch.conf.js.

require('babel-register')();
const SCREENSHOT_PATH = "./screenshots/";
const BIN_PATH = './node_modules/nightwatch/bin/';

// we use a nightwatch.conf.js file so we can include comments and helper functions
module.exports = {
  "src_folders": [
    "__tests__/e2e/specs"// Where you are storing your Nightwatch e2e tests
  ],
  "output_folder": "./reports", // reports (test outcome) output by nightwatch
  "selenium": { // downloaded by selenium-download module (see readme)
    "start_process": true, // tells nightwatch to start/stop the selenium process
    "start_session" : true,
    "server_path": "./node_modules/nightwatch/bin/selenium.jar",
    "host": "127.0.0.1",
    "port": 4444, // standard selenium port
    "cli_args": { // chromedriver is downloaded by selenium-download (see readme)
      "webdriver.chrome.driver" : "./node_modules/nightwatch/bin/chromedriver"
    }
  },
  "test_settings": {
    "default": {
      "selenium_port"  : 4444,
      "screenshots": {
        "enabled": true, // if you want to keep screenshots
        "path": './screenshots' // save screenshots here
      },
      "globals": {
        "waitForConditionTimeout": 15000 // sometimes internet is slow so wait.
      },
      "desiredCapabilities": { // use Chrome as the default browser for tests
        "browserName": "chrome"
      }
    },
    "chrome": {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true // turn off to test progressive enhancement
      }
    }
  },
}

/**
 * selenium-download does exactly what it's name suggests;
 * downloads (or updates) the version of Selenium (& chromedriver)
 * on your localhost where it will be used by Nightwatch.
 /the following code checks for the existence of `selenium.jar` before trying to run our tests.
 */

require('fs').stat(BIN_PATH + 'selenium.jar', function (err, stat) { // got it?
  if (err || !stat) {
    require('selenium-download').ensure(BIN_PATH, function(error) {
      if (error) throw new Error(error);
      console.log('✔ Selenium & Chromedriver downloaded to:', BIN_PATH);
    });
  }
});

nightwatch version: 0.9.16
selenium standalone server version: 3.3.0
selenium chromedriver version: 2.31

Do you have Docker installed on your machine @davidRuizHernandez? Or some other service running on localhost?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sgleonardoopitz picture sgleonardoopitz  Â·  3Comments

willli666 picture willli666  Â·  3Comments

t00f picture t00f  Â·  3Comments

antogyn picture antogyn  Â·  4Comments

MateuszJeziorski picture MateuszJeziorski  Â·  3Comments