test: add Playwright E2E infrastructure with smoke test

Set up Playwright with Chromium, dev server auto-start, test helpers
for seeding bots and programmatic auth. Added smoke spec that verifies
homepage and leaderboard load without crashes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-13 05:14:15 +00:00
co-authored by Claude Opus 4.6
parent 5e40221a2f
commit a7520be0e7
6 changed files with 174 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test'
test('homepage loads', async ({ page }) => {
await page.goto('/')
// Page should load without errors
await expect(page).toHaveTitle(/botfights/i)
})
test('leaderboard page loads', async ({ page }) => {
await page.goto('/leaderboard')
// Should render without console errors
const errors: string[] = []
page.on('console', msg => {
if (msg.type() === 'error') errors.push(msg.text())
})
await page.waitForTimeout(1000)
// Allow some errors (e.g., missing API data) but no crashes
expect(errors.filter(e => e.includes('TypeError') || e.includes('ReferenceError'))).toHaveLength(0)
})