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:
co-authored by
Claude Opus 4.6
parent
5e40221a2f
commit
a7520be0e7
@@ -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)
|
||||
})
|
||||
Reference in New Issue
Block a user