Gitako/playwright.config.mts
EnixCoda 19ac348bc8 Add Playwright report artifacts to CI and enable manual trigger
- Upload playwright-report and test-results artifacts after e2e tests
- Add workflow_dispatch for manual workflow triggering
- Temporarily enable always-on traces/videos/screenshots for testing
- Fix ESM imports in playwright.config.mts
2026-01-17 22:13:14 +08:00

46 lines
1.2 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test'
import * as dotenv from 'dotenv'
import * as path from 'path'
import { fileURLToPath } from 'url'
if (process.arch === 'arm64' && process.platform === 'darwin') {
dotenv.config()
}
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const EXTENSION_PATH = path.resolve(__dirname, 'dist')
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 3 : 0,
workers: process.env.CI ? 2 : undefined,
reporter: 'html',
timeout: 60000,
expect: {
timeout: 10000,
},
use: {
trace: 'on', // TODO: revert to 'on-first-retry' after verifying GitHub Actions report
video: 'on', // TODO: revert to 'on-first-retry' after verifying GitHub Actions report
screenshot: 'on', // TODO: remove after verifying GitHub Actions report
},
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
// Load the extension
launchOptions: {
args: [
`--no-sandbox`,
`--disable-extensions-except=${EXTENSION_PATH}`,
`--load-extension=${EXTENSION_PATH}`,
],
headless: false,
},
},
},
],
})