You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @prop {string} [endpoint] - explicit CDP endpoint. Setting this switches the helper to ATTACH
17
-
* mode: it only connects, and never spawns or kills a process, no matter what else is configured.
18
-
* Leave it unset for SELF-MANAGED mode (see below).
19
-
* @prop {string} [binaryPath] - path to the `obscura` executable, used in SELF-MANAGED mode
20
-
* (`endpoint` unset). Checked before `OBSCURA_PATH` and `PATH`.
21
-
* @prop {number} [port] - port `obscura serve` listens on, in SELF-MANAGED mode. When unset, a
22
-
* free port is picked automatically, which is what makes `run-workers` collision-free — every
23
-
* worker gets its own instance on its own port with zero config.
24
-
* @prop {number} [serverStartTimeout=15000] - milliseconds to wait for a spawned `obscura serve`
25
-
* to answer `/json/version` before `_connect` gives up.
16
+
* @prop {string} [endpoint] - connect to a running Obscura instead of starting one (ATTACH mode).
17
+
* @prop {string} [binaryPath] - path to the `obscura` executable. Checked before `OBSCURA_PATH` and `PATH`.
18
+
* @prop {number} [port] - port for `obscura serve`. A free port is picked when unset, so parallel workers never collide.
19
+
* @prop {number} [serverStartTimeout=15000] - how long to wait for `obscura serve` to start, in milliseconds.
26
20
*/
27
21
constconfig={}
28
22
29
23
/**
30
-
* Obscura drives [Obscura](https://github.com/h4ckf0r0day/obscura), a minimal headless
31
-
* browser exposed over the Chrome DevTools Protocol. From v0.2.0, default release builds ship a
32
-
* real rendering engine (layout, paint, screenshots); `-no-render` variants and v0.1.x builds keep
33
-
* the original single-V8-isolate, nothing-rendered mode. This helper does not hardcode which mode a
34
-
* given binary is in — `CDPBrowser._probeCapabilities` detects `layout`/`screenshot` per binary at
35
-
* runtime, so the same helper works against either.
24
+
* Obscura drives [Obscura](https://github.com/h4ckf0r0day/obscura), a lightweight headless
25
+
* browser controlled over the Chrome DevTools Protocol. Default builds from v0.2.0 render pages
26
+
* (layout, screenshots); `-no-render` builds and v0.1.x run JavaScript and the DOM only. The helper
27
+
* detects which build it runs against, so the same config works for both.
36
28
*
37
-
* This helper is a thin `CDPBrowser` subclass: it changes nothing about how locating or acting on
38
-
* elements works, it only pins the config presets Obscura requires and manages the `obscura serve`
39
-
* process lifecycle, the same way Playwright manages its own browser process.
29
+
* The helper starts and stops `obscura serve` for you, the same way Playwright manages its browser.
40
30
*
41
31
* > Obscura support is experimental in CodeceptJS 4.2. Pin the browser version in CI and keep a
42
32
* > Playwright/WebDriver job for browser-compatibility coverage.
@@ -56,8 +46,8 @@ const config = {}
56
46
* - **SELF-LAUNCH** — `endpoint` is unset and a binary can be resolved, in order: `binaryPath` in
57
47
* the config, then the `OBSCURA_PATH` environment variable, then `obscura` on `PATH`. The helper
58
48
* spawns `obscura serve --port <port> --allow-private-network --allow-file-access` (`port` from
59
-
* the config, or a free port picked automatically), waits for it to answer, connects, and kills
60
-
* it in `_finishTest`.
49
+
* the config, or a free port picked automatically), waits for it to answer, connects, and stops
50
+
* it when tests finish.
61
51
* - **COURTESY-ATTACH** — `endpoint` is unset and no binary can be resolved, but something already
62
52
* answers `http://127.0.0.1:9222/json/version` (e.g. `obscura serve` started by hand, or by CI
63
53
* before this process ever ran). The helper attaches to it and never kills it — it isn't the
@@ -96,13 +86,11 @@ const config = {}
96
86
*
97
87
* | option | value | why |
98
88
* | --- | --- | --- |
99
-
* | `input` | `synthetic` | coordinate-click navigation is unreliable over CDP on Obscura even on rendering builds (no `frameNavigated` event, stale `page.url()`); `click` always takes the `forceClick` path — on Obscura, `click` and `forceClick` are the same thing |
100
-
* | `xpathPolyfill` | `auto` | probed per binary/page: Obscura's native `document.evaluate` still doesn't support attribute selection or `not()`, so the polyfill is used until that lands |
89
+
* | `input` | `synthetic` | clicks that navigate are unreliable in Obscura, so `click` behaves like `forceClick` |
90
+
* | `xpathPolyfill` | `auto` | Obscura's XPath lacks attribute selection and `not()`, so the polyfill is used when needed |
101
91
*
102
-
* `capabilities.layout`/`capabilities.screenshot`/`capabilities.xpath` are intentionally left
103
-
* unset here — `CDPBrowser._probeCapabilities` detects them at runtime from the actual binary
104
-
* (`'real'`/`true` on v0.2.0+ default builds, `'none'`/`false` on `-no-render` builds and v0.1.x).
105
-
* Set them explicitly in your own config to skip probing or to force a mode.
92
+
* `capabilities` are detected at runtime from the Obscura build. Set them in your config to skip
93
+
* detection or to force a mode.
106
94
*
107
95
* ## Limitations
108
96
*
@@ -168,17 +156,6 @@ class Obscura extends CDPBrowser {
168
156
this._selfManagedResolved=false
169
157
}
170
158
171
-
/**
172
-
* In ATTACH mode, connects exactly as `CDPBrowser._connect` would. In SELF-MANAGED mode,
173
-
* resolves and spawns `obscura serve` (or courtesy-attaches to an already-running one on
174
-
* :9222) exactly once via `_resolveSelfManaged`, then connects.
175
-
*
176
-
* A spawn failure (e.g. a bad binary) is delivered asynchronously by Node as an `error`
177
-
* event; it is recorded on `this.serverError` and surfaced as a rejection from `_waitForServer`
178
-
* instead of crashing the process as an uncaught exception.
0 commit comments