@reasonabletech/config-playwright 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,253 @@
1
+ import { devices } from '@playwright/test';
2
+
3
+ // src/index.ts
4
+
5
+ // src/cross-app.ts
6
+ var EMPTY_CONFIG = {};
7
+ var crossAppConfig = {
8
+ testDir: "./tests/acceptance/cross-app",
9
+ testMatch: "**/*.{test,spec}.{ts,js}",
10
+ use: {
11
+ // Extended timeout for cross-app navigation
12
+ actionTimeout: 1e4,
13
+ navigationTimeout: 15e3,
14
+ // Cross-domain configuration
15
+ extraHTTPHeaders: {
16
+ Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
17
+ },
18
+ // Authentication state for cross-app flows
19
+ storageState: "tests/fixtures/auth/cross-app-authenticated.json",
20
+ // Enable video for complex cross-app debugging
21
+ video: "retain-on-failure",
22
+ trace: "retain-on-failure"
23
+ }
24
+ };
25
+ function createCrossAppConfig(options) {
26
+ const { environments, customConfig = EMPTY_CONFIG } = options;
27
+ const environment = process.env.TEST_ENV ?? "development";
28
+ const envConfig = environments[environment];
29
+ if (envConfig === void 0) {
30
+ throw new Error(
31
+ `Unknown test environment "${environment}". Available environments: ${Object.keys(environments).join(", ")}`
32
+ );
33
+ }
34
+ const defaultBaseUrl = Object.values(envConfig.baseUrls).at(0);
35
+ if (defaultBaseUrl === void 0) {
36
+ throw new Error(
37
+ `Environment "${environment}" must define at least one base URL`
38
+ );
39
+ }
40
+ return {
41
+ ...baseConfig,
42
+ ...crossAppConfig,
43
+ ...customConfig,
44
+ use: {
45
+ ...baseConfig.use,
46
+ ...crossAppConfig.use,
47
+ ...customConfig.use,
48
+ // Set base URL to the first entry in baseUrls (typically the landing page)
49
+ baseURL: defaultBaseUrl
50
+ },
51
+ projects: [
52
+ // Desktop browsers for cross-app flows
53
+ {
54
+ name: "cross-app-chromium",
55
+ testDir: "./tests/acceptance/cross-app",
56
+ use: {
57
+ ...baseConfig.projects?.[0]?.use,
58
+ // Cross-app specific browser settings
59
+ viewport: { width: 1920, height: 1080 }
60
+ }
61
+ },
62
+ {
63
+ name: "cross-app-firefox",
64
+ testDir: "./tests/acceptance/cross-app",
65
+ use: {
66
+ ...baseConfig.projects?.[1]?.use,
67
+ viewport: { width: 1920, height: 1080 }
68
+ }
69
+ },
70
+ {
71
+ name: "cross-app-webkit",
72
+ testDir: "./tests/acceptance/cross-app",
73
+ use: {
74
+ ...baseConfig.projects?.[2]?.use,
75
+ viewport: { width: 1920, height: 1080 }
76
+ }
77
+ }
78
+ ]
79
+ };
80
+ }
81
+ var EMPTY_CONFIG2 = {};
82
+ ({
83
+ projects: [
84
+ {
85
+ name: "chromium",
86
+ use: { ...devices["Desktop Chrome"] }
87
+ },
88
+ {
89
+ name: "firefox",
90
+ use: { ...devices["Desktop Firefox"] }
91
+ },
92
+ {
93
+ name: "webkit",
94
+ use: { ...devices["Desktop Safari"] }
95
+ }
96
+ ]
97
+ });
98
+ ({
99
+ projects: [
100
+ {
101
+ name: "Mobile Chrome",
102
+ use: { ...devices["Pixel 5"] }
103
+ },
104
+ {
105
+ name: "Mobile Safari",
106
+ use: { ...devices["iPhone 12"] }
107
+ }
108
+ ]
109
+ });
110
+ ({
111
+ projects: [
112
+ {
113
+ name: "chromium",
114
+ use: { ...devices["Desktop Chrome"] }
115
+ }
116
+ ]
117
+ });
118
+ function createBaseConfig(customConfig = EMPTY_CONFIG2) {
119
+ return {
120
+ ...baseConfig,
121
+ ...customConfig,
122
+ use: {
123
+ ...baseConfig.use,
124
+ ...customConfig.use,
125
+ // Single-app specific settings
126
+ storageState: void 0
127
+ // No cross-app auth state by default
128
+ },
129
+ projects: customConfig.projects ?? baseConfig.projects
130
+ };
131
+ }
132
+
133
+ // src/index.ts
134
+ var EMPTY_CONFIG3 = {};
135
+ var baseConfig = {
136
+ // Test discovery and execution
137
+ testDir: "./tests/acceptance",
138
+ testMatch: "**/*.{test,spec}.{ts,js}",
139
+ // Global test settings
140
+ fullyParallel: true,
141
+ forbidOnly: Boolean(process.env.CI),
142
+ retries: process.env.CI !== void 0 ? 2 : 0,
143
+ workers: process.env.CI !== void 0 ? 4 : void 0,
144
+ // Test execution timeouts
145
+ timeout: 30 * 1e3,
146
+ // 30 seconds for individual tests
147
+ expect: {
148
+ timeout: 5 * 1e3
149
+ // 5 seconds for assertions
150
+ },
151
+ // Reporter configuration for different environments
152
+ reporter: [
153
+ ["html", { outputFolder: "./generated/playwright/reports" }],
154
+ ["json", { outputFile: "./generated/playwright/results.json" }],
155
+ process.env.CI !== void 0 ? ["github"] : ["list"]
156
+ ],
157
+ // Output folder for test results
158
+ outputDir: "./generated/playwright/test-results",
159
+ // Global test options
160
+ use: {
161
+ // Browser context settings
162
+ viewport: { width: 1280, height: 720 },
163
+ ignoreHTTPSErrors: true,
164
+ headless: true,
165
+ // Always headless by default (use --headed flag to override)
166
+ // Action timeouts
167
+ actionTimeout: 10 * 1e3,
168
+ // 10 seconds for actions
169
+ navigationTimeout: 30 * 1e3,
170
+ // 30 seconds for navigation
171
+ // Debugging and artifact collection - sensible defaults
172
+ trace: "on-first-retry",
173
+ video: "retain-on-failure",
174
+ screenshot: "only-on-failure",
175
+ // No authentication state by default (apps can override)
176
+ storageState: void 0
177
+ },
178
+ // Browser and device matrix
179
+ // Local dev: Chromium only for speed
180
+ // CI: Full browser matrix for compatibility testing
181
+ projects: process.env.CI !== void 0 ? [
182
+ // Desktop browsers
183
+ {
184
+ name: "chromium",
185
+ use: { ...devices["Desktop Chrome"] }
186
+ },
187
+ {
188
+ name: "firefox",
189
+ use: { ...devices["Desktop Firefox"] }
190
+ },
191
+ {
192
+ name: "webkit",
193
+ use: { ...devices["Desktop Safari"] }
194
+ },
195
+ // Mobile devices
196
+ {
197
+ name: "Mobile Chrome",
198
+ use: { ...devices["Pixel 5"] }
199
+ },
200
+ {
201
+ name: "Mobile Safari",
202
+ use: { ...devices["iPhone 12"] }
203
+ },
204
+ // Tablet devices
205
+ {
206
+ name: "iPad",
207
+ use: { ...devices["iPad Pro"] }
208
+ }
209
+ ] : [
210
+ // Local development: Chromium only for fast iteration
211
+ {
212
+ name: "chromium",
213
+ use: { ...devices["Desktop Chrome"] }
214
+ }
215
+ ],
216
+ // Development server integration - common defaults for web apps
217
+ webServer: process.env.CI !== void 0 ? void 0 : {
218
+ command: "pnpm dev",
219
+ reuseExistingServer: true,
220
+ timeout: 120 * 1e3
221
+ // 2 minutes to start
222
+ }
223
+ };
224
+ function createPlaywrightConfig(customConfig = EMPTY_CONFIG3) {
225
+ return {
226
+ ...baseConfig,
227
+ ...customConfig,
228
+ use: {
229
+ ...baseConfig.use,
230
+ ...customConfig.use
231
+ },
232
+ projects: customConfig.projects ?? baseConfig.projects
233
+ };
234
+ }
235
+ function createCIConfig(customConfig = EMPTY_CONFIG3) {
236
+ return createPlaywrightConfig({
237
+ ...customConfig,
238
+ fullyParallel: true,
239
+ retries: 3,
240
+ workers: 4,
241
+ use: {
242
+ ...customConfig.use,
243
+ trace: "retain-on-failure",
244
+ video: "retain-on-failure",
245
+ screenshot: "only-on-failure"
246
+ }
247
+ });
248
+ }
249
+ var index_default = createPlaywrightConfig;
250
+
251
+ export { baseConfig, createBaseConfig, createCIConfig, createCrossAppConfig, createPlaywrightConfig, index_default as default };
252
+ //# sourceMappingURL=index.js.map
253
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cross-app.ts","../src/base.ts","../src/index.ts"],"names":["EMPTY_CONFIG","devices"],"mappings":";;;;;AAaA,IAAM,eAAe,EAAC;AAKf,IAAM,cAAA,GAAuC;AAAA,EAClD,OAAA,EAAS,8BAAA;AAAA,EACT,SAAA,EAAW,0BAAA;AAAA,EAEX,GAAA,EAAK;AAAA;AAAA,IAEH,aAAA,EAAe,GAAA;AAAA,IACf,iBAAA,EAAmB,IAAA;AAAA;AAAA,IAGnB,gBAAA,EAAkB;AAAA,MAChB,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AA;AAAA,IAGA;AAAA,MACE,IAAA,EAAM,MAAA;AAAA,MACN,GAAA,EAAK,EAAE,GAAGA,OAAAA,CAAQ,UAAU,CAAA;AAAE;AAChC,GACF,GACA;AAAA;AAAA,IAEE;AAAA,MACE,IAAA,EAAM,UAAA;AAAA,MACN,GAAA,EAAK,EAAE,GAAGA,OAAAA,CAAQ,gBAAgB,CAAA;AAAE;AACtC,GACF;AAAA;AAAA,EAGN,SAAA,EACE,OAAA,CAAQ,GAAA,CAAI,EAAA,KAAO,SACf,MAAA,GACA;AAAA,IACE,OAAA,EAAS,UAAA;AAAA,IACT,mBAAA,EAAqB,IAAA;AAAA,IACrB,SAAS,GAAA,GAAM;AAAA;AAAA;AAEzB;AAOO,SAAS,sBAAA,CACd,eAAiCD,aAAAA,EACX;AACtB,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,GAAG,YAAA;AAAA,IACH,GAAA,EAAK;AAAA,MACH,GAAG,UAAA,CAAW,GAAA;AAAA,MACd,GAAG,YAAA,CAAa;AAAA,KAClB;AAAA,IACA,QAAA,EAAU,YAAA,CAAa,QAAA,IAAY,UAAA,CAAW;AAAA,GAChD;AACF;AAOO,SAAS,cAAA,CACd,eAAiCA,aAAAA,EACX;AACtB,EAAA,OAAO,sBAAA,CAAuB;AAAA,IAC5B,GAAG,YAAA;AAAA,IACH,aAAA,EAAe,IAAA;AAAA,IACf,OAAA,EAAS,CAAA;AAAA,IACT,OAAA,EAAS,CAAA;AAAA,IACT,GAAA,EAAK;AAAA,MACH,GAAG,YAAA,CAAa,GAAA;AAAA,MAChB,KAAA,EAAO,mBAAA;AAAA,MACP,KAAA,EAAO,mBAAA;AAAA,MACP,UAAA,EAAY;AAAA;AACd,GACD,CAAA;AACH;AAMA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * Cross-app Playwright configuration for multi-frontend testing\n * @module @reasonabletech/config-playwright/cross-app\n */\n\nimport { type PlaywrightTestConfig } from \"@playwright/test\";\nimport {\n baseConfig,\n type PlaywrightConfig,\n type TestEnvironmentConfig,\n} from \"./index.js\";\n\n// Empty readonly config for default parameters\nconst EMPTY_CONFIG = {} as const satisfies PlaywrightConfig;\n\n/**\n * Cross-app specific configuration options\n */\nexport const crossAppConfig: PlaywrightTestConfig = {\n testDir: \"./tests/acceptance/cross-app\",\n testMatch: \"**/*.{test,spec}.{ts,js}\",\n\n use: {\n // Extended timeout for cross-app navigation\n actionTimeout: 10000,\n navigationTimeout: 15000,\n\n // Cross-domain configuration\n extraHTTPHeaders: {\n Accept: \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\n },\n\n // Authentication state for cross-app flows\n storageState: \"tests/fixtures/auth/cross-app-authenticated.json\",\n\n // Enable video for complex cross-app debugging\n video: \"retain-on-failure\",\n trace: \"retain-on-failure\",\n },\n};\n\n/**\n * Accessibility testing configuration with axe-core\n */\nexport const accessibilityConfig: PlaywrightTestConfig = {\n testDir: \"./tests/acceptance/accessibility\",\n testMatch: \"**/*.{test,spec}.{ts,js}\",\n\n use: {\n // Slower execution for accessibility checks\n actionTimeout: 15000,\n navigationTimeout: 20000,\n },\n};\n\n/**\n * Performance testing configuration for Lighthouse integration\n */\nexport const performanceConfig: PlaywrightTestConfig = {\n testDir: \"./tests/acceptance/performance\",\n testMatch: \"**/*.{test,spec}.{ts,js}\",\n\n // Sequential execution for accurate performance measurements\n fullyParallel: false,\n workers: 1,\n\n use: {\n // Extended timeouts for performance measurements\n actionTimeout: 30000,\n navigationTimeout: 45000,\n\n // Minimal interference for accurate measurements\n video: \"off\",\n screenshot: \"off\",\n trace: \"off\",\n },\n};\n\n/**\n * Options for creating a cross-domain authentication workflow configuration.\n */\nexport interface AuthWorkflowOptions {\n /** The cookie domain (e.g. \".example.com\"). */\n domain: string;\n /**\n * List of subdomains where authentication cookies should persist\n * (e.g. [\"accounts.example.com\", \"app.example.com\"]).\n */\n expectedPersistence: readonly string[];\n}\n\n/**\n * Configuration shape returned by {@link createAuthWorkflowConfig}.\n */\nexport interface AuthWorkflowConfig {\n /**\n * Cookie settings used for cross-domain authentication.\n */\n readonly cookieConfig: {\n readonly domain: string;\n readonly secure: true;\n readonly httpOnly: true;\n readonly sameSite: \"lax\";\n };\n /**\n * Subdomains where authentication should remain valid.\n */\n readonly expectedPersistence: readonly string[];\n}\n\n/**\n * Creates a cross-domain authentication configuration for the given domain.\n * @param options - Domain and persistence settings\n * @returns An authentication workflow config object\n */\nexport function createAuthWorkflowConfig(\n options: AuthWorkflowOptions,\n): AuthWorkflowConfig {\n return {\n cookieConfig: {\n domain: options.domain,\n secure: true,\n httpOnly: true,\n sameSite: \"lax\" as const,\n },\n expectedPersistence: options.expectedPersistence,\n } as const;\n}\n\n/**\n * Options for creating a cross-app Playwright configuration.\n */\nexport interface CrossAppConfigOptions {\n /**\n * Map of environment names to their configuration.\n * The key used is determined by the `TEST_ENV` environment variable,\n * falling back to `\"development\"`.\n */\n environments: Readonly<Record<string, TestEnvironmentConfig | undefined>>;\n /** Additional Playwright configuration overrides. */\n customConfig?: PlaywrightConfig;\n}\n\n/**\n * Creates a Playwright configuration for cross-app workflows.\n *\n * Consumers must supply their own environment map so that base URLs are not\n * hardcoded in this shared package.\n * @param options - Environments map and optional custom config overrides\n * @returns A Playwright configuration optimized for cross-app testing\n */\nexport function createCrossAppConfig(\n options: CrossAppConfigOptions,\n): PlaywrightTestConfig {\n const { environments, customConfig = EMPTY_CONFIG } = options;\n\n const environment = process.env.TEST_ENV ?? \"development\";\n const envConfig = environments[environment];\n\n if (envConfig === undefined) {\n throw new Error(\n `Unknown test environment \"${environment}\". Available environments: ${Object.keys(environments).join(\", \")}`,\n );\n }\n\n const defaultBaseUrl = Object.values(envConfig.baseUrls).at(0);\n\n if (defaultBaseUrl === undefined) {\n throw new Error(\n `Environment \"${environment}\" must define at least one base URL`,\n );\n }\n\n return {\n ...baseConfig,\n ...crossAppConfig,\n ...customConfig,\n use: {\n ...baseConfig.use,\n ...crossAppConfig.use,\n ...(customConfig as PlaywrightTestConfig).use,\n // Set base URL to the first entry in baseUrls (typically the landing page)\n baseURL: defaultBaseUrl,\n },\n projects: [\n // Desktop browsers for cross-app flows\n {\n name: \"cross-app-chromium\",\n testDir: \"./tests/acceptance/cross-app\",\n use: {\n ...baseConfig.projects?.[0]?.use,\n // Cross-app specific browser settings\n viewport: { width: 1920, height: 1080 },\n },\n },\n {\n name: \"cross-app-firefox\",\n testDir: \"./tests/acceptance/cross-app\",\n use: {\n ...baseConfig.projects?.[1]?.use,\n viewport: { width: 1920, height: 1080 },\n },\n },\n {\n name: \"cross-app-webkit\",\n testDir: \"./tests/acceptance/cross-app\",\n use: {\n ...baseConfig.projects?.[2]?.use,\n viewport: { width: 1920, height: 1080 },\n },\n },\n ],\n };\n}\n\n/**\n * Creates a configuration for accessibility testing with axe-core\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration with accessibility testing setup\n */\nexport function createAccessibilityConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return {\n ...baseConfig,\n ...accessibilityConfig,\n ...customConfig,\n use: {\n ...baseConfig.use,\n ...accessibilityConfig.use,\n ...(customConfig as PlaywrightTestConfig).use,\n },\n projects: [\n {\n name: \"accessibility-chromium\",\n testDir: \"./tests/acceptance/accessibility\",\n use: {\n ...baseConfig.projects?.[0]?.use,\n viewport: { width: 1280, height: 720 },\n },\n },\n ],\n };\n}\n\n/**\n * Creates a configuration for performance testing with Lighthouse\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration with performance testing setup\n */\nexport function createPerformanceConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return {\n ...baseConfig,\n ...performanceConfig,\n ...customConfig,\n use: {\n ...baseConfig.use,\n ...performanceConfig.use,\n ...(customConfig as PlaywrightTestConfig).use,\n },\n projects: [\n {\n name: \"performance-chromium\",\n testDir: \"./tests/acceptance/performance\",\n use: {\n ...baseConfig.projects?.[0]?.use,\n viewport: { width: 1920, height: 1080 },\n },\n },\n ],\n };\n}\n\n/**\n * Creates a configuration optimized for authentication workflow testing\n * @param options - Cross-app config options (environments map and optional custom config)\n * @returns A Playwright configuration for auth workflow testing\n */\nexport function createAuthTestConfig(\n options: CrossAppConfigOptions,\n): PlaywrightTestConfig {\n const { environments, customConfig = EMPTY_CONFIG } = options;\n return createCrossAppConfig({\n environments,\n customConfig: {\n ...customConfig,\n testDir: \"./tests/acceptance/auth\",\n use: {\n ...(customConfig as PlaywrightTestConfig).use,\n // No pre-authenticated state for auth tests\n storageState: undefined,\n },\n },\n });\n}\n\nexport default createCrossAppConfig;\n","/**\n * Base browser configuration for Playwright testing\n * @module @reasonabletech/config-playwright/base\n */\n\nimport { type PlaywrightTestConfig, devices } from \"@playwright/test\";\nimport { baseConfig, type PlaywrightConfig } from \"./index.js\";\n\n// Empty readonly config for default parameters\nconst EMPTY_CONFIG = {} as const satisfies PlaywrightConfig;\n\n/**\n * Desktop-only browser configuration\n */\nexport const desktopConfig: PlaywrightTestConfig = {\n projects: [\n {\n name: \"chromium\",\n use: { ...devices[\"Desktop Chrome\"] },\n },\n {\n name: \"firefox\",\n use: { ...devices[\"Desktop Firefox\"] },\n },\n {\n name: \"webkit\",\n use: { ...devices[\"Desktop Safari\"] },\n },\n ],\n};\n\n/**\n * Mobile-only browser configuration\n */\nexport const mobileConfig: PlaywrightTestConfig = {\n projects: [\n {\n name: \"Mobile Chrome\",\n use: { ...devices[\"Pixel 5\"] },\n },\n {\n name: \"Mobile Safari\",\n use: { ...devices[\"iPhone 12\"] },\n },\n ],\n};\n\n/**\n * Chromium-only configuration for faster development testing\n */\nexport const chromiumOnlyConfig: PlaywrightTestConfig = {\n projects: [\n {\n name: \"chromium\",\n use: { ...devices[\"Desktop Chrome\"] },\n },\n ],\n};\n\n/**\n * Creates a base Playwright configuration for single-app testing\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration for standard single-app testing\n */\nexport function createBaseConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return {\n ...baseConfig,\n ...customConfig,\n use: {\n ...baseConfig.use,\n ...customConfig.use,\n // Single-app specific settings\n storageState: undefined, // No cross-app auth state by default\n },\n projects: customConfig.projects ?? baseConfig.projects,\n };\n}\n\n/**\n * Creates a desktop-only configuration for faster testing cycles\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration for desktop browsers only\n */\nexport function createDesktopConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return createBaseConfig({\n ...customConfig,\n projects: desktopConfig.projects,\n });\n}\n\n/**\n * Creates a mobile-only configuration for mobile-specific testing\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration for mobile browsers only\n */\nexport function createMobileConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return createBaseConfig({\n ...customConfig,\n projects: mobileConfig.projects,\n });\n}\n\n/**\n * Creates a Chromium-only configuration for development\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration for Chromium browser only\n */\nexport function createChromiumConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return createBaseConfig({\n ...customConfig,\n projects: chromiumOnlyConfig.projects,\n workers: 1, // Single worker for development\n });\n}\n\nexport default createBaseConfig;\n","/**\n * Base Playwright configuration for all applications\n * @module @reasonabletech/config-playwright\n */\n\nimport { type PlaywrightTestConfig, devices } from \"@playwright/test\";\n\n/**\n * Recursively makes all properties of `T` readonly.\n *\n * Useful for configuration objects defined with `as const`, ensuring callers\n * don't accidentally mutate shared config.\n */\nexport type DeepReadonly<T> = {\n readonly [P in keyof T]: T[P] extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepReadonly<U>>\n : T[P] extends Array<infer U>\n ? ReadonlyArray<DeepReadonly<U>>\n : T[P] extends object\n ? DeepReadonly<T[P]>\n : T[P];\n};\n\n/**\n * Immutable Playwright config type accepted by config helpers.\n */\nexport type PlaywrightConfig = DeepReadonly<PlaywrightTestConfig>;\n\n// Empty readonly config for default parameters\nconst EMPTY_CONFIG = {} as const satisfies PlaywrightConfig;\n\n/**\n * Service configuration for a test environment.\n */\nexport interface TestEnvironmentServices {\n /** Whether to use real backend services instead of mocks. */\n useRealServices: boolean;\n /** Whether to mock external (third-party) API calls. */\n mockExternalAPIs: boolean;\n}\n\n/**\n * Configuration for a single test environment (e.g. development, staging, production).\n *\n * Consumers define their own environment map and pass it to helpers like\n * {@link createCrossAppConfig} in `cross-app.ts`.\n */\nexport interface TestEnvironmentConfig {\n /** Map of application names to their base URLs. */\n baseUrls: Record<string, string>;\n /** Service-layer settings for this environment. */\n services: TestEnvironmentServices;\n /** When true, only smoke tests should run (e.g. in production). */\n smokeTestsOnly?: boolean;\n}\n\n/**\n * Base configuration options that apply to all acceptance test environments\n */\nexport const baseConfig: PlaywrightTestConfig = {\n // Test discovery and execution\n testDir: \"./tests/acceptance\",\n testMatch: \"**/*.{test,spec}.{ts,js}\",\n\n // Global test settings\n fullyParallel: true,\n forbidOnly: Boolean(process.env.CI),\n retries: process.env.CI !== undefined ? 2 : 0,\n workers: process.env.CI !== undefined ? 4 : undefined,\n\n // Test execution timeouts\n timeout: 30 * 1000, // 30 seconds for individual tests\n expect: {\n timeout: 5 * 1000, // 5 seconds for assertions\n },\n\n // Reporter configuration for different environments\n reporter: [\n [\"html\", { outputFolder: \"./generated/playwright/reports\" }],\n [\"json\", { outputFile: \"./generated/playwright/results.json\" }],\n process.env.CI !== undefined ? [\"github\"] : [\"list\"],\n ],\n\n // Output folder for test results\n outputDir: \"./generated/playwright/test-results\",\n\n // Global test options\n use: {\n // Browser context settings\n viewport: { width: 1280, height: 720 },\n ignoreHTTPSErrors: true,\n headless: true, // Always headless by default (use --headed flag to override)\n\n // Action timeouts\n actionTimeout: 10 * 1000, // 10 seconds for actions\n navigationTimeout: 30 * 1000, // 30 seconds for navigation\n\n // Debugging and artifact collection - sensible defaults\n trace: \"on-first-retry\",\n video: \"retain-on-failure\",\n screenshot: \"only-on-failure\",\n\n // No authentication state by default (apps can override)\n storageState: undefined,\n },\n\n // Browser and device matrix\n // Local dev: Chromium only for speed\n // CI: Full browser matrix for compatibility testing\n projects:\n process.env.CI !== undefined\n ? [\n // Desktop browsers\n {\n name: \"chromium\",\n use: { ...devices[\"Desktop Chrome\"] },\n },\n {\n name: \"firefox\",\n use: { ...devices[\"Desktop Firefox\"] },\n },\n {\n name: \"webkit\",\n use: { ...devices[\"Desktop Safari\"] },\n },\n\n // Mobile devices\n {\n name: \"Mobile Chrome\",\n use: { ...devices[\"Pixel 5\"] },\n },\n {\n name: \"Mobile Safari\",\n use: { ...devices[\"iPhone 12\"] },\n },\n\n // Tablet devices\n {\n name: \"iPad\",\n use: { ...devices[\"iPad Pro\"] },\n },\n ]\n : [\n // Local development: Chromium only for fast iteration\n {\n name: \"chromium\",\n use: { ...devices[\"Desktop Chrome\"] },\n },\n ],\n\n // Development server integration - common defaults for web apps\n webServer:\n process.env.CI !== undefined\n ? undefined\n : {\n command: \"pnpm dev\",\n reuseExistingServer: true,\n timeout: 120 * 1000, // 2 minutes to start\n },\n};\n\n/**\n * Creates a merged configuration from the base and any custom options\n * @param customConfig - Additional configuration options\n * @returns A merged Playwright configuration\n */\nexport function createPlaywrightConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return {\n ...baseConfig,\n ...customConfig,\n use: {\n ...baseConfig.use,\n ...customConfig.use,\n },\n projects: customConfig.projects ?? baseConfig.projects,\n };\n}\n\n/**\n * Creates a configuration optimized for CI/CD environments\n * @param customConfig - Additional configuration options\n * @returns A Playwright configuration optimized for CI/CD\n */\nexport function createCIConfig(\n customConfig: PlaywrightConfig = EMPTY_CONFIG,\n): PlaywrightTestConfig {\n return createPlaywrightConfig({\n ...customConfig,\n fullyParallel: true,\n retries: 3,\n workers: 4,\n use: {\n ...customConfig.use,\n trace: \"retain-on-failure\",\n video: \"retain-on-failure\",\n screenshot: \"only-on-failure\",\n },\n });\n}\n\n// Re-export for convenience\nexport { createCrossAppConfig } from \"./cross-app.js\";\nexport { createBaseConfig } from \"./base.js\";\n\nexport default createPlaywrightConfig;\n"]}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Base browser configuration for Playwright testing
3
+ * @module @reasonabletech/config-playwright/base
4
+ */
5
+ import { type PlaywrightTestConfig } from "@playwright/test";
6
+ import { type PlaywrightConfig } from "./index.js";
7
+ /**
8
+ * Desktop-only browser configuration
9
+ */
10
+ export declare const desktopConfig: PlaywrightTestConfig;
11
+ /**
12
+ * Mobile-only browser configuration
13
+ */
14
+ export declare const mobileConfig: PlaywrightTestConfig;
15
+ /**
16
+ * Chromium-only configuration for faster development testing
17
+ */
18
+ export declare const chromiumOnlyConfig: PlaywrightTestConfig;
19
+ /**
20
+ * Creates a base Playwright configuration for single-app testing
21
+ * @param customConfig - Additional configuration options
22
+ * @returns A Playwright configuration for standard single-app testing
23
+ */
24
+ export declare function createBaseConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
25
+ /**
26
+ * Creates a desktop-only configuration for faster testing cycles
27
+ * @param customConfig - Additional configuration options
28
+ * @returns A Playwright configuration for desktop browsers only
29
+ */
30
+ export declare function createDesktopConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
31
+ /**
32
+ * Creates a mobile-only configuration for mobile-specific testing
33
+ * @param customConfig - Additional configuration options
34
+ * @returns A Playwright configuration for mobile browsers only
35
+ */
36
+ export declare function createMobileConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
37
+ /**
38
+ * Creates a Chromium-only configuration for development
39
+ * @param customConfig - Additional configuration options
40
+ * @returns A Playwright configuration for Chromium browser only
41
+ */
42
+ export declare function createChromiumConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
43
+ export default createBaseConfig;
44
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,oBAAoB,EAAW,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK/D;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,oBAe3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,oBAW1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,oBAOhC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAYtB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAKtB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAKtB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAMtB;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Cross-app Playwright configuration for multi-frontend testing
3
+ * @module @reasonabletech/config-playwright/cross-app
4
+ */
5
+ import { type PlaywrightTestConfig } from "@playwright/test";
6
+ import { type PlaywrightConfig, type TestEnvironmentConfig } from "./index.js";
7
+ /**
8
+ * Cross-app specific configuration options
9
+ */
10
+ export declare const crossAppConfig: PlaywrightTestConfig;
11
+ /**
12
+ * Accessibility testing configuration with axe-core
13
+ */
14
+ export declare const accessibilityConfig: PlaywrightTestConfig;
15
+ /**
16
+ * Performance testing configuration for Lighthouse integration
17
+ */
18
+ export declare const performanceConfig: PlaywrightTestConfig;
19
+ /**
20
+ * Options for creating a cross-domain authentication workflow configuration.
21
+ */
22
+ export interface AuthWorkflowOptions {
23
+ /** The cookie domain (e.g. ".example.com"). */
24
+ domain: string;
25
+ /**
26
+ * List of subdomains where authentication cookies should persist
27
+ * (e.g. ["accounts.example.com", "app.example.com"]).
28
+ */
29
+ expectedPersistence: readonly string[];
30
+ }
31
+ /**
32
+ * Configuration shape returned by {@link createAuthWorkflowConfig}.
33
+ */
34
+ export interface AuthWorkflowConfig {
35
+ /**
36
+ * Cookie settings used for cross-domain authentication.
37
+ */
38
+ readonly cookieConfig: {
39
+ readonly domain: string;
40
+ readonly secure: true;
41
+ readonly httpOnly: true;
42
+ readonly sameSite: "lax";
43
+ };
44
+ /**
45
+ * Subdomains where authentication should remain valid.
46
+ */
47
+ readonly expectedPersistence: readonly string[];
48
+ }
49
+ /**
50
+ * Creates a cross-domain authentication configuration for the given domain.
51
+ * @param options - Domain and persistence settings
52
+ * @returns An authentication workflow config object
53
+ */
54
+ export declare function createAuthWorkflowConfig(options: AuthWorkflowOptions): AuthWorkflowConfig;
55
+ /**
56
+ * Options for creating a cross-app Playwright configuration.
57
+ */
58
+ export interface CrossAppConfigOptions {
59
+ /**
60
+ * Map of environment names to their configuration.
61
+ * The key used is determined by the `TEST_ENV` environment variable,
62
+ * falling back to `"development"`.
63
+ */
64
+ environments: Readonly<Record<string, TestEnvironmentConfig | undefined>>;
65
+ /** Additional Playwright configuration overrides. */
66
+ customConfig?: PlaywrightConfig;
67
+ }
68
+ /**
69
+ * Creates a Playwright configuration for cross-app workflows.
70
+ *
71
+ * Consumers must supply their own environment map so that base URLs are not
72
+ * hardcoded in this shared package.
73
+ * @param options - Environments map and optional custom config overrides
74
+ * @returns A Playwright configuration optimized for cross-app testing
75
+ */
76
+ export declare function createCrossAppConfig(options: CrossAppConfigOptions): PlaywrightTestConfig;
77
+ /**
78
+ * Creates a configuration for accessibility testing with axe-core
79
+ * @param customConfig - Additional configuration options
80
+ * @returns A Playwright configuration with accessibility testing setup
81
+ */
82
+ export declare function createAccessibilityConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
83
+ /**
84
+ * Creates a configuration for performance testing with Lighthouse
85
+ * @param customConfig - Additional configuration options
86
+ * @returns A Playwright configuration with performance testing setup
87
+ */
88
+ export declare function createPerformanceConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
89
+ /**
90
+ * Creates a configuration optimized for authentication workflow testing
91
+ * @param options - Cross-app config options (environments map and optional custom config)
92
+ * @returns A Playwright configuration for auth workflow testing
93
+ */
94
+ export declare function createAuthTestConfig(options: CrossAppConfigOptions): PlaywrightTestConfig;
95
+ export default createCrossAppConfig;
96
+ //# sourceMappingURL=cross-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-app.d.ts","sourceRoot":"","sources":["../../src/cross-app.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAC;AAKpB;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,oBAqB5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,oBASjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,oBAkB/B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;QACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,mBAAmB,GAC3B,kBAAkB,CAUpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC,CAAC,CAAC;IAC1E,qDAAqD;IACrD,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,oBAAoB,CA4DtB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAqBtB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAqBtB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,oBAAoB,CActB;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Base Playwright configuration for all applications
3
+ * @module @reasonabletech/config-playwright
4
+ */
5
+ import { type PlaywrightTestConfig } from "@playwright/test";
6
+ /**
7
+ * Recursively makes all properties of `T` readonly.
8
+ *
9
+ * Useful for configuration objects defined with `as const`, ensuring callers
10
+ * don't accidentally mutate shared config.
11
+ */
12
+ export type DeepReadonly<T> = {
13
+ readonly [P in keyof T]: T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepReadonly<U>> : T[P] extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T[P] extends object ? DeepReadonly<T[P]> : T[P];
14
+ };
15
+ /**
16
+ * Immutable Playwright config type accepted by config helpers.
17
+ */
18
+ export type PlaywrightConfig = DeepReadonly<PlaywrightTestConfig>;
19
+ /**
20
+ * Service configuration for a test environment.
21
+ */
22
+ export interface TestEnvironmentServices {
23
+ /** Whether to use real backend services instead of mocks. */
24
+ useRealServices: boolean;
25
+ /** Whether to mock external (third-party) API calls. */
26
+ mockExternalAPIs: boolean;
27
+ }
28
+ /**
29
+ * Configuration for a single test environment (e.g. development, staging, production).
30
+ *
31
+ * Consumers define their own environment map and pass it to helpers like
32
+ * {@link createCrossAppConfig} in `cross-app.ts`.
33
+ */
34
+ export interface TestEnvironmentConfig {
35
+ /** Map of application names to their base URLs. */
36
+ baseUrls: Record<string, string>;
37
+ /** Service-layer settings for this environment. */
38
+ services: TestEnvironmentServices;
39
+ /** When true, only smoke tests should run (e.g. in production). */
40
+ smokeTestsOnly?: boolean;
41
+ }
42
+ /**
43
+ * Base configuration options that apply to all acceptance test environments
44
+ */
45
+ export declare const baseConfig: PlaywrightTestConfig;
46
+ /**
47
+ * Creates a merged configuration from the base and any custom options
48
+ * @param customConfig - Additional configuration options
49
+ * @returns A merged Playwright configuration
50
+ */
51
+ export declare function createPlaywrightConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
52
+ /**
53
+ * Creates a configuration optimized for CI/CD environments
54
+ * @param customConfig - Additional configuration options
55
+ * @returns A Playwright configuration optimized for CI/CD
56
+ */
57
+ export declare function createCIConfig(customConfig?: PlaywrightConfig): PlaywrightTestConfig;
58
+ export { createCrossAppConfig } from "./cross-app.js";
59
+ export { createBaseConfig } from "./base.js";
60
+ export default createPlaywrightConfig;
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,oBAAoB,EAAW,MAAM,kBAAkB,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GACxD,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAC9B,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACzB,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAC9B,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjB,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAClB,CAAC,CAAC,CAAC,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AAKlE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,6DAA6D;IAC7D,eAAe,EAAE,OAAO,CAAC;IACzB,wDAAwD;IACxD,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,mDAAmD;IACnD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,mEAAmE;IACnE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,oBAoGxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAUtB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,YAAY,GAAE,gBAA+B,GAC5C,oBAAoB,CAatB;AAGD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,eAAe,sBAAsB,CAAC"}
package/docs/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @reasonabletech/config-playwright Documentation
2
+
3
+ Reference documentation for shared Playwright configuration in the core-utils monorepo.
4
+
5
+ ## Start Here
6
+
7
+ - [Usage Guide](./guides/usage-guide.md)
8
+
9
+ ## API Reference
10
+
11
+ - [API Reference](./api/api-reference.md) — Factory functions, options, and preset configs
12
+
13
+ ## Quick Example
14
+
15
+ ```ts
16
+ // playwright.config.ts
17
+ import { createPlaywrightConfig } from "@reasonabletech/config-playwright";
18
+
19
+ export default createPlaywrightConfig({
20
+ use: {
21
+ baseURL: "http://localhost:3000",
22
+ },
23
+ });
24
+ ```
25
+
26
+ ## Monorepo Context
27
+
28
+ - [Package README](../README.md)
29
+ - [Architecture](../../../docs/architecture.md) — How packages relate
30
+ - [Tooling](../../../docs/tooling.md) — Turbo, Changesets, Playwright details
31
+ - [Contributing](../../../CONTRIBUTING.md)