---
description: Build and test the iOS app in Xcode Simulator
---

## Test iOS App

### Prerequisites
- All services running (`./run-local-all-services.sh start`)
- Backend healthy: `curl http://127.0.0.1:8000/health`
- CocoaPods installed: `pod install` in `mobile_app/ios/`

### Step 1 — Run mobile code quality checks

Run `/mobile-code-quality` first to catch compile errors across all targets.

### Step 2 — Open the workspace

Open **`mobile_app/ios/LysnrAI.xcworkspace`** (NOT `.xcodeproj` — CocoaPods requires the workspace).

- Scheme: **LysnrAI**
- Destination: **iPhone 16 Pro** Simulator

### Step 3 — Build and run (Cmd+R)

### Step 4 — Verify main app features

- **Login/Register**: Enter email + password, tap Sign Up or Log In
- **Home screen**: Should show personalized greeting ("Good morning/afternoon/evening, {first name}")
- **Settings**: Should show profile header with initials avatar, name, email, plan badge
- **Form validation**: Try empty fields, short password, invalid email — should show inline errors

### Step 5 — Verify keyboard extension

1. On Simulator: Settings → General → Keyboard → Keyboards → Add New Keyboard → **LysnrAI**
2. Toggle **Allow Full Access** ON (required for Azure Speech + telemetry)
3. Open any text field (Notes, Messages, Safari)
4. Switch to LysnrAI keyboard (globe icon → LysnrAI)
5. Verify:
   - **Keyboard UI**: Mic button (green), backspace, space, return, globe, "LysnrAI Voice" brand
   - **Status label**: Shows "Tap mic to dictate"
   - **Space/Backspace/Return**: All insert correct characters
   - **Settings button**: Opens main LysnrAI app (or shows Full Access prompt)

### Step 6 — Verify voice dictation

> Note: Microphone may not work in Simulator. Test on physical device if possible.

1. Tap mic button — should turn red, show "Starting..."
2. If Azure keys configured (via App Group): should show "Listening (Azure)..."
3. If no keys / no Full Access: should show "Listening (on-device)..."
4. Speak — partial text should appear in blue italic
5. Tap mic again to stop — recognized text should insert into text field
6. Check word count indicator updates

### Key Files

| File | Purpose |
|------|---------|
| `mobile_app/ios/LysnrAI/Auth/AuthService.swift` | Auth state, credential sharing with keyboard |
| `mobile_app/ios/LysnrAI/ContentView.swift` | Tab navigation, passes authService to views |
| `mobile_app/ios/LysnrKeyboard/KeyboardViewController.swift` | Keyboard extension main controller |
| `mobile_app/ios/LysnrKeyboard/LysnrTelemetry.swift` | Keyboard telemetry client |
| `mobile_app/ios/LysnrKeyboard/Info.plist` | Extension config + privacy descriptions |

### API Endpoint
iOS Simulator connects to `http://127.0.0.1:8000` (configured in AuthService.swift)
