# Slidev E2E Test Execution Plan

**Version:** 1.0
**Date:** 2025-10-09
**Status:** Documentation Complete - Ready for Execution

## Executive Summary

This document provides a comprehensive test execution plan for the Slidev presentation generation and control system with GitHub Pages hosting integration. The plan covers performance testing, concurrent load testing, E2E functional testing, browser compatibility testing, and Pipecat agent integration testing.

## Test Environment

### Environment Status

**API Environment:** Not currently configured (no .env file present)

**Required Configuration:**
```bash
# API Configuration
API_BASE_URL=<motia-api-endpoint>          # e.g., http://localhost:3000
SLIDEV_API_KEY=<api-key-for-control>       # API key for control commands

# GitHub Integration
GITHUB_TOKEN=<github-personal-access-token> # Token with repo and pages permissions

# Supabase Configuration
SUPABASE_URL=<supabase-project-url>
SUPABASE_SERVICE_KEY=<supabase-service-key>
```

### Test Infrastructure

**Test Scripts:**
- `scripts/performance-test.ts` - Performance benchmark testing (10 runs)
- `scripts/concurrent-test.ts` - Concurrent load testing (15 simultaneous)

**E2E Test Suites:**
- `tests/e2e/slidev-flow.spec.ts` - Happy path tests (10 scenarios)
- `tests/e2e/error-handling.spec.ts` - Error handling tests (comprehensive)
- `tests/e2e/browser-compatibility.spec.ts` - Cross-browser tests (4 browsers + mobile)

**Test Utilities:**
- `tests/e2e/helpers.ts` - Reusable test helper functions

**Configuration:**
- `playwright.config.ts` - Playwright test configuration

## Test Execution Sequence

### Phase 1: Environment Validation

**Objective:** Ensure test environment is properly configured

**Steps:**
1. Verify `.env` file exists with all required variables
2. Verify API endpoint is accessible
3. Verify GitHub token has correct permissions
4. Verify Supabase connection
5. Install Playwright browsers: `npx playwright install --with-deps`

**Success Criteria:**
- All environment variables are set
- API responds to health check
- GitHub API accessible
- Supabase connection successful
- Playwright browsers installed

### Phase 2: Performance Testing

**Objective:** Measure system performance under normal load

**Script:** `pnpm run test:performance`

**Configuration:**
- Default iterations: 10
- Delay between tests: 2 seconds
- Custom iterations: `pnpm run test:performance -- --iterations 20`

**Metrics Measured:**
- **Build Time:** Time to build Slidev deck (target: < 30s, ideal: < 15s)
- **GitHub Pages Publish Time:** Time for GitHub Pages to publish (target: < 60s, ideal: < 30s)
- **Total Generation Time:** Build + publish time (target: < 90s)
- **Control Command Latency:** Time for control commands to execute (target: < 500ms, ideal: < 200ms)
- **Page Load Time:** Time to load deck from GitHub Pages CDN (target: < 3s)
- **Command Success Rate:** Percentage of successful commands (target: > 95%)

**Test Flow per Iteration:**
1. Generate deck with test data
2. Wait for GitHub Pages publish
3. Measure page load time from CDN
4. Execute control commands (next, prev, goto)
5. Measure command latency
6. Record results

**Expected Output:**
- Performance metrics summary table
- Average, min, max values for all metrics
- Success/failure status vs targets
- Detailed logs for each iteration

**Success Criteria:**
- All performance targets met
- Success rate >= 95%
- No critical failures

### Phase 3: Concurrent Load Testing

**Objective:** Validate system handles multiple simultaneous presentations

**Script:** `pnpm run test:concurrent`

**Configuration:**
- Default concurrent requests: 15
- Target successful: 10+
- Custom count: `pnpm run test:concurrent -- --count 20`

**Test Flow:**
1. Launch 15 deck generations simultaneously
2. Track success/failure for each request
3. Measure generation time under load
4. Analyze GitHub Pages concurrent publishing
5. Identify rate limiting or failures

**Metrics Measured:**
- Total requests
- Successful requests
- Failed requests
- Success rate
- Average success time
- Min/max success time
- Average failure time
- GitHub Pages concurrent publish success

**Expected Output:**
- Concurrent load summary
- Performance under load metrics
- Target validation
- GitHub Pages stress test results
- Failure analysis (error distribution)

**Success Criteria:**
- >= 10 successful concurrent generations (out of 15)
- Success rate >= 67%
- GitHub Pages handles concurrent publishing
- System remains stable under load

### Phase 4: E2E Happy Path Testing

**Objective:** Validate complete end-to-end flow works correctly

**Script:** `pnpm test:e2e:happy-path`

**Test Scenarios:**

1. **Full Deck Generation Flow**
   - Generate deck with complete data
   - Wait for GitHub Pages publish (30-90s)
   - Verify deck URL is accessible via HTTPS
   - Validate all placeholders replaced
   - Verify Slidev presentation loads

