mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-07 11:54:59 -04:00
Add command center screen
This commit is contained in:
40
tests/command-center.spec.ts
Normal file
40
tests/command-center.spec.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
const FULL_SESSION = 9472
|
||||
|
||||
test.describe('Command Center', () => {
|
||||
test('loads as default route with local coverage summary', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
|
||||
await expect(page.getByTestId('command-center')).toBeVisible()
|
||||
await expect(page.getByText('Command Center')).toBeVisible()
|
||||
await expect(page.getByTestId('cc-focus')).toBeVisible()
|
||||
await expect(page.getByTestId('cc-session-9472')).toBeVisible()
|
||||
})
|
||||
|
||||
test('nav link reaches command center from race hub', async ({ page }) => {
|
||||
await page.goto('/race-hub')
|
||||
await page.getByRole('link', { name: 'Command' }).click()
|
||||
await expect(page).toHaveURL('/')
|
||||
await expect(page.getByTestId('command-center')).toBeVisible()
|
||||
})
|
||||
|
||||
test('quick action opens race hub for default session', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await expect(page.getByTestId('cc-action-race-hub')).toContainText(String(FULL_SESSION))
|
||||
await page.getByTestId('cc-action-race-hub').click()
|
||||
await expect(page).toHaveURL(new RegExp(`/race-hub\\?session_key=${FULL_SESSION}`))
|
||||
await expect(page.getByText('Final Classification')).toBeVisible()
|
||||
})
|
||||
|
||||
test('existing routes continue to work', async ({ page }) => {
|
||||
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
|
||||
await expect(page.getByText('Final Classification')).toBeVisible()
|
||||
|
||||
await page.goto('/data-library')
|
||||
await expect(page.getByTestId('data-library')).toBeVisible()
|
||||
|
||||
await page.goto('/live')
|
||||
await expect(page.getByTestId('live-empty')).toBeVisible()
|
||||
})
|
||||
})
|
||||
@@ -3,6 +3,13 @@ import { test, expect } from '@playwright/test'
|
||||
const FULL_SESSION = 9472
|
||||
|
||||
test.describe('Production serving (Go + built React)', () => {
|
||||
test('serves command center as default route', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
|
||||
await expect(page.getByTestId('command-center')).toBeVisible()
|
||||
await expect(page.getByTestId('cc-session-9472')).toBeVisible()
|
||||
})
|
||||
|
||||
test('serves race hub with classification from built assets', async ({ page }) => {
|
||||
await page.goto(`/race-hub?session_key=${FULL_SESSION}`)
|
||||
|
||||
@@ -25,8 +32,11 @@ test.describe('Production serving (Go + built React)', () => {
|
||||
})
|
||||
|
||||
test('nav links work from built SPA', async ({ page }) => {
|
||||
await page.goto('/race-hub')
|
||||
await page.getByRole('link', { name: 'Data Library' }).click()
|
||||
await page.goto('/')
|
||||
await page.locator('.app-nav').getByRole('link', { name: 'Race Hub' }).click()
|
||||
await expect(page).toHaveURL(/\/race-hub/)
|
||||
|
||||
await page.locator('.app-nav').getByRole('link', { name: 'Data Library' }).click()
|
||||
await expect(page).toHaveURL(/\/data-library/)
|
||||
|
||||
await page.getByRole('link', { name: 'Live' }).click()
|
||||
|
||||
BIN
tests/visual/__snapshots__/desktop/command-center.png
Normal file
BIN
tests/visual/__snapshots__/desktop/command-center.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
tests/visual/__snapshots__/mobile/command-center.png
Normal file
BIN
tests/visual/__snapshots__/mobile/command-center.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
BIN
tests/visual/__snapshots__/tablet/command-center.png
Normal file
BIN
tests/visual/__snapshots__/tablet/command-center.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@@ -14,6 +14,14 @@ export async function waitForScreenshotReady(page: Page): Promise<void> {
|
||||
await page.waitForTimeout(150)
|
||||
}
|
||||
|
||||
export async function gotoCommandCenterReady(page: Page): Promise<void> {
|
||||
await page.goto('/')
|
||||
await expect(page.getByTestId('command-center')).toBeVisible()
|
||||
await expect(page.getByTestId('cc-focus')).toBeVisible()
|
||||
await expect(page.getByTestId('cc-session-9472')).toBeVisible()
|
||||
await waitForScreenshotReady(page)
|
||||
}
|
||||
|
||||
export async function gotoRaceHubReady(page: Page, sessionKey = FULL_SESSION): Promise<void> {
|
||||
await page.goto(`/race-hub?session_key=${sessionKey}`)
|
||||
await expect(page.getByText('Final Classification')).toBeVisible()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { test } from '@playwright/test'
|
||||
import {
|
||||
gotoCommandCenterReady,
|
||||
gotoDataLibraryReady,
|
||||
gotoLiveEmptyReady,
|
||||
gotoRaceHubReady,
|
||||
@@ -7,6 +8,11 @@ import {
|
||||
} from './helpers'
|
||||
|
||||
test.describe('MVP visual regression', () => {
|
||||
test('command-center', async ({ page }) => {
|
||||
await gotoCommandCenterReady(page)
|
||||
await screenshotPage(page, 'command-center')
|
||||
})
|
||||
|
||||
test('race-hub', async ({ page }) => {
|
||||
await gotoRaceHubReady(page)
|
||||
await screenshotPage(page, 'race-hub')
|
||||
|
||||
Reference in New Issue
Block a user