@plune-ai/playwright 0.5.0 → 0.7.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/README.md +85 -9
- package/dist/index.cjs +801 -89
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +803 -91
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ That is the whole setup. Options, if you want them:
|
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
['@plune-ai/playwright', {
|
|
33
|
-
externalKey: process.env.GITHUB_RUN_ID
|
|
33
|
+
externalKey: `${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT ?? '1'}`, // several processes → one run
|
|
34
34
|
batchSize: 100, // results per request (max 500)
|
|
35
35
|
fallbackPath: '.plune/pending-results.jsonl',
|
|
36
36
|
apiUrl: 'https://beta-api.plune.ai', // or PLUNE_API_URL
|
|
@@ -50,10 +50,14 @@ fills in what you left out. Anything set in the config file wins.
|
|
|
50
50
|
|---|---|
|
|
51
51
|
| `PLUNE_TOKEN` | the API token — so a CI job need not run `plune login` |
|
|
52
52
|
| `PLUNE_RUN` | the shared run key: every process with the same value lands in one run |
|
|
53
|
+
| `PLUNE_CONFIGURATION` | the combination this job runs, `Browser=Chrome;Operating system=Windows`: its results land under that combination of the run (see [A matrix](#a-matrix-one-run-a-combination-per-job)) |
|
|
53
54
|
| `PLUNE_API_URL` | the deployment to report to |
|
|
54
55
|
| `PLUNE_SHARED_RUN` | this process is one of several — do not close the run |
|
|
56
|
+
| `PLUNE_SHARD` | `k/N`: this process is shard k of N; it reports itself done and the run closes when all N have (implies `PLUNE_SHARED_RUN`) |
|
|
55
57
|
| `PLUNE_PROCEED` | the job closes the run itself, later |
|
|
56
|
-
| `PLUNE_BATCH_SIZE` | results per request (default
|
|
58
|
+
| `PLUNE_BATCH_SIZE` | results per request (default 500, max 500) |
|
|
59
|
+
| `PLUNE_UPLOAD_CONCURRENCY` | files uploaded at once (1 to 32, default 4) |
|
|
60
|
+
| `PLUNE_UPLOAD_RETRIES` | retries of a file's request after a 429 with `Retry-After` (0 to 20, default 6) |
|
|
57
61
|
| `PLUNE_FALLBACK` | where unsent batches are written |
|
|
58
62
|
| `PLUNE_RUN_TITLE` | what to call the run in the list (default: `<directory> · 2026-09-15 15:26 · ci`) |
|
|
59
63
|
| `PLUNE_ENV` | where it ran — `staging`, `prod`, a preview name |
|
|
@@ -99,6 +103,40 @@ A shard **never closes the run** — it cannot know the others have finished. Wh
|
|
|
99
103
|
closes it: your `merge-reports` step, or `plune run finish <id>`. Until then the run reads as
|
|
100
104
|
still running, which is the truth.
|
|
101
105
|
|
|
106
|
+
## A matrix: one run, a combination per job
|
|
107
|
+
|
|
108
|
+
The jobs of a matrix of browsers and systems report into one run, each under its own combination of
|
|
109
|
+
configuration values, when they share `PLUNE_RUN` and each names its cell in `PLUNE_CONFIGURATION`:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
strategy:
|
|
113
|
+
matrix:
|
|
114
|
+
browser: [Chrome, Firefox]
|
|
115
|
+
os: [Windows, macOS]
|
|
116
|
+
env:
|
|
117
|
+
PLUNE_RUN: ${{ github.run_id }}-${{ github.run_attempt }}
|
|
118
|
+
PLUNE_SHARED_RUN: 1
|
|
119
|
+
PLUNE_CONFIGURATION: "Browser=${{ matrix.browser }};Operating system=${{ matrix.os }}"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`PLUNE_SHARED_RUN` keeps each job from closing the run its siblings still report into; close it
|
|
123
|
+
once at the end with `plune run finish <id>`.
|
|
124
|
+
|
|
125
|
+
`PLUNE_CONFIGURATION` is `Group=Value` pairs split by `;`, with the names of the groups and values
|
|
126
|
+
as in Settings → Configurations. Case does not matter, spaces around a name or a value are dropped,
|
|
127
|
+
and so is an empty pair (`;;`, a `;` at the end); a value may hold `=`, since a pair splits at its
|
|
128
|
+
first one. Every results batch carries it, and Plune files the results under that combination of the
|
|
129
|
+
run: one the run already has (a run launched from the dashboard with configurations, joined by its
|
|
130
|
+
key), or one it adds. A value that is not in Settings is taken as sent, marked "not in the list".
|
|
131
|
+
Unset or blank, the batch is sent as before.
|
|
132
|
+
|
|
133
|
+
- A pair without `=`, without a group or without a value, or one group named twice, is a
|
|
134
|
+
configuration error: the reporter sends nothing and says why.
|
|
135
|
+
- Every job of a run names the same groups. Plune refuses with 422 a batch that names other groups,
|
|
136
|
+
or one that would take the run past its limits (25 combinations, 40 000 results to expect); the
|
|
137
|
+
reporter prints the platform's message as it came, and the batch goes to the fallback file, which
|
|
138
|
+
keeps the combination for `plune run report`.
|
|
139
|
+
|
|
102
140
|
## How a result finds its test case
|
|
103
141
|
|
|
104
142
|
In order, first match wins:
|
|
@@ -108,8 +146,12 @@ In order, first match wins:
|
|
|
108
146
|
follows `@P` with **no space**: `@Ptc-1a2b`;
|
|
109
147
|
3. an `application/plune.metadata+json` attachment — for a fixture or helper that knows the id, or
|
|
110
148
|
a key from another tool: `{"id": "tc-1a2b"}` or `{"keys": [{"kind": "qase", "value": "Q-9"}]}`;
|
|
111
|
-
4. the
|
|
112
|
-
|
|
149
|
+
4. an entry for the test's `path-title` in the mapfile `plune/ids.json` (what `plune ids --write`
|
|
150
|
+
writes), so a case id survives renaming the test without editing the source. Looked up under the
|
|
151
|
+
directory the run starts in; `PLUNE_IDS_FILE` or the `idsFile` option names another path. A missing
|
|
152
|
+
file is skipped, an invalid one is warned about once and skipped;
|
|
153
|
+
5. the Playwright test id (`playwright-id`), stable across shards and merges;
|
|
154
|
+
6. the file and title path (`path-title`) — the spec file relative to your `testDir`, then each
|
|
113
155
|
`describe` and the test title, e.g. `cart.spec.ts#cart#rejects a negative quantity`.
|
|
114
156
|
|
|
115
157
|
```ts
|
|
@@ -129,10 +171,10 @@ under the name it was attached with: `testInfo.attach('checkout', { path })` arr
|
|
|
129
171
|
`checkout.png`.
|
|
130
172
|
|
|
131
173
|
Plune takes PNG, JPEG and WebP, up to 2 MB a file and 20 a result. An image outside those limits is
|
|
132
|
-
skipped: the run summary counts it and says why, once per reason. Traces, videos and other files
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
174
|
+
skipped: the run summary counts it and says why, once per reason. Traces, videos and other files
|
|
175
|
+
need a storage bucket (see below); an image attached as a `body` rather than a file is not uploaded
|
|
176
|
+
— attach it with `path`. A screenshot that does not arrive never costs its result or your run's exit
|
|
177
|
+
code.
|
|
136
178
|
|
|
137
179
|
## JSON and text files
|
|
138
180
|
|
|
@@ -147,7 +189,7 @@ await testInfo.attach('server.log', { path: 'logs/server.log', contentType: 'tex
|
|
|
147
189
|
|
|
148
190
|
Name the type: `application/json` or `text/plain` (a log is `text/plain`, whatever its file is
|
|
149
191
|
called). An attachment that names none is not uploaded, and its extension is not guessed at;
|
|
150
|
-
Markdown, HTML
|
|
192
|
+
Markdown, HTML and CSV are not uploaded as text either. Plune takes UTF-8 text without NUL
|
|
151
193
|
bytes, up to 512 KiB a file and 10 a result — apart from the screenshots' 20. A text outside those
|
|
152
194
|
limits, an empty one, or one whose name starts with an underscore is skipped: the run summary counts
|
|
153
195
|
it and says why, once per reason. The reporter sends a file as it is; Plune cleans the credentials it
|
|
@@ -158,6 +200,40 @@ A text attached as a `body` exists only in memory: it is uploaded once Plune has
|
|
|
158
200
|
and is never written to `.plune/pending-results.jsonl`, so a result sent again with `plune run report`
|
|
159
201
|
goes without it.
|
|
160
202
|
|
|
203
|
+
## Traces and videos: your own bucket
|
|
204
|
+
|
|
205
|
+
A trace or a video is too big for Plune's own storage. Once your project has a storage bucket
|
|
206
|
+
connected in Plune, the reporter uploads them, and every other file a test kept, straight into it.
|
|
207
|
+
Ask Playwright to keep them in `playwright.config.ts`:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { defineConfig } from '@playwright/test';
|
|
211
|
+
|
|
212
|
+
export default defineConfig({
|
|
213
|
+
retries: 1,
|
|
214
|
+
reporter: [['list'], ['@plune-ai/playwright']],
|
|
215
|
+
use: {
|
|
216
|
+
trace: 'on-first-retry', // the trace of the first retry of a failed test
|
|
217
|
+
video: 'retain-on-failure', // the video of a failed test, dropped when it passes
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
A trace is kept only when the test is retried, so `retries` must be at least 1 for `on-first-retry`
|
|
223
|
+
to produce one; `trace: 'retain-on-failure'` keeps one for every failed attempt without retries.
|
|
224
|
+
|
|
225
|
+
Each file goes to its own short-lived link Plune hands out, from disk, up to four at a time; a file of
|
|
226
|
+
100 MB is never read into memory. The links are write keys to your bucket, so they are never
|
|
227
|
+
printed: not in the log, not in an error. The first time a run finds the bucket it says so in one
|
|
228
|
+
line, and the summary reads `N file(s) uploaded to your bucket`, with `, K skipped` and
|
|
229
|
+
`, M failed to upload` when there are any.
|
|
230
|
+
|
|
231
|
+
The limits in a bucket are larger than in Plune's storage: 10 MiB for an image, 5 MiB for a text,
|
|
232
|
+
50 MiB for any other file, 100 MiB for a trace or a video, and 30 files a result. A file over its
|
|
233
|
+
limit, or one the bucket refuses, is a warning that names the file and a code. It never costs the
|
|
234
|
+
result or your run's exit code. Without a bucket, a trace or a video is not stored: the log says so
|
|
235
|
+
once, naming the first one, and the summary counts them.
|
|
236
|
+
|
|
161
237
|
## When Plune is unreachable
|
|
162
238
|
|
|
163
239
|
Nothing is lost and nothing fails. An unreachable platform, a refused token or an already-closed
|