Add analytics data foundation

This commit is contained in:
2026-05-25 02:04:16 -04:00
parent 5470b0df38
commit c7438f0ed8
23 changed files with 2167 additions and 94 deletions

46
tests/race-hub.spec.ts Normal file
View File

@@ -0,0 +1,46 @@
import { test, expect } from '@playwright/test'
const FULL_SESSION = 9472
const CORE_ONLY_SESSION = 9000
test.describe('Race Hub', () => {
test('loads classification for a seeded session', async ({ page }) => {
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
await expect(page.getByText('Final Classification')).toBeVisible()
await expect(page.locator('.drv-code', { hasText: 'VER' })).toBeVisible()
await expect(page.locator('.drv-code', { hasText: 'HAM' })).toBeVisible()
})
test('strategy tab shows chart placeholder when stints are available', async ({ page }) => {
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
await page.getByRole('tab', { name: 'Strategy' }).click()
await expect(page.getByText('Strategy chart: not yet implemented.')).toBeVisible()
await expect(page.getByText('Stints not available.')).not.toBeVisible()
})
test('positions tab shows chart placeholder when positions are available', async ({ page }) => {
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
await page.getByRole('tab', { name: 'Positions' }).click()
await expect(page.getByText('Position evolution chart: not yet implemented.')).toBeVisible()
await expect(page.getByText('Lap-by-lap positions not available.')).not.toBeVisible()
})
test('strategy tab shows missing notice when stints are unavailable', async ({ page }) => {
await page.goto(`/race-hub?session_key=${CORE_ONLY_SESSION}`)
await page.getByRole('tab', { name: 'Strategy' }).click()
await expect(page.getByText('Stints not available.')).toBeVisible()
await expect(page.getByText('Strategy chart: not yet implemented.')).not.toBeVisible()
})
test('positions tab shows missing notice when positions are unavailable', async ({ page }) => {
await page.goto(`/race-hub?session_key=${CORE_ONLY_SESSION}`)
await page.getByRole('tab', { name: 'Positions' }).click()
await expect(page.getByText('Lap-by-lap positions not available.')).toBeVisible()
await expect(page.getByText('Position evolution chart: not yet implemented.')).not.toBeVisible()
})
})