title: Running Angular cli e2e tests in headless Chrome with travis ci
body: <p>I am trying to use Chrome's new headless browser mode to run angular tests on Travis ci but encounter an error when running my protractor e2e tests with <code>npm run e2e</code> (<code>ng e2e</code>). Running my units tests with <code>npm test</code> (<code>ng test --watch=false</code>) works fine though.</p>
  
  <p>Travis Config:</p>
  
  <pre class="lang-yaml prettyprint-override"><code>sudo: false
  dist: trusty
  
  language: node_js
  node_js:
    - '6.11'
  
  addons:
    chrome: stable
  
  install:
    - npm install -g @angular/cli
    - npm install
  
  script:
    - npm test
    - npm run e2e
  
  notifications:
    webhooks:
      on_success: change
      on_failure: always
      on_start: false
  </code></pre>
  
  <p>Protractor Config:</p>
  
  <pre class="lang-js prettyprint-override"><code>const { SpecReporter } = require('jasmine-spec-reporter');
  
  exports.config = {
    allScriptsTimeout: 11000,
    specs: [
      './e2e/**/*.e2e-spec.ts'
    ],
    capabilities: {
      browserName: 'chrome',
      chromeOptions: {
        args: ['--headless', '--disable-gpu', '--window-size=800x600']
      }
    },
    directConnect: true,
    baseUrl: 'http://localhost:4200/',
    framework: 'jasmine',
    jasmineNodeOpts: {
      showColors: true,
      defaultTimeoutInterval: 30000,
      print: function() {}
    },
    onPrepare() {
      require('ts-node').register({
        project: 'e2e/tsconfig.e2e.json'
      });
      jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
    }
  };
  </code></pre>
  
  <p>Travis Error</p>
  
  <pre><code>webpack: Compiled successfully.
  [03:23:26] I/file_manager - creating folder /home/travis/build/kpfromer/smarttodo-angular/node_modules/protractor/node_modules/webdriver-manager/selenium
  [03:23:26] I/update - chromedriver: unzipping chromedriver_2.35.zip
  [03:23:27] I/update - chromedriver: setting permissions to 0755 for /home/travis/build/kpfromer/smarttodo-angular/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.35
  [03:23:27] I/launcher - Running 1 instances of WebDriver
  [03:23:27] I/direct - Using ChromeDriver directly...
  [03:24:27] E/launcher - unknown error: Chrome failed to start: crashed
    (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.14.12-041412-generic x86_64)
  [03:24:27] E/launcher - WebDriverError: unknown error: Chrome failed to start: crashed
    (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.14.12-041412-generic x86_64)
      at WebDriverError (/home/travis/build/kpfromer/smarttodo-angular/node_modules/selenium-webdriver/lib/error.js:27:5)
      at Object.checkLegacyResponse (/home/travis/build/kpfromer/smarttodo-angular/node_modules/selenium-webdriver/lib/error.js:505:15)
      at parseHttpResponse (/home/travis/build/kpfromer/smarttodo-angular/node_modules/selenium-webdriver/lib/http.js:509:13)
      at doSend.then.response (/home/travis/build/kpfromer/smarttodo-angular/node_modules/selenium-webdriver/lib/http.js:440:13)
      at process._tickCallback (internal/process/next_tick.js:109:7)
  From: Task: WebDriver.createSession()
  ...
  </code></pre>