question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress is running really slow after upgrading to v10

See original GitHub issue

Current behavior

We were on 9.5.4. Then did the upgrade to the latest version of cypress 10.3.1. Now the test execution time takes too long. This appears to occur when loading a page. Just the cypress package and cypress.config.js file changed. Screenshot attached with the differences on the same test code. Hopefully the information provided helps

Screenshot 2022-07-20 at 15 52 30 Screenshot 2022-07-20 at 15 52 54

Desired behavior

We expect to run faster or at the same speed

Test code to reproduce

it(‘Create new forecast’, () => { cy.intercept(‘/transformation/’).as(‘wait’) cy.visit(${global.url}/company/adient/forecasting/annual-iu62wfojz8iourjk74wn) cy.wait(‘@wait’).its(‘response.statusCode’).should(‘be.oneOf’, [200, 307]) cy.wait(‘@wait’).its(‘response.statusCode’).should(‘be.oneOf’, [200, 307]) cy.wait(1500)

cy.window().then((appWindow) => {
  let spreadHostElement = appWindow.document.querySelector(pageObj.forecastObj.hostElement)
  let spread = appWindow.GC.Spread.Sheets.findControl(spreadHostElement)
  let activeSheet = spread.getActiveSheet()
  activeSheet.setActiveCell(4, 5)
  activeSheet.startEdit(true, '10')
  cy.get('.cc-forecasting.cc-ui-block').type('{enter}')
  cy.wait(300)
})

cy.get(':nth-child(3) > .cc-ui-button').click({force: true})
cy.get('.cc-company-forecasting-save > .cc-ui-field > input').type('New forecast')

cy.intercept('POST', '/graphql', (req) => {
  aliasMutation(req, 'SaveForecast')
})
cy.get('.cc-company-forecasting-save__actions > .cc-ui-button').click({force: true})
cy.wait('@SaveForecast')
cy.get('.is-active > .cc-ui-icon > .iconPlus').click({ force: true })
cy.wait(1500)

})

Cypress Version

10.3.1

Other

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:51 (29 by maintainers)

github_iconTop GitHub Comments

4reactions
lmiller1990commented, Dec 6, 2022

It’s not just you, I am able to reproduce (finally). It’s not a minimal reproduction, but we are getting there. This data is the same as the videos I posted above, but I ran it on CI, which is plain old Ubuntu. It’s on GitHub Actions.

Notes:

  • More apparently on CI (almost twice as slow)
  • Reproduced by loading 200 JS modules
  • See here
  • I am NOT using a dev server - this is the result of yarn vite build.

Numbers

Cypress 9

Done in 13.51s.                                                                                                  

real    0m13.656s
user    0m8.576s
sys     0m1.459s


Cypress 10

Done in 24.01s.                                                                                                  

real    0m24.185s
user    0m9.431s
sys     0m2.132s

I am still finding a minimal reproduction so we can actually FIX this, but it’s pretty clear to me that, at least, loading lots of JS modules (many lots of <files>, I’m not sure yet) is significantly slower between Cypress 9 and Cypress 10.

Please wait a bit more while I debug this, I will fix it.

2reactions
lmiller1990commented, Dec 19, 2022

Hello all, I’m still debugging this. I am chipping away this, bit by bit. In this reproduction, you can see that after exactly 138 JS module requests, it goes slow. The JS modules appear to be loaded in chunks of 6. It loads 6, waits for a (0.5s?) and then loads some more. This seems like a reproduction in line with what @VictorGosse is encountering.

Based on the below, it looks like it’s not between Cy 9.7 (last version of Cy 9) and Cy 10.0.0 (first version of Cy 10) but a later regression. This also lines up with the OP:

We were on 9.5.4. Then did the upgrade to the latest version of cypress 10.3.1.

So, assuming this is the same bug for everyone involved, and there’s only one bug, it was somewhere between 9.7.0 and 10.3.1.

I had to turn off cache to reproduce this. Makes sense - if the modules do not go through the Cypress network layer, they don’t go through the bottleneck.

I will now try to find the commit that introduced this.

  • 10.0.0 - ok
  • 10.2.0 - ok
  • ??? somewhere in here is not ok
  • 10.3.0 - not ok
  • 10.4.0 - not ok
  • 10.5.0 - not ok

Must be in here:

git log --pretty=oneline v10.2.0...v10.3.0 tags/v10.2.0

