From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Retrying tests in Playwright

Retrying tests in Playwright

- One really nice feature that is baked into Playwright test is the ability to retry test if they fail. There could be many different reasons why a test fail as part of a test run. A few examples could be the test fail due to getting stuck in a bad state. For example, you expected to be logged in, but were in a logged out state. Or maybe another test or user touched the data that you were asserting against. Or if there's a race condition in the automation code where it's trying to make assertions before data is loaded within the page. We've seen that happen in this course. Maybe the test timed out because you didn't have the proper await syntax implemented, or maybe a third-party service failed, or maybe you hit a rate limit when you were making API calls using either the UI or API request. Maybe the test is passing every other run because we only have the latest code deployed to half of the running servers, if it's behind the load balancer, maybe a container crash because we're…

Contents