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

Failure in nested before hook makes root-level test disappear from report #213

Open
JessefSpecialisterren opened this issue Jun 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@JessefSpecialisterren
Copy link

To Reproduce
Run this spec with allure reporting enabled:

it('root-level test', () => {
  cy.log('root-level test')
})

context('somecontext', () => {
  before(() => {
    cy.log('nested before hook')
    throw new Error('failure in a nested before hook')
  })

  it('nested test', () => {
    cy.log('nested test')
  })
})

Note how the resulting report only contains nested test, but that test contains the log step of root-level test (?) as well as the error message from the before hook. Commenting the throw line results in a report that correctly contains both tests

Expected behavior
I would expect to find root-level test in the report marked Passed, and nested test marked Broken/Defect

Environment (please complete the following information):

  • Cypress version: 12.14.0
  • OS: Windows 10
  • cypress-allure-plugin version: 2.40.0
  • allure2 version: 2.19.0
@JessefSpecialisterren JessefSpecialisterren added the bug Something isn't working label Jun 20, 2023
@Shelex
Copy link
Owner

Shelex commented Feb 29, 2024

I think the problem here is caused by test which is not attached to any suite and works just because cypress wraps everything in some "global" suite per file, however due to possible edge-cases I am not sure a proper solution could be found for such "hanging" tests without parent suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants