如何添加 chrome 二进制文件以运行,例如在 CI 服务器上对 headless chrome 进行 Karma 测试 [英] How to add the chrome binary to run e.g. Karma tests on headless chrome on a CI server

查看:25
本文介绍了如何添加 chrome 二进制文件以运行,例如在 CI 服务器上对 headless chrome 进行 Karma 测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢在无头 chrome 上运行我的业力单元测试.在我的机器上使用 karma-chrome-launcher 并将浏览器设置为ChromeHeadless".但在 CI 服务器上,它会失败并显示消息您的平台上的 ChromeHeadless 浏览器没有二进制文件".无法在 CI 机器上安装 chrome.还有另一种加载chrome二进制文件的方法吗?例如,google puppeteer 模块似乎在运行时加载了该模块.来自文档:Puppeteer 下载并使用特定版本的 Chromium".我怎样才能达到同样的效果?

解决方案

你可以使用 Puppeteer (headlessChromium),请遵循这些说明.p>

I like to run my karma unit tests on a headless chrome. Using karma-chrome-launcher and setting the browser to "ChromeHeadless" works on my machine. But on the CI server it fails with the message "No binary for ChromeHeadless browser on your platform." Installing chrome on the CI machine is not possible. Is there another way to load the chrome binaries? for example the google puppeteer module seems to load that when run. from the docs: "Puppeteer downloads and uses a specific version of Chromium". How can i achieve the same?

解决方案

You can use Puppeteer (headless Chromium), follow these instructions.

这篇关于如何添加 chrome 二进制文件以运行,例如在 CI 服务器上对 headless chrome 进行 Karma 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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