openreader/playwright.config.ts
Richard R 60c1540744 refactor(ui): decouple settings modal trigger from modal logic
extract SettingsTrigger component to separate modal open control from SettingsModal.
update HomeContent to manage modal state and pass open/onOpenChange props.
remove redundant trigger button from SettingsModal for improved composability.

removes embedded trigger logic from SettingsModal, enabling external state
management and better integration with various UI layouts. also cleans up
playwright config by centralizing testIgnore for unit tests.
2026-05-30 15:13:15 -06:00

98 lines
2.9 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
import 'dotenv/config';
import fs from 'node:fs';
import path from 'node:path';
import dotenv from 'dotenv';
if (process.env.CI === 'true') {
const envCiPath = path.join(process.cwd(), '.env.ci');
if (fs.existsSync(envCiPath)) {
dotenv.config({ path: envCiPath, override: true });
}
}
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
testIgnore: '**/unit/**',
tsconfig: './tsconfig.json',
timeout: 30 * 1000,
outputDir: './tests/results',
globalTeardown: './tests/global-teardown.ts',
// fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
// workers: '50%',
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:3003',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'retain-on-first-failure',
screenshot: 'only-on-failure',
},
/* Run your local dev server before starting the tests */
webServer: {
// Disable auth rate limiting for tests to support parallel workers creating sessions.
// ENABLE_TEST_NAMESPACE opts the production build into honoring the
// x-openreader-test-namespace header (ignored on real prod deployments).
command: `pnpm build && DISABLE_AUTH_RATE_LIMIT=true ENABLE_TEST_NAMESPACE=true pnpm start`,
url: 'http://localhost:3003',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
extraHTTPHeaders: { 'x-openreader-test-namespace': 'chromium' },
},
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox'],
extraHTTPHeaders: { 'x-openreader-test-namespace': 'firefox' },
},
},
{
name: 'webkit',
use: {
...devices['Desktop Safari'],
extraHTTPHeaders: { 'x-openreader-test-namespace': 'webkit' },
},
},
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
});