critical priority low complexity testing pending testing specialist Tier 6

Acceptance Criteria

Automated widget test confirms that when org feature flags do not include 'driver', the bottom navigation bar renders exactly the standard 5 tabs with no driver-specific tab
Automated test verifies that deep linking to any driver route (e.g., /driver/assignments, /driver/declaration) redirects to a 404/not-found screen or home screen when driver flag is absent
Automated test confirms no DriverAssignmentListWidget, DeclarationBadge, or DriverScreen widget appears anywhere in the widget tree for a non-driver org session
Manual test matrix is documented and executed covering: NHF session, HLF session, Barnekreftforeningen session (all without driver flag) and Blindeforbundet session (with driver flag)
Test confirms that the FeatureFlagGuard widget returns SizedBox.shrink() or equivalent empty widget — not a placeholder or disabled button — for driver UI elements in non-driver orgs
Test verifies Riverpod or BLoC provider for driver feature flag is initialized from org profile at login and does not leak state between org switches
All 4 org types produce identical navigation structure with the exception of Blindeforbundet driver additions — documented in test matrix
No console errors or widget build exceptions occur during rendering of any screen in a non-driver org session

Technical Requirements

frameworks
flutter_test
integration_test
bloc_test or riverpod overrides for flag injection
apis
Supabase org profile query (feature_flags column)
Organization session initialization
data models
OrganizationProfile
FeatureFlagSet
UserSession
performance requirements
Automated smoke tests must complete in under 60 seconds total
Feature flag evaluation must occur synchronously at session initialization — no async flag fetch mid-navigation
security requirements
Feature flag state must be sourced from authenticated org profile — not from client-side configuration that could be modified
Deep link guard must validate flag server-side if any sensitive driver data would be exposed
ui components
BottomNavigationBar
FeatureFlagGuard wrapper widget
AppRouter deep link handler
DriverAssignmentListScreen (must be absent)

Execution Context

Execution Tier
Tier 6

Tier 6 - 158 tasks

Can start after Tier 5 completes

Implementation Notes

The FeatureFlagGuard widget should be implemented as a simple conditional builder: if the flag is absent, return const SizedBox.shrink(). Avoid using Opacity(opacity: 0) or IgnorePointer — these still render the widget tree and will cause test failures. For deep link guard, the AppRouter's redirect callback should check the flag and return '/' if driver flag is absent. When seeding org sessions in tests, use a fake OrganizationRepository that returns a hardcoded OrganizationProfile with the desired feature flags.

The test matrix document should explicitly list every driver-related route path so future engineers can maintain coverage as new driver screens are added.

Testing Requirements

Write one widget test per org type using providerOverride or BLoC injection to seed each org's feature flag set. For each org, assert: (1) bottom nav item count and labels match expected spec, (2) widget tree contains no widgets with 'driver' in their runtimeType name (use tester.widgetList with a custom finder), (3) navigating to a driver deep link path redirects correctly. Document a manual test matrix as a markdown table in the test file header comment covering all supported org types × flag combinations × navigation entry points. Execute manual TestFlight smoke test on a physical device for Blindeforbundet (flag ON) and NHF (flag OFF) before marking task complete.

Epic Risks (3)
high impact medium prob technical

The declaration acknowledgement screen has the most complex accessibility requirements of any screen in this feature: scrollable long-form legal text, a conditional checkbox that is only enabled after reading, and a timestamp capture. Incorrect focus management or missing semantics annotations could fail VoiceOver navigation or cause the screen reader to announce the checkbox as available before the driver has scrolled, undermining the legal validity of the acknowledgement.

Mitigation & Contingency

Mitigation: Build the acknowledgement screen against the WCAG 2.2 AA checklist from the start, not as a post-hoc audit. Use semantics-wrapper-widget and live-region-announcer from the platform's accessibility toolkit. Include a VoiceOver test session in the acceptance criteria with a tester using the screen reader.

Contingency: If WCAG compliance cannot be fully achieved within the sprint, ship the screen with a documented list of accessibility gaps and a follow-up sprint commitment. Do not block the declaration workflow launch if the core interaction works but a non-critical semantics annotation is missing.

medium impact medium prob integration

Drivers receive a push notification with a deep link to the declaration acknowledgement screen for a specific assignment. If the deep link handler does not correctly route to the right screen and assignment context — particularly when the app is launched cold from the notification — the driver may see a blank screen or the wrong declaration.

Mitigation & Contingency

Mitigation: Implement and test all three notification scenarios: app foregrounded, app backgrounded, and cold start. Use the platform's existing deep-link-handler infrastructure. Add integration tests that simulate notification tap events and assert correct screen and data loading.

Contingency: If cold-start deep link routing proves unreliable, implement a notification-centre fallback where the driver can find the pending declaration from the notification centre screen, ensuring the workflow can always complete even if the direct deep link fails.

medium impact low prob technical

If the driver-feature-flag-guard has any rendering edge case — such as a brief flash of driver UI before the flag value is loaded, or a guard that fails open on a flag service error — driver-specific UI elements could be momentarily visible to coordinators in organizations that have not opted in, causing confusion and potentially a support escalation.

Mitigation & Contingency

Mitigation: Default the guard to rendering nothing (not a loading indicator) until the flag value is definitively resolved. Treat flag service errors as flag-disabled to fail closed. Write widget tests covering the loading, disabled, and enabled states including the error case.

Contingency: If fail-closed cannot be guaranteed within the sprint, add a server-side RLS check on the driver assignment endpoints so that even if the UI guard leaks, the data layer refuses to return driver data for organizations without the flag enabled.