EDIT: Solved.
I'm running automated UI tests for an eCommerce site, and most of my files have cleanup functions in the afterEach section so that past tests (especially failed ones) don't mess up future tests. Today my test runs started failing because Playwright would invariably close the browser in the middle of one of those cleanup functions. I've checked all over my code and I don't see anything that would interrupt the test, and I don't think this is a timeout issue because my timeouts are super long (for database reasons) and I'm not seeing any timeout messages, just "browser context closed" ones. Help???
This thread is trying to answer question "How can I resolve an issue where the browser closes in the middle of a cleanup function in an automated UI test?"
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 [email protected].