Is there a way for me to do headless testing with Protractor when I am using a Windows platform?

angularjs, protractor, selenium, selenium-webdriver

Solution

Yes phantomjs works with protractor in Windows. I too have found nearly all online documentation to be *nix specific but getting it working in Windows is very easy. Assuming you already have protractor running with chrome:

Add phantomjs. You can either install the Windows version or install the node module. I suggest the node module because it will simplify build setup if another development environment needs to be set up:

npm install phantomjs --save-dev

Then update your protractor.conf.js to point to phantomjs:

capabilities: {
  browserName: 'phantomjs',
  'phantomjs.binary.path': require('phantomjs').path
},

Note the value of phantomjs.binary.path. All online documentation to date hard codes the value of that path to *nix appropriate values. Using those hardcoded paths in Windows won't resolve to the correct binary. Since we rely on the path property, this configuration will work in both Windows and *nix!

Problem

I am using Protractor to do testing. Can anyone tell me if there is a way for me to change it from using Chrome to doing headless testing. I saw a number of articles about these seem to assume I am using a Linux OS. I am using a Windows machine to do my testing.

Original source