Add new comment

Cypress testing framework visited

Submitted by Erik Wegner on

It is a common pattern in the JavaScript world to check out the Framework of the week. Every now and then a new framework emerges and promises to change the world of programming.

No other words come from the Cypress homepage:

Let's give it a try.


The setup is easy on my Linux box. It actually identifies my Angular project and sets things to the correct start url.


The Angular application requires user authentication for any further action, so upon loading, the app checks for some authentication information and redirects the user to the login provider if necessary.

Because the test is started the first time, redirect to the login application is expected. But: cypress denies to show any other domain within the test run.

Execuse: Only test applications you have full control over.

Workaround: Use some other authentication methods for login. In my case, the keycloak plugin gives some hints for using server side requests, which initialize the login prior to running the tests.

This is bad in my opinion. This does not test my application as an end user would do.

Second drawback

Running the test for the first time logs the user in, opens the page, does some CORS enabled requests from the front end to the API endpoint, job done.

Rerunning the test shows that the login flow fails, because the user is already logged in. Btw.: the login happens server side, so no browser involved here. Easy enough, fire up a Google search and find the documentation for a command called clearCookies. Another result brings up this issue #408: it simply says that it does not work. Which is not as bad as the fact that this issue exists for more than five years now.

Sure, changes to the code can be made, check which response is coming from the login provider. But this again is not the way to write tests with reproducible results in my opinion.

Third topic

Now the login works wonderful in Firefox. Let's switch to Chrome.

The server side code executed by NodeJS on the server side fails to run with Chrome. Why? Why does the frontend bother about things on the server?

Why does Cypress fail to abstract enough from the browser running the tests?

Final thoughts

This seems to be a case of the prettier user interface wins. A test runner has to run tests. Again and again. In many ways. Presenting the results is a smaller part in the process, but seems to be the focus of cypress. It has some opinions how testing works, but I do not see the niche where this fits in my developer life.

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.