cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.19k forks source link

Cypress is running really slow after upgrading to v10 #22868

Closed SadiqRahim closed 1 year ago

SadiqRahim commented 2 years ago

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

lmiller1990 commented 1 year ago

I think https://github.com/cypress-io/cypress/pull/25209 should address some issues. It'll be in the next release.

I'll leave this open a little while more.

dcherevatenko commented 1 year ago

Seems like updating to Cypress 12.3 from 11.2 (with wiping "node_modules" folder) helped me to restore test perfomance on Windows distro (I compared it with WSL distro on the same machine). Thanks!

lmiller1990 commented 1 year ago

It's been a month since we shipped the fix. Happy to reopen if there are other perf issues (definitely possible) but most likely we should make a new issue. Thanks everyone for the patience and help debugging!

inorganik commented 1 year ago

Thought I would just share a finding - when running my tests with cypress set to Chrome 113, they ran extremely slow. When I switched to Electron 100, it ran as fast as it used to when Chrome was selected. It's possible something changed in chrome that is slowing cypress down.

lmiller1990 commented 1 year ago

@inorganik I had a similar issue, the problem I was having was chrome was running in emulation mode (I had M1 but was a darwin binary, I think - or something along these lines). Not sure if that's an issue you might be running into, but sharing in case it helps anyone else.

jon-robinson commented 1 year ago

Thought I would just share a finding - when running my tests with cypress set to Chrome 113, they ran extremely slow. When I switched to Electron 100, it ran as fast as it used to when Chrome was selected. It's possible something changed in chrome that is slowing cypress down.

I'm having the same problem actually. I'm using v9.7.0 (can't upgrade easily right now, hence the older version). Chrome 113 and Edge 113 are running horribly. Very laggy, ever since upgrading to 113 (112 was fine). Same issue either in open or run mode. macOS 12.6.5 M1

As you can see from this quick video, the duration clock is lagging quite a lot... https://github.com/cypress-io/cypress/assets/16207039/eba30235-6155-4ebf-9743-f2ee53555465

jon-robinson commented 1 year ago

@inorganik I had a similar issue, the problem I was having was chrome was running in emulation mode (I had M1 but was a darwin binary, I think - or something along these lines). Not sure if that's an issue you might be running into, but sharing in case it helps anyone else.

Hey @inorganik @lmiller1990 Out of interest, what did you do to resolve the issue? Assuming you did fix it somehow?

inorganik commented 1 year ago

My fix is to use Electron 100 instead of Chrome. But I suspect when Electron gets to 113 it may become slow as well. I would suggest the Cypress team try to find the underlying issue here.

Daniel-Shiosaky commented 1 year ago

Thought I would just share a finding - when running my tests with cypress set to Chrome 113, they ran extremely slow. When I switched to Electron 100, it ran as fast as it used to when Chrome was selected. It's possible something changed in chrome that is slowing cypress down.

I'm having the same problem actually. I'm using v9.7.0 (can't upgrade easily right now, hence the older version). Chrome 113 and Edge 113 are running horribly. Very laggy, ever since upgrading to 113 (112 was fine). Same issue either in open or run mode. macOS 12.6.5 M1

As you can see from this quick video, the duration clock is lagging quite a lot... https://github.com/cypress-io/cypress/assets/16207039/eba30235-6155-4ebf-9743-f2ee53555465

we are having the same issue, we noticed this especially with people using Macs with M1 chip was horribly slow we are still using cypress 9.7.0 is there an open ticket for this issue?

srotak5 commented 1 year ago

Same issue on 12.12.0

nagash77 commented 1 year ago

@srotak5 please open a new issue with a reproducible example and the Cypress team will be happy to investigate.

jon-robinson commented 1 year ago

Anyone, do we have a linked, open ticket?

scorpyto commented 1 year ago

I've just tried to run some tests with "run --" command and it was ultra slow compared to "open". I've disabled the video and it seems to work faster now. You can try it too. Cypress version 12.12.0

jamiek-acl commented 1 year ago

Using Cypress 10.4.0 (Mac M1 Pro)

When run test with Chrome v114, Cypress is almost un-usably slow (like 1s per keystroke, mocking API calls sometimes times out after 10s, pressing the 'Re-run' button is super laggy and doesnt always work without restarting). The odd time I'm able to get the test to run, it takes 77 seconds.

Changed it to use Firefox v113, test takes 7 seconds.

Changed it to use Electron v102, test takes 6 seconds.

AtofStryker commented 1 year ago

@jamiek-acl are you able to open a new issue with a reproducible example?

alpo22 commented 1 year ago

Here you go: https://github.com/cypress-io/cypress/issues/27344

kylemh commented 1 year ago

@inorganik I had a similar issue, the problem I was having was chrome was running in emulation mode (I had M1 but was a darwin binary, I think - or something along these lines). Not sure if that's an issue you might be running into, but sharing in case it helps anyone else.

@lmiller1990 how do I check if this is an issue and how do I resolve it? Feels very much like tha problem for me.

Basically seeing the same as others where Firefox and Electron take seconds, but Cypress crawls

nickls commented 1 year ago

@kylemh -- I'm having the same issue on M1. You can confirm in the Chrome About page.

image
mikejackowski commented 1 year ago

why was this closed? it's still happening.

lmiller1990 commented 12 months ago

@inorganik I had a similar issue, the problem I was having was chrome was running in emulation mode (I had M1 but was a darwin binary, I think - or something along these lines). Not sure if that's an issue you might be running into, but sharing in case it helps anyone else.

@lmiller1990 how do I check if this is an issue and how do I resolve it? Feels very much like tha problem for me.

Basically seeing the same as others where Firefox and Electron take seconds, but Cypress crawls

I don't quite remember how I fixed this, sorry! The issue was related to the browser running in emulation mode (eg M1 but running using an x86 binary + emulation).