Commit range 61f8bdc0def0c8d9b8c61d558bcb9919a30168ab chore: updating version for 10.3.0 (#22566) f902b968970f1b6160f07215b881dab6c39c21f1 chore: Adding record key context for internal ui jobs (#22559) 54e31e3243dd872435fd9300c46c055e019c3178 chore: Improve pkg/driver types part 2 (#21610) c0ea9bdaa566a6f9296b6b70f0894a6c62d23ae3 fix: use posix path for ts-node loader (#22550) 5d5574e1bb9b030c1426fb5f918d59c12b9eca06 fix: add baseUrl to TestConfigOverrides (#22445) 9101a9066c44fa2bb5bcbca64351c30cb5457cae fix: distribute files to machines for external contributors. (#22326) 4726ea90a9acdb6dec75616be29f5b761f17ecb8 feat: Display Cypress Dashboard metrics in the Specs Explorer (#21250) 24052eb62a2467b79af7b1d5050e88e047a8c113 test: Addressing launchpad test flake in Windows (#22536) fac83fd451acf8fff0691e10b8c13ec61449a37e chore(deps): update dependency semantic-release to v19 [security] (#22238) 22d2c31d856203b5110a1ed3270d0c93467e13fe chore: Address skipped specs in server package (#22356) 3ee77a8e55e8aa1efc25a4436b998c12676563b1 Empty-Commit to generate new percy nonce c7f63e1f2973b2de6478e1fd73262ee4da627273 fix: handle case of implicit plugins/index.js files during migration (#22501) 2f8475cbc0780e463251785c71fa19645f1b2706 chore: add reporter webpack to gulp watch script (#22386) 0fccc45aaf1edabf1a3539df02fbef2982352307 fix: Increase timeout for npm-webpack-dev-server tests (#22489) 172c36402127acbea0473c93760cc6435ccad471 fix: Time out unmatched prerequests in proxy to avoid leaking memory (#22462) 120052680ca520a29457d3a69ddf6180c86d6a33 fix: Sort results in findCrossOriginLogs test helper to deterministic (#22481) 75a5daf9d5e403e4bc179b5dd58ff21ce4fa6684 fix: memory leak caused by storing base64 encoded files recieved by CDP `Network.requestWillBeSent` (#22460) a21c942ee41ac175b30403c7dd9c6aefb137d1f5 fix: Improve cross-origin cookie handling (#22320) b678b1487731c5379fc8c75474beaf4712b79f95 feat: Add button to clear value from search fields (#22202) 0dc1f268c1ee47959502ed6699fefa1759a9d8ab chore: Add test to verify settings panels are collapsed by default (#22382) defde91f2a2354a1cae7dea7741f6e5c20a72e4b fix: process_profiler follow up work for v10 (#22363) 6458f6cd5c8e13d0181dc5eaf99bc1a61d63635e chore: Update Chrome (stable) to 103.0.5060.53 (#22441) a8f5e59b7dfabebb17c8be5f0f226d3982043f68 refactor: use design system windicss config (#21503) 2603f013ac106704277f38cc8a2067a264b2a9de chore: update readme logo (#22433) f2f0652743b1faace5794bf94907832c4f67228e chore: Update Chrome (beta) to 103.0.5060.53 (#22351)

Edit: yes, here is the offending commit! 172c36402127acbea0473c93760cc6435ccad471. The PR in question: https://github.com/cypress-io/cypress/pull/22462

Demonstrating the bug ## Cypress 9 - all modules loaded without delay

https://user-images.githubusercontent.com/19196536/208342872-56d94c75-18d9-4fd2-9056-244c44d7cb72.mp4

Cypress 10.0.0 - all modules loaded without delay

https://user-images.githubusercontent.com/19196536/208344852-6567f107-f0fc-4433-afcf-22a922179cf8.mp4

Cypress 11.2.0 - loaded in batches of 6 after 138 requests

https://user-images.githubusercontent.com/19196536/208343141-c7084ac1-9bb9-4d12-b069-1627650e751b.mp4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress v10 Tips and Tricks - Gleb Bahmutov
This blog post collects my tips for using Cypress v10+ which is a large ... Collect the component code coverage; Slow down Cypress...
Read more >
Installing Cypress and writing your first test
We are going to be running our application locally on localhost:3000 so let's update the cy.visit() with the correct address. describe("home page", () ......
Read more >
Writing and Organizing Tests - Cypress Documentation
All 3 tests above are marked pending when Cypress finishes running the spec file. Cypress with three pending test. So remember - if...
Read more >
Testing Your App | Cypress Documentation
When your application is running in production you can't control it. ... you'll always need to set up / tear down this state...
Read more >
Cypress 10 Upgrade - TestersDock
So here clicking on the Rename the specs for me button only changed ... Also with v10, cypress has removed the experimental feature...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found