Playwright Limit Failures and Fail Fast

Profile picture for user arilio666

In this article, we will see how we can efficiently maintain failures in a more controlled manner.

Limit Failures:

  • The main aim is to limit failures to specific numbers and fix critical shortcomings firsthand.
  • After this moving on to less critical failure is optimal.
  • This helps reduce time and effort to fix test failures.

Fail Fast:

  • This strategy involves failing tests as soon as a failure is detected.
  • We can identify the failure quickly as soon as possible by failing fast before they bulge and becomes a bigger problem.
  • This helps save the time and effort required to fix test failures and improve the suite's reliability.

We can limit the failed tests in the whole suite by using the maxFailure config option or passing the --max-failures command line flag.

npx playwright test --max-failures=20

We can also set this in the config file.

maxFailures: process.env.CI ? 10 : undefined