首页 > 解决方案 > 赛普拉斯 UI 测试因等待浏览器而超时

问题描述

我正在AzureDevOpsCI/CD 中运行赛普拉斯 UI 测试,并且大多数 UI 测试都失败了。几天前,所有测试都运行良好。它抛出一个Timed out waiting for the browser to connect. Retrying.错误:关于如何解决问题的任何建议。

环境详细信息: Cypress 版本:3.4.1,节点:10.x,Azure DevOps CI/CD

Running: report/send-report.spec.js...                         (12 of 14) 
2019-10-10T00:47:31.0294852Z 
2019-10-10T00:47:31.0295427Z Warning: Cypress can only record videos when using the built in 'electron' browser.
2019-10-10T00:47:31.0295707Z 
2019-10-10T00:47:31.0296579Z You have set the browser to: 'chrome'
2019-10-10T00:47:31.0296837Z 
2019-10-10T00:47:31.0297613Z A video will not be recorded when using this browser.
2019-10-10T00:47:31.0313740Z (node:4030) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit
2019-10-10T00:48:01.0316223Z 
2019-10-10T00:48:01.0592004Z Timed out waiting for the browser to connect. Retrying...
2019-10-10T00:48:31.0587550Z 
2019-10-10T00:48:31.0839142Z Timed out waiting for the browser to connect. Retrying again...
2019-10-10T00:49:01.0877330Z 
2019-10-10T00:49:01.1241198Z The browser never connected. Something is wrong. The tests cannot run. Aborting...

标签: node.jscypress

解决方案


我注意到您已将重试值设置为 2 以启用在失败时立即重试,而不是继续进行下一个测试。所以我建议您更改该值并检查错误是否仍然存在。

您可以尝试另一种解决方法,将numTestsKeptInMemory50 更改为类似10. 这是官方文档。https://docs.cypress.io/guides/references/configuration.html#Global

此外,这似乎是一个偶然的错误。因为有些用户在第一个管道上失败了,但在第二个管道上成功了。而这应该是cypress本身或者你系统内存的问题,你可以直接向cypress报告这个问题。

这是关于 cypress-io/cypress 的链接。https://github.com/cypress-io/cypress/issues/

这是有关相同错误消息的链接。https://github.com/cypress-io/cypress/issues/1305


推荐阅读