Cypress: Cypress should set a mocha slow threshold for more reasonable reporting

Created on 9 Mar 2017  路  16Comments  路  Source: cypress-io/cypress

I realize that this is something I can set, and that test speeds will probably be all over the map depending on what I'm testing, but I assume right now that cypress is using the default slow threshold which prints that red (123ms) after a "slow" test. Right now our non-cypress users on our team look at CI and say, "wow your tests are having some issues"

So I guess I'm wondering if there's a better threshold to set it to where it might provide meaning for the general case.. and if so, can that be the default in cypress?

1锔忊儯 first-timers-only needs a test enhancement

Most helpful comment

This is finally about to be done for good ;-)

I know there is an existing PR, but we had to do it in a slightly different way - but the result is the same.

All 16 comments

Agreed. Mocha slow threshold is completely inappropriate for e2e/integration testing. We'll file this away as "expose mocha to be configurable" either via cypress.json or as code in a support/index.js file.

-s, --slow <ms> "slow" test threshold in milliseconds [75] is the option in Mocha.

Perhaps we should raise this to a default of 5000ms and then expose something in cypress.json like slowTestThreshold.

It's probably possible to tell mocha about this right now in a root before / beforeEach hook with this.slow(...)

In addition, we need to lift off this property from runnables else this.slow(...) will not work.

Specifically when we pull runnable data to send to the backend server to mocha's reporter...

This is finally about to be done for good ;-)

I know there is an existing PR, but we had to do it in a slightly different way - but the result is the same.

@jennifer-shehane @brian-mann what's the timeline on this? I'd love to see this go into 4.0 if possible. Minimize the red!

image

I feel like the first part of this was done, and the second part regarding increasing thresholds was never implemented. Would probably require looking at some averages we've collected and assigning a new threshold.

I'm not completely sure what @brian-mann had planned.

This is finally about to be done for good ;-)

Did this ever happen? Using mochawesome with cypress leaves a lot of red in the console, and confuses users into thinking that tests are failing.

I tried adding the following code to support/index.js, but it didn't work:

beforeEach(function() {
  this.slow(30000);
});

Sorry I am a bit confused by this thread. Was something implemented in the end? Do I have a way (any way) to move the threshold up? All my tests are 20s or more (and that's perfectly normal) so would be great if I could.

@FredTreg unfortunately not, but this PR is in review https://github.com/cypress-io/cypress/pull/4066

Any news on this? I can't believe that something so simple and useful is taking so long

Is this task part of any ongoing or merged PR? #4066 was just closed.

Please implement this, would be really nice to have

There is no work done for this - there was a stale PR with some work for this that is now closed due to inactivity. Feel free to open a PR.

up on this.

Until this is done properly, is there a workaround for now? I tried calling this.slow(999999) in the tests but it seem to be ignored...

any updates on this?

Was this page helpful?
0 / 5 - 0 ratings