high priority low complexity testing pending testing specialist Tier 3

Acceptance Criteria

ContactCardWidget test: name text is rendered and matches the fixture contact's display name
ContactCardWidget test: role badge is present and displays the org-label-resolved role string
ContactCardWidget test: notes field is truncated with ellipsis when text exceeds one line
ContactCardWidget test: tapping the card invokes the onTap callback with the correct contact ID
ContactCardWidget test: widget dimensions meet the 48x48dp minimum touch target (WCAG 2.2 SC 2.5.8)
PeerMentorCardWidget test: all mentor-specific fields (availability, certification status, specialization) are rendered
PeerMentorCardWidget test: availability chip displays the correct color token for each availability state (available, busy, paused)
PeerMentorCardWidget test: certification chip displays the correct color token for valid vs expired certification
PeerMentorCardWidget test: widget meets 48x48dp minimum touch target
Golden tests capture a baseline screenshot for both widgets and flag visual regressions on re-run
All tests pass with flutter test with no skipped assertions

Technical Requirements

frameworks
Flutter
flutter_test
data models
Contact
PeerMentor
OrgLabels
performance requirements
Each widget test must complete in under 2 seconds
ui components
ContactCardWidget
PeerMentorCardWidget
Role badge widget
Availability chip widget
Certification status chip widget

Execution Context

Execution Tier
Tier 3

Tier 3 - 413 tasks

Can start after Tier 2 completes

Implementation Notes

For touch target size assertion: use tester.getSize(find.byType(ContactCardWidget)) and assert width >= 48 and height >= 48. For callback verification: use a bool flag or a captured-value variable — avoid Mockito unless already in the project dependencies. For golden tests: establish baselines on first run with --update-goldens; commit PNG baselines to the repo under test/goldens/. For color chip assertions: use tester.widget(find.descendant(...)) and inspect the decoration color, mapping it against the design token constants.

Ensure OrgLabels are injected via the widget constructor or a test-scoped provider override — do not rely on a real Supabase call.

Testing Requirements

Use flutter_test WidgetTester for all tests. Organize tests in two describe blocks: contact_card_widget_test.dart and peer_mentor_card_widget_test.dart. Each file must have: (1) a 'renders correctly' group with field-level assertions, (2) an 'interaction' group with tap callback verification, (3) an 'accessibility' group checking touch target size via tester.getSize(), (4) a 'golden' group generating PNG baselines with matchesGoldenFile. Use the mock fixture factory from task-001 to construct test data.

Do not use real Supabase connections. Wrap widgets in MaterialApp with the project theme to ensure design tokens resolve correctly.

Component
Contact Card Widget
ui low
Epic Risks (2)
medium impact medium prob technical

Design token color values used in role badges, certification status indicators, and availability chips may not meet the WCAG 2.2 AA contrast ratio of 4.5:1 when rendered against card backgrounds, requiring rework after accessibility review and potentially blocking acceptance sign-off.

Mitigation & Contingency

Mitigation: Run the contrast-ratio-validator on every new token combination during widget development. Enforce the CI accessibility lint runner on all PRs touching visualization components, and validate against the contrast-safe-color-palette before finalizing card designs.

Contingency: If contrast failures are found late, adjust token values in the design token theme centrally — since all widgets consume design tokens rather than hardcoded colors, all affected widgets will be corrected by a single token update without per-widget changes.

low impact medium prob dependency

The ContactViewSwitcher is required for Barnekreftforeningen but must not appear for other organizations. If the organization labels provider does not yet expose a reliable feature flag for this widget, it may render universally or be conditionally hidden in an inconsistent way, breaking the role-specific layout contract.

Mitigation & Contingency

Mitigation: Implement view switcher visibility as a constructor parameter on ContactListScreen injected from a provider, defaulting to hidden. Document the integration point for the org labels provider so the flag can be wired without changing the widget's API.

Contingency: If org labels integration is delayed beyond this epic, use a feature flag constant keyed to the Barnekreftforeningen organization ID as a temporary gate, with a tracked issue to replace it with the runtime labels provider before general release.