Skip to content

docs(testing): document CV flakiness and high-leverage assert patterns - #109

Merged
racitores merged 2 commits into
mainfrom
docs/cv-stale-press-flakiness
Aug 4, 2026
Merged

docs(testing): document CV flakiness and high-leverage assert patterns#109
racitores merged 2 commits into
mainfrom
docs/cv-stale-press-flakiness

Conversation

@racitores

@racitores racitores commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Expands component-view guidance with patterns learned from Mobile CV work:

  1. Stale press targets (Mobile #34241) — do not hold an element across awaits when the UI re-renders on a timer; re-query immediately before fireEvent.press. Prefer default { name: Routes.X } route probes.
  2. Migration assert parity (MMQA-2104 / Mobile #34197) — unit→CV must not weaken deleted expects (tabId, filterId, formatted dates, full analytics). Mandatory gap-check in unit-cv-overlap.
  3. Filter both-sides — Golden Rule 10 already required this; add an explicit antipattern: analytics/refetch alone is not enough — seed distinct before/after rows.
  4. Loading / skeleton honesty — pending-phase tests must match production UX (skeleton / not-yet-visible), not optimistic titles the screen does not show while loading.
  5. RefreshControl + flag overrides — call refreshControl.props.onRefresh inside act; drive flag-gated sheets via Redux / remote-flag overrides.

Files updated (testing/mobile-testing)

  • references/component-view.md — Golden Rules 10–12
  • references/component-view/writing-tests.md — high-leverage interaction pitfalls
  • references/component-view/navigation-mocking.md — analytics-only filter antipattern
  • references/component-view/reference.md — self-review 5/11–13, diagnosing failures, assertion patterns, What NOT to Do
  • references/placement/unit-cv-overlap.md — mandatory assert-parity gap check before DELETE
  • CHANGELOG.md

Type of Change

  • Skill improvement/update
  • New skill
  • Bug fix
  • Documentation update
  • Other (please describe):

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • My skill follows the SKILL_TEMPLATE.md format
  • I have tested this skill with an AI agent
  • My skill does not contain any secrets, private keys, or sensitive data
  • I have added appropriate documentation
  • My changes don't break existing skills

Testing

Reviewed guidance against Mobile CV fixes in #34241 and the MMQA-2104 Predict unit↔CV pass (#34197). No installer/CLI behavior change.

Additional Context

Highest-leverage items first (parity, filter both-sides example, loading honesty, RefreshControl/flags), on top of the existing stale-press / route-probe docs.

After merge, Mobile consumers pick this up on next metamask-skills sync --include testing/mobile-testing. Companion in-repo doc sync for docs/testing/component-view-tests.md can follow separately if desired.

racitores and others added 2 commits August 4, 2026 11:16
Capture the live-clock re-render race (re-query before press) and
default route-probe guidance in mobile-testing component-view refs so
agents fix CI flakes the same way as MetaMask Mobile PR #34241.

Co-authored-by: Cursor <cursoragent@cursor.com>
Capture migration assert parity, filter both-sides (analytics alone is
not enough), loading/skeleton honesty, RefreshControl + flag overrides,
and the overlap gap-check so agents avoid the same CV regressions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@racitores racitores changed the title docs(testing): document CV stale-press flakiness patterns docs(testing): document CV flakiness and high-leverage assert patterns Aug 4, 2026
@racitores
racitores enabled auto-merge (squash) August 4, 2026 09:35
@racitores
racitores merged commit 2d04b15 into main Aug 4, 2026
28 checks passed
@racitores
racitores deleted the docs/cv-stale-press-flakiness branch August 4, 2026 09:38
racitores added a commit that referenced this pull request Aug 7, 2026
## Summary

- Add CV guidance for the flake class where a **container mounts before
a child value settles** (own query / debounce / skeleton).
- Encode it as Golden Rule 13, a writing-tests pitfall, self-review
checklist item, diagnosing-failures row, assertion pattern, and What NOT
to Do example in `mobile-testing` component-view refs.
- Motivated by the intermittent `PredictMarketDetails` Positions-tab
`$60` failure on metamask-mobile `main` CI (sync `getByText` after
awaiting only the tab container).

## Test plan

- [x] `yarn audit:skills` — 0 errors
- [x] `yarn test` — 61/61 pass
- [ ] Reviewer: confirm the rule complements (does not duplicate) the
existing stale-press-target guidance from #109 / metamask-mobile #34241


Made with [Cursor](https://cursor.com)

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants