sourcegraph/client/web-sveltekit/playwright.config.ts
James McNamara 4077b3ec22
feat(ci): Adds playwright tests for sveltekit to bazel (#62560)
This runs playwright tests with bazel. This changes how the
app is served in the tests, specifically playwright will intercept all
network calls to the local server and serve the static assets directly
or serve root index.html file if nothing is matched.

---------

Co-authored-by: bahrmichael <michael.bahr@sourcegraph.com>
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
Co-authored-by: Michael Bahr <1830132+bahrmichael@users.noreply.github.com>
Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
Co-authored-by: Camden Cheek <camden@ccheek.com>
2024-06-06 12:45:05 -06:00

29 lines
815 B
TypeScript

import type { PlaywrightTestConfig } from '@playwright/test'
import { devices } from '@playwright/test'
const PORT = process.env.PORT ? Number(process.env.PORT) : 4173
const config: PlaywrightTestConfig = {
testMatch: 'src/**/*.spec.ts',
reporter: 'list',
// note: if you proxy into a locally running vite preview, you may have to raise this to 60 seconds
timeout: 5_000,
use: {
baseURL: `http://localhost:${PORT}`,
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
launchOptions: {
// When in CI, use bazel packaged linux chromium
executablePath: process.env.CHROMIUM_BIN,
},
},
},
],
}
export default config