Use anchors as checklist items.
pages/, components/, flows/, assertions/.Specs describe workflows. Pages/components/flows implement mechanics. Assertions are centralized.
flows/.assertions/.pages/
HomePage.*
LoginPage.*
SettingsPage.*
EditorPage.*
ArticlePage.*
ProfilePage.*
components/
Navbar.*
ArticlePreview.*
TagList.*
flows/
AuthFlow.*
PublishArticleFlow.*
FollowUserFlow.*
assertions/
expectLoggedIn.*
expectArticleVisible.*
expectToast.*
helpers/
env.*
urls.*
dataFactories.*
One responsibility per layer:
page = screen, component = reusable UI chunk, flow = cross-page task,
assertion = reusable expectation set.
| Default | getByRole + accessible name |
| Next | getByLabel (forms) / getByPlaceholder (only if stable) |
| Next | getByTestId (when accessibility name not stable or not available) |
| Escalation | CSS selector anchored to stable attribute (document why) |
| Disallowed | index selectors, deep DOM traversal, brittle chains, “works today” XPath |
If CSS is required, include the justification in the page object as a comment adjacent to the locator.
open() and assertAt() (or isAt() + explicit expect).assertions/ (avoid mixed responsibilities).page usage in specs).pages/NewFeaturePage.* with open() and assertAt().components/ object and reference it from the page.flows/ helper.assertions/ for repeated checks.UI change should update 1–2 files (page/component/flow). Specs should not require bulk edits.
flows/ (not duplicated across specs).assertions/.open() + assertAt().# detect hardcoded URLs and raw selectors in specs
grep -R "http://" -n specs pages components flows assertions || true
grep -R "https://" -n specs pages components flows assertions || true
# discourage inline locator patterns in specs
grep -R "getByRole\\(|getByLabel\\(|getByTestId\\(|locator\\(" -n specs || true Set env contract:
export WEB_BASE_URL="http://sut.testlab:3000"
export API_BASE_URL="http://sut.testlab:3001/api" Run Sprint 8 recipe spec:
npx playwright test specs/sprint8 \
--project=auth-chromium --workers=1 --reporter=line
Use auth-chromium / unauth-chromium per the config.
Do not use --project=chromium unless it exists.
assertions/.flows/ and reuse.| UPSTREAM |
Sprint 07 — Fixtures (execution control) Sprint 05 — Test data (state correctness) |
| CURRENT LAYER |
UI abstraction layer (this runbook) Converts raw UI into stable domain actions |
| DOWNSTREAM |
Sprint 14 — Failure artifacts Sprint 15 — Failure classification Sprint 17 — Release decisions |
If UI abstraction is unstable, all downstream signals (failures, triage, release gates) become unreliable.