将gitlab中的puppeteer与gitlab-ci.yml集成 [英] integrate puppeteer in gitlab with gitlab-ci.yml

查看:94
本文介绍了将gitlab中的puppeteer与gitlab-ci.yml集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在Chrome Puppeteer中进行e2e测试.我正处于将测试集成到开发过程中的理想阶段.

Im currently working on e2e test in Chrome Puppeteer. I am at the stage where it would be ideal to integrate my tests in the development process.

我要完成的工作如下:在每次部署到生产之前,我的测试都是自动运行的.如果部署成功,则部署成功;如果部署失败,则取消部署.

What I want to accomplish is the following: my tests run automated before every deploy to production. If they succeed deployment goes through, if they fail deployment is canceled.

我在gitlab上使用管道来自动化部署过程.所以我的主要问题是如何将我的操纵p测试集成到gitlab-ci.yml文件中?

I use a pipeline on gitlab to automate my deployment process. So my main question is how can I integrate my puppeteer tests into the gitlab-ci.yml file?

推荐答案

这可能有点破解,但是我的运行方式是这样的:

This might be a bit of a hack but mine are running like this:

test:
image: node:latest
stage: run
script:
- apt-get update
- apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- yarn
- yarn test

那些超长的库列表是木偶发布Chrome所需的库.理想情况下,您将拥有一个就绪的泊坞窗映像,但我发现的所有预制映像都不适用于我.

That super long list of libraries are the ones that the puppeteer needs to launch chrome. Ideally you would have a ready docker image but all the premade ones I found did not work for me.

准备生产时,您应该构建自己的映像,该映像取自节点并安装依赖项本身.

When getting ready for prod you should build your own image that takes from node and installs the dependencies itself.

这篇关于将gitlab中的puppeteer与gitlab-ci.yml集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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