Cypress.io: Server Error | 404 - File or director not found

7.3k views Asked by At

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:

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

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: enter image description here

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.

1

There are 1 answers

6
Zach Bloomquist On BEST ANSWER

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.

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