TOPIC 32/6018 MINNOT STARTED

Component testing with Playwright

Test one piece of a page in a real browser, without logging in or loading the whole site. Learn what a story, a gallery and the mount fixture are.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: testing one brick before the whole castle. If a castle wobbles, you do not rebuild it to find the bad brick. You press each brick on its own. A bad brick shows up at once, and you know which one it is.

Daily List is a to-do list app. Leo changes how one task row looks when a task is overdue. The row shows the title, the due date and a tick box. When the date has passed, it turns red and shows the word Overdue.

An would open the site, sign up, log in, add a task with an old date, and look at the row. That is slow. It can fail for reasons that have nothing to do with the row.

The picture has a limit. A brick does not change when you put it in the castle. A page piece can behave differently inside the full page. Some end-to-end tests are still needed.

What it is: Playwright is a free library from Microsoft that drives a real browser from code. This topic is one slice of that library: testing one piece without the whole site. A is a small wrapper that shows the piece in one situation, such as an overdue task. A is a page your app serves, which can show any story by name. The mount fixture is mount from @playwright/test. It opens the gallery, shows one story, and hands back a locator. The nearest neighbour is a full sign-up journey. That journey proves the pieces fit. It is a slow way to prove one row turns red.

Why it matters: An overdue style should not need a sign-up to prove. Leo sees a colour bug in seconds. A failure points at the row, not at login, the network or the database. The gallery is real work the team must keep. If nobody owns it, these tests rot.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)

PLAIN WORDS · 3 in this section
wobbles
Gives a different answer each time, like a shaky scale.
playwright
a free Microsoft tool that drives a browser for tests
locator
a pointer telling you where to find something

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 Showing one piece of a page alone, in chosen situations, so a fault points at that piece.

  1. Pick the piece
  2. Write a story
  3. Mount it
  4. Check it
Press one brick before the castle

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
One lego brickOne page component
Pressing the brickMounting it in a browser
A named shape of brickA component story
The table you press bricks onThe story gallery

WHERE THIS PICTURE STOPS

  • A brick does not change inside the castle. A page piece can behave differently in the full page.
  • A table is just a table. A gallery is code that must be kept up.
  • Bricks are always the same. Real data can be long, empty or odd.

HOOK

Press one brick before the castle.

REMEMBER IT THIS WAY

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

Bad row? Press the one brick first, testing the overdue row alone before the whole site.

What each part of the trick stands for
In the trickWhat it stands for
brickone page component
pressmounting it in a browser

A piece can behave differently in the full page, so keep a few end-to-end tests.

TELL A FRIEND

Testing one lego brick before the whole castle. A checks one piece of the page by itself.

OFTEN MIXED UP WITH The test pyramid and its critics. The pyramid lesson asks how many tests of each size. This lesson is about the middle size: one piece in a real browser.