2. **Control Commands**
   - Test 'next' command
   - Test 'prev' command
   - Test 'goto' command with specific slide
   - Verify latency < 500ms
   - Confirm UI updates in real-time

3. **Performance Benchmarks**
   - Total generation < 90s
   - Control latency < 500ms
   - Page load < 3s

4. **Rapid Command Succession**
   - Send multiple commands quickly
   - Verify all commands process correctly
   - No race conditions

5. **State Persistence**
   - Reload page after commands
   - Verify state is maintained
   - Deck still functional

6. **Edge Cases**
   - Minimal data (required fields only)
   - Special characters in data
   - Long company names
   - Unicode characters

**Expected Output:**
- 10 test scenarios executed
- All tests pass
- Screenshots on any failures
- Performance metrics logged

**Success Criteria:**
- All happy path tests pass
- No console errors
- HTTPS certificate valid
- All placeholders replaced correctly

### Phase 5: E2E Error Handling Testing

**Objective:** Validate error scenarios are handled gracefully

**Script:** `pnpm test:e2e:errors`

**Test Categories:**

**A. Generation API Errors**
- Invalid session ID → 404
- Missing sessionId → 400
- Invalid sessionId format → 400
- Missing templateId → 400
- Invalid templateId → 400
- Missing data fields → 400
- Invalid data types → 400

**B. Control API Errors**
- Missing API key → 401
- Invalid API key → 401
- Non-existent deck → 404
- Invalid deckId format → 400
- Missing command → 400
- Invalid command → 400
- goto without slideId → 400
- Malformed JSON → 400

**C. Rate Limiting**
- Rapid request handling (20 requests)
- Validates 429 status code
- Retry-after header present

**D. Edge Cases**
- Concurrent deck generation (5 concurrent)
- Very large data payloads
- Empty data objects

**Expected Output:**
- All error scenarios return correct status codes
- Error messages are helpful
- System handles errors gracefully
- No crashes or unhandled exceptions

**Success Criteria:**
- All expected errors return correct HTTP codes
- Error responses include helpful messages
- Rate limiting works correctly
- System remains stable

### Phase 6: Browser Compatibility Testing

**Objective:** Verify Slidev presentations work across all major browsers

**Script:** `pnpm test:e2e:browsers`

**Browsers Tested:**
- Chrome (Chromium)
- Firefox
- Safari (WebKit)
- Microsoft Edge

**Test Coverage per Browser:**
- Rendering validation
- Control command functionality
- Console error detection
- Screenshot capture for visual verification

**Additional Tests:**
- Performance consistency across browsers
- CSS and layout validation
- Cross-browser synchronization (multi-context)
- Mobile viewports (iPhone SE, iPhone 12 Pro)

**Expected Output:**
- Test results for each browser
- Screenshots saved to `test-results/screenshots/`
- Performance comparison across browsers
- Any browser-specific issues identified

**Success Criteria:**
- All browsers render correctly
- Control commands work in all browsers
- No critical console errors
- Performance consistent across browsers
- Mobile viewports display correctly

### Phase 7: Pipecat Integration Testing

**Objective:** Validate Slidev integration with Pipecat AI agent

**Type:** Manual testing with checklist

**Reference:** `docs/testing/pipecat-integration-checklist.md`

**Prerequisites:**
- Pipecat agent deployed to staging
- Agent configured with Slidev API credentials
- Test customer account set up
- Daily.co room configured

**Test Scenarios:**
1. Agent generates deck during conversation
2. Agent announces deck URL to customer
3. Agent controls slides while narrating
4. Slide transitions sync with speech
5. Customer views slides via screenshare
6. Demo experience feels natural
7. GitHub Pages URLs work correctly
8. No visual glitches or delays

**Expected Duration:** 30-45 minutes

**Success Criteria:**
- All checklist items pass
- Demo feels professional
- No technical issues
- Customer experience is smooth

## Performance Targets Summary

| Metric | Target | Ideal | Priority |
|--------|--------|-------|----------|
| Build Time | < 30s | < 15s | High |
| GitHub Pages Publish | < 60s | < 30s | High |
| Total Generation Time | < 90s | < 60s | Critical |
| Control Command Latency | < 500ms | < 200ms | Critical |
| Page Load Time (CDN) | < 3s | < 2s | Medium |
| Command Success Rate | > 95% | 100% | Critical |
| Concurrent Capacity | 10+ | 15+ | Medium |
| Success Rate (Concurrent) | > 67% | > 80% | Medium |

## Test Data Management

### Test Deck Cleanup

**Current Strategy (MVP):**
- Test decks left in place for inspection
- Manual cleanup required

**Cleanup Procedures:**
1. **Database:** Delete from `slidev_decks` table
2. **GitHub:** Remove deck directories from repository
3. **Local:** Temp files auto-cleaned by OS

**Future Enhancement:**
- Implement automated cleanup script
- Add cleanup to test helpers
- Scheduled cleanup jobs

## Risk Assessment

### High-Risk Areas

