koral
koral

Reputation: 2955

cypress fails tests randomly in headless mode but all passes all tests in real browse

I use Cypress 9.5 to test application in Angular 13. As a backend I have local server in PHP.

I have bunch of tests. When I run them in browser they all pass several times. When I run in headless mode they fail quite randomly. In both cases I use built-in electron browser.

In my tests I have log in as command using cy.request and storing required user data in sessionStorage. Then when I want to visit main page - login dialog appears.

How can I debug this to find a root cause?

Hint: watching videos from tests I can observe big lags in refreshing rendered image comparing to real browser.

Upvotes: 4

Views: 2861

Answers (2)

Abhishek Gautam
Abhishek Gautam

Reputation: 1767

Remove the video:true

from the cypress.config.js (v10) or cypress.json in version less than 10.

Try hitting the test in headless mode, the test will run without any errors.

Upvotes: 2

lazurey
lazurey

Reputation: 327

We had a similar issue, and after disabled the video, the ghost is gone.

Upvotes: 4

Related Questions