如何让 travis 在 Chrome 上执行 Angular 测试(“请设置环境变量 CHROME_BIN") [英] How to make travis execute Angular tests on Chrome ("Please set env variable CHROME_BIN")

查看:26
本文介绍了如何让 travis 在 Chrome 上执行 Angular 测试(“请设置环境变量 CHROME_BIN")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个由 yeoman 生成的示例 Angular 项目.
我能够在本地运行业力测试(我将系统变量 CHROME_BIN 设置为指向铬二进制文件,但这可以以更优雅的方式完成.只是一个快速的解决方法.)

I'm working on a sample Angular project generated by yeoman.
I am able to run karma tests locally (I set system variable CHROME_BIN to point to chromium binary, but this could have been done in more elegant way. Just a quick work-around.)

但是,在尝试使用 travis 生成成功构建时,出现以下错误:

However, when attempting to produce a successful build with travis, I get following error:

ERROR [launcher]: Cannot start Chrome
    Can not find the binary google-chrome
    Please set env variable CHROME_BIN

我已按照此处所述的步骤操作(基本上使用 generator-travis-ci)
然后尝试使用 this 修复它 - 出现另一个错误:
/home/travis/build.sh: line 142: ./.travis/scripts/install_chrome.sh: 权限被拒绝

I've followed the steps described here (basically using generator-travis-ci)
Then tried to fix it with this - got another error:
/home/travis/build.sh: line 142: ./.travis/scripts/install_chrome.sh: Permission denied


这是一个使用 Yeoman 创建的标准角度应用程序 - 事情应该开箱即用,而现实则不同......
有人配置成功了吗?


It's a standard angular app created with Yeoman - things should work out of the box, whereas reality is different ...
Has anybody successfully configured it?

<小时>我一直在使用的软件版本:


Software versions I've been using:

user@machine:~/somewhere $ yo -v; grunt --version; bower -v
1.0.4
grunt-cli v0.1.9
grunt v0.4.1
1.2.6

我的 Travis 工作:https://travis-ci.org/vucalur/editor-yeoman-test

my Travis job: https://travis-ci.org/vucalur/editor-yeoman-test

推荐答案

恐怕只能运行 Firefox(因为它已经安装在 VM 中)和 PhantomJS(因为它是可移植和无头的).

I'm afraid to say that you can only run Firefox (because it's already installed in the VM) and PhantomJS (because it's portable and headless).

>

将以下内容添加到您的 .travis.yml 文件中以启动 Firefox:

Add the following into your .travis.yml file to startup Firefox:

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

然后,您只需在配置中启用 Firefox 作为 Karma 浏览器.

Then you'll just have to enable Firefox as a Karma browser in your configs.

文档

这篇关于如何让 travis 在 Chrome 上执行 Angular 测试(“请设置环境变量 CHROME_BIN")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