1. **GitHub Pages Publishing Delays**
   - Risk: Tests may timeout waiting for publish
   - Mitigation: Extended timeouts (3 min), retry logic
   - Impact: Test duration increases

2. **Rate Limiting**
   - Risk: GitHub API rate limits may cause failures
   - Mitigation: Some tests expected to trigger limits
   - Impact: Need to verify rate limiter works

3. **Concurrent Load**
   - Risk: System may not handle 15 simultaneous requests
   - Mitigation: Target is 10+ successful (67% pass rate)
   - Impact: May need infrastructure scaling

4. **Environment Configuration**
   - Risk: Missing or incorrect environment variables
   - Mitigation: Validation step before tests
   - Impact: Tests cannot run without proper config

### Medium-Risk Areas

1. **Browser Compatibility**
   - Risk: Browser-specific rendering issues
   - Mitigation: Cross-browser testing with screenshots
   - Impact: May need browser-specific fixes

2. **Network Conditions**
   - Risk: Slow or unreliable network affects results
   - Mitigation: Run tests in stable environment
   - Impact: May need network simulation tests

## Test Execution Checklist

- [ ] Phase 1: Environment validation complete
- [ ] Phase 2: Performance testing complete (10 runs)
- [ ] Phase 3: Concurrent load testing complete (15 simultaneous)
- [ ] Phase 4: E2E happy path tests complete
- [ ] Phase 5: E2E error handling tests complete
- [ ] Phase 6: Browser compatibility tests complete
- [ ] Phase 7: Pipecat integration tests complete
- [ ] All test results documented
- [ ] Screenshots/videos captured for failures
- [ ] Performance metrics aggregated
- [ ] Test report generated
- [ ] Production readiness assessed

## Reporting

### Test Results Location

```
docs/testing/test-results/
├── README.md                          # Results overview
├── performance-metrics.json           # Performance test data
├── concurrent-load-results.json       # Concurrent test data
├── e2e-test-summary.json             # E2E test results
├── screenshots/                       # Failure screenshots
└── videos/                            # Test recordings
```

### Final Test Report

**Document:** `docs/testing/slidev-e2e-report.md`

**Contents:**
- Executive summary
- Test summary (totals, pass/fail rates)
- Performance metrics (all benchmarks)
- Test scenarios (detailed results)
- Issues found (with severity)
- Browser compatibility results
- Recommendations
- Production readiness assessment

## Notes

### Test Duration Estimates

- **Performance Testing:** ~20-30 minutes (10 iterations x 90s + overhead)
- **Concurrent Testing:** ~10-15 minutes (single batch of 15)
- **E2E Happy Path:** ~30-40 minutes (10 scenarios with GitHub Pages delays)
- **E2E Error Handling:** ~15-20 minutes (API errors, fast execution)
- **Browser Compatibility:** ~60-90 minutes (4 browsers x multiple tests)
- **Pipecat Integration:** ~30-45 minutes (manual testing)

**Total Estimated Duration:** 2.5-3.5 hours

### Known Limitations

1. **API Environment Required:** Tests cannot run without deployed API
2. **GitHub API Quota:** Limited by GitHub API rate limits
3. **Browser Availability:** Edge requires separate installation on some systems
4. **Manual Testing:** Pipecat integration requires human tester
5. **Test Data:** Decks not automatically cleaned up in MVP

## Appendix A: Quick Reference Commands

```bash
# Install dependencies
pnpm install
npx playwright install --with-deps

# Run all tests
pnpm test:performance           # Performance (10 runs)
pnpm test:concurrent            # Concurrent (15 simultaneous)
pnpm test:e2e                   # All E2E tests
pnpm test:e2e:happy-path        # Happy path only
pnpm test:e2e:errors            # Error handling only
pnpm test:e2e:browsers          # Browser compatibility only

# Run specific browser
pnpm test:e2e:chrome            # Chrome only
pnpm test:e2e:firefox           # Firefox only
pnpm test:e2e:safari            # Safari only
pnpm test:e2e:edge              # Edge only

# Interactive/Debug modes
pnpm test:e2e:ui                # Interactive UI
pnpm test:e2e:headed            # Visible browser
pnpm test:e2e:debug             # Debug mode

# View reports
pnpm test:e2e:report            # Open HTML report
```

## Appendix B: Troubleshooting

### Common Issues

**Issue:** Tests timeout waiting for GitHub Pages
**Solution:** GitHub Pages can take 60-90s. Ensure timeouts are set to 3 minutes.

**Issue:** 404 Session not found
**Solution:** Verify Supabase connection and ensure conversation_sessions table exists.

**Issue:** 401 Authentication failed
**Solution:** Check SLIDEV_API_KEY matches server configuration.

**Issue:** 429 Rate limit exceeded
**Solution:** This is expected in rate limiting tests. Verify it's the test, not a problem.

**Issue:** Browser not found
**Solution:** Run `npx playwright install --with-deps`

## Document History

| Version | Date | Changes | Author |
|---------|------|---------|--------|
| 1.0 | 2025-10-09 | Initial test execution plan | Claude Code Agent |
