Note ·

TIL: soft assertions let a test collect all failures before stopping

Had a test that checked six fields on a summary page. Every time one field was wrong, the test stopped and I had to fix, rerun, find the next broken field, repeat.

Playwright’s soft assertions fix this:

await expect.soft(page.getByTestId('name')).toHaveText('Alice');
await expect.soft(page.getByTestId('email')).toHaveText('alice@example.com');
await expect.soft(page.getByTestId('role')).toHaveText('Admin');
// test continues even if one of the above fails
expect(test.info().errors).toHaveLength(0);

All three assertions run regardless of individual failures. The final expect collects them.

Useful for form validation checks, summary screens, and anywhere you want the full picture of what’s broken in one run.

Discussion

Comments run on GitHub (Giscus) and load only when you tap the button. Details