Prr*_*Prr 3 automated-tests node.js circleci e2e-testing testcafe
我正在尝试使用 TestCafe 在 CircleCi 上运行浏览器测试。我遵循了这个文档。主要问题是chrome浏览器打不开。CircleCi 能够成功下载图像,因为通过了自旋环境。
我在 CircleCi 上的下一步(Container circleci/node:11.6.0-browsers)中遇到问题,这会引发错误:
$ _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
Job was canceled
Run Code Online (Sandbox Code Playgroud)
稍后在 UI 测试步骤中抛出此错误:
$ testcafe chrome:headless uitests/tests/* -r xunit:/tmp/test-results/res.xml -e
ERROR Was unable to open the browser "chrome:headless" due to an error.
Error: Unable to run the browser. The browser path or command template is not specified.
at checkBrowserPath$ (/rp-web/node_modules/testcafe-browser-tools/lib/api/open.js:47:23)
at tryCatch (/rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:72:40)
at Generator.invoke [as _invoke] (/rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:334:22)
at Generator.prototype.(anonymous function) [as next] (/rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:105:21)
at tryCatch (/rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:72:40)
at invoke (/rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:146:20)
at /rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:191:11
at new Promise (<anonymous>)
at new F (/rp-web/node_modules/core-js/library/modules/$.export.js:30:36)
at callInvokeWithMethodAndArg (/rp-web/node_modules/testcafe-browser-tools/node_modules/babel-runtime/regenerator/runtime.js:190:16)
Type "testcafe -h" for help.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
Run Code Online (Sandbox Code Playgroud)
这是我的 yml 的样子:
jobs:
build-and-test:
working_directory: /repo
docker:
- image: node:10.5.0
- image: circleci/node:11.6-browsers
Run Code Online (Sandbox Code Playgroud)
另外,尝试了没有沙箱的运行命令,但得到了同样的错误:
testcafe chrome:headless uitests/tests/* -r xunit:/tmp/test results/res.xml -e --no-sandbox
Run Code Online (Sandbox Code Playgroud)
我能够成功地在本地运行,但无法在 CircleCi 上运行。任何人都可以帮助解决这个问题吗?
我认为- image: node:10.5.0从您的配置中删除“ ”行将修复这些错误。我创建了一个示例项目(https://github.com/AndreyBelym/testcafe-example-circle-ci)并配置了 CircleCI 构建(https://circleci.com/gh/AndreyBelym/testcafe-example-circle-ci ) 来测试我的假设。
如果您在构建作业配置中指定多个容器镜像,则第一个镜像将被视为主容器,所有其他镜像将被视为辅助容器。所有构建步骤都在主容器中执行,辅助容器在后台启动,构建步骤只能通过共享网络访问。您可以在选择执行器类型 - 使用多个 Docker 映像中阅读更多相关信息。
您的构建作业配置:
jobs:
build-and-test:
working_directory: /repo
docker:
- image: node:10.5.0
- image: circleci/node:11.6-browsers
Run Code Online (Sandbox Code Playgroud)
意味着您尝试在node:10.5.0未安装任何浏览器的情况下运行 TestCafe 。这就是为什么 TestCafe 找不到浏览器并给您"Error: Unable to run the browser. The browser path or command template is not specified."错误的原因。
也因为它node:10.5.0使用了一个特权较低的特殊用户帐户,所以node:11.6.0-browsers会"_XSERVTransmkdir: ERROR: euid != 0"出现错误,因为它需要管理员特权才能启动 Xvfb - 一个虚拟 X11 服务器(即虚拟桌面)。
| 归档时间: |
|
| 查看次数: |
1996 次 |
| 最近记录: |