test(web): add SPA route smoke test script and results

Add test_routes.sh to verify all SPA routes on ai-code-battle.pages.dev
return valid HTML. All 36 static/redirect/parameterized routes pass.
The /r2/ data paths return 404 (data not yet deployed to R2).

Test method: curl (ADB not available on this system). For full
device testing, see related bead bf-cmh1.

Closes: bf-2qp0

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-24 21:57:49 -04:00
parent 1a9c8374f2
commit 561f9e2a84
2 changed files with 245 additions and 0 deletions

View file

@ -0,0 +1,96 @@
# SPA Route Smoke Test Results
**Date:** 2026-05-24
**Bead:** bf-2qp0
**Method:** curl (ADB not available on this system)
**Base URL:** https://ai-code-battle.pages.dev
## Summary
| Metric | Count |
|--------|-------|
| **Passed** | 36 |
| **Warned (404)** | 7 |
| **Failed** | 0 |
| **Total** | 43 |
**Result:** All SPA routes return valid HTML. The /r2/ data paths return 404 (data not yet deployed to R2/Pages Function).
## Static Routes (All Passed)
| Route | Description | Status |
|-------|-------------|--------|
| `/` | Home page | 200 OK |
| `/watch` | Watch hub | 200 OK |
| `/watch/replays` | Matches page | 200 OK |
| `/watch/playlists` | Playlists page | 200 OK |
| `/watch/replay` | Replay page (no id) | 200 OK |
| `/watch/predictions` | Predictions page | 200 OK |
| `/watch/series` | Series page | 200 OK |
| `/compete` | Compete hub | 200 OK |
| `/compete/sandbox` | Sandbox page | 200 OK |
| `/compete/register` | Register page | 200 OK |
| `/compete/docs` | Compete docs | 200 OK |
| `/compete/docs/api` | API docs | 200 OK |
| `/leaderboard` | Leaderboard page | 200 OK |
| `/evolution` | Evolution page | 200 OK |
| `/blog` | Blog page | 200 OK |
| `/seasons` | Seasons page | 200 OK |
| `/rivalries` | Rivalries page | 200 OK |
| `/feedback` | Feedback page | 200 OK |
| `/docs/api` | API docs (alt path) | 200 OK |
## Redirect Routes (All Passed)
| Route | Description | Status |
|-------|-------------|--------|
| `/matches` | Redirect to /watch/replays | 200 OK |
| `/playlists` | Redirect to /watch/playlists | 200 OK |
| `/replay` | Redirect to /watch/replay | 200 OK |
| `/predictions` | Redirect to /watch/predictions | 200 OK |
| `/series` | Redirect to /watch/series | 200 OK |
| `/sandbox` | Redirect to /compete/sandbox | 200 OK |
| `/register` | Redirect to /compete/register | 200 OK |
| `/bots` | Redirect to /leaderboard | 200 OK |
| `/docs` | Redirect to /compete/docs | 200 OK |
| `/clip-maker` | Redirect to /watch/replays | 200 OK |
## Parameterized Routes (All Passed - routing only)
| Route | Description | Status |
|-------|-------------|--------|
| `/watch/replay/:id` | Replay detail | 200 OK |
| `/bot/:id` | Bot profile | 200 OK |
| `/compete/bot/:id` | Bot profile (compete path) | 200 OK |
| `/season/:id` | Season detail | 200 OK |
| `/watch/series/:id` | Series detail | 200 OK |
| `/blog/:slug` | Blog post | 200 OK |
| `/watch/playlists/:slug` | Playlist detail | 200 OK |
Note: Parameterized routes tested with placeholder IDs. Routes return valid SPA shell; actual data loading depends on /r2/ data path.
## Data Paths (/r2/) - 404 Expected
| Path | Description | Status |
|------|-------------|--------|
| `/r2/` | R2 data root | 404 Not Found |
| `/r2/data/matches/index.json` | Matches index | 404 Not Found |
| `/r2/data/leaderboard.json` | Leaderboard data | 404 Not Found |
| `/r2/data/seasons/index.json` | Seasons index | 404 Not Found |
| `/r2/data/series/index.json` | Series index | 404 Not Found |
| `/r2/data/blog/index.json` | Blog index | 404 Not Found |
| `/r2/data/playlists/index.json` | Playlists index | 404 Not Found |
**Note:** These 404s are expected - the data has not been uploaded to R2 or the Pages Function has not been configured yet. This is a data availability issue, not a routing issue. See related bead `bf-cmh1` for end-to-end replay viewer testing.
## Test Script
The test script is available at `/home/coding/ai-code-battle/test_routes.sh`. Run with:
```bash
./test_routes.sh
```
## ADB Testing
ADB was not available on this system (adb-check command not found, no platform-tools in ~/.local/). The fallback curl method was used instead. For full device testing with ADB, see the related bead `bf-cmh1`.

149
test_routes.sh Executable file
View file

