Skip to Content
📚 MyStoryFlow Docs — Your guide to preserving family stories
FeaturesTrial ExperienceTesting Scenarios

Testing Scenarios

Comprehensive test cases and edge cases for the Trial Experience feature.

Functional Test Cases

Trial Start

Test CaseStepsExpected Result
Start new trialVisit /trial, click “Start Trial”Anonymous session created, timer starts at 30:00
Resume existing trialReturn to /trial with active sessionSession resumes with remaining time
Permanent user redirectLogged-in user visits /trialRedirected to /dashboard
Multiple browser tabsOpen /trial in two tabsSame session ID in both tabs

Timer Behavior

Test CaseStepsExpected Result
Timer countdownWait and observeTimer decrements every second
15-minute warningLet timer reach 15:00Timer bar shows subtle pulse
5-minute warningLet timer reach 5:00Timer bar turns amber
1-minute warningLet timer reach 1:00Timer bar turns red with pulse
Timer expiresLet timer reach 0:00Modal appears: “Time’s up! Save your progress”
Page refreshRefresh during active trialTimer shows correct remaining time from server

AI Conversation Trial

Test CaseStepsExpected Result
Start conversationChoose AI mode, send messageElena responds, message saved with trial_session_id
Multiple messagesSend 10+ messagesConversation count increments, quality score improves
Long messageSend 500+ word messageProcesses successfully, quality score reflects detail
Empty messageTry to send empty messageButton disabled or error message
Conversation saveCheck database after conversationAll messages have is_trial=true

Voice Recording Trial

Test CaseStepsExpected Result
Start recordingChoose Voice mode, click recordRecording starts, timer visible
10-minute recordingRecord for 10+ minutesQuality indicator shows “story ready”
Stop and resumeStop recording, start new oneBoth recordings saved with trial_session_id
Audio qualityRecord with background noiseSystem handles gracefully (no crash)
Browser permissionsDeny mic accessHelpful error message with retry option

Content Validation

Test CaseStepsExpected Result
Valid voice content10+ min recording, click “I’m Done”Validation passes, signup modal appears
Valid AI content10+ detailed exchanges, click “I’m Done”Validation passes, signup modal appears
Insufficient voice2 min recording, click “I’m Done”Validation fails with suggestions
Insufficient AI3 short messages, click “I’m Done”Validation fails with suggestions
Empty trialNo content, click “I’m Done""Add some content first” message

Account Upgrade

Test CaseStepsExpected Result
Email signupEnter email/password in modalAccount created, trial data linked
Google OAuthClick “Continue with Google”OAuth flow, account linked, trial data preserved
Apple OAuthClick “Continue with Apple”OAuth flow, account linked, trial data preserved
Existing account loginChoose “Already have account?”Login modal, trial data merged

Story Generation

Test CaseStepsExpected Result
Async generationComplete signup after trialStory generation starts in background
Status pollingObserve during onboardingStatus updates from “processing” to “complete”
Generation successWait for completionStory record created with correct content
Post-payment redirectComplete payment after story readyRedirected to /stories/[id]/edit
Payment before readyComplete payment while processingLoading screen until story ready, then redirect

Edge Cases

Session Management

Edge CaseStepsExpected Result
Expired session retryTry to interact after expiry”Session expired” message, option to start new
Browser clearedClear cookies mid-trialSession lost, must start new trial
Multiple devicesStart trial on phone, continue on desktopSeparate sessions (expected behavior)
Long inactive periodLeave page for 25 min, returnTimer reflects elapsed time (may be expired)

Content Edge Cases

Edge CaseStepsExpected Result
Very long recordingRecord for 30 minutes (full session)Handles large file, content saved
Very short recordingRecord 10 seconds onlySaved but validation will fail
Non-English contentSpeak in Spanish/FrenchTranscription attempts language detection
Mixed contentDo both AI and voice in same sessionBoth saved, validation uses higher quality content
Audio upload (if allowed)Upload existing audio fileProcess like recording

Error Handling

