Skip to content

Cypress massively slows down when the test output is toggled open #8012

Closed
@nphillipsworth

Description

@nphillipsworth

Current behavior:

For the clearest demonstration of what I mean see this video:

We have some fairly long running tests (1 minute long test cases)

When the test is running if the test log (left panel) is toggled open for the current test, the test speed will slow down to a crawl. The slow down is proportional to how long the given test case has been running, at the start the slow down is barely noticeable, by the end it slows to the point of barely moving.

This can be shown manually, by clicking the toggle, as in the video. Proving that this is directly related to the output being toggled and not a symptom of the test slowing down because of some other issue ( eating too much memory ).

However this does also happen when the test are run in pipeline causing some very bizarre behaviour.
There is some logic that defaults the toggle to being open on the first test case of a describe block but not the second. Meaning we can massively improve the speed of our test by introducing a dummy test case before the real one. This happens despite the tests being run in headless mode.

Desired behavior:

As far as I can see the speed of the test should never depend on the output being toggled.
If for some reason it has to, then there should be a setting that allows us to force the output to stay closed when run through our pipeline.

Test code to reproduce

Simple test case that loops round 200 times filling in an input box.

https://github.com/nphillipsworth/cypress-test-tiny/

Steps to reproduce

  1. this takes about a minute to run with the test output toggle closed.
  2. delete the first empty test case, it now will run so slow it won't complete.
    empty tests shouldn't effect run speed!

Versions

"cypress": "^4.10.0", mac, both chrome and electron

Activity

billiegoose

billiegoose commented on Jul 17, 2020

@billiegoose

I'm a developer at stoplight.io (@stoplightio) and am seeing similar behavior:

  • In Cypress 4.8, tests run fine.
  • In Cypress 4.9 and 4.10 (with test output toggled open) we're seeing:
    • Cypress consuming as much as 80% of the CPU time and
    • operations that normally take <200ms are now taking up to 20 seconds (such as an HTTP request served from the Chrome disk cache) and
    • high memory usage, up to 750MB of memory being allocated in the span of a few seconds.

Here's some screenshots from our situation at Stoplight:

4.8.0
image

4.10.0
image

4.10.0 if I manually collapse the test output toggles in the sidebar:
image

Here's a chrome profile showing it is indeed Cypress code that is bottlenecking the CPU, with a 180ms synchronous task that's run every 200ms, leaving only 20ms for our own code:
image

(I can provide the raw profile data upon request by email (will.hilton@stoplight.io) if you'd like to open it in Chrome's debugger and zoom in and inspect the stack traces better.)

4.10.0 memory usage spike:
image

Hopefully this is enough for you to go on. If not feel free to contact me at my Stoplight email address (I don't check my GitHub notifications anymore because there's simply way too many of them). I spent about 6 hours investigating the issue yesterday before finally "solving" it by downgrading from 4.10 to 4.8 but would love to see a proper fix implemented so we can continue to upgrade to newer versions.

jvanoostveen

jvanoostveen commented on Aug 24, 2020

@jvanoostveen

Cypress 5.0 also has this issue.
I would love to see a fix for this, maybe a workaround by allowing to have the left panel with the steps collapsed or something. This issue is doubling the time for our tests. 😢

srdjanprole

srdjanprole commented on Aug 24, 2020

@srdjanprole

ok, this started to be a huge problem.

jvanoostveen

jvanoostveen commented on Aug 28, 2020

@jvanoostveen

@bahmutov As this issue has been around for some time, this has to be surfaced somewhere? I really want to make use of some of the fixes and new additions in Cypress, but this issue makes us not able to upgrade to a more recent version of Cypress.

jvanoostveen

jvanoostveen commented on Sep 7, 2020

@jvanoostveen
jvanoostveen

jvanoostveen commented on Sep 7, 2020

@jvanoostveen

Ah I see there is another issue, that's more alive at the moment: #8297

9 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jvanoostveen@billiegoose@flotwig@jennifer-shehane@nphillipsworth

      Issue actions

        Cypress massively slows down when the test output is toggled open · Issue #8012 · cypress-io/cypress