Cypress: Failure in test causing actions (.type(), .click()) in afterEach to not work

Created on 19 Mar 2018  路  5Comments  路  Source: cypress-io/cypress

Current behavior:

When a test fails in the "it" function the afterEach function is no longer able to type.

Desired behavior:

type should always function regardless of failures in test

How to reproduce:

https://github.com/Tarig0/cypress-test-tiny

  • Operating System:Win 10
  • Cypress Version: 2.1
  • Browser Version: Chrome 64
duplicate

Most helpful comment

Having this problem with .click() as well, also only in an afterEach function when the previous test has failed.

All 5 comments

This is very weird. Can confirm. The afterEach test code does run, yet the .type() functionality specifically does not appear to be working. The .type() only does not work if the test fails.

My example - to prove it was not some weird issue with google site -

context('Actions', () => {
  beforeEach(() => {
    cy.visit('http://example.cypress.io/commands/actions')
  })

  afterEach(() => {
    cy.get('.action-email').clear()
      .type('[email protected]').should('have.value', '[email protected]')
  })

  it('type into a DOM element', () => {
    cy.get('.action-email').should('have.value', 'a')
  }
})

Also, this error appears as if some subject has changed incorrectly.
screen shot 2018-03-19 at 2 36 34 pm

Added another case to show that the element is being found and can be set by

.then(($el) => $el.val('speed'))

Having this problem with .click() as well, also only in an afterEach function when the previous test has failed.

I am also seeing this. .click() simply seems to stop working in afterEach if a test has failed.
This is kind of a showstopper, as it prevents cleanup after failing tests...

Going to close this in favor of #2831

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simonhaenisch picture simonhaenisch  路  3Comments

weskor picture weskor  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments

igorpavlov picture igorpavlov  路  3Comments

verheyenkoen picture verheyenkoen  路  3Comments