# Quick Test Guide - Account/Character System

**Test this NOW to verify everything works!**

---

## 🧪 Test 1: New User Registration

**Steps:**
1. Open https://echoesoftheashgame.patacuack.net
2. Should redirect to login page
3. Click "Don't have an account? Register"
4. Enter email: `test@example.com`
5. Enter password: `test123`
6. Click "Register"

**Expected:**
- ✅ Redirects to character selection screen
- ✅ Shows "You don't have any characters yet"
- ✅ Shows "Create New Character" card
- ✅ Shows "0 / 1 slots used" (free account)

---

## 🧪 Test 2: Character Creation

**Steps:**
1. From character selection, click "Create New Character" card
2. Enter name: `TestHero`
3. Allocate stats:
   - Strength: 8
   - Agility: 5
   - Endurance: 4
   - Intellect: 3
4. Check "Points Remaining" shows 0
5. Check HP preview shows 140 (100 + 4*10)
6. Check Stamina preview shows 120 (100 + 4*5)
7. Click "Create Character"

**Expected:**
- ✅ Redirects back to character selection
- ✅ Shows new character card with:
  - Name: TestHero
  - Level 1
  - HP: 140/140
  - Correct stat emojis (💪8 ⚡5 🛡️4 🧠3)
- ✅ Shows "1 / 1 slots used"
- ✅ "Create New Character" card is GONE (at limit)
- ✅ Shows premium upgrade banner

---

## 🧪 Test 3: Character Selection & Game Entry

**Steps:**
1. From character selection, click "Play" on TestHero
2. Wait for redirect

**Expected:**
- ✅ Redirects to game screen
- ✅ Game header shows "TestHero" in top right
- ✅ Game loads normally
- ✅ Can interact with game

---

## 🧪 Test 4: Character Limit (Free Account)

**Steps:**
1. From game, click "TestHero" in header
2. Should redirect to character selection
3. Try to click "Create New Character"

**Expected:**
- ✅ "Create New Character" card is NOT visible
- ✅ Premium banner shows: "Character Limit Reached"
- ✅ Banner shows: "Upgrade to Premium to create up to 10 characters!"

---

## 🧪 Test 5: Logout and Re-Login

**Steps:**
1. From character selection, click "Logout"
2. Should redirect to login screen
3. Enter same email: `test@example.com`
4. Enter password: `test123`
5. Click "Login"

**Expected:**
- ✅ Redirects to character selection
- ✅ Shows TestHero character card
- ✅ Character data persisted (level, stats, etc.)
- ✅ Can click "Play" and enter game again

---

## 🧪 Test 6: Character Deletion

**Steps:**
1. From character selection, click "Delete" on TestHero
2. Confirm deletion in popup
3. Wait for deletion

**Expected:**
- ✅ Shows confirmation dialog
- ✅ Character card disappears after confirm
- ✅ Shows "You don't have any characters yet" message
- ✅ "Create New Character" card appears again
- ✅ Shows "0 / 1 slots used"

---

## 🧪 Test 7: Validation Tests

### Character Name Validation
1. Try creating character with name: `ab` (too short)
   - ❌ Should show error: "Name must be between 3 and 20 characters"

2. Try creating character with name: `a very long name that exceeds twenty characters`
   - ❌ Should show error: "Name must be between 3 and 20 characters"

3. Create character named `Hero1`, then try creating another with same name
   - ❌ Should show error about name already exists

### Stat Allocation Validation
1. Try to allocate only 15 points (leave 5 remaining)
   - ❌ "Create Character" button should be DISABLED
   - ❌ Points remaining shows "5 / 20" in normal color

2. Try to allocate 25 points (5 over)
   - ❌ Should prevent going over 20
   - ❌ Points remaining shows "-5 / 20" in RED

3. Allocate exactly 20 points
   - ✅ "Create Character" button becomes ENABLED
   - ✅ Points remaining shows "0 / 20" in GREEN

---

## 🧪 Test 8: Email Validation

**Steps:**
1. Try to register with invalid emails:
   - `notanemail` - ❌ Should show error
   - `test@` - ❌ Should show error
   - `@example.com` - ❌ Should show error

2. Try to register with valid email:
   - `valid@example.com` - ✅ Should succeed

**Expected:**
- Email validation shows clear error message
- Only valid email formats accepted

---

## 🧪 Test 9: Mobile Responsiveness

**Steps:**
1. Open site on mobile browser (or resize browser to 375px width)
2. Navigate through all screens:
   - Login
   - Character selection
   - Character creation
   - Game

**Expected:**
- ✅ Login card fits screen, readable text
- ✅ Character cards stack in single column
- ✅ Character creation form is scrollable
- ✅ All buttons are tappable (not too small)
- ✅ No horizontal scrolling
- ✅ Text is readable without zooming

---

## 🧪 Test 10: Error Handling

### Invalid Login
1. Try to login with wrong email: `wrong@example.com`
   - ❌ Should show error: "Authentication failed"

2. Try to login with wrong password
   - ❌ Should show error: "Authentication failed"

### Network Error Simulation
1. Open browser dev tools
2. Set network to "Offline"
3. Try to create character
   - ❌ Should show error message (not crash)

4. Set network back to "Online"
5. Try again
   - ✅ Should work normally

---

## 📊 Success Criteria

**All tests should pass:**
- [x] Can register new account with email
- [x] Can create character with 20 stat points
- [x] Can select character and enter game
- [x] Free account limited to 1 character
- [x] Premium banner shows when at limit
- [x] Can logout and login again
- [x] Can delete characters
- [x] Validation works correctly
- [x] Email format validated
- [x] Mobile responsive
- [x] Errors handled gracefully

---

## 🚨 If Something Doesn't Work

### Frontend Not Loading
```bash
# Check PWA container logs
docker logs echoes_of_the_ashes_pwa --tail 50

# Rebuild if needed
cd /opt/dockers/echoes_of_the_ashes
docker compose build echoes_of_the_ashes_pwa
docker compose up -d echoes_of_the_ashes_pwa
```

### API Errors
```bash
# Check API logs
docker logs echoes_of_the_ashes_api --tail 50

# Restart if needed
docker compose restart echoes_of_the_ashes_api
```

### Database Issues
```bash
# Check if migration ran
docker exec echoes_of_the_ashes_db psql -U eota_user -d echoes_of_the_ashes -c "\dt"

# Should show: accounts, characters tables
```

### Clear Browser Cache
If frontend looks old:
1. Open browser dev tools (F12)
2. Right-click refresh button
3. Select "Empty Cache and Hard Reload"

---

## 📞 Quick Commands

```bash
# Check all containers
docker ps

# View all logs
docker compose logs -f

# Restart everything
docker compose restart

# Rebuild frontend
docker compose build echoes_of_the_ashes_pwa && docker compose up -d echoes_of_the_ashes_pwa

# Check database
docker exec echoes_of_the_ashes_db psql -U eota_user -d echoes_of_the_ashes -c "SELECT COUNT(*) FROM accounts;"
docker exec echoes_of_the_ashes_db psql -U eota_user -d echoes_of_the_ashes -c "SELECT COUNT(*) FROM characters;"
```

---

**Happy Testing!** 🎮
