cypress-fail-on-console-error icon indicating copy to clipboard operation
cypress-fail-on-console-error copied to clipboard

Spies still does not get resetted between cypress commands

Open rkhomi opened this issue 2 years ago • 2 comments

image First failed test due to console errors makes all other test failed as well due to same console error

Plugin version 3.2.1

rkhomi avatar Aug 19 '22 07:08 rkhomi

Hi @rkhomi I am willing to help but the provided information is not enough to debug into this.

If you execute the corresponding internal integration test you can verify this is no general issue. this feature is covered by tests.

  1. clone this repo
  2. execute npm install
  3. execute cypress open
  4. execute e2e/shouldResetSpiesBetweenTests.cy.js test case

my request:

  1. cypress version
  2. operating os
  3. provide cypress runner log with config.cypressLog = true (see readme)
  4. provide console.log from chrome dev tools
  5. provide formal test case description including hooks: before, beforeEach, After, AfterEach (I need to know which commands are executed in the tests and if the page is refreshed between tests)

alternatively you can also provide a repo where I can reproduce the issue locally. That would be most helpful!

nils-hoyer avatar Aug 19 '22 13:08 nils-hoyer

1.cypress version: 10.6.0 2. Operating system: cypress/browsers:node14.17.6-chrome100-ff98 3. Spec structure describe(name, () => { it(test 1) it(test 2) it(test 3) it(test 4)

})

Hmm, it might be that this depends on some specific console error I will try to get some logs and see how it appears in console

romankhomitskyi avatar Aug 23 '22 20:08 romankhomitskyi

it(test 1, () =》{

// element is not present, command is retried, in the middle of command retry console error is appeared in dev console, after commad retry timeout test is failed cy.get(element).should(be.visible) })

it(test 2, () => { cy.log() cy.request() // and now this test is failed because of console error from first test

})

romankhomitskyi avatar Sep 28 '22 06:09 romankhomitskyi

Hi @rkhomi,

thanks for sharing additional information. It was very helpful. I could reproduce the issue and provided a fix with version 4.0.1

https://github.com/nils-hoyer/cypress-fail-on-console-error/releases/tag/4.0.1

nils-hoyer avatar Oct 16 '22 22:10 nils-hoyer