TOPIC 12/6018 MINNOT STARTED

Soft assertions, timeouts and clear failure messages

See every wrong fact in one run with soft assertions, know which time limit ran out, and write a failure message that tells the next person what broke.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a teacher who marks the whole page, not only the first mistake. A poor marker stops at the first wrong answer and hands the paper back. The student fixes it, and only then learns about the next mistake. A good marker circles every mistake in one pass.

Daily List is a to-do list app. The profile page shows four facts: the name, the email, the plan, and the reminder. Tom, the tester, checks all four. If the first check stops the test, he learns about the other three only after another run.

What it is: Playwright is a library that drives a real browser. This slice is how a failed check is reported. A records the failure and lets the test go on. A hard assertion stops at once. The nearest neighbour is a pile of separate tests, one per fact. Other ecosystems may provide comparable behavior through their runner, assertion library or plugins; do not assume a matching built-in setting.

Why it matters: Stopping at the first wrong label hides the other wrong labels on the same screen. Tom then spends four runs on one profile page. Soft checks plus a clear message show every wrong fact in one report.

A teacher can tell which mistakes are small. A test cannot. Tom still chooses which checks may be soft, and he keeps a hard stop before a step that deletes something.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named here are made up.)

PLAIN WORDS · 1 in this section
playwright
a free Microsoft tool that drives a browser for tests

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Seeing every wrong fact in one run, knowing which time limit ran out, and reading a clear message.

  1. Soft for peers
  2. Hard for needs
  3. Read the limit
  4. Add a message
Mark the whole page

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Marking the whole pageSoft assertions
Circling each mistakeThe list of failures in the report
A note in the marginThe custom expect message
The time allowed for the examThe time limits

WHERE THIS PICTURE STOPS

  • A teacher knows which mistakes are small. A tester must choose which checks may be soft.
  • A teacher marks after the exam. A test reports at the end of the run.
  • A margin note is for the student. A message is for whoever reads the report.

HOOK

Mark the whole page.

REMEMBER IT THIS WAY

A rule of thumb: if you see this, think that.

Checking four profile facts? Use soft checks so one run lists every miss, and add a margin note saying what you meant.

What each part of the trick stands for
In the trickWhat it stands for
Soft checksmarking the whole page
Margin notethe custom expect message

If a later step needs the first check to pass, stopping at the first failure can be clearer.

TELL A FRIEND

A teacher who marks all the mistakes on a page, not only the first.

OFTEN MIXED UP WITH Web-first assertions: expect that keeps trying. The earlier lesson makes keep trying. This lesson decides what happens after a check fails, and how long and how clearly it reports.

Sources & standards — 4 sources
  1. Market practice

    Assertions (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.

    Locator/page web assertions re-read current state; generic value assertions do not retry. APIResponse toBeOK checks a fixed captured 2xx status once, as confirmed by the pinned 1.65 matcher implementation; broad guide grouping must not imply a request resend. Soft assertions retain failure state; poll/toPass repeat their callbacks with explicit side-effect and deadline considerations. · Checked 2026-11-06

    Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.

  2. Market practice

    Timeouts (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.

    Describes the test timeout (30 seconds by default at the time of writing, covering the test body, fixtures and beforeEach hooks), the expect timeout (5 seconds by default at the time of writing), the action and navigation timeouts set under use in the config (no limit by default), test.setTimeout, test.slow (triple the test timeout), the separate timeout of beforeAll and afterAll hooks and the global timeout. Says the expect timeout can be overridden per assertion. Default values change between releases, so lessons say 'at the time of writing' or leave them out. Vendor documentation for one tool. Practitioner guidance, not a standard. · Checked 2026-11-06

    Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.

  3. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Prefer web-first assertions that retry; avoid fixed waits (search excerpt, page not opened)

    Recommends user-facing locators such as role-based ones over Cascading Style Sheets (CSS) or XPath, web-first assertions that retry, and avoiding fixed waits. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. A second search on 2026-10-20 returned this page for its title and matched the described content; the page was still not opened (search excerpt, page not opened).

  4. Market practice

    TestInfo class reference (Playwright documentation) ↗ — Microsoft (Playwright) · test.info().errors holds the errors thrown during the test; the Assertions page uses it to check for soft assertion failures before a later step (search excerpt, page not opened)

    Says test.info().errors holds the errors thrown during test execution, if any. The Assertions page uses expect(test.info().errors).toHaveLength(0) to stop a test after earlier soft assertion failures. Vendor documentation for one tool. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

PRACTISE AND KEEP

Sources for this topic — 4 sources
  1. Market practice

    Assertions (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.

    Locator/page web assertions re-read current state; generic value assertions do not retry. APIResponse toBeOK checks a fixed captured 2xx status once, as confirmed by the pinned 1.65 matcher implementation; broad guide grouping must not imply a request resend. Soft assertions retain failure state; poll/toPass repeat their callbacks with explicit side-effect and deadline considerations. · Checked 2026-11-06

    Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.

  2. Market practice

    Timeouts (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.

    Describes the test timeout (30 seconds by default at the time of writing, covering the test body, fixtures and beforeEach hooks), the expect timeout (5 seconds by default at the time of writing), the action and navigation timeouts set under use in the config (no limit by default), test.setTimeout, test.slow (triple the test timeout), the separate timeout of beforeAll and afterAll hooks and the global timeout. Says the expect timeout can be overridden per assertion. Default values change between releases, so lessons say 'at the time of writing' or leave them out. Vendor documentation for one tool. Practitioner guidance, not a standard. · Checked 2026-11-06

    Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.

  3. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Prefer web-first assertions that retry; avoid fixed waits (search excerpt, page not opened)

    Recommends user-facing locators such as role-based ones over Cascading Style Sheets (CSS) or XPath, web-first assertions that retry, and avoiding fixed waits. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. A second search on 2026-10-20 returned this page for its title and matched the described content; the page was still not opened (search excerpt, page not opened).

  4. Market practice

    TestInfo class reference (Playwright documentation) ↗ — Microsoft (Playwright) · test.info().errors holds the errors thrown during the test; the Assertions page uses it to check for soft assertion failures before a later step (search excerpt, page not opened)

    Says test.info().errors holds the errors thrown during test execution, if any. The Assertions page uses expect(test.info().errors).toHaveLength(0) to stop a test after earlier soft assertion failures. Vendor documentation for one tool. Practitioner guidance, not a standard. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.