high priority medium complexity testing pending testing specialist Tier 7

Acceptance Criteria

Widget test: EditContactScreen renders with all fields pre-populated from the provided Contact fixture; every field value matches the fixture data
Widget test: entering an invalid value in a field and tapping save (or triggering validation) displays the correct per-field error message beneath that field
Widget test: tapping the 'add chapter' chip opens the chapter selector and selecting a chapter adds it to the chapter list; tapping the remove icon on an existing chip removes it
Widget test: save button is rendered as disabled when any validation error is active; button becomes enabled when all errors are resolved
Widget test: when mock service returns success, Navigator.pop is called and ScaffoldMessenger shows a SnackBar with the expected success message
Widget test: when mock service throws an error, the inline error banner is visible with the error message and the retry button is present
Integration test: full flow — load screen with fixture contact, modify name field, add a chapter, tap save — mock service captures the correct payload containing the modified name and new chapter
Integration test: service failure path — mock service throws, error banner appears, user taps retry, service is called a second time with identical payload
All widget tests use fake/mock implementations of contact-edit-service injected via the DI mechanism (Riverpod override or BLoC injection)
Test file follows project naming convention and is placed alongside the widget under test or in the corresponding test directory

Technical Requirements

frameworks
Flutter
flutter_test
BLoC
Riverpod
apis
contact-edit-service (mocked)
data models
Contact
ContactEditPayload
Chapter
performance requirements
All widget tests complete in under 5 seconds total in CI
Integration test completes in under 30 seconds
security requirements
Test fixtures must not contain real personal data — use synthetic/anonymised data only
ui components
EditContactScreen
AppTextField
Chapter chip widgets
AppButton
Inline error banner

Execution Context

Execution Tier
Tier 7

Tier 7 - 84 tasks

Can start after Tier 6 completes

Implementation Notes

Create a `FakeContactEditService` class implementing the real service interface that returns configurable success/failure responses — this is simpler than Mockito mocks for this use case. Use `const Key('save-button')` and similar semantic keys on key widgets to make finders deterministic. For the chapter chip add/remove test, ensure the chapter picker modal is handled — if it uses a separate route, use `tester.pumpAndSettle()` after tap to let the route animation complete. For navigation assertion in widget tests, wrap the screen in a `MaterialApp` with a spy `NavigatorObserver` to capture `didPop` events.

For SnackBar assertion, use `find.byType(SnackBar)` after `pumpAndSettle`. Group related tests with descriptive `group()` blocks. Avoid `tester.pump(Duration(seconds: 5))` — use `pumpAndSettle` with a timeout instead.

Testing Requirements

Use flutter_test for all tests. Widget tests: use `WidgetTester.pumpWidget` with `ProviderScope.overrides` (Riverpod) or `BlocProvider` override to inject a `FakeContactEditService`. Use `tester.enterText`, `tester.tap`, and `tester.pump` / `tester.pumpAndSettle` appropriately. Assert UI state with `find.text`, `find.byType`, `find.byKey`.

Integration test: use `integration_test` package; mount the full screen with mocked service; drive interactions programmatically; assert final navigation state. Coverage target: 90% line coverage on EditContactScreen and its cubit/BLoC. Run tests in CI with `flutter test --coverage`.

Component
Edit Contact Screen
ui medium
Epic Risks (3)
medium impact medium prob scope

The encrypted-field-display confirmation dialog adds interaction steps that may frustrate coordinators who access sensitive fields frequently, leading to requests to bypass the flow or skip read-receipt logging, which would violate Blindeforbundet's compliance requirements.

Mitigation & Contingency

Mitigation: Design the confirmation dialog to be as minimal as possible (one clear sentence, single confirm action) and ensure it does not reappear for the same field within a single screen session. Validate the UX with Blindeforbundet coordinators during the TestFlight pilot before finalising.

Contingency: If coordinators raise strong objections, escalate to Blindeforbundet's data protection officer to determine whether a lighter confirmation pattern (e.g., biometric confirmation instead of dialog) satisfies their compliance obligation.

medium impact medium prob technical

The activity-history-list infinite scroll requires paginated Supabase queries. Contacts with hundreds of activities (e.g., an HLF peer mentor with 380 annual registrations) could cause slow page loads or memory pressure on older devices if pagination boundaries are set too large.

Mitigation & Contingency

Mitigation: Use a page size of 20 records with cursor-based pagination. Implement list item recycling using Flutter's ListView.builder. Benchmark memory usage with 400+ item simulation on a low-end test device before TestFlight release.

Contingency: If performance degrades on older devices, reduce page size to 10 and add a time-window filter (last 30 days, last 6 months, all) so the default view loads a manageable record count for most coordinators.

low impact high prob scope

The cognitive load rule engine (from the Cognitive Accessibility feature) mandates no more than 7 fields per screen section. If a contact model has more than 7 editable fields, the edit-contact-screen layout must be split into sections, adding complexity not accounted for in the initial scope.

Mitigation & Contingency

Mitigation: Audit the full contact field list from all four organisations before implementation. Group fields into logical sections (personal info, contact details, affiliation) so no single section exceeds 7 fields. Use the cognitive-load-rule-engine component if it is already delivered by the Cognitive Accessibility feature.

Contingency: If the rule-engine component is not yet available, implement a simple manual section layout with accordion-style expansion for less-frequently edited fields to stay within the 7-field guideline without blocking delivery.