-
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
Cypress 7.2.0 still runs slower than 6.9.1 (disregarding screen size increase) #16305
Comments
Cypress v7.2.0? |
Ah I was on 7.1 so will try upgrading and report back. Thanks! |
There were some performance issues that we addressed in 7.2.0. Please try updating to the latest version of Cypress. Additionally, if you are running Cypress in a headless browser, the default screen size was increased to 1920x1080 which may introduce extra time. You could try reducing the screen size to the default size prior to 7.0 (1280x720) to see if the performance is related to the increase in screen size. Instructions here. |
Thanks for the reply @jennifer-shehane! I upgraded to 7.2 and it runs in 15 minutes. That's still twice as slow as 5.6.0, with the viewport set to 1440 x 660 on both versions. Summary: These times are all using Regardless, I'm glad to see 7.2 improved things, but I'm going to stick with 5.6 for now since it's still twice as fast with |
nitpick: Did you upgrade to |
@amine-benselim I used to 7.2 for the v7 results I posted above. Sorry, had a typo in that comment which I just fixed. |
@coryhouse Could you provide a repo that demonstrates the slower performance? It may be particular to the tests written or the application under test that we'd need to track down. Thanks! |
I too agree with @coryhouse when I updated 7.1.0 cypress version and cypress run was facing serious performance issues. Usually my test run completed in 25 minutes and the 7.1.0 version run took more than 70 minutes to complete the test run and I have seen most of my test gets failed. So I have to revert back to 6.6.0 version. But now I wish to go back to older version of cypress, like 5.6.0 as @coryhouse said, but I can't really as many of tests are using |
I confirm that 7.2.0 is very slow for me:
|
Need reproducible exampleWe'll need a reproducible example of the performance issues that show a difference between 6.9.1 and 7.2.0 (comparing the exact same screen size during the run). We definitely want to address all performance issues, but can't do it without a repo provided to reproduce on our side. Thanks. |
I can't share a reproducible example but our test suite is still twice as slow when upgrading from 5.2.0 to 7.2.0. We are using the same screen size, 640x360. |
Same here with the new version 7.3.0 288 tests:
|
Same here as well. I'm in the process of checking which operations take the longest, but generally operations involving cy.visit, click(), cy.contains and cy.intercept seem to be affected the most. We're on 6.6.0 and every version after that run significantly slower, especially in our Jenkins environment. |
I want to be very clear that the screen size is not the viewport size. Setting The screen size represents the virtual machine's screen, the size that screenshots and videos will be taken at. You have to follow the instructions here to change the screen size. |
Thanks for clarifying @jennifer-shehane! However, the instructions you linked to appear to be out of date, correct? In this comment, you said the default screen size is now 1920x1080. But the instructions you linked to say the default is 1280x720. Which is right? |
@coryhouse Yes 😞 I opened a PR to update the docs here: cypress-io/cypress-documentation#3925 |
So @jennifer-shehane would the screen size setting effect speed even if I have screenshots and video disabled? |
Hey guys, I have been trying to revert cypress version to 6.9.0 but there seems to be a problem:
It's possible to revert to 6.9.1 tho |
@jennifer-shehane I tried changing the headless screen size to the old default and while the tests still are slower it's not as impactful. It's closer to a 10-20% increase in execution time rather than 50-100% as before. Still noticeable, but now it's workable in case we decide to upgrade. But it would be great if it were more straight-forward to change the screen size, with the cypress.json file or an environment variable. |
@coryhouse We'd like to narrow down the variables for performance issues, if videos and screenshots are disabled, that would help narrow it down potentially. @redReno I agree it would be much easier to have an easily configurable value. We'll be looking into the video issues in general in regards to performance soon. |
I am seeing more than 20% increased testing time on a Vue+Vuetify app with 28 tests, when video is turned off. (No snapshots are created.) With video on, the increase is > 50%. I am comparing Cypress 7.3.0 with 6.8.0. |
@ottopaulsen Have you tried reducing the screen size from the instructions here? |
@ottopaulsen Or can you provide a reproducible example we can run? |
If I reduce the screen size to 600x800, I get a good effect. Then the video hardly affects the time. However, it is still much slower than 6.8. And 600x800 is not very useful. With 1400x1200 it is still very slow. Sorry, I cannot share the code. |
FWIW, changing the screen size back to the pre-7 setting as @jennifer-shehane suggested has made a big difference for us. |
The following steps can be used to reproduce the performance issue on cypress 7.2.0
If more information is required then please let me know. |
I ran these two versions of Cypress on Ubuntu 18.04.
This is the test that I benchmarked, When I commented out it('should fail to sign in', function () {
cy.log('1. Logging in');
cy.visit('/', {
retryOnNetworkFailure: true,
});
cy.get('[placeholder="User Name"] input.dx-texteditor-input').type('not-a-real-user');
cy.get('[placeholder="Password"] input.dx-texteditor-input[type="Password"]').type('mypass');
cy.contains('.dx-button-text', 'Login').click();
cy.log('2. Verifying that failed login message is displayed');
cy.contains('Unable to log in with provided credentials');
cy.log('3. Comparing snapshot of .dx-card element on login page');
cy.get('.dx-card').toMatchImageSnapshot({
threshold: 0.05,
});
}); Here is my cypress.json config file: {
"chromeWebSecurity": false,
"video": true,
"viewportWidth": 1600,
"viewportHeight": 1200,
"trashAssetsBeforeRuns": false,
"defaultCommandTimeout": 15000,
"execTimeout": 60000,
"timeout": 8000,
"taskTimeout": 90000,
"pageLoadTimeout": 60000,
"requestTimeout": 9000,
"responseTimeout": 30000,
"reporter": "cypress/reporters/nunit",
"reporterOptions": {
"output": "cypress-nunit-result.xml"
},
"baseUrl": "http://127.0.0.1:4300",
"restServerUrl": "http://localhost:8300",
"ignoreTestFiles": [
"**/__snapshots__/*",
"**/__image_snapshots__/*"
],
"cypress-plugin-snapshots": {
"serverPort": 3000
}
}
|
@jennifer-shehane I have experimented with this issue and Cypress 7.5.0. What I have noticed is that it takes significantly more time to load the page with 7.x (tested 7.5.0) than it does with 6.x (tested 6.6.0), when using We have vue 2 app, with roughly 40 or so js chunks that get loaded, and although the contents are cached, the network tab says it still takes a few seconds to load these files under 7.x, whereas in 6.6.0 this is done in under a second. I was able to see this behavior with Same behavior under chrome or electron, not a problem with |
There's an issue that's been identified concerning It would be helpful to identify exactly where the increased time is being seen at. I think we've been focusing on video performance since that was a large change, but I don't think this has been clearly identified as the cause of a large increase in time in any case. I also think that the performance increase is likely dependent on some aspect of the test being run, which is why a reproducible example is important. I'm going to try to recreate the kitchensink example mentioned above in a docker container or Windows VM with reduced resources. |
It really seems like something is slowing down the loading of ressources, and having many small ressources makes things much worse. Perhaps it is possible to create a test case of a simple page with 50 external javascript files? |
Following through on what @pranavj1001 suggested, I ran the kitchensink actions.spec.js in a Windows VM with limited resources (2CPU / 4gb memory). Some thoughts in general from this, but it needs more investigation:
|
For reference, this is the timing on my Mac (6CPU, 16gb memory) running the same kitchensink
The optimal time for this specfile to run is ~15secs, with ~8secs video processing time. So even the baseline 6.8.0 runs on the underpowered Windows machine were not as performant as they should be. I would suggest everyone run their spec files first on a high resources machine, to get a baseline of how long a spec file should run for - then compare this against your CI run. If the CI is running slower, I would add more resources to the machine to see if that improves runtime. That being said, we are evaluating ways to help in situations where Cypress is run on underpowered machines because the reason behind slow/slower runs is not something that is immediately obvious today or clear to diagnose. TakeawayWe will be reverting the screen size back to 1280x720 in our next breaking release. You can read more about this decision here: #16853. We believe this is the sole contributing factor to increased runtime (outside of this visit issue: #16671). Need a reproducible exampleWe need a reproducible example showing clear evidence of a slowdown of runtime/processing time between 6.8.0 and 7.2.0 that has reduced the screen size back to 1280x720. We'll have to close this issue if this is not provided. We've spent a lot of time running performance metrics and can't find any evidence outside of these observations so far. |
We've also identified that there's an issue in Chrome 89 regarding video frames that would slow down runs when recording video. This will be addressed. Please follow: #16152 This issue will be closed as there are other issues open now to address the underlying slower runs between 6.9.1 and 7.2.0:
Please follow these issues for updates, we're aiming for 8.0 to release these fixes. |
Same here cy v6.5.0 tests run 25m update to 7.7.0 tests run 1h 44m on Jenkins CI pipeline. Screen size 1440x900. Angular app. |
Please upgrade to Cypress 8.0.0 as this has reduced the screen size to 1280x720 and may fix many of your issues. |
updated to 8.0.0 but still 2x slower then 6.5.0 with video recording on |
I just upgraded from 6.8 to 8.3, and my performance problems seem to have been solved now. Thanks! |
Current behavior
My tests complete in 7.5 minutes with Cypress 5.6. They take 9.5 minutes with Cypress 6.9.1. They take nearly 29 minutes with Cypress 7. The tests run equally fast when I use Cypress open. But the different times above occur when I use Cypress run. The run command is much slower on Cypress 7 with both Chrome and Electron.
Desired behavior
Cypress tests should run equally fast on all versions, whether I use run or open.
Test code to reproduce
I can't share the code, but it's a medium-sized React app with 66 Cypress tests.
Versions
The text was updated successfully, but these errors were encountered: