2

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.

WasteD
  • 758
  • 4
  • 24
  • A side question: Is the mix of slashes and backlslashes in url ok? What happens if you replace your backslashes by slashes? – Reporter Oct 19 '20 at 07:07
  • @Reporter I used backslashes because I'm working on windows. Forward slashes work too apparently... – WasteD Oct 19 '20 at 07:56
  • Judging from the screenshot your app runs on IIS it'd be better to see what's happening if you could have a look at the IIS logs. Perhaps the app restarts (recycles) itself and when it does it results with 404. – siaznik Oct 19 '20 at 13:33

1 Answers1

2

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

Zach Bloomquist
  • 5,309
  • 29
  • 44
  • Thank you very much I will try that. Hopefully solves the problem for me and gets fixed with a future release. – WasteD Oct 20 '20 at 07:36
  • I think it works better but sadly the Error still appears sometimes... And when I run all the tests with a .bat-Script the script still gets stopped after the error... So the only thing that I can do is hope that it gets fixed? – WasteD Oct 20 '20 at 12:40
  • 1
    Pretty much @WasteD, 5.4.0 will contain some improvements to the `experimentalSourceRewriting` feature to make it work on more domains. – Zach Bloomquist Oct 20 '20 at 17:29
  • Hmm sadly I'm already using version 5.4.0 and that doesn't solve it for me but thanks. – WasteD Oct 21 '20 at 11:23
  • 1
    Sorry, I meant 5.5.0/5.4.1 - the next release it was a long day. – Zach Bloomquist Oct 21 '20 at 14:57
  • Ok now after the update it seems to be working. I didn't read anything specific in the Changelog I even removed ```experimentalSourceReqriting``` and its still working. – WasteD Nov 11 '20 at 14:55