Lesson 69 — Visual Engineering: Baselines, Thresholds & Flake Control · Practical QA
LESSON VIEW
A-08 · ADVANCED · PRACTICAL QA

Lesson 69 — Visual Engineering: Baselines, Thresholds & Flake Control

Objective: Visual testing that survives reality: stable baselines, sane thresholds, masked dynamism. (Status: pixel-diff is a roadmap value-pack for TestGen — this is the tool-agnostic discipline, usable today with Playwright's screenshot assertions.)

⏱ ≈53 min full lesson · English edition — Español · العربية · বাংলা in translation

⚡ Key Points

  • A visual check is 3 artifacts + a decision: BASELINE (approved look, captured in a CONTROLLED environment), CANDIDATE (this run, same conditions), DIFF (pixels changed beyond threshold), DECISION (a human accepts = new baseline, or rejects = bug).
  • Two different knobs: per-pixel TOLERANCE forgives RENDERING differences (anti-aliasing, font rasterization).
  • Baselines must be captured IN the CI environment itself.
  • Dates, prices, ads, rotating heroes → MASK those regions or FREEZE them (factories with known values, A-05).
  • Earn their keep: marketing pages, pricing, checkout, dashboards — high-value, layout-dense, change-frequent.

📖 Read

A visual check is 3 artifacts + a decision: BASELINE (approved look, captured in a CONTROLLED environment), CANDIDATE (this run, same conditions), DIFF (pixels changed beyond threshold), DECISION (a human accepts = new baseline, or rejects = bug). Tools that auto-approve are change-HIDERS.

Two different knobs: per-pixel TOLERANCE forgives RENDERING differences (anti-aliasing, font rasterization). Max-diff PERCENTAGE forgives a small amount of REAL change. Tune them separately, from measurements — and write down why.

Baselines must be captured IN the CI environment itself. A laptop baseline “fails” in CI for font-rendering reasons alone — manufactured false diffs. One baseline set per project (browser × viewport).

Dates, prices, ads, rotating heroes → MASK those regions or FREEZE them (factories with known values, A-05). Animations → capture settled states only. Lazy images → assert loaded before capture. The meta-rule: capture determinism is engineered, like any other feature.

Earn their keep: marketing pages, pricing, checkout, dashboards — high-value, layout-dense, change-frequent. Don't: volatile data tables, third-party embeds, anything that changes by design daily. An approval queue nobody reads is a rubber stamp with extra steps.

Pick one high-value page. List everything on it that can LEGITIMATELY differ between two runs today. That list is your mask/freeze plan — the document every visual implementation actually begins with, whatever the tool.

Pixels governed. Next: accessibility engineering — scans in the suite, audits on the calendar.