Accelerate Your UI Development

Permanent Limitations of Cypress End-to-end Testing Framework

Cypress is an end-to-end testing framework for web applications. It is used to validate that your web applications UI and backend systems are all working as intended. End-to-end testing is crucial when you need to confirm major functionality in your web app still works after every new code commit. Cypress is great. However, there are some crucial limitations that you, as an architect, need to know prior to getting started with it.

There will never be support for multiple browser tabs

Cypress makes it very clear that they don’t intend on supporting multiple browser tabs testing, ever. The first reason they’ve given for not allowing this functionality is that the tool runs inside the browser. It does not have access to the browser automation APIs to be able to switch browser tabs. The second reason they give is that you should not be testing expected behavior. You should test the thing that is triggering the browser to open a new tab, not the opening tab behavior. In your test, look for the anchor element and the properties configured on it.

Multiple browsers open at the same time are not allowed

You cannot open multiple browsers at the same time using Cypress. This means that if you are, for example, testing a sales bidding app and want to see the UI behavior for two different users in separate browsers, you cannot achieve this in Cypress. Instead, find a way to call the backend API to simulate the actions of another user to a bidding scenario and check the results in your one browser.

You cannot visit two domains of different origin in the same test

You cannot cross origins in a single test. This means that if your test is trying to visit “https://apple.com” and then “https://google.com” in the same test, it will fail. However, if you have separate tests visiting each of those websites, then you are all good. Where would you need the ability to cross domains? You would need it in situations where you want to go through 3rd party authentication like Single Sign On (SSO) or OAuth to log into your web application. For this situation, follow some of the how-tos that Cypress put together to overcome the said limitation.

In summary, know why you are using Cypress

Cypress is a very specialized testing framework. It focuses and performs end-to-end testing incredibly well. It is not an automation tool and does not claim to do a plethora of other actions dealing with browsers; like web indexing, spidering links, application performance testing, UI scripting third party sites. There are other, more specialized tools that do allow you to complete some of the above actions. For example, you can use Puppeteer or (*sigh*) Selenium. At the end of the day, make sure that you are selecting the right tool that approximates your use cases as best as possible.