Sign in to create and edit playbooks. Sign In Register

Semantic Versioning On Ui Elements

do-semantic-versioning-on-ui-elements · always_apply: no

Content

UI naming for Playwright and accessibility

Selector order (use in this order): get_by_test_idget_by_roleget_by_labelget_by_text (stable only). Do not use CSS/XPath for primary flows.

Every interactive control: stable data-testid, plus aria-label or visible label; forms need Label + aria-describedby for errors; dialogs need unique accessible name.

Naming: hierarchical feature-area--role, e.g. intent-form-dialog, intent-name-input, save-intent-button. Lists/cards: container + per-item ids (data-intent-id).

State: expose data-state, data-valid, aria-invalid, aria-pressed where it affects tests.

Portals (dialogs/menus): query from page, not a nested container—page.get_by_test_id("…").

Tests: disable animations in test env (1ms transitions). Prefer stable data-testid over dynamic button text.

Checklist before merge: ids on interactive nodes; labels on inputs; dialog names; no CSS-only E2E selectors; portals from page.

See project E2E docs for full examples when needed.

Details
Slug:
do-semantic-versioning-on-ui-elements
Always apply:
No
Created:
Apr 20, 2026
Updated:
Apr 20, 2026
Playbook
Junior Edda

v73.0

View Playbook
Activities 1