@reasonabletech/config-playwright
v0.1.1
Published
Shared Playwright configuration for E2E testing
Maintainers
Readme
@reasonabletech/config-playwright
@reasonabletech/config-playwright provides shared Playwright configuration factories for single-app and cross-app browser test suites. createCrossAppConfig is designed for suites that test across multiple running services, while createPlaywrightConfig handles the common single-app case.
Installation
pnpm add -D @reasonabletech/config-playwright @playwright/testPeer Dependencies
| Dependency | Version | Required | | ---------------- | --------- | -------- | | @playwright/test | >= 1.40 | Yes | | lighthouse | >= 10.0 | Optional |
This package provides Playwright configuration factories and requires @playwright/test 1.40+ for modern browser testing features. Install lighthouse if using the performance configuration exports.
Exported Entry Points
| Import Path | Purpose | Main Exports |
| --------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| @reasonabletech/config-playwright | General Playwright defaults | createPlaywrightConfig, createCIConfig, createBaseConfig, createCrossAppConfig |
| @reasonabletech/config-playwright/base | Single-app browser presets | createBaseConfig, createDesktopConfig, createMobileConfig, createChromiumConfig |
| @reasonabletech/config-playwright/cross-app | Cross-app and specialized suites | createCrossAppConfig, createAccessibilityConfig, createPerformanceConfig, createAuthTestConfig, createAuthWorkflowConfig |
Usage
Standard Project Configuration
// playwright.config.ts
import { createPlaywrightConfig } from "@reasonabletech/config-playwright";
export default createPlaywrightConfig({
use: {
baseURL: "http://localhost:3000",
},
});CI-Oriented Configuration
// playwright.config.ts
import { createCIConfig } from "@reasonabletech/config-playwright";
export default createCIConfig({
use: {
baseURL: "https://staging.example.com",
},
});Desktop-Only Configuration
// playwright.config.ts
import { createDesktopConfig } from "@reasonabletech/config-playwright/base";
export default createDesktopConfig();Cross-App Configuration
// playwright.config.ts
import { createCrossAppConfig } from "@reasonabletech/config-playwright/cross-app";
const environments = {
development: {
baseUrls: {
app: "http://localhost:3000",
admin: "http://localhost:3001",
},
services: {
useRealServices: false,
mockExternalAPIs: true,
},
},
staging: {
baseUrls: {
app: "https://staging.example.com",
admin: "https://admin-staging.example.com",
},
services: {
useRealServices: true,
mockExternalAPIs: false,
},
},
} as const;
export default createCrossAppConfig({ environments });createCrossAppConfig uses TEST_ENV to select the active environment (development by default).
Changelog
See CHANGELOG.md for release history.
This package follows Semantic Versioning. Breaking changes are documented with migration guides when applicable.
