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>
32 lines
1.1 KiB
TypeScript
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)
|
|
})
|
|
})
|