Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network delay in 13.3.1 running lighthouse in cypress #28113

Closed
metalix2 opened this issue Oct 23, 2023 · 4 comments · Fixed by #28188
Closed

Network delay in 13.3.1 running lighthouse in cypress #28113

metalix2 opened this issue Oct 23, 2023 · 4 comments · Fixed by #28188
Labels

Comments

@metalix2
Copy link

metalix2 commented Oct 23, 2023

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.

@jennifer-shehane
Copy link
Member

Hey @metalix2, we're investigating. I'm pretty sure this is due to this change because we saw this situation in other cases and did the 13.3.2 patch release to address some of those in this PR. It seems like you have another case outside of that. Thanks for the repo! It helps a ton.

@jennifer-shehane jennifer-shehane added the stage: investigating Someone from Cypress is looking into this label Oct 23, 2023
@jennifer-shehane
Copy link
Member

Hey @metalix2, we have identified the issue, it was related to the work I mentioned. It also has to do with the lighthouse calls occurring in another tab. Historically we haven’t handled traffic from other tabs so great.

Coincidentally enough though, we’ve been doing other work to address multiple tabs traffic, so it does look like this future PR fixes this issue: #27954 we hope this will go out in a release in ~2weeks.

In the meantime I would suggest downgrading to 13.3.0.

@metalix2
Copy link
Author

Hi @jennifer-shehane,

This is great news! Thanks for the investigation. I look forward to seeing how #27954 progresses!

We'll stick to 13.3.0 in the meantime. Thank you!

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 8, 2023

Released in 13.5.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.5.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: investigating Someone from Cypress is looking into this label Nov 8, 2023
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants