Cypress 无法在 Jenkins 中连接到 Edge/Firefox

问题描述 投票:0回答:1

我创建了一些 VueJS 测试并使用 Cypress 运行。

一切正常,直到我在 Jenkins 上运行它(使用 GITScm 轮询的 GitHub 挂钩触发器)

只有

cypress run --browser chrome
cypress run --browser electron
有效。

使用 Edge 和 Firefox,它返回了这种错误

Still waiting to connect to Edge, retrying in 1 second (attempt 62/62)
Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.

This usually indicates there was a problem opening the Edge browser.

The CDP port requested was 63444.

Error: connect ECONNREFUSED 127.0.0.1:63444
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)

Error: Command failed with exit code 1: npm run cypress:run
    at makeError (C:\ProgramData\Jenkins\.jenkins\workspace\Homepage\node_modules\start-server-and-test\node_modules\execa\lib\error.js:60:11)
    at handlePromise (C:\ProgramData\Jenkins\.jenkins\workspace\Homepage\node_modules\start-server-and-test\node_modules\execa\index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  shortMessage: 'Command failed with exit code 1: npm run cypress:run',
  command: 'npm run cypress:run',
  escapedCommand: '"npm run cypress:run"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

如何在Jenkins中正常运行?预先感谢。

jenkins testing browser cypress
1个回答
0
投票

对于 Firefox,我必须更新到最新版本的 Cypress,目前是(13.5),此外,还必须解决一些防火墙安全问题。 对于 Edge,我还没有找到修复方法;我确实尝试过:https://github.com/cypress-io/cypress/issues/27830 但这没有用。仍在调查中。如果我确实找到了 Edge 的修复程序,我会回来发布。 一件事是,本地 Edge 工作正常,但通过 Jenkins -> Cypress 云却失败了。

© www.soinside.com 2019 - 2024. All rights reserved.