From fe962eb4a20820dc715c102cf867b896c1ead7bf Mon Sep 17 00:00:00 2001 From: ikedam Date: Sun, 23 Feb 2020 16:40:47 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20Make=20TravisCI=20run=20wi?= =?UTF-8?q?th=20headless=20chrome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 -- gulp/e2e-tests.js | 6 +++++- protractor-headless.conf.js | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 protractor-headless.conf.js diff --git a/.travis.yml b/.travis.yml index e924162..0877b86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ before_install: - echo 'Europe/Bratislava' | sudo tee /etc/timezone - sudo dpkg-reconfigure --frontend noninteractive tzdata - export CHROME_BIN=/usr/bin/google-chrome - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - sudo apt-get update - sudo apt-get install -y libappindicator1 fonts-liberation - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb diff --git a/gulp/e2e-tests.js b/gulp/e2e-tests.js index fb7b8f2..e5ee3f3 100644 --- a/gulp/e2e-tests.js +++ b/gulp/e2e-tests.js @@ -19,7 +19,11 @@ function runProtractor (done) { gulp.src(path.join(conf.paths.e2e, '/**/*.spec.js')) .pipe($.protractor.protractor({ - configFile: 'protractor.conf.js', + configFile: ( + !process.env.TRAVIS + ? 'protractor.conf.js' + : 'protractor-headless.conf.js' + ), args: args })) .on('error', function (err) { diff --git a/protractor-headless.conf.js b/protractor-headless.conf.js new file mode 100644 index 0000000..9778d01 --- /dev/null +++ b/protractor-headless.conf.js @@ -0,0 +1,15 @@ +// https://angular.io/guide/testing#configure-cli-for-ci-testing-in-chrome +const config = require('./protractor.conf').config; +config.capabilities = { + browserName: 'chrome', + chromeOptions: { + args: [ + "--headless", + "--disable-gpu", + "--no-sandbox", + "--disable-dev-shm-usage", + "--window-size=800,600" + ] + } +}; +exports.config = config;