How to add the chrome binary to run e.g. Karma tests on headless chrome on a CI server

血红的双手。 提交于 2019-12-13 11:59:19

问题


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?


回答1:


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




回答2:


If what you fear is that download from the internet might be slow, you can tell puppeteer where to download chrome from and use a local address.

Use PUPPETEER_DOWNLOAD_HOST to specify where to download Chrome from and PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to skip downloading Chrome altogether.

You can read more about this in the documentation.



来源:https://stackoverflow.com/questions/45881228/how-to-add-the-chrome-binary-to-run-e-g-karma-tests-on-headless-chrome-on-a-ci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!