【发布时间】:2020-08-06 02:20:32
【问题描述】:
几个月前,我使用 codeceptjs/puppeteer 在 gitlab 上做了一些测试。我的测试有 0 个问题。今天早上我醒来,每个应用程序的每一个测试在应用程序开始之前就失败了。超过 4 周没有更新任何测试。直到现在,它们都自己运行良好。
现在我每次在第一次测试开始之前都会收到这个错误
`example -- user inserts text and html macro :heavy_multiplication_x: "before each" hook: codeceptjs.before for "user inserts text and html macro" in 13ms Error: Failed to launch the browser process!`
我不知道是什么原因造成的。我做了一些谷歌搜索,所有以前的问题都说在配置中添加"args": ["--no-sandbox", "--disable-setuid-sandbox"] 可以解决这个问题,但我的配置文件中已经有了。它已经在我的配置文件中几个月了。不知道昨晚和今晚之间发生了什么变化。这是我的 gitlab-ci.yml 文件
`image: node:latest
all_tests:
script:
- apt-get update && apt-get install -yq libgconf-2-4
- apt-get update && apt-get install -y wget --no-install-recommends && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && apt-get update && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont --no-install-recommends && rm -rf /var/lib/apt/lists/* && apt-get purge --auto-remove -y curl && rm -rf /src/*.deb
- npm install
- npm i codeceptjs-puppeteer
- npm i codeceptjs puppeteer
- ln -sf ./node_modules/.bin/codeceptjs /usr/local/bin/codeceptjs
- npm i --save arrify
- ./node_modules/.bin/codeceptjs run --steps
cache:
paths:
- ./node_modules/.bin/codeceptjs
after_script:
- echo "Cleaning up"
- rm -rf "%CACHE_PATH%/%CI_PIPELINE_ID%"
`
几个月前,我从 gitlab 上的一个 repo 中提取了它,因为我不知道如何构建一个正常工作的 puppeteer 测试。 codeceptjs/puppeteer 有一个配置文件,这里是内容
`exports.config = {
tests: './tests/test_test.js',
output: './output',
helpers: {
Puppeteer: {
url: 'http://localhost',
show: false,
chrome: {
"args": ["--no-sandbox", "--disable-setuid-sandbox"]
}
}
},
include: {
I: './steps_file.js',
login: './pages/login.js',
confluence: './pages/confluence.js',
editor: './pages/editor.js',
},
bootstrap: null,
mocha: {},
name: 'cloud ME user'
};`
所以是的,这个配置几个月来对我来说都很好,直到昨晚突然失败了。我读到的所有内容都说我需要指定 chrome 是无头的,但我已经尝试过了。几个月前我试过了。有人知道是什么原因造成的吗?
【问题讨论】:
-
您的项目是否公开?我想看看我是否可以复制这个问题。
标签: docker gitlab gitlab-ci puppeteer codeceptjs