赛普拉斯无法验证设置为"baseUrl"的服务器正在运行: [英] Cypress could not verify that the server set as your 'baseUrl' is running:

查看:151
本文介绍了赛普拉斯无法验证设置为"baseUrl"的服务器正在运行:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从使用网络浏览器的计算机访问xxxx.com:8089,该计算机也正在容器上运行,但远程计算机不同.一切都好.我的cypress.json

I can reach from my computer with web browser to xxxx.com:8089 which is running on a container too but different remote machine. Everything is fine. My cypress.json

"baseUrl":" http://xxxx.com:8089 "是这个.

"baseUrl": "http://xxxx.com:8089" is this.

我正在尝试运行docker容器以使用Cypress进行测试:

I am trying to run docker container to run tests with Cypress :

docker run --rm --name burak --ipc="host" -w /hede -v         /Users/kurhanb/Desktop/nameoftheProject:/hede'  cypress  /bin/bash -c    cypress run --browser chrome && chmod -R 777 . --reporter mochawesome --reporter-options --reportDir=Users/kurhanb/Desktop/CypressTest overwrite=false

它给了我:

Cypress无法验证设置为"baseUrl"的服务器正在运行:

Cypress could not verify that the server set as your 'baseUrl' is running:

http://xxxx.com

您的测试可能会向此"baseUrl"发出请求,并且如果您不启动服务器,这些测试将失败.

Your tests likely make requests to this 'baseUrl' and these tests will fail if you don't boot your server.

所以基本上,我可以从计算机上访问,但是容器不能访问?

So basically, I can reach from my computer but container can not ?

推荐答案

Cypress会给您该错误,因为在Cypress启动时,您的应用程序尚未准备好开始响应请求.

Cypress is giving you that error because at the time that Cypress starts, your application is not yet ready to start responding to requests.

比方说,您的应用程序需要10秒钟来设置并开始响应请求.如果您同时启动应用程序和赛普拉斯,则赛普拉斯将在最初的十秒钟内无法访问您的应用程序.而是无限期地等待该应用程序上线,赛普拉斯将退出并告诉您您的应用程序尚未上线.

Let's say your application takes 10 seconds to set up and start responding to requests. If you start your application and Cypress at the exact same time, Cypress will not be able to reach your application for the first ten seconds. Rather then wait indefinitely for the app to come online, Cypress will exit and tell you that your app is not yet online.

解决此问题的方法是在赛普拉斯上电之前确保Web服务器正在运行.赛普拉斯文档中提供了一些有关如何实现此目标的示例:

The way to fix this problem is to make sure that your web server is serving before Cypress ever turns on. The Cypress docs have some examples of how you can make this happen: https://docs.cypress.io/guides/guides/continuous-integration.html#Boot-your-server

这篇关于赛普拉斯无法验证设置为"baseUrl"的服务器正在运行:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