Cypress.io:服务器错误|404-找不到文件或导演 [英] Cypress.io: Server Error | 404 - File or director not found
问题描述
我目前正在尝试针对大型Web应用程序(DMS)文档管理系统自动化测试.稍微解释一下系统:有一个负载均衡器,它连接到两个前端之一.为了确保在我的测试中不会有任何问题,我直接尝试访问前端.现在是我的问题:
I'm currently trying to automate the test for a pretty big webapplication (DMS) Document Management System. To explain the system a little bit: There is a loadbalancer which connect to one of two frontends. To be sure that will be no problems in my test I directly try to access frontend one. Now to my problem:
当尝试使用Test Runner运行所有测试(大约20个规格文件)时,以及尝试使用以下命令通过控制台运行测试时:.\ node_modules \ .bin \ cypress run-规格柏树/积分/基数/**/*";-浏览器镶边
When trying to run all the tests (around 20 spec-Files) with the Test Runner and also when trying to run the tests via console with the following command: .\node_modules\.bin\cypress run --spec "cypress/integration/Basis/**/*" --browser chrome
有时在 cy.visit()
之后出现服务器错误.该错误还会使控制台上的测试停止运行,并且看起来像使柏树崩溃.错误如下:
Sometimes after a cy.visit()
a Server Error comes up. That error also stops the tests on console from running and looks like it crashes cypress. The error is the following:
由于大多数情况下测试有效,因此资源丢失或其他地方的可能性不大.在大多数情况下,都会出现错误的不同测试.最糟糕的是,我不知道如何重现该错误.看来这个问题只在我身上出现.
It's not possible that the resource is missing or somewhere else because most of the times the test works. Most of the time its a different test where the error comes up. The worst part is that I have no idea how to reproduce that error. And it looks like that problem is only appearing for me.
所以,请告诉我您是否曾经看过此消息,也许您可以帮助我解决此问题.谢谢您的帮助.
So please tell me if you have ever seen this message and maybe you can help me fix this problem. Thank you for your help.
推荐答案
这是由于赛普拉斯(Cypress)中的一个错误引起的,该错误导致使用 window.location.href
和其他 Location
>错误地使用/__/
作为基本URL的方法.
This is caused by a bug in Cypress which causes usages of window.location.href
and other Location
methods to incorrectly use /__/
as the base URL.
您可以尝试启用 experimentalSourceRewriting
配置选项来解决此问题,请在此处阅读更多信息:
You can try enabling the experimentalSourceRewriting
config option to work around this, read here for more info: https://docs.cypress.io/guides/references/experiments.html#Configuration
这篇关于Cypress.io:服务器错误|404-找不到文件或导演的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!