@molecule/app-e2e-playwright 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +129 -9
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,26 +1,146 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-09-12T19:49:04.133Z
7
+ -->
8
+
1
9
  # @molecule/app-e2e-playwright
2
10
 
3
- Real Playwright browsers for the e2e bond — the user's machine and CI
11
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
+ > It is written to be read by coding agents as much as by people, and is generated from this
13
+ > package's source — edit `src/index.ts` JSDoc, not this file.
14
+
15
+ E2E bond that opens real Playwright browsers. Inside a molecule sandbox the
16
+ same specs drive the live preview through `@molecule/app-e2e-preview`; on
17
+ your own machine and in CI this bond gives them Chromium, Firefox or WebKit
18
+ with everything Playwright offers — screenshots, traces, videos, network
19
+ interception.
20
+
21
+ When the test runner picks the `playwright` provider, `@molecule/app-e2e`'s
22
+ `test` IS Playwright's `test`, so this bond is only reached by scripts that
23
+ call `connect()` themselves (a measurement script, a smoke check outside the
24
+ runner). Under `npx playwright test`, Playwright's own fixtures launch the
25
+ browser as usual.
26
+
27
+ ## Quick Start
28
+
29
+ ```ts
30
+ // e2e/bonds.ts (scaffolded)
31
+ import { resolveE2EProviderName, setProvider } from '@molecule/app-e2e'
32
+ import { provider as playwright } from '@molecule/app-e2e-playwright'
33
+ import { provider as preview } from '@molecule/app-e2e-preview'
34
+
35
+ setProvider(resolveE2EProviderName() === 'preview' ? preview : playwright)
36
+
37
+ // a script
38
+ import { connectPlaywright } from '@molecule/app-e2e-playwright'
39
+ const page = await connectPlaywright({
40
+ baseURL: 'http://localhost:3000',
41
+ viewport: { width: 390, height: 844 },
42
+ })
43
+ await page.goto('/')
44
+ await page.screenshot({ path: 'home-phone.png' })
45
+ await page.close() // closes the context and the browser too
46
+ ```
4
47
 
5
48
  ## Type
6
49
 
7
50
  `provider`
8
51
 
9
- ## Implements
52
+ ## Installation
53
+
54
+ ```bash
55
+ npm install @molecule/app-e2e-playwright @molecule/app-bond @molecule/app-e2e @playwright/test
56
+ ```
57
+
58
+ ## API
59
+
60
+ ### Interfaces
61
+
62
+ #### `PlaywrightConnectOptions`
63
+
64
+ Options for `provider.connect()` beyond the core's.
65
+
66
+ ```typescript
67
+ interface PlaywrightConnectOptions extends E2EConnectOptions {
68
+ /** Browser to launch; default `chromium` (also `MOL_E2E_BROWSER`). */
69
+ browser?: PlaywrightBrowserName
70
+ /** Show the browser window; default headless (also `MOL_E2E_HEADED=1`). */
71
+ headed?: boolean
72
+ /** Extra launch options passed through to Playwright. */
73
+ launchOptions?: LaunchOptions
74
+ }
75
+ ```
76
+
77
+ ### Types
78
+
79
+ #### `PlaywrightBrowserName`
80
+
81
+ Which Playwright browser to launch.
82
+
83
+ ```typescript
84
+ type PlaywrightBrowserName = 'chromium' | 'firefox' | 'webkit'
85
+ ```
86
+
87
+ ### Functions
88
+
89
+ #### `connectPlaywright(options?)`
90
+
91
+ Open a real browser page from any script.
92
+
93
+ ```typescript
94
+ function connectPlaywright(options?: PlaywrightConnectOptions): Promise<Page>
95
+ ```
96
+
97
+ ### Constants
98
+
99
+ #### `provider`
100
+
101
+ The bond: `setProvider(provider)` in your `e2e/bonds.ts`.
102
+
103
+ ```typescript
104
+ const provider: E2EProvider
105
+ ```
106
+
107
+ ## Core Interface
108
+
109
+ Implements `@molecule/app-e2e` interface.
110
+
111
+ ## Bond Wiring
112
+
113
+ Setup function to register this provider with the core interface:
114
+
115
+ ```typescript
116
+ import { setProvider } from '@molecule/app-e2e'
117
+ import { provider } from '@molecule/app-e2e-playwright'
10
118
 
11
- `@molecule/app-e2e`
119
+ export function setupE2ePlaywright(): void {
120
+ setProvider(provider)
121
+ }
122
+ ```
12
123
 
13
124
  ## Injection Notes
14
125
 
15
126
  ### Requirements
16
127
 
17
- - None
128
+ Peer dependencies:
18
129
 
19
- ### Post-Injection Steps
130
+ - `@molecule/app-bond` ^1.0.1
131
+ - `@molecule/app-e2e` ^1.0.0
132
+ - `@playwright/test` ^1.40.0
20
133
 
21
- - Run `npm install` to install dependencies
22
- - Run `npm run build` to compile
134
+ ### Runtime Dependencies
23
135
 
24
- ### Known Limitations
136
+ - `@molecule/app-bond`
137
+ - `@molecule/app-e2e`
138
+ - `@playwright/test`
25
139
 
26
- - None yet
140
+ - Browsers are installed once with `npx playwright install chromium`
141
+ (`@playwright/test` never downloads them on `npm install`). The launch
142
+ error says so when they are missing.
143
+ - `MOL_E2E_BROWSER=firefox|webkit` picks the engine; `MOL_E2E_HEADED=1`
144
+ shows the window.
145
+ - Do not use this bond inside a molecule sandbox: there is no browser there
146
+ by design, and the preview bond is the one that works.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-e2e-playwright",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "E2E bond that opens real Playwright browsers — the same specs that drive the live preview inside a molecule sandbox run here on your machine and in CI, with screenshots, traces and network interception.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "url": "https://github.com/molecule-dev/molecule.git",
33
33
  "directory": "packages/app/bonds/e2e/playwright"
34
34
  },
35
- "homepage": "https://molecule.dev",
35
+ "homepage": "https://www.molecule.dev/packages/app-e2e-playwright",
36
36
  "bugs": {
37
37
  "url": "https://github.com/molecule-dev/molecule/issues"
38
38
  },
@@ -45,8 +45,8 @@
45
45
  "@playwright/test": "^1.40.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@molecule/app-bond": "1.0.1",
49
- "@molecule/app-e2e": "1.0.0",
48
+ "@molecule/app-bond": "1.0.2",
49
+ "@molecule/app-e2e": "1.0.1",
50
50
  "@playwright/test": "1.62.0",
51
51
  "@types/node": "26.1.2",
52
52
  "typescript": "6.0.3",