@ -0,0 +1,149 @@
#!/usr/bin/env bash
# Smoke-test all SPA routes on ai-code-battle.pages.dev
# Fallback method: curl (ADB not available on this system)
BASE_URL="https://ai-code-battle.pages.dev"
PASSED=0
FAILED=0
WARNED=0
# Color output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo "=== SPA Route Smoke Test ==="
echo "Testing routes on $BASE_URL"
echo "Method: curl (ADB not available)"
echo ""
# Helper to test a route returns valid HTML
test_route() {
local route="$1"
local description="$2"
local url="${BASE_URL}${route}"
local response=$(curl -s -L -w "\n%{http_code}" "$url" 2>/dev/null)
local status_code=$(echo "$response" | tail -1)
local body=$(echo "$response" | head -n -1)
# Check for successful response and HTML doctype
if [[ "$status_code" == "200" ]] && [[ "$body" == *"<!DOCTYPE html>"* ]]; then
echo -e "${GREEN}${NC} $route - $description (200 OK)"
((PASSED++))
return 0
else
echo -e "${RED}${NC} $route - $description (status: $status_code)"
if [[ "$body" != *"<!DOCTYPE html>"* ]]; then
echo " Response is not valid HTML"
fi
((FAILED++))
return 1
fi
}
# Helper to test data path endpoints
test_data_path() {
local path="$1"
local description="$2"
local url="${BASE_URL}${path}"
local status_code=$(curl -s -o /dev/null -w "%{http_code}" "$url" 2>/dev/null)
if [[ "$status_code" == "200" ]]; then
echo -e "${GREEN}${NC} $path - $description (200 OK)"
((PASSED++))
return 0
elif [[ "$status_code" == "404" ]]; then
echo -e "${YELLOW}${NC} $path - $description (404 Not Found - data may not exist yet)"
((WARNED++))
return 2
else
echo -e "${RED}${NC} $path - $description (status: $status_code)"
((FAILED++))
return 1
fi
}
echo "=== Static Routes (SPA Shell) ==="
# Main routes - all should return the same HTML shell
test_route "/" "Home page"
test_route "/watch" "Watch hub"
test_route "/watch/replays" "Matches page"
test_route "/watch/playlists" "Playlists page"
test_route "/watch/replay" "Replay page (no id)"
test_route "/watch/predictions" "Predictions page"
test_route "/watch/series" "Series page"
test_route "/compete" "Compete hub"
test_route "/compete/sandbox" "Sandbox page"
test_route "/compete/register" "Register page"
test_route "/compete/docs" "Compete docs"
test_route "/compete/docs/api" "API docs"
test_route "/leaderboard" "Leaderboard page"
test_route "/evolution" "Evolution page"
test_route "/blog" "Blog page"
test_route "/seasons" "Seasons page"
test_route "/rivalries" "Rivalries page"
test_route "/feedback" "Feedback page"
test_route "/docs/api" "API docs (alt path)"
echo ""
echo "=== Redirect Routes (should return 200 with SPA content) ==="
test_route "/matches" "Redirect to /watch/replays"
test_route "/playlists" "Redirect to /watch/playlists"
test_route "/replay" "Redirect to /watch/replay"
test_route "/predictions" "Redirect to /watch/predictions"
test_route "/series" "Redirect to /watch/series"
test_route "/sandbox" "Redirect to /compete/sandbox"
test_route "/register" "Redirect to /compete/register"
test_route "/bots" "Redirect to /leaderboard"
test_route "/docs" "Redirect to /compete/docs"
test_route "/clip-maker" "Redirect to /watch/replays"
echo ""
echo "=== Data Path Tests (/r2/) ==="
test_data_path "/r2/" "R2 data root"
test_data_path "/r2/data/matches/index.json" "Matches index"
test_data_path "/r2/data/leaderboard.json" "Leaderboard data"
test_data_path "/r2/data/seasons/index.json" "Seasons index"
test_data_path "/r2/data/series/index.json" "Series index"
test_data_path "/r2/data/blog/index.json" "Blog index"
test_data_path "/r2/data/playlists/index.json" "Playlists index"
echo ""
echo "=== Parameterized Routes (with sample IDs) ==="
echo "Note: These will fail if /r2/ data path is not working"
# Try with known-good IDs if we can fetch them
# For now, test that the route pattern returns valid HTML
test_route "/watch/replay/test_match_id" "Replay detail (placeholder id)"
test_route "/bot/test_bot_id" "Bot profile (placeholder id)"
test_route "/compete/bot/test_bot_id" "Bot profile compete path (placeholder id)"
test_route "/season/test_season_id" "Season detail (placeholder id)"
test_route "/watch/series/test_series_id" "Series detail (placeholder id)"
test_route "/blog/test-slug" "Blog post (placeholder slug)"
test_route "/watch/playlists/test-slug" "Playlist detail (placeholder slug)"
echo ""
echo "=== Summary ==="
echo -e "${GREEN}Passed: $PASSED${NC}"
echo -e "${YELLOW}Warned (404): $WARNED${NC}"
echo -e "${RED}Failed: $FAILED${NC}"
echo "Total: $((PASSED + WARNED + FAILED))"
if [[ $FAILED -eq 0 ]]; then
if [[ $WARNED -gt 0 ]]; then
echo -e "\n${YELLOW}All routes passed, but some data paths returned 404${NC}"
exit 0
else
echo -e "\n${GREEN}All routes and data paths passed!${NC}"
exit 0
fi
else
echo -e "\n${RED}Some routes failed.${NC}"
exit 1
fi