Testing of the Daily Work Popup
Test Plan: Daily Work Area Popup
Purpose
This plan verifies the daily work area popup behavior described in:
docs/daily-work-area-popup/daily-work-area-popup-prd.mddocs/daily-work-area-popup/daily-work-area-popup-architecture.md
The main claim to prove is that the popup is gated by whether it has actually popped up for the current local day, not by whether the app has opened today.
Scope
In scope:
- Local date-key generation.
- AsyncStorage read/write behavior for the popup shown date.
- Missing, corrupt, and failing persistence behavior.
- Work area screen focus behavior.
- Same-day suppression after presentation.
- Next-day eligibility.
- Regression coverage that app startup alone does not mark the popup as shown.
Out of scope:
- Popup visual redesign.
- Notification scheduling.
- Server sync or backend persistence.
- Full mobile session, telemetry, weather, activity, or prediction pipeline verification.
Existing Test Context
The app uses Jest with jest-expo and already has service, db, component, and
integration tests under src/__tests__/.
Known command:
npm run autoTest
Expected evidence:
- Jest exits successfully.
- New popup state and screen behavior tests pass.
- Existing tests continue to pass.
Testing Profiles
Static verification:
- Applicable. Run lint/type checks if implementation changes TypeScript surfaces.
- Command:
npm run lint - Evidence: exit code 0 or a reviewed list of unrelated existing warnings.
Unit:
- Applicable. Cover the local date-key and AsyncStorage helper.
Component/render:
- Applicable if the popup is controlled by React screen state. Use React Native Testing Library around the relevant screen or a narrow extracted gate component.
Integration:
- Applicable at the screen lifecycle boundary: screen focus plus storage state plus popup presentation.
Database, contract/API, server, LLM/eval:
- N/A. This feature is local UI state only.
E2E/browser:
- N/A for browser. Optional device/manual smoke is enough for v0.
Accessibility and visual regression:
- Deferred. Existing popup UI is unchanged.
Performance:
- N/A. One local storage read on screen focus is not a meaningful performance risk.
Security/privacy:
- Low risk. The stored value is only a local date string and contains no sensitive user data.
Regression/CI:
- Applicable. Existing Jest suite should remain green.
Coverage Map
Acceptance criterion: App opens today, user reaches work area screen later today, popup appears.
- Check: screen behavior test renders app/screen with no shown date written by startup and triggers screen focus.
- Evidence: popup present/open callback called once; AsyncStorage contains shown date only after presentation.
Acceptance criterion: Popup appears at most once on the same local day.
- Check: storage has today’s local date, focus the screen.
- Evidence: popup is not shown.
Acceptance criterion: Popup can appear again tomorrow.
- Check: storage has yesterday’s local date, inject today’s date, focus the screen.
- Evidence: popup shown and stored date updates to today’s key.
Acceptance criterion: Missing, corrupt, or unreadable storage is eligible.
- Check: helper tests for null value, malformed value, and rejected
getItem. - Evidence: helper returns not shown for all three cases.
Acceptance criterion: App launch does not suppress the popup.
- Check: startup or app-level test verifies popup shown-date key is not written before the work area screen presents the popup.
- Evidence: no write to the popup storage key during app initialization path.
Acceptance criterion: Existing popup content and dismissal behavior are unchanged.
- Check: component snapshot/query coverage should assert the existing popup still renders the same key title/action labels where practical.
- Evidence: existing popup queries still pass; no content assertions were removed without replacement.
TDD Slices
Slice 1: Date State Helper
RED:
- Add unit tests for local date-key generation, missing storage, today’s stored date, prior stored date, corrupt storage, read failure, and write behavior.
- Verify the tests fail because the helper does not exist or does not implement the new semantics.
GREEN:
- Implement the smallest AsyncStorage helper that passes those tests.
Refactor:
- Keep the helper names and storage key explicit. Avoid a generic prompt framework.
Slice 2: Screen Focus Gate
RED:
- Add a screen or gate-component test where the screen focuses with no shown date and expects the popup to open.
- Add a same-day storage test that expects no popup.
GREEN:
- Wire the relevant work area screen to call the helper on focus and open the existing popup only when eligible.
Refactor:
- Extract only enough logic to keep async focus handling readable and testable.
Slice 3: Launch Regression
RED:
- Add a regression test proving app startup or non-work-area navigation does not write the popup shown date.
GREEN:
- Remove or bypass any app-open code that writes the shown-date key.
Refactor:
- Keep popup state ownership inside the screen workflow.
Automated Checks
Unit Tests
Target:
- Daily popup state helper.
Cases:
getLocalDateKeyreturnsYYYY-MM-DDusing local date fields.- No stored date means popup has not shown today.
- Today’s stored date means popup has shown today.
- Yesterday’s stored date means popup has not shown today.
- Corrupt stored value means popup has not shown today.
- Storage read rejection means popup has not shown today.
markDailyWorkAreaPopupShownwrites today’s local date key.- Storage write rejection does not throw if implementation chooses best-effort persistence.
Screen Tests
Target:
- Relevant daily work area screen, or a small extracted popup gate if the full screen is too heavy to render.
Cases:
- On first focus with no stored date, the popup opens once.
- On repeated focus while the first eligibility check is in flight, the popup does not open twice.
- On focus with today’s stored date, the popup does not open.
- On focus with a previous stored date, the popup opens and writes today’s date.
- Opening another screen or starting the app does not write the popup shown date.
Manual Smoke Check
Use a simulator or physical device after automated tests pass:
- Clear app storage.
- Open the app and stay off the work area screen.
- Close and reopen the app on the same day if practical.
- Navigate to the work area screen.
- Confirm the popup appears.
- Dismiss the popup, leave the screen, and return.
- Confirm the popup does not appear again the same day.
- Change the stored date to yesterday through test setup or debug tooling.
- Return to the work area screen.
- Confirm the popup appears again.
Evidence:
- Notes with device/simulator, date used, and pass/fail result for each step.
- Screenshots only if the implementation agent needs visual proof for review.
Failure Triage
If a check fails:
- Confirm whether the failing path is app launch, screen focus, popup presentation, or persistence.
- Inspect the stored popup date value and current injected/local date key.
- Verify whether the shown date is written before or after popup presentation.
- Check for duplicate focus or render effects.
- Fix the smallest root cause and rerun the failed test plus the full
npm run autoTestsuite.
Completion Evidence
No implementation agent should claim this change is done without:
- Passing helper tests.
- Passing screen or gate behavior tests.
- Passing launch regression coverage.
- Fresh
npm run autoTestoutput. - Manual smoke notes if the popup screen is hard to fully cover with automated tests.