Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fail in the after each hook covers the fail in a test run #3918

Closed
testquantilope opened this issue Apr 9, 2019 · 16 comments
Closed

A fail in the after each hook covers the fail in a test run #3918

testquantilope opened this issue Apr 9, 2019 · 16 comments
Labels
pkg/driver This is due to an issue in the packages/driver directory stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period type: bug

Comments

@testquantilope
Copy link

testquantilope commented Apr 9, 2019

Current behavior:

When a test case fails and the following after each hook also fails, only the error from the after each hook is printed in the cypress dashboard, but only the fail screenshot of the test case is included.

Example
This screenshot is attached to my failed test:
image

The same fail has the following console output, which is obviously incorrect:
image

Desired behavior:

When a test case fails and the following after all hook also fails, there should be fail messages, one for the test case and one for the after all hook. There should also be a screenshot for both fails attached.

Steps to reproduce:

  1. Create a test case with an after each hook.
  2. Make sure the test case itself will fail.
  3. Run the testcase.
  4. Observe the issue.

Versions

image

@jennifer-shehane
Copy link
Member

Yes, this is a bug that we actually JUST encountered ourselves. The work is already in progress for fixing this. Thanks for opening an issue!

@kuceb kuceb mentioned this issue Apr 24, 2019
57 tasks
@testquantilope
Copy link
Author

Hi,
Is there any update on this issue?

Especially in combination with this issue it makes it a little painful to debug test cases: #2831

@cvasile001
Copy link

Hi Everyone. I am also experiencing this issue. Is there any update on this issue? Maybe a workaround?

@Dimbbass
Copy link

Have the same problem. IT was failed, then after each failed and then all other tests skipped, because fail was in after each block (in fact in test, not in after each)

Will be cool, if anyone offer a workaround.

@nc-williamss
Copy link

Same here. my after block cleans up, but when it doesn't execute, it causes my next tests to fail because the browser wasn't cleaned up. PLZ halp :)

@rachelruderman
Copy link
Contributor

Also experiencing this. How come it hasn't been prioritized yet?

@joszo
Copy link

joszo commented Nov 24, 2020

Also I'm facing same issue.

@cvasile001
Copy link

It has been a while, do we know if this is going to be worked on yet?

@bahmutov
Copy link
Contributor

@bkucera any updates on this issue?

@jennifer-shehane
Copy link
Member

This doesn't happen in all cases of failures, but the below example shows the afterEach error being printed instead of the error in the test.

Click fail in afterEach / it failure for visibility

describe('Tests', () => {
  afterEach(() => {
    // ❗️ does not exist, purposely fails
    cy.get('.foo').click()
  })

  it('test', () => {
   // ❗️ does not exist, purposely fails
   cy.contains('it test').should('be.visible')
  })
})

During cypress open

Screen Shot 2021-01-22 at 2 21 29 PM

During cypress run

Screen Shot 2021-01-22 at 2 23 20 PM

@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: work in progress labels Jan 22, 2021
@jennifer-shehane jennifer-shehane added the pkg/driver This is due to an issue in the packages/driver directory label Jan 22, 2021
@cvasile001
Copy link

The problem is click actions do not work in the 'after' section when you have a failure in the 'it' section. So in your example, if you have a legit click action in the 'afterEach', with a good actionable element, does it work?

@jennifer-shehane
Copy link
Member

yes, somewhat related but not the exact issue if the fact that click will not work in afterEach if a test fails: #2831

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 18, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2023
@pixelpax
Copy link

This still hasn't been addressed? This is making it nearly impossible for me to debug a CI-only issue.

@nagash77
Copy link
Contributor

nagash77 commented Jul 5, 2023

@pixelpax are you seeing this issue on the latest version of Cypress?

@nagash77 nagash77 assigned nagash77 and unassigned nagash77 Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period type: bug
Projects
None yet
Development

No branches or pull requests