Sources & standards — 3 sources
  1. Market practice

    Component testing (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 component testing with a mount fixture that renders a story from a gallery page you serve, and notes that the older experimental component packages are no longer updated. Describes features of recent releases. Vendor documentation or 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.

  2. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Test user-visible behaviour, keep tests isolated and use locators that match how users find things (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).

  3. Market practice

    ISTQB Certified Tester Foundation Level Syllabus v4.0.1 ↗ — International Software Testing Qualifications Board · Section 2.2, Test Levels and Test Types: component testing is one of the test levels, and system testing is another (confirmed against the syllabus, read in full text from a mirror copy of the publisher PDF, v4.0.1, 15 September 2024)

    The examinable statement of what a foundation-level tester is expected to know: six chapters, 64 learning objectives, each tagged K1 Remember, K2 Understand or K3 Apply, plus the test-design techniques the qualification names and groups as black-box, white-box and experience-based.

    Used here for the test-craft questions a Payment Quality Assurance Analyst and a Production Support Analyst are asked. It is cited for what the syllabus says a tester must be able to do, never as a rule about how payments work. · Checked 2026-11-07

    v4.0.1 is dated 15 September 2024 and is a list of corrections to v4.0 (21 April 2023) that reworded six learning objectives — not a cosmetic reissue. 78 pages.

    Two traps this entry exists to stop. v4.0.2 is the German edition (1 March 2025, 94 pages), so sorting by version number reaches the wrong document. And the widely-repeated per-chapter question allocation "8 / 5 / 4 / 11 / 9 / 3" is wrong: it is 8 / 6 / 4 / 11 / 9 / 2, derived from three official sample-exam answer keys and confirmed against the Exam Structure Tables.

    The single most consequential detail for a question bank: white-box coverage — statement and branch — is K2 "Explain", not K3 "Apply" (FL-4.3.1, FL-4.3.2, FL-4.3.3), and MC/DC, path and condition coverage are declared out of scope in §4.3. A question asking a candidate to compute branch coverage is testing something this syllabus does not.

    Read through a mirror, because the publisher's own domain could not be fetched (a reachability gap, not a statement about the publisher). A 403 there is a policy refusal and says nothing about whether the document exists or is reachable elsewhere.

    Anyone on an unrestricted network should open the canonical URL above and confirm the section and page numbers cited against it. Every claim drawn from this entry is written so that it can be checked against a numbered page.

    Read from two independent PDF-to-markdown conversions mirrored on raw.githubusercontent.com. They are treated as faithful because they were produced by unrelated parties with different tooling, agree on the full 64-item objective set including wording, and reproduce the same internal inconsistency present in the source PDF. Chapter 1 reads "testware that supports" where Appendix B reads "that support". A conversion artefact does not replicate across two toolchains.

    The licence permits attributed non-commercial extracts and use as the basis for articles. Whether a site that sells a pass may rely on that is an owner's decision, not this entry's.

    7 November 2026 review: actual publisher PDF 4.0.1, 15 September 2024, 78 pages, front matter/copyright and relevant numbered operative sections 0.5–0.10 and chapters 1–6 compared with CTFLpractice lessons. Earlier mirror/search descriptions are historical access records. TheK2 white-box objectives require explanation; the source does not justify a categorical ban on small numeric illustrations that support explanation. Later Exam Rules 1.2§4.1.4 usesK2 for keyword definitions, while syllabus§0.5 usesK1; keep dated scopes distinct. No copied questions or figure assets.

PRACTISE AND KEEP

Sources for this topic — 3 sources
  1. Market practice

    Component testing (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 component testing with a mount fixture that renders a story from a gallery page you serve, and notes that the older experimental component packages are no longer updated. Describes features of recent releases. Vendor documentation or 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.

  2. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Test user-visible behaviour, keep tests isolated and use locators that match how users find things (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).

  3. Market practice

    ISTQB Certified Tester Foundation Level Syllabus v4.0.1 ↗ — International Software Testing Qualifications Board · Section 2.2, Test Levels and Test Types: component testing is one of the test levels, and system testing is another (confirmed against the syllabus, read in full text from a mirror copy of the publisher PDF, v4.0.1, 15 September 2024)

    The examinable statement of what a foundation-level tester is expected to know: six chapters, 64 learning objectives, each tagged K1 Remember, K2 Understand or K3 Apply, plus the test-design techniques the qualification names and groups as black-box, white-box and experience-based.

    Used here for the test-craft questions a Payment Quality Assurance Analyst and a Production Support Analyst are asked. It is cited for what the syllabus says a tester must be able to do, never as a rule about how payments work. · Checked 2026-11-07

    v4.0.1 is dated 15 September 2024 and is a list of corrections to v4.0 (21 April 2023) that reworded six learning objectives — not a cosmetic reissue. 78 pages.

    Two traps this entry exists to stop. v4.0.2 is the German edition (1 March 2025, 94 pages), so sorting by version number reaches the wrong document. And the widely-repeated per-chapter question allocation "8 / 5 / 4 / 11 / 9 / 3" is wrong: it is 8 / 6 / 4 / 11 / 9 / 2, derived from three official sample-exam answer keys and confirmed against the Exam Structure Tables.

    The single most consequential detail for a question bank: white-box coverage — statement and branch — is K2 "Explain", not K3 "Apply" (FL-4.3.1, FL-4.3.2, FL-4.3.3), and MC/DC, path and condition coverage are declared out of scope in §4.3. A question asking a candidate to compute branch coverage is testing something this syllabus does not.

    Read through a mirror, because the publisher's own domain could not be fetched (a reachability gap, not a statement about the publisher). A 403 there is a policy refusal and says nothing about whether the document exists or is reachable elsewhere.

    Anyone on an unrestricted network should open the canonical URL above and confirm the section and page numbers cited against it. Every claim drawn from this entry is written so that it can be checked against a numbered page.

    Read from two independent PDF-to-markdown conversions mirrored on raw.githubusercontent.com. They are treated as faithful because they were produced by unrelated parties with different tooling, agree on the full 64-item objective set including wording, and reproduce the same internal inconsistency present in the source PDF. Chapter 1 reads "testware that supports" where Appendix B reads "that support". A conversion artefact does not replicate across two toolchains.

    The licence permits attributed non-commercial extracts and use as the basis for articles. Whether a site that sells a pass may rely on that is an owner's decision, not this entry's.

    7 November 2026 review: actual publisher PDF 4.0.1, 15 September 2024, 78 pages, front matter/copyright and relevant numbered operative sections 0.5–0.10 and chapters 1–6 compared with CTFLpractice lessons. Earlier mirror/search descriptions are historical access records. TheK2 white-box objectives require explanation; the source does not justify a categorical ban on small numeric illustrations that support explanation. Later Exam Rules 1.2§4.1.4 usesK2 for keyword definitions, while syllabus§0.5 usesK1; keep dated scopes distinct. No copied questions or figure assets.

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.