high priority medium complexity testing pending testing specialist Tier 7

Acceptance Criteria

Integration test: PeriodicSummaryCard dismissal (swipe-to-dismiss or dismiss button) persists dismissed state in the BLoC/local storage and does not re-appear on widget rebuild
Integration test: Pull-to-refresh on CoordinatorTeamSummaryView triggers RefreshTeamSummary event and a new BLoC Loading → Loaded cycle completes
Integration test: FilterByOutlier toggle updates the displayed list to show only outlier rows when activated, and shows the full list when deactivated
Integration test: Tapping a mentor row navigates to the correct mentor detail route with the correct mentor_id parameter (verified via NavigatorObserver or GoRouter test helpers)
Integration test: PeriodComparisonWidget renders correctly when priorPeriod values are all zero — no NaN, Infinity, or exception thrown
Golden test: PeriodicSummaryCard in light theme at 375px width
Golden test: PeriodicSummaryCard in dark theme at 375px width
Golden test: CoordinatorTeamSummaryView (loaded state, 3 mentors, 1 outlier) in light theme at 390px width
Golden test: CoordinatorTeamSummaryView (loaded state, 3 mentors, 1 outlier) in dark theme at 390px width
Golden test: PeriodComparisonWidget at 320px width (overflow-safe layout) in light theme
Golden test: PeriodComparisonWidget at 320px width in dark theme
All tests run successfully in the project's CI pipeline (GitHub Actions or equivalent) on every push to main and feature branches
Golden test failures cause CI to fail; approved goldens are committed to the repository under test/goldens/
No test relies on sleep() or arbitrary delays — use pump(), pumpAndSettle(), or await Future.delayed with a reasonable max of 100ms

Technical Requirements

frameworks
Flutter
flutter_test
BLoC (flutter_bloc)
Dart
apis
No real API calls in tests — all Supabase interactions mocked via fake repositories
data models
MentorSummaryModel
PeriodSummaryData
PeriodicSummaryCardModel
performance requirements
Full test suite for this epic must complete within 60 seconds in CI
Golden tests must use matchesGoldenFile with a tolerance threshold to avoid CI flakiness from sub-pixel rendering differences
security requirements
Test fixtures must use anonymized fake data — no real user names, IDs, or organization data

Execution Context

Execution Tier
Tier 7

Tier 7 - 84 tasks

Can start after Tier 6 completes

Implementation Notes

Organize test files to mirror the source structure: test/widgets/coordinator_team_summary_view_test.dart, test/widgets/periodic_summary_card_test.dart, test/widgets/period_comparison_widget_test.dart. Create a shared test/fixtures/mentor_summary_fixtures.dart file with factory functions that generate fake MentorSummaryModel instances — this prevents duplication across test files. For golden tests, run flutter test --update-goldens locally to generate the initial approved baseline files, then commit them. Add a CI step that runs flutter test without --update-goldens and fails if any golden differs.

For the BLoC integration tests, define a simple FakeBloc that implements the Stream interface and exposes an add(Event) method that synchronously enqueues state emissions — this gives you full control without async complexity. Document the golden update procedure in a comment at the top of each golden test file so future developers know how to update them when UI changes are intentional.

Testing Requirements

All tests use flutter_test. Use FakeCoordinatorTeamSummaryBloc (manually crafted fake implementing Bloc interface) to emit predefined state sequences. For golden tests, use flutter_test's matchesGoldenFile and commit approved goldens to test/goldens/. Set window size per test using tester.binding.window.physicalSizeTestValue and tester.binding.window.devicePixelRatioTestValue.

Use NavigatorObserver mock (or GoRouter's testing utilities) to verify navigation calls without running a real navigator. Cover both ThemeData.light() and ThemeData.dark() in all golden tests by wrapping the widget under test in a MaterialApp with the respective theme. Integration tests use pumpWidget + pumpAndSettle; avoid real timers.

Component
Coordinator Team Summary View
ui medium
Epic Risks (3)
medium impact medium prob technical

If the cached summary is from a prior period (e.g., previous quarter's card is still cached), the digest card could appear on the home screen with outdated numbers after a new period begins, confusing users who have already seen that data.

Mitigation & Contingency

Mitigation: In the SummaryCacheRepository, store the period_start and period_end alongside cached data. In the PeriodicSummaryCard BLoC, compare the cached record's period against the current date using PeriodCalculatorService. Only render the card if the cached summary belongs to the active period.

Contingency: If stale cards appear in production, push a hotfix that adds the period validity check to the BLoC and clears all cached summaries older than the current period boundary via a forced cache flush on next app launch.

medium impact medium prob technical

Using colour alone to distinguish underactive from overloaded mentors in the coordinator view would fail WCAG 1.4.1 (use of colour). This is especially critical for organisations serving users with colour vision deficiency.

Mitigation & Contingency

Mitigation: Always pair colour indicators with a text label or icon (e.g., a downward arrow + 'Underactive' text alongside the amber colour). Use the contrast-safe-color-palette design tokens throughout. Run the contrast-ratio-validator on all new colour combinations in CI.

Contingency: If an accessibility audit flags colour-only indicators post-launch, introduce icon-based indicators as a patch release and update the design token definitions to enforce the paired-indicator pattern going forward.

low impact medium prob integration

Inserting a new card into the role-based home screen requires changes to shared home screen widget composition, which may conflict with parallel feature branches also modifying the home screen layout, causing merge conflicts and integration delays.

Mitigation & Contingency

Mitigation: Implement the PeriodicSummaryCard as a fully self-contained widget that the home screen conditionally renders based on a BLoC state flag. Minimise changes to the home screen itself to a single conditional insertion point, reducing the surface area for merge conflicts.

Contingency: If integration conflicts block the PR, isolate the card behind the organisation-scoped feature flag so it can be toggled independently and merged without affecting other home screen changes.