high priority medium complexity testing pending testing specialist Tier 7

Acceptance Criteria

Empty form validation test: tapping submit on a blank form triggers field-level error messages for all required fields; no service call is made
Template pre-fill test: providing a RecurringTemplate fixture to the screen widget populates all mapped form fields with the expected values on first render
Duplicate dialog render test: stubbing the cubit to emit ProxyRegistrationDuplicateWarning state causes the duplicate warning dialog to appear with correct conflict date, time, and coordinator name
Duplicate dialog Cancel test: tapping Cancel in the duplicate dialog dismisses the dialog and leaves the form intact with no service call dispatched
Duplicate dialog Proceed test: tapping 'Proceed anyway' dismisses the dialog and calls ProxyRegistrationService.submit() with overrideDuplicate: true
Loading state test: while cubit emits ProxyRegistrationSubmitting, the submit button is non-interactive and a loading indicator is visible
Success navigation test: when cubit emits ProxyRegistrationSuccess, the NavigatorObserver (or mock GoRouter) records a push to the confirmation route with the correct activityId parameter
All tests use mock cubits (MockProxyRegistrationFormCubit) and do not require Supabase connectivity
Test file compiles with zero linter warnings and runs in under 10 seconds

Technical Requirements

frameworks
Flutter
flutter_test
flutter_bloc
mocktail or mockito
apis
ProxyRegistrationFormCubit (mocked)
NavigatorObserver or mock GoRouter for navigation assertions
data models
ProxyRegistrationFormState
RecurringTemplate
DuplicateWarning
ProxyRegistrationSuccess
performance requirements
Widget test suite for this screen must complete in under 10 seconds
ui components
ProxyRegistrationScreen
AppButton
Duplicate warning AlertDialog
CircularProgressIndicator
Inline error Text widgets

Execution Context

Execution Tier
Tier 7

Tier 7 - 84 tasks

Can start after Tier 6 completes

Implementation Notes

Create a test helper method pumpProxyRegistrationScreen(WidgetTester tester, {required MockProxyRegistrationFormCubit cubit}) that wraps the screen in MaterialApp + BlocProvider to reduce boilerplate across test cases. For template pre-fill, pass the template via the screen's constructor parameter and assert field values using tester.widget(find.byKey(...)).controller.text. For the duplicate dialog, use tester.tap(find.text('Proceed anyway')) followed by tester.pumpAndSettle() and then verify mockCubit.confirmOverride() was called. Keep mock state sequences simple — emit a single target state per test rather than replaying the full state machine.

Testing Requirements

All tests use pumpWidget with a provided MockProxyRegistrationFormCubit using BlocProvider.value(). Use tester.pump() after state changes for synchronous rendering. For navigation tests, inject a MockGoRouter or use a NavigatorObserver and verify pushNamed() is called with the confirmation route name and correct arguments. Group tests under descriptive group() blocks matching each scenario.

Use find.byType() and find.text() for assertions. Ensure no real network calls are made — all dependencies must be mocked.

Component
Proxy Registration Screen
ui medium
Epic Risks (3)
medium impact medium prob technical

The 2-hour window duplicate detection logic requires querying existing proxy records with compound key matching (mentor + date + activity type within time range). If the query is too broad it produces false positives that frustrate coordinators; if too narrow it misses genuine duplicates that corrupt Bufdir data.

Mitigation & Contingency

Mitigation: Define the duplicate detection window as a configurable parameter from the start. Prototype the Supabase query with representative data covering edge cases (midnight boundaries, different activity types same day, same activity type different mentors) before finalising the implementation.

Contingency: If the detection produces excessive false positives in UAT, allow coordinators to explicitly acknowledge and bypass the duplicate warning with a reason field, preserving safety while reducing friction.

high impact medium prob scope

If the proxy registration form does not clearly distinguish between the acting coordinator and the attributed mentor, coordinators may submit records attributing activities to themselves, causing inaccurate Bufdir reporting and potential funding issues.

Mitigation & Contingency

Mitigation: Conduct UAT with at least one real coordinator via TestFlight before release. Use distinct visual treatment (different card colours, explicit 'Registering on behalf of:' label) and require the confirmation screen to show both identities prominently.

Contingency: Add a mandatory confirmation checkbox on the confirmation screen that explicitly names the attributed mentor, preventing accidental self-attribution from slipping through.

high impact medium prob security

Coordinators with multi-chapter access must select an active chapter context before the mentor list is filtered correctly. If chapter scope resolution fails or is bypassed, cross-org proxy registrations could occur, violating data isolation between chapters.

Mitigation & Contingency

Mitigation: Reuse the existing active-chapter-state and hierarchy-service components established by the org hierarchy feature. Add a guard that blocks entry to the proxy flow if no chapter context is active, prompting chapter selection first.

Contingency: If the chapter resolution service is unavailable, default to the most restrictive scope (no mentors visible) and surface a clear error message rather than showing an unfiltered mentor list.