Files
gui/apps/kitchen-sink/playwright.config.ts
zeekay c183da5389 Drop webpack from the stack
The loader and the Next plugin only existed to drive webpack; Next runs
on Turbopack and Vite has its own plugin. kitchen-sink and the
integration app serve through vite, the optimizer suite drops the
webpack name, and its fixture packages join the workspace so a fresh
checkout links @my/ui.
2026-09-06 08:17:57 -07:00

80 lines
2.8 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
import { ANIMATION_DRIVERS } from './tests/test-utils'
const port = process.env.PORT || '9000'
// Support both single-driver mode (via env var) and multi-driver parallel mode
const singleDriver = process.env.GUI_TEST_ANIMATION_DRIVER
const drivers = singleDriver ? [singleDriver] : [...ANIMATION_DRIVERS]
/**
* Test organization:
* - *.animated.test.ts - Animation-dependent tests, run with ALL animation drivers
* - *.test.ts (non-animated) - Style/functional tests, run ONCE with default driver
*
* This significantly speeds up the test suite since most tests don't need
* to run 4x across all animation drivers.
*/
export default defineConfig({
// Look for test files in the "tests" directory, relative to this configuration file.
testDir: 'tests',
reporter: [['list']],
use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: `http://localhost:${port}`,
// Larger viewport to prevent popover positioning issues
viewport: { width: 1920, height: 1080 },
},
projects: [
// Non-animated tests run once with default driver (native)
{
name: 'default',
testIgnore: '**/*.animated.test.{ts,tsx}',
metadata: { animationDriver: 'native' },
},
// WebKit project scoped to RemoveScroll tests (scroll restoration)
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
testMatch: '**/RemoveScroll.test.{ts,tsx}',
metadata: { animationDriver: 'native' },
},
// mobile WebKit (Safari engine + touch) for sheet keyboard/gesture tests —
// chromium's touch/scroll/rubber-band behavior differs from iOS Safari
{
name: 'webkit-sheet',
use: { browserName: 'webkit' },
testMatch: '**/SheetWebKeyboard*.test.{ts,tsx}',
metadata: { animationDriver: 'css' },
},
// Animated tests run with all animation drivers
...drivers.map((driver) => ({
name: `animated-${driver}`,
testMatch: '**/*.animated.test.{ts,tsx}',
// AnimationsWithMediaQueries only passes with css and motion drivers for now
...(driver !== 'motion' &&
driver !== 'css' && {
testIgnore: '**/AnimationsWithMediaQueries.animated.test.{ts,tsx}',
}),
metadata: { animationDriver: driver },
})),
],
// Run your local dev server before starting the tests.
// When run-tests-parallel.ts manages the server, REUSE_SERVER is set to skip launching another.
webServer: {
command: `PORT=${port} bun run start:web`,
url: `http://localhost:${port}`,
reuseExistingServer: !!process.env.REUSE_SERVER,
timeout: 120_000, // the dev server compiles on first request
},
fullyParallel: true,
workers: process.env.CI ? 2 : 4,
retries: process.env.CI ? 2 : 1,
timeout: 50_000,
})