Software Testing / Learning brief

Tom swaps the props before the curtain goes up

What this means in plain language

Tom cannot wait for nine in the morning, move to a new place or read a real clipboard. A stage-props story shows a fake clock, built-in options, and an init script added before the page loads.

Understand the full idea, step by step

In a play, a real knife would be dangerous, so the actors use a prop that looks right. The stage manager swaps the props before the curtain goes up, never in the middle of a scene.

Tom's tests need props too.

The time, the place and the clipboard are real tools, and a robot cannot easily control them. So he swaps them for props before the page starts.

PLAIN WORDS · 1 in this section
clipboard
a board with a clip for holding papers

Evidence & review

REVIEWED 2026-10-18

The date on this lesson is when it went up on Payments Signal, not when its material was written — most of these were brought across from an earlier catalogue in a single run, which is why so many of them share a date. What the lesson says about the world is dated by the review above and by the sources below it.

Playwright Test as taught in this academy, with an invented app and invented people. Tool details come from vendor reference pages seen only as search excerpts.

What this brief simplifies: Fiction labelled SYNTHETIC / TRAINING ONLY. Sources were seen only as search excerpts. The stage is a teaching picture. The site address is a teaching address that does not exist.

Sources for this brief — 4 sources
  1. Market practice

    Mock browser APIs (Playwright documentation) ↗ — Microsoft (Playwright) · Install mocks with page.addInitScript so they exist before the page's own scripts run; the guide overrides window.navigator.getBattery with a fixed object (search excerpt, page not opened)

    Describes replacing a browser API before the page loads. Vendor documentation, 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

    BrowserContext (Playwright documentation) ↗ — Microsoft (Playwright) · addInitScript runs after the document is created and before its scripts; the order of several init scripts is not defined; permissions include clipboard-read and clipboard-write and differ between browsers; a clock property exists on page and context in recent versions (search excerpt, page not opened)

    Describes addInitScript, grantPermissions, geolocation and the clock. Vendor documentation, 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; read at the time of writing. 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.

  3. Market practice

    Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Test user-visible behaviour, keep tests isolated, and prefer web-first assertions (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. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

Learn this properly

START HEREMocking browser APIs: clock, geolocation, clipboard and moreReplace parts of the browser with stage props, such as the time, the place, the clipboard or the battery, before the page loads, so a test can control what the page sees.Opens at L0 Explain simply · about 18 min

Related briefs