Hi there! In case of the failed assertion or due to the timeout of one of the functions - is it possible to get a case when a runner will not execute an afterEach hook?
Basically to be more specific - in case of failed assertion, and in case we need to do something inside our application as a part of the afterEach hook - will the failed assetion cloase the browser? Or in this case we will be able to execute the expected actions as part of the hook and then the browser will be closed?
This thread is trying to answer question "In case of the failed assertion or due to the timeout of one of the functions - is it possible to get a case when a runner will not execute an afterEach hook?"
Hi, if you want to have different behavior in your afterEach you can use https://playwright.dev/docs/api/class-testinfo#test-info-status
And to have multiple cases you could inspect the test error using https://playwright.dev/docs/api/class-testinfo#test-info-errors
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email firstname.lastname@example.org.