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.

Test is 6x slower in 3.3.2 with cy:open

See original GitHub issue

@jfaissolle commented on Fri Jun 28 2019

Current behavior:

With cypress open, running a single spec: Running in 3.3.1 takes 21 seconds. Running in 3.3.2 takes 117 seconds.

Most CPU is consumed by the hasBinary function.

Desired behavior: Perfomance at least as good as 3.3.1 with cypress open.

Versions Cypress 3.3.1 on Ubuntu 18.04.2, Chrome 75.0.3770.100


@flotwig commented on Fri Jun 28 2019

Hey @jfaissolle, could you share the spec code that is taking longer in 3.3.2? We made performance improvements in 3.3.2, but it looks like you’re hitting a new edge case caused by #4407.


@jfaissolle commented on Mon Jul 01 2019

I have found that the slowdown happens with @cypress/code-coverage on. If I disable the plugin, tests perform as fast as in 3.3.1.

Here is an example of test.


const continueButton = '[data-ft="panel-footer"] button:contains("Continue")';
const backButton = '[data-ft="panel-footer"] button:contains("Back")';

const surveyCategory = '[data-ft="survey-category"]';

context('Stepper', function () {
  beforeEach(function () {
    cy.visit('iframe.html?id=survey--survey-stepper');
  });

  it('Looks good', function () {
    cy.wait(500);
    cy.matchImageSnapshot();
  });
});


context('Actions', function () {
  beforeEach(function () {
    cy.visit('iframe.html?id=survey--survey-wizard');
    cy.get('[data-ft="survey-card"]:first()').click();
  });

  it('Displays 3 steps', function () {
    cy.get('[data-ft="survey-stepper"] button').should('have.length', 3);
  });

  it('Shows first category in survey', function () {
    cy.get(surveyCategory).should('contain', 'Actionnariat');
  });

  it('Clicking on second category should display second category', function () {
    cy.get('[data-ft="survey-stepper"] span:contains("Evolution organisation"):last()').click();
    cy.get(surveyCategory).should('contain', 'Evolution organisation');
  });

  it('Clicking on Continue / Back should navigate in categories', function () {
    cy.get(continueButton).click();

    cy.get(surveyCategory).should('contain', 'Evolution organisation');

    cy.get(continueButton).click();

    cy.get(surveyCategory).should('contain', 'Effectif');

    cy.get(continueButton).should('not.exist');

    cy.get(backButton).click();

    cy.get(surveyCategory).should('contain', 'Evolution organisation');
  });

  it('Close with close button', function () {
    cy.get('[data-ft="panel-footer"] button:contains("Save")').click();
  });
});


@bahmutov commented on Mon Jul 01 2019

@jfaissolle yes, it can quite possibly be due to code-coverage plugin, because it combines the code coverage after each test with previous results - which includes loading a JSON file, merging it, saving updated JSON file. These are slow file operations and can be super slow for large applications where the coverage object is large. I wonder if hasBinary gets triggered when we use cy.task to send coverage info from the plugin to the Node process here https://github.com/cypress-io/code-coverage/blob/master/support.js and if we can pass a flag to NOT verify it (we know the object to be good for example)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
bahmutovcommented, Nov 14, 2019

🎉 This issue has been resolved in version 1.10.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

3reactions
42tgcommented, Aug 29, 2019

The slowdown comes from the changes introduced in cypress-io/cypress#4407, which allows circular references to be sent over the websocket. There is probably room for optimization in the normalization steps to improve this. Created an issue: cypress-io/cypress#4713 In the meantime, serializing the message manually (with JSON.stringify, for example) will get around this since it won’t be checked for circular references.

Where exactly does JSON.stringify go? Need to workaround this!

You have to replace the cy.task('combineCoverage', applicationSourceCoverage) with cy.task('combineCoverage', JSON.stringify(applicationSourceCoverage));

and adjust the concrete task accordingly (to parse the now given string to json) this fixed my issues with the performance in 3.4.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Untitled
Ingredients schtroumpfs haribo, Haxsync 4 x apk, Redstone technical test center ... Allizard regis, Jc dahlsen pty ltd, Imss sua 3.3.2, Ligi kuu...
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