Edge CaseStepsExpected Result
Network loss during recordingDisconnect wifi while recordingRecording continues locally, saves when reconnected
Network loss during saveDisconnect during “Save”Retry logic, error message if persistent
AI API failureOpenAI returns errorFriendly error, retry option
Database errorSupabase unavailable”Technical difficulties” message
Transcription failureAudio too noisy for transcriptionFallback message, manual review option

Concurrency

Edge CaseStepsExpected Result
Rapid message sendingSend 10 messages in 2 secondsAll processed in order, no duplicates
Multiple save attemptsClick “Save” button multiple timesDebounced, only one validation triggered
Simultaneous signupComplete signup form twiceFirst succeeds, second handles gracefully

Performance Tests

Load Testing

TestTargetMeasurement
Concurrent trials100 simultaneous sessionsResponse time < 500ms
Trial start latencyCold start< 2 seconds
Status check latencyActive session< 200ms
Validation latencyContent validation API< 5 seconds
Story generation timeFull story generation< 30 seconds

Resource Usage

TestMetricAcceptable Range
Database connectionsPer 100 users< 50 connections
Memory usagePer trial session< 10MB
Storage per trialAudio + conversation< 50MB
AI token usagePer validation< 3,000 tokens
AI token usagePer story generation< 10,000 tokens

Security Tests

Authentication

TestStepsExpected Result
Anonymous user isolationTwo users start trialsCannot see each other’s data
Session hijacking attemptCopy session ID to different browserAuth required, blocked
Token refreshSession active beyond token expiryToken refreshes automatically

Data Access

TestStepsExpected Result
RLS enforcementQuery trial_sessions as different userOnly own session returned
API authorizationCall /api/trial/status without auth401 Unauthorized
Trial data after conversionCheck is_trial flag post-conversionSet to false

Input Validation

TestStepsExpected Result
XSS in conversationSend message with script tagSanitized before storage and display
SQL injection attemptMalicious session IDRejected at validation
Large payloadSend 10MB of textRejected with size limit error

Integration Tests

End-to-End Flows

describe('Trial to Conversion Flow', () => { it('completes full trial to story journey', async () => { // 1. Start trial const { sessionId } = await startTrial() expect(sessionId).toBeDefined() // 2. Create conversation content await sendMessages(sessionId, 10) // 3. Validate content const validation = await validateContent(sessionId) expect(validation.isValid).toBe(true) // 4. Sign up const user = await signUp({ email: 'test@example.com', password: 'test123' }) expect(user.is_anonymous).toBe(false) // 5. Check trial conversion const session = await getTrialSession(sessionId) expect(session.status).toBe('converted') // 6. Wait for story generation await waitForStoryGeneration(sessionId) // 7. Verify story created const story = await getStoryForSession(sessionId) expect(story).toBeDefined() expect(story.content).toContain('story content') }) })

Component Integration

describe('TrialTimerBar Integration', () => { it('updates when context changes', async () => { render( <TrialProvider> <TrialTimerBar /> </TrialProvider> ) // Start trial await userEvent.click(screen.getByText('Start Trial')) // Verify timer appears expect(screen.getByText('30:00')).toBeInTheDocument() // Wait and verify countdown await waitFor(() => { expect(screen.getByText('29:59')).toBeInTheDocument() }) }) })

Monitoring Checklist

After deployment, monitor:

  • Trial start success rate
  • Average trial duration before conversion
  • Content validation pass/fail ratio
  • Story generation success rate
  • AI API error rates
  • Time to story generation completion
  • Conversion rate (trial → signup → payment)

Rollback Plan

If issues arise:

  1. Feature flag: Disable trial routes in middleware
  2. Marketing CTA: Remove trial links from marketing site
  3. Database: Trial data remains, no cleanup needed
  4. Monitoring: Alert on conversion rate drop

Test Environment Setup

# Set up test environment cp .env.example .env.test # Required test env vars NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321 SUPABASE_SERVICE_ROLE_KEY=test-key OPENAI_API_KEY=test-key # Run tests npm run test:e2e -- --grep "trial"