Protractor can be used with PhantomJS Headless WebKit. The following section is an excerpt of protractor documentation:
To test locally with PhantomJS, you need to either install it globally or relative to your project. For a global installation, see PhantomJS Download Page . For relative installation start: npm install --save-dev phantomjs .
Add phantomjs to the driver features and include the path to the binary if using a 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':'./node_modules/phantomjs/bin/phantomjs', /* * Command line arugments to pass to phantomjs. * Can be ommitted if no arguments need to be passed. * Acceptable cli arugments: https://github.com/ariya/phantomjs/wiki/API- Reference#wiki-command-line-options */ 'phantomjs.cli.args':['--logfile=PATH', '--loglevel=DEBUG'] }
The main workflow can be running tests on phantomjs on a development machine. This allows you to run e2e without the annoying browser window. Tests on other browsers can be run on the continuous integration server. When you develop, you run the test with phantom js before you go. Then you click, the assembly runs on the ci server and runs the tests against different browsers. If one of the tests does not work in a specific browser, you can run it on your dev machine. For example, with chrome:
protractor --browser=chrome
source share