【问题标题】:Timeout error when try to run testcafe selenium based test using GitLab Pipeline尝试使用 GitLab Pipeline 运行基于 testcafe selenium 的测试时出现超时错误
【发布时间】:2022-06-11 02:49:51
【问题描述】:

我创建了一个 test-café 运行器文件并使用 selenium 网格运行测试。它在我的机器上运行良好,但我们需要使用 GitLab 管道进行相同的操作。

使用管道,我可以连接 selenium 网格服务器,但总是出现超时错误。

登录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)

YAML 文件

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

包.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"
    }
}

任何帮助将不胜感激

【问题讨论】:

    标签: selenium-webdriver gitlab-ci gitlab-ci-runner testcafe


    【解决方案1】:

    TestCafe documentation 声明您将需要使用他们的 docker 映像,或者将 testcafe 安装在具有您将要测试的必要浏览器运行时的映像中。

    【讨论】:

      猜你喜欢
      • 2017-11-01
      • 2016-03-23
      • 2020-11-03
      • 2011-01-25
      • 1970-01-01
      • 1970-01-01
      • 2021-05-26
      • 2013-01-01
      • 2011-12-02
      相关资源
      最近更新 更多