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

Code in afterEach fails if test didn't pass #3487

Closed
chilikasha opened this issue Feb 15, 2019 · 1 comment
Closed

Code in afterEach fails if test didn't pass #3487

chilikasha opened this issue Feb 15, 2019 · 1 comment

Comments

@chilikasha
Copy link

chilikasha commented Feb 15, 2019

Current behavior:

I added logout to some tests (we face some specific issues if not to do that) and logout works fine if the test itself passes.
In case test fails, then logout also fails.
Attached screenshot

Desired behavior:

Logout from afterEach hook is executed successfully

Steps to reproduce: (app code and test code)

error: click() failed because it requires a DOM element

screenshot 2019-02-15 at 23 23 34
`
afterEach:

afterEach(function() {
    functions.logout()
  })

logout code:

logout: function() {
    cy.get('[data-testid="profile-settings-button"]')
      .click()
    cy.get('[data-testid="menu-log-out"]')
      .click()
    cy.get('[data-testid="login-emailphone-input"]')
      .should('be.visible')
  },

sometimes code from afterEach hook fails on second click()

Versions

3.1.5, Chromium 74, Mac OS

@cypress-bot cypress-bot bot added the stage: needs information Not enough info to reproduce the issue label Feb 15, 2019
@jennifer-shehane
Copy link
Member

Duplicate of #2831

@jennifer-shehane jennifer-shehane marked this as a duplicate of #2831 Feb 15, 2019
@jennifer-shehane jennifer-shehane added topic: hooks ↪ and removed stage: needs information Not enough info to reproduce the issue labels Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants