Files
box-box/tests/race-hub.spec.ts

47 lines
2.0 KiB
TypeScript
Raw Normal View History

2026-05-25 02:04:16 -04:00
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()
})
2026-05-25 02:19:53 -04:00
test('strategy tab renders stint chart when stints are available', async ({ page }) => {
2026-05-25 02:04:16 -04:00
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
await page.getByRole('tab', { name: 'Strategy' }).click()
2026-05-25 02:19:53 -04:00
await expect(page.locator('[data-testid="strategy-chart"]')).toBeVisible()
2026-05-25 02:04:16 -04:00
await expect(page.getByText('Stints not available.')).not.toBeVisible()
})
2026-05-25 02:19:53 -04:00
test('positions tab renders position chart when positions are available', async ({ page }) => {
2026-05-25 02:04:16 -04:00
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
await page.getByRole('tab', { name: 'Positions' }).click()
2026-05-25 02:19:53 -04:00
await expect(page.locator('[data-testid="position-chart"]')).toBeVisible()
2026-05-25 02:04:16 -04:00
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()
2026-05-25 02:19:53 -04:00
await expect(page.locator('[data-testid="strategy-chart"]')).not.toBeVisible()
2026-05-25 02:04:16 -04:00
})
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()
2026-05-25 02:19:53 -04:00
await expect(page.locator('[data-testid="position-chart"]')).not.toBeVisible()
2026-05-25 02:04:16 -04:00
})
})