Phase 4 of 4 · Study weeks 13-16
Testing, security and shipping
This phase makes the last checkpoint possible: an app you can change safely and defend to a security reviewer.
Topics every week
- Week 138 h
- Component tests and Storybook
- End-to-end tests with Playwright
- Mocking the network
- Flaky tests
Hand inEnd-to-end tests of the purchase flow on two browsers
- Week 148 h
- Cross-site scripting and output encoding
- Content Security Policy
- Cookies and storage
- Dependency audits
Hand inA strict policy and a blocked seeded payload
- Week 158 h
- Accessibility in CI with axe
- Visual regression
- Error handling and monitoring
- Feature flags and safe rollout
Hand inAn accessibility gate and a rollout plan
- Week 168 h
- Release and rollback
- Upgrade policy for a fast-moving ecosystem
- What changes for ten teams
- Review
Hand inCheckpoint 4, the memo and the upgrade policy
Practice projects
- Practice 1, the flaky test (Week 13): make a test flaky on purpose with a race. Done when: you fix it with a proper wait on state, not a fixed sleep, and run it 50 times with no failure.
- Practice 2, the payload (Week 14): put a script payload in a product name. Done when: the page renders it as text, the policy blocks inline script and a test proves both.
- Practice 3, the audit gate (Week 14): pin a package with a known advisory in a test branch. Done when: the audit fails CI and removing it passes.
- Optional, a visual diff: add screenshot tests for three components. Done when: a seeded colour change fails the check.
GitHub repos to study
Existence and last commit were checked on 22 Nov 2026 by shallow clone. Every repository below had a commit in the last 12 months.
| Repo | What to read | Week |
|---|---|---|
| microsoft/playwright | Reliable tests, traces and sharding | 13 |
| storybookjs/storybook | Component testing and docs | 13 |
| mswjs/msw | Realistic network mocking | 13 |
| dequelabs/axe-core | The rules and how to run them in CI | 15 |
Milestone checkpoint
Run Checkpoint 4. Write the purchase-flow tests and run them on two browsers. Turn on the strict policy, add the seeded payload and the seeded vulnerable package, and add the accessibility gate. Write the memo with the numbers from the checkpoints: what the budgets caught, what they cost and what you would change for ten teams. Hand in the CI output (a failing and a passing run), the blocked-payload test, ADR-7 (the security and testing policy) and the memo.
Check yourself
Answer each question in your head first, then open it to check.
What does a Content Security Policy protect against, and what does it not?
It limits where scripts and other resources can load from, which blunts many injection attacks. It does not fix the injection itself, and a loose policy withunsafe-inlineprotects little.Why encode output instead of filtering input?
Where the data ends up decides what is dangerous. Encoding for that context is correct there, while input filters miss cases and break valid data.Why is a fixed sleep in a test a bug?
It waits too long on a fast machine and too short on a slow one. Wait for the state you need.What does an automated accessibility scan miss?
Many problems, such as a confusing reading order, unclear labels or a poor focus order. A scan finds a portion of issues and a person must test the rest.How do you roll out a risky change safely?
Behind a feature flag, to a small share of users first, with a metric to watch and a tested way to turn it off.