title: Running e2e tests on Sauce Labs from Protractor on Travis
body: <p>So I have my open source project (<a href="https://github.com/ahmednuaman/radian">https://github.com/ahmednuaman/radian</a>) and I have some e2e tests that run fine locally using <a href="https://github.com/angular/protractor">Protractor</a>. </p>
  
  <p>I've followed the <a href="https://saucelabs.com/tests">Sauce Labs docs</a> and set up my <a href="https://github.com/ahmednuaman/radian/blob/feature-23-an/.travis.yml"><code>.travis.yml</code></a> accordingly. The tests run right to the point where Protractor tries to connect to selenium server on Sauce Labs, this is a brief snapshot of the error:</p>
  
  <pre><code>Running "exec:e2e" (exec) task
  Using the selenium server at ahmednuaman-radian:06dd4e07-0f52-4fdf-be5e-389f2117bbf5@localhost:4445
  &gt;&gt; 
  &gt;&gt; timers.js:103
  &gt;&gt; if (!process.listeners('uncaughtException').length) throw e;
  &gt;&gt; ^
  &gt;&gt; TypeError: Cannot read property 'length' of undefined
  &gt;&gt;     at HttpClient.send (/home/travis/.nvm/v0.8.26/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:62:16)
  </code></pre>
  
  <p>Here's the full job log: <a href="https://travis-ci.org/ahmednuaman/radian/jobs/16250460">https://travis-ci.org/ahmednuaman/radian/jobs/16250460</a></p>
  
  <p>So the next thing I did was try to emulate this locally. I read the <a href="https://saucelabs.com/docs/connect">Sauce Labs Connect docs</a> and eventually ran this in my terminal:</p>
  
  <pre><code>java -jar ~/bin/Sauce-Connect.jar USERNAME PASSWORD
  </code></pre>
  
  <p>Everything started fine, <a href="https://travis-ci.org/ahmednuaman/radian/jobs/16250460#L7294">exactly the same as on Travis</a> but as I then ran my <code>grunt e2e</code> task (after updating the <a href="https://github.com/ahmednuaman/radian/blob/feature-23-an/test/e2e/protractor.conf.coffee"><code>protractor.conf.coffee</code></a> to match the Travis config locally) and recieved the same error as Travis had, here's a snapshot:</p>
  
  <pre><code>Running "exec:e2e" (exec) task
  Using the selenium server at ahmednuaman-radian:06dd4e07-0f52-4fdf-be5e-389f2117bbf5@localhost:4445
  &gt;&gt; 
  &gt;&gt; /Users/ahmed/bin/node/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1542
  &gt;&gt;       throw error;
  &gt;&gt;             ^
  &gt;&gt; TypeError: Cannot read property 'length' of null
  &gt;&gt;     at HttpClient.send (/Users/ahmed/bin/node/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:62:16)
  </code></pre>
  
  <p>I had a google around but I couldn't find anyone else with this problem. So, is it my config? Is it a protractor/webdriver issue? Care to shed any light on this?</p>