Karma没有使用travis-ci上的最新firefox

时间:2016-10-08 20:33:39

标签: firefox karma-runner ubuntu-12.04 travis-ci

我正在使用Karma在Travis-ci上运行Jasmine测试套件。我想在最新版本的firefox中测试,并且能够安装最新版本(50.0)。但是,Karma仍在使用firefox的旧版本(38.4)进行测试。

这是我的.travis.yml

language: node_js
node_js:
    - "node"
script: npm test
# sudo is needed to install the newest firefox
sudo: true
before_install:
    - firefox -v
    # install newest firefox
    - sudo add-apt-repository -y ppa:mozillateam/firefox-next
    - sudo apt-get update
    - sudo apt-get install -y firefox
    # Start a display server where all graphical operations happens in memory
    - export DISPLAY=:99.0
    - sh -e /etc/init.d/xvfb start

答案可能是Install Latest Version of Firefox on Travis And Run with Protractor,但我希望没有固定版本号的内容。

1 个答案:

答案 0 :(得分:0)

我没有手动安装最新的Firefox版本,而是发现使用Ubuntu Trusty图像(而不是Precise)与“{最新”版本的Firefox addon一起工作。如下所述:https://docs.travis-ci.com/user/trusty-ci-environment/#Firefox

.travis.yml

sudo: required
dist: trusty
addons:
  firefox: "latest"
before_install:
    # Start a display server where all graphical operations happens in memory
    - export DISPLAY=:99.0
    - sh -e /etc/init.d/xvfb start

输出结果为:

$ export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64'

Installing Firefox latest

0.92s$ wget -O /tmp/firefox-latest.tar.bz2 $FIREFOX_SOURCE_URL

--2016-10-12 10:57:06--  https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64

Resolving download.mozilla.org (download.mozilla.org)... 52.200.112.178

Connecting to download.mozilla.org (download.mozilla.org)|52.200.112.178|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: http://download.cdn.mozilla.net/pub/firefox/releases/49.0.1/linux-x86_64/en-US/firefox-49.0.1.tar.bz2 [following]

--2016-10-12 10:57:06--  http://download.cdn.mozilla.net/pub/firefox/releases/49.0.1/linux-x86_64/en-US/firefox-49.0.1.tar.bz2

Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 65.152.202.202, 65.152.202.185, 2610:18:1440:100::d803:32d9, ...

Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|65.152.202.202|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 55201247 (53M) [application/x-tar]

Saving to: ‘/tmp/firefox-latest.tar.bz2’

100%[======================================>] 55,201,247  81.2MB/s   in 0.6s   

2016-10-12 10:57:06 (81.2 MB/s) - ‘/tmp/firefox-latest.tar.bz2’ saved [55201247/55201247]

> karma start .config/karma.conf.js --single-run

12 10 2016 10:57:42.884:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/

12 10 2016 10:57:42.887:INFO [launcher]: Launching browser Firefox with unlimited concurrency

12 10 2016 10:57:42.896:INFO [launcher]: Starting browser Firefox

12 10 2016 10:57:45.535:INFO [Firefox 49.0.0 (Linux 0.0.0)]: Connected on socket /#33hXRwO5ncbWGpouAAAA with id 49996403