Skip to content

Network delay in 13.3.1 running lighthouse in cypress #28113

Description

@metalix2

Current behavior

Since Cypress 13.3.1 we have noticed another delay in the network layer when using the cypress browser for running lighthouse against. This isn't the first time this has happened - Related issue #17327 saw the same impact where the network request time was a minimum of 0.5 seconds to fetch any resource. Now as of 13.3.1 the minimum fetch time has jumped to massive 2.0 seconds! This renders our lighthouse tests redundant as they are not comparable to just a normal lighthouse test. For example the project we test against is a simlpe CreateReactApp with a simple data fetch that is intercepted. When testing outside of Cypress our score is 99. As of 13.3.1 the score has dropped to 56 due to these network latencies.

Desired behavior

Lighthouse Tests ran against a cypress browser using a devPort should not be subject to network penalities set by the Cypress browser.

Test code to reproduce

Code to repoduce

The reproducible tests in the repo below run a basic create react app which gets a lighthouse score of 56 our of 100. It should be 99/100.

Reproducible repo - https://github.com/metalix2/cypress-lighthouse-slow

Setup instructions in readme.

Some observations. On the cypress window with the UI. the Page loads as expected. It's just when its loaded in a different tab it seems to be very slooooooooooow.

See screenshots below.

cypress-page-trace (Last few assets are of the page being tested the size strangely don't align with the other tab's network resources.)

Loading assets taking 2000ms 👎

cypress-tab-trace

Before 13.3.1
cypress-13 2 0

I have videos and Cypress recordings available please do not hesitate to ask. I'd love to see this resolved once and for all.

Cypress Version

13.3.2

Node version

v18.18.1

Operating System

macOS 13.5.2

Debug Logs

https://gist.github.com/metalix2/38c3566f7c4db297ee5cc5094c10eb68

Other

From the original investigation in #17327 I created a diff in one of my comments perhaps someone more familiar with the cypress core will understand better.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions