Jak wykonać testy kątowe na Chrome ("Proszę ustawić ENV variable CHROME BIN")

Pracuję nad przykładowym projektem Angular wygenerowanym przez yeomana.
Jestem w stanie uruchomić testy karmy lokalnie (ustawiłem zmienną systemową CHROME_BIN, aby wskazywała na binarny chromium, ale można to było zrobić w bardziej elegancki sposób. Tylko szybkie obejście.)

Jednak, gdy próbuję stworzyć udaną kompilację z Travisem, dostaję następujący błąd:]}
ERROR [launcher]: Cannot start Chrome
    Can not find the binary google-chrome
    Please set env variable CHROME_BIN

Wykonałem kroki opisane tutaj (W zasadzie używając generator-travis-ci)
Następnie próbował naprawić to za pomocą tego - mam kolejny błąd:
/home/travis/build.sh: line 142: ./.travis/scripts/install_chrome.sh: Permission denied


Jest to standardowa aplikacja angular stworzona z Yeoman-rzeczy powinny działać po wyjęciu z pudełka, podczas gdy rzeczywistość jest inna ...
Czy ktoś go pomyślnie skonfigurował?


Wersje oprogramowania, z których korzystałem:
user@machine:~/somewhere $ yo -v; grunt --version; bower -v
1.0.4
grunt-cli v0.1.9
grunt v0.4.1
1.2.6

Moja praca: https://travis-ci.org/vucalur/editor-yeoman-test

Author: vucalur, 2013-10-08

4 answers

Obawiam się powiedzieć, że można uruchomić tylko Firefoksa (ponieważ jest już zainstalowany w VM) i PhantomJS (ponieważ jest przenośny i bezgłowy).

Dodaj do pliku .travis.yml, aby uruchomić Firefoksa:

before_install:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"

Wtedy będziesz musiał włączyć Firefoksa jako przeglądarkę karmy w swoich konfiguracjach.

Dokumentacja

 18
Author: gustavohenke,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-10-17 00:11:55

Użyj tego rozwiązania, aby uruchomić go przy użyciu preinstalowanej wersji Chromium w Travis-CI VM: https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076

.travis.yml

  node_js:
  - "0.10"

script: node_modules/karma/bin/karma start test/karma.conf.js --single-run

before_install:
  - export CHROME_BIN=chromium-browser
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
Karma.conf.js
module.exports = function(config) {
  var configuration = {

    /* ... */

    // start these browsers
    browsers: ['Chrome', 'ChromeCanary'],

    customLaunchers: {
      Chrome_travis_ci: {
        base: 'Chrome',
        flags: ['--no-sandbox']
      }
    },

    /* ... */

  };

  if(process.env.TRAVIS){
    configuration.browsers = ['Chrome_travis_ci'];
  }

  config.set(configuration);
};
 28
Author: Jan Paepke,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-05-19 20:46:14

W wydaniu projektu karma-runner ( https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076 ) powinieneś ustawić zmienną środowiskową CHROME_BIN w swoim .travis.yml i skonfigurować customLauncher w konfiguracji pliku karma.

Na przykład, twój .travis.zawartość pliku yml będzie:

language: node_js
node_js:
    - '0.10'
before_script:
    - 'export CHROME_BIN=chromium-browser'
    - 'export DISPLAY=:99.0'
    - 'sh -e /etc/init.d/xvfb start'
    - 'npm install -g bower karma grunt-cli jshint'
    - 'npm install'
    - 'bower install'

I twoja karma.conf.js treść:

module.exports = function(config) {
    config.set({

        // ... your default content

        // This is the new content for your travis-ci configuration test
        //  Custom launcher for Travis-CI
        customLaunchers: {
            Chrome_travis_ci: {
                base: 'Chrome',
                flags: ['--no-sandbox']
            }
        },

        // Continuous Integration mode
        // if true, it capture browsers, run tests and exit
        singleRun: true 
    });

    if(process.env.TRAVIS){
        config.browsers = ['Chrome_travis_ci'];
    }

};

 7
Author: Wilson Mendes,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-10 05:12:16

Opcja 1: APT Addon

Możesz wykonać testy kątowe w Chrome używając APT Addon aby zainstalować pakiet google-chrome-stable i uruchomić go bez użycia Xvfb.

# Set language
language: node_js

# Set version of node
node_js:
  - node

# Set DISPLAY for Xvfb
env:
  - DISPLAY=:99.0

# Use APT Addon to install Chrome
addons:
  apt:
    sources:
      - google-chrome
    packages:
      - google-chrome-stable

# Start Xvfb so you can run headless Chrome
before_install:
  - sh -e /etc/init.d/xvfb start

# Install packages
install:
  - npm install

# Run tests in continuous integration mode
script:
  - ng test --single-run

Opcja 2: Chrome Addon

Alternatywnie, jeśli twoje środowisko wirtualizacji to Linux Trusty lub OS X, możesz użyć dodatku Chrome w trybie headless.

# Use a trusty version of linux
dist: trusty

# Set language
language: node_js

# Set version of node
node_js:
  - node

# Install Chrome addon
addons:
  - chrome: stable

# Install packages
install:
  - npm install

# Run tests in continuous integration mode with headless chrome
script:
  - karma start --single-run  --browsers ChromeHeadless

Aby uruchomić testy e2e, zaktualizuj protractor.conf.js, Aby określić bezgłowy chrome.

capabilities: {
  browserName: 'chrome',

  chromeOptions: {
     args: [ '--headless', '--disable-gpu' ]
   }
}
 4
Author: Courtney Pattison,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-12-05 00:30:16