codeceptjs 4.2.0 → 4.2.1-beta.2
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/README.md +2 -0
- package/bin/codecept.js +11 -0
- package/docs/agents.md +26 -1
- package/docs/ai.md +57 -0
- package/docs/alternative-browsers.md +175 -148
- package/docs/assertions.md +74 -0
- package/docs/bootstrap.md +2 -0
- package/docs/commands.md +45 -0
- package/docs/configuration.md +37 -0
- package/docs/debugging.md +1 -1
- package/docs/helpers/ApiDataFactory.md +20 -20
- package/docs/helpers/Appium.md +1615 -670
- package/docs/helpers/Decision.md +146 -0
- package/docs/helpers/GraphQL.md +31 -31
- package/docs/helpers/GraphQLDataFactory.md +20 -20
- package/docs/helpers/Kitesurf.md +1808 -25
- package/docs/helpers/Lightpanda.md +139 -0
- package/docs/helpers/Obscura.md +1799 -74
- package/docs/helpers/Playwright.md +490 -428
- package/docs/helpers/Puppeteer.md +317 -255
- package/docs/helpers/REST.md +43 -43
- package/docs/helpers/WebDriver.md +237 -175
- package/docs/installation.md +16 -0
- package/docs/mcp.md +7 -1
- package/docs/parallel.md +35 -1
- package/docs/plugins/pause.md +2 -1
- package/docs/plugins/sitemap.md +48 -0
- package/docs/plugins.md +4 -0
- package/lib/ai.js +81 -2
- package/lib/codecept.js +32 -2
- package/lib/command/init.js +22 -0
- package/lib/command/initAgent.js +78 -0
- package/lib/command/run-multiple.js +3 -0
- package/lib/command/run-workers.js +10 -3
- package/lib/command/run.js +3 -2
- package/lib/command/utils.js +15 -0
- package/lib/command/workers/runTests.js +10 -10
- package/lib/container.js +4 -2
- package/lib/effects.js +19 -1
- package/lib/helper/CDPBrowser.js +382 -1393
- package/lib/helper/Decision.js +256 -0
- package/lib/helper/Kitesurf.js +3 -21
- package/lib/helper/Lightpanda.js +137 -0
- package/lib/helper/Obscura.js +21 -238
- package/lib/helper/Playwright.js +6 -4
- package/lib/helper/Puppeteer.js +12 -7
- package/lib/helper/WebDriver.js +2 -1
- package/lib/helper/clientscripts/cdpBrowserClient.js +1 -1
- package/lib/helper/clientscripts/layoutProbe.js +12 -0
- package/lib/helper/extras/CDPConnection.js +10 -2
- package/lib/listener/result.js +4 -0
- package/lib/mocha/bdd.js +19 -1
- package/lib/plugin/junitReporter.js +4 -1
- package/lib/plugin/pause.js +4 -1
- package/lib/plugin/sitemap.js +228 -0
- package/lib/recorder.js +19 -18
- package/lib/result.js +16 -0
- package/lib/step/base.js +12 -0
- package/lib/utils.js +2 -10
- package/lib/webServer.js +193 -0
- package/lib/workers.js +118 -31
- package/package.json +4 -2
- package/typings/index.d.ts +60 -7
- package/typings/promiseBasedTypes.d.ts +772 -824
- package/typings/types.d.ts +866 -833
- package/docs/helpers/CDPBrowser.md +0 -2138
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /helpers/Lightpanda
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: Lightpanda
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## Lightpanda
|
|
11
|
+
|
|
12
|
+
**Extends CDPBrowser**
|
|
13
|
+
|
|
14
|
+
Lightpanda drives [Lightpanda][1], a headless browser written from scratch
|
|
15
|
+
for automation, exposed over the Chrome DevTools Protocol. It executes real JavaScript in V8 and
|
|
16
|
+
implements the DOM and Web APIs, but has no graphical rendering engine: nothing is ever painted,
|
|
17
|
+
so there are no screenshots.
|
|
18
|
+
|
|
19
|
+
This helper is a thin `CDPBrowser` subclass: it changes nothing about how locating or acting on
|
|
20
|
+
elements works, it only pins the config presets Lightpanda requires and manages the
|
|
21
|
+
`lightpanda serve` process lifecycle, the same way Playwright manages its own browser process.
|
|
22
|
+
|
|
23
|
+
> Lightpanda support is experimental. Pin the browser version in CI and keep a
|
|
24
|
+
> Playwright/WebDriver job for browser-compatibility coverage.
|
|
25
|
+
|
|
26
|
+
## Modes
|
|
27
|
+
|
|
28
|
+
* **ATTACH** — `endpoint` is set explicitly in the config. The helper only connects to it; it
|
|
29
|
+
never spawns or kills anything, no matter what `binaryPath`/`port` are set to.
|
|
30
|
+
* **SELF-LAUNCH** — `endpoint` is unset and a binary can be resolved, in order: `binaryPath` in
|
|
31
|
+
the config, then the `LIGHTPANDA_PATH` environment variable, then `lightpanda` on `PATH`. The
|
|
32
|
+
helper spawns `lightpanda serve --host 127.0.0.1 --port <port>` (`port` from the config, or a
|
|
33
|
+
free port picked automatically), waits for it to answer, connects, and kills it in
|
|
34
|
+
`_finishTest`.
|
|
35
|
+
* **COURTESY-ATTACH** — `endpoint` is unset and no binary can be resolved, but something already
|
|
36
|
+
answers `http://127.0.0.1:9222/json/version` (e.g. `lightpanda serve` started by hand, or the
|
|
37
|
+
`lightpanda/browser` Docker image). The helper attaches to it and never kills it. If neither a
|
|
38
|
+
binary nor a running server on :9222 can be found, the helper throws a loud, actionable error.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
Follow the [official installation instructions][2],
|
|
43
|
+
then put `lightpanda` on your `PATH`, or point `binaryPath`/`LIGHTPANDA_PATH` at it. The helper
|
|
44
|
+
then launches and tears it down automatically.
|
|
45
|
+
|
|
46
|
+
Lightpanda sends usage telemetry by default. This helper always spawns it with
|
|
47
|
+
`LIGHTPANDA_DISABLE_TELEMETRY=true`; set that variable yourself when you start the server by hand.
|
|
48
|
+
|
|
49
|
+
Lightpanda is licensed under AGPL-3.0. It runs as a separate process that CodeceptJS talks to
|
|
50
|
+
over a WebSocket, so it does not change the license of CodeceptJS or of your tests.
|
|
51
|
+
|
|
52
|
+
## Config presets
|
|
53
|
+
|
|
54
|
+
These are set automatically and only need overriding for unusual setups:
|
|
55
|
+
|
|
56
|
+
| option | value | why |
|
|
57
|
+
| ------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
58
|
+
| `input` | `synthetic` | nothing is painted, so coordinates are not hit-tested; `click` always takes the `forceClick` path |
|
|
59
|
+
| `xpathPolyfill` | `auto` | probed per binary/page |
|
|
60
|
+
| `capabilities.layout` | `real` | Lightpanda computes visibility-related styles and element boxes without painting, which is enough for `seeElement` and the `waitForVisible` family; it is pinned because the runtime layout probe cannot run on Lightpanda's `about:blank` |
|
|
61
|
+
| `capabilities.screenshot` | `false` | there is no rendering engine |
|
|
62
|
+
|
|
63
|
+
## Limitations
|
|
64
|
+
|
|
65
|
+
* No screenshots and no screencast: `saveScreenshot` and `saveElementScreenshot` do nothing (a debug message is printed).
|
|
66
|
+
* No frames or popups.
|
|
67
|
+
* No scrolling: scroll positions always stay at 0.
|
|
68
|
+
* Computed styles cover what visibility checks need (`display`, `visibility`, `opacity`,
|
|
69
|
+
`pointer-events`); `grabCssPropertyFrom` and `seeCssPropertiesOnElements` are unreliable for
|
|
70
|
+
other properties.
|
|
71
|
+
* No coordinate-based input (`clickXY`).
|
|
72
|
+
* No clipboard access.
|
|
73
|
+
* Some rich text editors (TinyMCE, Trix, Monaco) never finish initialising.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Configuration
|
|
78
|
+
|
|
79
|
+
This helper should be configured in codecept.conf.js
|
|
80
|
+
|
|
81
|
+
Type: [object][3]
|
|
82
|
+
|
|
83
|
+
### Properties
|
|
84
|
+
|
|
85
|
+
* `endpoint` **[string][4]?** explicit CDP endpoint. Setting this switches the helper to ATTACH
|
|
86
|
+
mode: it only connects, and never spawns or kills a process, no matter what else is configured.
|
|
87
|
+
Leave it unset for SELF-MANAGED mode (see below).
|
|
88
|
+
* `binaryPath` **[string][4]?** path to the `lightpanda` executable, used in SELF-MANAGED mode
|
|
89
|
+
(`endpoint` unset). Checked before `LIGHTPANDA_PATH` and `PATH`.
|
|
90
|
+
* `port` **[number][5]?** port `lightpanda serve` listens on, in SELF-MANAGED mode. When unset, a
|
|
91
|
+
free port is picked automatically, which is what makes `run-workers` collision-free — every
|
|
92
|
+
worker gets its own instance on its own port with zero config.
|
|
93
|
+
* `serverStartTimeout` **[number][5]?** milliseconds to wait for a spawned `lightpanda serve`
|
|
94
|
+
to answer `/json/version` before `_connect` gives up.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## Example
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
// inside codecept.conf.js — SELF-LAUNCH mode (recommended): the helper finds/starts/stops
|
|
102
|
+
// lightpanda serve on its own, on a free port. Ideal for run-workers: every worker gets its
|
|
103
|
+
// own instance with no config.
|
|
104
|
+
{
|
|
105
|
+
helpers: {
|
|
106
|
+
Lightpanda: {
|
|
107
|
+
url: 'http://localhost',
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
// ATTACH mode — connect to a Lightpanda instance you manage yourself (remote host, container, etc.)
|
|
115
|
+
{
|
|
116
|
+
helpers: {
|
|
117
|
+
Lightpanda: {
|
|
118
|
+
url: 'http://localhost',
|
|
119
|
+
endpoint: 'http://127.0.0.1:9222',
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Methods
|
|
126
|
+
|
|
127
|
+
### Parameters
|
|
128
|
+
|
|
129
|
+
* `config` **LightpandaConfig** 
|
|
130
|
+
|
|
131
|
+
[1]: https://lightpanda.io
|
|
132
|
+
|
|
133
|
+
[2]: https://lightpanda.io/docs/open-source/installation
|
|
134
|
+
|
|
135
|
+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
136
|
+
|
|
137
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
138
|
+
|
|
139
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|