问题描述
我目前正在尝试自动化测试一个相当大的 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 个规范文件)以及尝试使用以下命令通过控制台运行测试时:.
ode_modules.bincypress run --规范柏树/集成/基础/**/*"--browser chrome
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: .
ode_modules.bincypress 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
配置选项来解决此问题,请阅读此处了解更多信息:https://docs.cypress.io/guides/references/experiments.html#Configuration
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 - 找不到文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!