Files
botfights/e2e/fight-replay.spec.ts
T
DorianandClaude Opus 4.6 5bc8932d25 test: E2E specs for signup, fight replay, and leaderboard flows
Bot registration (3 tests), human registration (1 test), fight replay
(2 tests for JS error checking), and leaderboard (3 tests for rendering).
All use Playwright with text-based selectors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 05:15:46 +00:00

32 lines
1.1 KiB
TypeScript

import { test, expect } from '@playwright/test'
test.describe('fight replay', () => {
test('arena page loads without JS errors', async ({ page }) => {
const jsErrors: string[] = []
page.on('pageerror', err => jsErrors.push(err.message))
await page.goto('/arena')
await page.waitForTimeout(2000)
// Filter out expected errors (e.g., missing API data in test env)
const criticalErrors = jsErrors.filter(e =>
e.includes('TypeError') || e.includes('ReferenceError') || e.includes('SyntaxError')
)
expect(criticalErrors).toHaveLength(0)
})
test('fight page with invalid ID shows error gracefully', async ({ page }) => {
const jsErrors: string[] = []
page.on('pageerror', err => jsErrors.push(err.message))
await page.goto('/arena/nonexistent-fight-id')
await page.waitForTimeout(2000)
// Should not crash — may show error state or redirect
const criticalErrors = jsErrors.filter(e =>
e.includes('ReferenceError') || e.includes('SyntaxError')
)
expect(criticalErrors).toHaveLength(0)
})
})