-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 requests slower in Cypress than outside of Cypress #8156
Comments
I do see the different in timing of loading the XHR request inside and outside of Cypress. I think you will see some performance increase if you set Other than that, I'm not sure of how to increase it any further at this time. Everything does goes through a proxy. in Cypressin Chrome |
Setting Other than that, I guess the best thing I can do at the moment is to try and keep the bundles being loaded as small as possible on our end. Thanks for taking the time to look into this. |
We are also experiencing slow network requests with bigger bundles (20..25 MB). The I measured with https://test-page-speed.cypress.io/index1000.html. The results are:
System My colleagues measurements are around 3.3 seconds vs. 7.3 seconds in Cypress. |
I face same issue - even with video: false and modifyObstructiveCode: false, page is loaded in Chrome 86 manually 3-4 times faster than in same Chrome 86 running by Cypress |
Hello @jennifer-shehane I am facing the same issues as well with experimentalSourceRewriting set to true. It was able to do the network request after the login was done much more quickly with WebDriverIO and Selenium WebDriver. I am not able to unset the experimentalSourceRewriting as the web application as this causes the test to stop running and produce this Type error below: |
@jennifer-shehane Any suggestions on the above? |
I am facing the same issue, what is the status of this current issue? |
It is expected that Cypress slows down page loads - it has to do some work to intercept all requests, including de/recompressing requests and responses, un/re-encrypting HTTPS requests, modifying obstructive code... You can check https://app.circleci.com/pipelines/github/cypress-io/cypress/17887/workflows/522dbc50-bd74-46d4-a3d0-974100962549/jobs/646752 to get an idea of the existing Cypress proxy performance compared to a regular browser. cc @dintifla - we run those page loads in CI and analyze the timings, check out the link You can see that while the difference between Chrome and Cypress (HTTP/1.1 only) is small, it can start to take up to 2-3 times as long if there is an HTTPS destination, or if there is another upstream proxy that the request has to traverse. One thing that can contribute to slowness in Cypress is the lack of HTTP/2 support. If your app is using HTTP/2, Cypress only supports HTTP/1.1, so it will be slower: #3708 @rayhan15243 Eventually, |
@flotwig I have to enable experimentalSourceRewriting as it won't work without it. See Screenshot. |
@rayhan15243 I am only telling you that experimentalSourceRewriting is slower, I am not denying that you need it :) |
@flotwig Ah okay cool. Yes I would not like to use it however it's the only way that I can get the web application to run the tests. Is there another way without using experimentalSourceRewriting to prevent this application code error? This web application is an off the shelf product. |
Is this issue and #3708 getting any love from the cypress devs? |
Thanks for the https://on.cypress.io/configuration#modifyObstructiveCode option. It does speed up my initial page load network |
I have done some testing on later versions of Cypress: Test page with the following script and an element with id=header: The result is the following when loading the test page in various versions of cypress (test.jpg is 415 kB): If this issue is not solved, I created #18771 to make it possible to bypass cypress processing of network requests. For our imaging application, the performance when fetching many images in a cypress test makes the tests very slow and unstable. |
I have found that is MacOS specific issue with Nodejs I have reported nodejs/node#41699 |
I am also facing the same issue on my end. I thought I did something wrong but looks like a lot of people are facing the same problem where the tests are terribly slow. I'm using an M1 Max. I have tried on other Windows laptops as well but the results were same. |
This would be one step to tackle this: #25201 |
@antick Please open a new issue with a reproducible example of your problem and we will be happy to investigate. This ticket is around an extremely old version of Cypress. As such I am going to close this issue. If folks have reproductions of this problem in later versions of Cypress, please open a new ticket and we will investigate. |
Current behaviour:
I'm trying to test my Nuxt app with Cypress, but find the tests to run very slowly because of how long it takes to download the JS bundles built by Nuxt. In development mode, bundles can get very large - upwards of 10mb. If I visit my site in Chrome, the network request for these bundles is very quick, <100ms. However, in my Cypress tests it takes almost 2 seconds just to download the bundle for each test case.
Desired behaviour:
Network speeds to be more comparable to those outside of Cypress.
Test code to reproduce
Run
yarn test:e2e:dev
in the example repository I've created.This is a vanilla initial Nuxt app with nothing added apart from importing the large library
zxcvbn
in order to add a bit of arbitrary bulk to the bundle to bring it slightly closer to the size of a real app. Then compare the network requests during the test with those when you just visit localhost:3000 separately in Chrome.For example, comparing the time for
default~app.js
:In each case, the vast majority of that time is spent in 'Content Download'. The request is about 10x slower in Cypress than it normally is in Chrome. I realise the request goes through a proxy with Cypress, but is it expected to cause this much extra overhead? (I'm not quite sure why the the file is two different sizes - perhaps to do with the proxy?)
Versions
Cypress: 4.11.0
OS: OS X 10.15.5
Browser: Chrome 84.0.4147.105
Thanks in advance for any insight you can provide!
The text was updated successfully, but these errors were encountered: