Skip to content

Screenshot on failure should take screenshot before running "afterEach" commands #394

@bahmutov

Description

@bahmutov

If there are lot of commands (or a meaningful change) in afterEach callback, the screenshot on failure produces an image that does not show the failure. For example

describe('something', () => {
  afterEach(() => {
    cy.visit('/else')
    cy.wait(100)
    cy.wait(100)
    cy.wait(100)
    cy.wait(100)
    // more calls like this
  })
  it('works', () => {
    cy.visit('/something')
    cy.contains('does not exist')
  })
})

In the above test I would like to see page "/something" during the failure cy.contains
but instead I see screenshot of /else and the command log might be scrolled way down
due to lots of cy.wait calls; hiding the red failure log.

It would be nice to have the screenshot taken right on failure, not at the end, despite #194 (which still applies)

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions