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>
20 lines
657 B
TypeScript
20 lines
657 B
TypeScript
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)
|
|
})
|