javascript - 如何配置赛普拉斯等待更长时间(或无限期)BaseUrl?
问题描述
我正在使用这个赛普拉斯图像docker-compose.yml
来运行端到端测试:cypress/included:6.1.0
当测试运行程序启动时,它将验证是否可以在baseUrl
. 如果没有,它会重试 3 次。
我的服务和 Web 服务器需要更多时间才能启动。
如何增加此检查的超时和/或重试次数。
最好,在我的情况下,我想要一个重试直到成功的策略,即无限期重试/等待。
我已经更普遍地检查了超时部分和cypress.json
文档。但是,这些超时或重试似乎都与此行为无关。
有这个设置吗?
澄清:这不是我实施(或想要)作为我规范的一部分的检查。据我所知,这是cyprus run
图像中默认命令的一个特性。如果可能的话,我想在不添加或修改测试本身的情况下对其进行配置。
这是 cypress 在容器中启动时的 docker-compose 控制台输出:
cypress_1 | Cypress could not verify that this server is running:
cypress_1 |
cypress_1 | > http://localhost:5000
cypress_1 |
cypress_1 | We are verifying this server because it has been configured as your `baseUrl`.
cypress_1 |
cypress_1 | Cypress automatically waits until your server is accessible before running tests.
cypress_1 |
cypress_1 | We will try connecting to it 3 more times...
cypress_1 | We will try connecting to it 2 more times...
cypress_1 | We will try connecting to it 1 more time...
cypress_1 |
cypress_1 | Cypress failed to verify that your server is running.
cypress_1 |
cypress_1 | Please start this server and then run Cypress again.
cypress_1 exited with code 1
解决方案
cypress run
在使用诸如wait-on或start-server-and-test 之类的实用程序调用之前,您应该确保您的服务器正在运行。
Cypress 的检查baseUrl
是最后的礼貌检查,这样您就不会在未运行的服务器上运行整个测试套件。
有关在运行赛普拉斯之前确保服务器正在运行的提示,请在此处查看赛普拉斯文档:https ://on.cypress.io/continuous-integration#Boot-your-server
推荐阅读
- javascript - 从 Javascript 变量中提取特定的 HTML 容器
- java - Java Map Reduce 拆分方法
- postgresql - postgrest 检索排名结果
- localization - Golang web框架Iris中的动态设置语言
- asp.net-core - 如何在 Asp.net Core 的登录过程中为“记住我”设置单独的 cookie 超时?
- file - 我如何从一个非常大的文件(1127k)的中间读取。部件
- python - 网络使用 python 抓取扑克游戏历史日志以获取统计信息
- c - ftell() 函数给出错误答案
- r - 如果 R data.table 中只有一个唯一值,则检查唯一值并返回它的最快方法
- node.js - 为什么“请求”类型上不存在发生的属性“用户”
'