- Next.js 14+ with App Router and TypeScript - Tailwind CSS and ShadCN UI styling - Zustand state management - Dexie.js for IndexedDB (local-first data) - Auth.js v5 for authentication - BMAD framework integration Co-Authored-By: Claude <noreply@anthropic.com>
2.2 KiB
2.2 KiB
ATDD Checklist - Epic 3, Story 3.4: PWA Polish
Date: 2026-01-26 Author: BMad TEA Agent Primary Test Level: Integration & Component
Story Summary
As a mobile user I want to install the app to my home screen So that I can access it easily and use it offline like a native app.
Acceptance Criteria
- Valid Manifest: App serves a valid
manifest.webmanifestwith name "Test01", standalone mode, and required icons. - Install Prompt: An in-app UI prompt appears when the browser determines the app is installable (
beforeinstallpromptevent). - Offline Access: App works offline (already covered by Story 3.3).
- Icons: 192px and 512px icons are available.
Failing Tests Created (RED Phase)
Integration Tests (1 file)
File: tests/integration/pwa-manifest.test.ts
- ✅ Test: should serve a valid manifest.webmanifest
- Status: RED (Next.js config might not be serving it at this route yet, or content mismatch).
- Verifies: JSON content, headers, and icon references.
- ✅ Test: should have accessible icon files
- Status: GREEN (Icons verified in public folder), but ensures they are served.
Component Tests (1 file)
File: src/components/features/pwa/install-prompt.test.tsx
- ✅ Test: should appear when beforeinstallprompt event fires
- Status: RED - Component does not exist.
- Verifies: Event listener logic and UI rendering.
- ✅ Test: calls prompt() when "Install" is clicked
- Status: RED - Component logic missing.
Implementation Checklist
Core Config
- Verify
manifest.tsoutput path (Next.js App Router). - Ensure
manifest.webmanifestormanifest.jsonroute works.
Component: InstallPrompt
File: src/components/features/pwa/install-prompt.tsx
- Create
InstallPromptcomponent. - Add
useEffectlistener forbeforeinstallprompt. - Implement "Install" button calling
deferredPrompt.prompt(). - Implement "Not Now" button to hide UI.
- Integrate into
src/app/layout.tsxorpage.tsx.
Running Tests
# Component Test
npx vitest run install-prompt.test.tsx
# Integration Test
npx playwright test pwa-manifest.test.ts