padosoft-frontend-testabilitylisted
Install: claude install-skill padosoft/skills
# Frontend testability contracts
A brittle end-to-end suite is usually not the tests' fault. The interface gave them nothing stable to hold
on to, so they held on to a class name and a delay.
**The rule: the markup owes the test a stable anchor and an observable state. Both are part of the
interface's contract, like an API response shape.**
---
## 1. The locator hierarchy the markup has to support
From most to least resilient. Whoever writes the interface decides how high the test can climb.
| # | Anchor | Survives |
|---|---|---|
| 1 | **the accessible role and name** | restyling, restructuring, copy changes in most cases |
| 2 | **the form label** | anything except renaming the label |
| 3 | the placeholder | last resort for a field with no label |
| 4 | visible text | only for **stable** text — page titles, fixed labels |
| 5 | **an explicit test identifier** | everything, because it exists for this |
| 6 | a style selector | nothing. Requires a written justification |
Markup that forces the test down to level 6 is a contract violation, and it is the interface that has to
change.
## 2. The eight rules
**A. Semantically stable markup.** Buttons, links, inputs, dialogs and checkboxes expose a role and an
accessible name that do not depend on a class or the shape of the tree.
```html
<!-- ❌ --> <div class="btn-primary" onclick="addToCart()">🛒</div>
<!-- ✅ --> <button type="button" aria-label="Add to cart">🛒</button>
<!-- ❌ --> <div class="modal-wrapper-v2">