Skip to content

E2E Unit Test : FAQ

Jason Huang edited this page Aug 12, 2015 · 1 revision

FAQ

Run a loop that runs through every browser ?

Testing Against Multiple Browsers

If you would like to test against multiple browsers, use the multiCapabilities configuration option.

multiCapabilities: [{
  'browserName': 'firefox'
}, {
  'browserName': 'chrome'
}]

Protractor will run tests in parallel against each set of capabilities. Please note that if multiCapabilities is defined, the runner will ignore the capabilities configuration.

Reference

Headless browser?

###Setting up PhantomJS

Note: We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers.

In order to test locally with PhantomJS, you'll need to either have it installed globally, or relative to your project. For global install see the PhantomJS download page. For local install run: npm install phantomjs.

Add phantomjs to the driver capabilities, and include a path to the binary if using local installation:

capabilities: {
  'browserName': 'phantomjs',

  /* 
   * Can be used to specify the phantomjs binary path.
   * This can generally be ommitted if you installed phantomjs globally.
   */
  'phantomjs.binary.path': require('phantomjs').path,
  
  /*
   * Command line args to pass to ghostdriver, phantomjs's browser driver.
   * See https://github.com/detro/ghostdriver#faq
   */
  'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
}

Reference

Clone this wiki locally