Search code examples
javascriptnode.jstestingautomationcypress

Click event in "after" hook doesn't work in "Cypress" whenever there is error or exception that occurs in "it" block


I am trying to logout an application by clicking the SignOut button written in "after" block of Cypress. The SignOut button is getting clicked whenever there is no error or exception in the "it" block (logging into the application and performing the action is written in the "it" block) but the button can`t be clicked when errors or exceptions occur (button's visibility can be checked in after block but unable to click).

Current behavior: Any click event in the after block fails if one of the performing action fails in the "it" block in Cypress.

Desired behavior: Click events in the after block should succeed even if there are failure in the "it" block.


Solution

  • This is a known bug in Cypress. You can find the bug report here.