high priority medium complexity testing pending testing specialist Tier 7

Acceptance Criteria

integration_test/cognitive_accessibility_e2e_test.dart exists and is runnable via `flutter test integration_test/cognitive_accessibility_e2e_test.dart`
Test step 1: app launches wizard, first step is visible and focused correctly for screen reader
Test step 2: user fills each wizard step in sequence using tester.enterText and tester.tap on Next
Test step 3: an intentionally invalid field value is entered; test asserts PlainLanguageErrorDisplay is visible with a non-empty, plain-language message (no technical jargon detected via regex)
Test step 4: tapping the inline help icon on a text field shows InlineContextualHelpWidget content; test asserts the help text is non-empty
Test step 5: test simulates app backgrounding mid-wizard (AppLifecycleState.paused) and re-foreground (AppLifecycleState.resumed); all previously entered field values remain intact
Test step 6: test navigates through remaining wizard steps to ConfirmBeforeSubmitScreen and asserts the screen is shown
Test step 7: test taps Confirm and asserts the wizard emits WizardSubmitted and the success state/screen is reached
Test passes on both iOS (TestFlight-compatible build) and Android
Test is tagged with @Tags(['accessibility', 'e2e']) for selective CI execution

Technical Requirements

frameworks
Flutter
flutter_test
integration_test
BLoC
apis
Supabase Auth (mocked via fake implementation)
data models
activity
assignment
performance requirements
Full e2e test must complete within 3 minutes on a standard CI runner
No individual step should take longer than 30 seconds
security requirements
Test must use a dedicated test Supabase project or a fully mocked Supabase client — never the production database
No real BankID or Vipps calls; authentication must be bypassed via a test-mode flag or fake repository
ui components
PlainLanguageErrorDisplay
InlineContextualHelpWidget
ConfirmBeforeSubmitScreen
WizardStateManager

Execution Context

Execution Tier
Tier 7

Tier 7 - 84 tasks

Can start after Tier 6 completes

Implementation Notes

Structure the test as a single sequential flow rather than isolated unit tests — the goal is a living contract proving the full user journey works end-to-end. Use `find.bySemanticsLabel` for all interactions to simultaneously validate accessibility labels. For the 'pause/resume' step, inject a fake lifecycle observer into the widget binding rather than relying on the OS — this makes the test deterministic in CI. For the draft-resume step, ensure the BLoC's draft persistence (typically Hive or Supabase draft row) is seeded before the resume step rather than relying on the prior pause step to have written it, making the test order-independent.

Add a descriptive comment block at the top of the file explaining this is the 'living contract' for the cognitive accessibility epic — future developers should update this test when accessibility-related behaviour changes.

Testing Requirements

Flutter integration_test framework. Each scenario step should be a clearly commented section within a single `testWidgets` block (or grouped `group` blocks) to serve as living documentation. Use `IntegrationTestWidgetsFlutterBinding.ensureInitialized()`. Mock Supabase using a fake SupabaseClient injected via dependency injection — do not rely on network calls.

For lifecycle simulation, use `tester.binding.handleAppLifecycleStateChanged`. Assert PlainLanguageErrorDisplay using a regex to detect common technical error patterns (e.g., no occurrences of 'null', 'exception', 'stacktrace', '500', 'error code'). Run this test suite in TestFlight distribution for iOS acceptance validation.

Component
Cognitive Accessibility Audit Utility
infrastructure medium
Epic Risks (4)
high impact medium prob technical

The WizardStateManager BLoC must guarantee that step transitions only occur on explicit user action, never automatically. Subtle reactive patterns in Bloc (e.g. stream listeners triggering add() calls) could inadvertently auto-advance the wizard, violating the core cognitive accessibility rule and creating a regression that is difficult to detect without dedicated tests.

Mitigation & Contingency

Mitigation: Write a dedicated unit test that subscribes to the BLoC stream and asserts no StepChanged event is emitted for 5 seconds after a state update, without an explicit user-sourced event being dispatched. Make this test part of the CI gate for the WizardStateManager.

Contingency: If an auto-advance regression is discovered post-integration, introduce a mandatory UserActionToken parameter on all step-transition events so the BLoC can structurally refuse transitions that do not originate from a user gesture handler.

medium impact medium prob integration

The ConfirmBeforeSubmitScreen requires deep-linking back to specific wizard steps for corrections. Implementing bidirectional navigation within a multi-step wizard while preserving all previously entered state is architecturally non-trivial and may conflict with the existing StatefulShellRoute navigation setup described in the app architecture.

Mitigation & Contingency

Mitigation: Design the ConfirmBeforeSubmitScreen's back-navigation links to dispatch a GoToStep event on the WizardStateManager rather than using GoRouter's pop() chain. This keeps navigation state entirely in the BLoC and avoids coupling to the router's stack semantics.

Contingency: If BLoC-driven step navigation proves incompatible with the router, implement the correction flow as a dedicated sub-route that pre-populates its form from the WizardStateManager's current draft, then merges the edited field back into the draft on completion before returning to the confirm screen.

medium impact medium prob technical

The CognitiveAccessibilityAudit utility must inspect live widget trees for violations such as icon-only buttons. Flutter's widget tree inspection APIs are available in test mode but have limitations in identifying semantic intent (e.g. distinguishing a decorative icon from a navigation button). False negatives could give a false sense of compliance.

Mitigation & Contingency

Mitigation: Augment the audit with a convention-based approach: require all navigation buttons to use a named wrapper widget (e.g. LabelledNavigationButton) that the audit can detect by type, rather than relying solely on widget-tree semantics analysis.

Contingency: If widget-tree detection proves insufficiently reliable, scope the CognitiveAccessibilityAudit to route-configuration analysis (verifying back navigation availability per route) and static analysis of wizard step count definitions via the CognitiveLoadRuleEngine, which provides deterministic results.

low impact high prob scope

The InlineContextualHelpWidget sources content from a bundled JSON asset via the HelpContentRegistry. If help texts are missing for newly added screens or fields (a likely scenario as the 61-feature app grows), the widget silently shows nothing, degrading the accessibility experience without any visible failure.

Mitigation & Contingency

Mitigation: Integrate a CognitiveAccessibilityAudit check that verifies every registered (screenId, fieldId) pair that requests help has a corresponding entry in the HelpContentRegistry bundle. Run this check in CI as part of the audit report.

Contingency: Add a debug-mode overlay that highlights fields with missing help entries using a visible warning indicator, making coverage gaps immediately obvious to developers during local development before they reach CI.