尝试使用gitlab管道运行基于testcafe硒的测试时超时错误
我创建了一个测试式赛跑者文件,并使用硒网格运行测试。它可以从我的机器上工作正常,但是我们需要使用GitLab管道进行相同的操作。
使用管道,我能够与Selenium Grid Server连接,但始终会出现超时错误。
当我登录Selenium节点服务器进行检查时,我可以看到TestCafe打开Chrome浏览器实例,但无法开始测试。
这是我的管道错误:
Selenium server address is set to: http://myserver:4444/wd/hub
Error: Unable to open the "selenium:chrome" browser due to the following error:
WebDriverError: unknown error: net::ERR_CONNECTION_TIMED_OUT
(Session info: chrome=102.0.5005.[63](https://gitlab.com/automation-test/load-testing/-/jobs/2556429847#L63))
at Object.throwDecodedError (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/error.js:522:15)
at parseHttpResponse (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/http.js:549:13)
at Executor.execute (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/http.js:475:28)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
at Object.execute (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/webdriver.js:735:17)
at BrowserConnection._runBrowser (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/testcafe/src/browser/connection/index.ts:214:32)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
文件
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
stages:
- deploy
e2e_tests:
stage: deploy
tags:
- shell-executor
image: node:12.13.0-alpine
before_script:
- npm install
script:
- node testcafe_runner.js
包。
{
"name": "TestCafe-TestRunner",
"version": "0.0.0",
"license": "MIT",
"private": true,
"devDependencies": {
"testcafe":"1.18.6",
"testcafe-browser-provider-selenium":"1.2.0",
"testcafe-reporter-html":"^1.4.4",
"testcafe-reporter-xunit":"^2.1.0",
"find-free-port":"2.0.0",
"node-cmd":"^3.0.0",
"internal-ip":"6.2.0",
"fs-extra":"^6.0.1",
"csv-parser":"^2.3.2",
"csv-writer":"^1.6.0"
}
}
yaml
I created a test-café runner file and running a test using selenium grid. Its working fine from my machine but we need to do same operation using GitLab pipeline.
Using pipeline, I am able to connect with selenium grid server but always getting Time-out error.
When I logged into the selenium node server to check, I can see that testcafe open a chrome browser instance but not able to start the test.
Here is my pipeline error:
Selenium server address is set to: http://myserver:4444/wd/hub
Error: Unable to open the "selenium:chrome" browser due to the following error:
WebDriverError: unknown error: net::ERR_CONNECTION_TIMED_OUT
(Session info: chrome=102.0.5005.[63](https://gitlab.com/automation-test/load-testing/-/jobs/2556429847#L63))
at Object.throwDecodedError (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/error.js:522:15)
at parseHttpResponse (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/http.js:549:13)
at Executor.execute (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/http.js:475:28)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
at Object.execute (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/selenium-webdriver/lib/webdriver.js:735:17)
at BrowserConnection._runBrowser (/etc/gitlab-runner/builds/1idHsSdk/0/automation-test/load-testing/node_modules/testcafe/src/browser/connection/index.ts:214:32)
at processTicksAndRejections (internal/process/task_queues.js:88:5)
YAML File
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
stages:
- deploy
e2e_tests:
stage: deploy
tags:
- shell-executor
image: node:12.13.0-alpine
before_script:
- npm install
script:
- node testcafe_runner.js
Package.json
{
"name": "TestCafe-TestRunner",
"version": "0.0.0",
"license": "MIT",
"private": true,
"devDependencies": {
"testcafe":"1.18.6",
"testcafe-browser-provider-selenium":"1.2.0",
"testcafe-reporter-html":"^1.4.4",
"testcafe-reporter-xunit":"^2.1.0",
"find-free-port":"2.0.0",
"node-cmd":"^3.0.0",
"internal-ip":"6.2.0",
"fs-extra":"^6.0.1",
"csv-parser":"^2.3.2",
"csv-writer":"^1.6.0"
}
}
Any help would be much appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
testcafe文档或在图像中安装
testcafe
,并带有您将要测试的必要浏览器运行时间。The TestCafe documentation states that you will need to use their docker image, or install
testcafe
in an image with the necessary browser runtimes you will be testing against.