high priority medium complexity testing pending testing specialist Tier 7

Acceptance Criteria

OrgSelectionScreen widget test: mocked OrganizationRepository returns 3 orgs and all 3 org card widgets are present in the widget tree
Tapping an org card in OrgSelectionScreen causes OrgSelectionService.selectOrg() to be called exactly once with the correct org ID
During org selection, a loading indicator widget is visible and org cards are non-interactive (disabled or pointer-ignored)
When OrgSelectionService returns an error, a localized error message widget is rendered with the correct error text; no crash occurs
OnboardingProgressIndicator widget is present in the tree when the test user is flagged as new (first login); it is absent for returning users
MultiOrgContextSwitcher renders one entry per org returned by the mocked repository, with the active org visually distinguished (e.g., checkmark or highlight widget)
Tapping a non-active org in MultiOrgContextSwitcher opens a confirmation dialog widget containing both confirm and cancel actions
Tapping cancel in the confirmation dialog closes the dialog and leaves the active org unchanged
Tapping confirm in the confirmation dialog calls OrgSelectionService.switchOrg() and updates the active context indicator widget
All 7 test scenarios pass with zero real Supabase network calls (verified by asserting no http.Client or SupabaseClient calls escape the mock boundary)
Test file is organized with descriptive group() and test() labels matching the 7 scenarios above
Test execution time for the full file is under 30 seconds on CI

Technical Requirements

frameworks
Flutter
flutter_test
Riverpod
BLoC
data models
Organization
UserOrganizationContext
OnboardingStatus
performance requirements
All widget tests must complete in under 30 seconds total
No real network I/O permitted — all async operations must resolve via mocked futures
security requirements
Mocked repositories must not use real org IDs, user IDs, or personal data in test fixtures — use synthetic test data only
ui components
OrgSelectionScreen
MultiOrgContextSwitcher
OnboardingProgressIndicator
OrgCard
ConfirmationDialog
LoadingIndicator
ErrorWidget

Execution Context

Execution Tier
Tier 7

Tier 7 - 84 tasks

Can start after Tier 6 completes

Implementation Notes

Structure the test file with a shared setUp() that builds the minimal ProviderScope override tree needed for both screens. Create lightweight fake implementations (not Mockito mocks) for OrganizationRepository and OrgSelectionService — fakes are easier to read and maintain. For the confirmation dialog test, use tester.tap(find.byKey(Key('confirm-org-switch-button'))) — coordinate with the UI task to ensure consistent Key assignments. For the OnboardingProgressIndicator visibility test, inject a UserSessionFake that returns isNewUser: true or false — avoid relying on Supabase auth state.

For the loading state test, use a Completer-backed fake that holds the future open so you can assert the loading indicator before resolving. Verify the active org indicator by asserting a specific widget (e.g., find.byKey(Key('active-org-checkmark-${org.id}'))) is present. Document all Key values used in tests with a comment linking to the widget file where they are defined.

Testing Requirements

All tests are widget tests using flutter_test with WidgetTester. Use Riverpod's ProviderScope with overrides to inject mock implementations of OrganizationRepository and OrgSelectionService — do not use real Supabase. For BLoC-based state, use a mock BLoC or emit states directly in test setup. Test each of the 7 scenarios in its own test() block inside a group().

Use tester.pump() and tester.pumpAndSettle() appropriately: pump() after triggering async actions to advance one frame, pumpAndSettle() only when waiting for animations. Assert widget presence using find.byType() and find.byKey(). Assert widget absence using findsNothing. Verify method calls on mocks using Mockito or manual call-counting fakes.

No golden/screenshot tests required for this task.

Epic Risks (2)
low impact high prob technical

OrgSelectionScreen and OrgContextSwitcher render partner-specific logos, colors, and text from dynamic data. Golden tests (pixel-comparison screenshots) will fail whenever branding assets are updated in the backend, causing CI failures that block unrelated PRs and eroding developer trust in the test suite.

Mitigation & Contingency

Mitigation: Use fixture-based golden tests with static mock Organization models containing embedded test assets rather than network-fetched assets. Separate branding asset acceptance tests into a dedicated CI job that only runs on branding-related PRs and is maintained by the design team.

Contingency: If golden test maintenance overhead becomes excessive, replace pixel-comparison goldens with semantic widget tests that assert widget tree structure and key property values, reserving golden tests for only the most stable, design-critical elements.

high impact medium prob scope

Several partner organizations (especially Blindeforbundet) have users who rely entirely on VoiceOver or TalkBack. Complex branded card layouts with overlaid logos, names, and selection states are notoriously difficult to make fully accessible; missing semantics or incorrect focus order could make the selection screen completely unusable for screen reader users before launch.

Mitigation & Contingency

Mitigation: Involve an accessibility specialist in the design review before any widget implementation begins. Use Flutter's Semantics widget with explicit label, hint, and button role on OrgCardWidget. Conduct manual screen reader testing on both iOS (VoiceOver) and Android (TalkBack) for every sprint that touches these screens, not just before release.

Contingency: If full WCAG compliance cannot be achieved within the sprint, implement a simplified text-list fallback mode that activates when the system detects an active screen reader, presenting orgs as plain accessible list tiles instead of the branded card layout.