@plune-ai/playwright 0.4.0 → 0.6.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 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, // several processes → one run
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
@@ -52,8 +52,11 @@ fills in what you left out. Anything set in the config file wins.
52
52
  | `PLUNE_RUN` | the shared run key: every process with the same value lands in one run |
53
53
  | `PLUNE_API_URL` | the deployment to report to |
54
54
  | `PLUNE_SHARED_RUN` | this process is one of several — do not close the run |
55
+ | `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
56
  | `PLUNE_PROCEED` | the job closes the run itself, later |
56
- | `PLUNE_BATCH_SIZE` | results per request (default 100, max 500) |
57
+ | `PLUNE_BATCH_SIZE` | results per request (default 500, max 500) |
58
+ | `PLUNE_UPLOAD_CONCURRENCY` | files uploaded at once (1 to 32, default 4) |
59
+ | `PLUNE_UPLOAD_RETRIES` | retries of a file's request after a 429 with `Retry-After` (0 to 20, default 6) |
57
60
  | `PLUNE_FALLBACK` | where unsent batches are written |
58
61
  | `PLUNE_RUN_TITLE` | what to call the run in the list (default: `<directory> · 2026-09-15 15:26 · ci`) |
59
62
  | `PLUNE_ENV` | where it ran — `staging`, `prod`, a preview name |
@@ -108,8 +111,12 @@ In order, first match wins:
108
111
  follows `@P` with **no space**: `@Ptc-1a2b`;
109
112
  3. an `application/plune.metadata+json` attachment — for a fixture or helper that knows the id, or
110
113
  a key from another tool: `{"id": "tc-1a2b"}` or `{"keys": [{"kind": "qase", "value": "Q-9"}]}`;
111
- 4. the Playwright test id (`playwright-id`), stable across shards and merges;
112
- 5. the file and title path (`path-title`) — the spec file relative to your `testDir`, then each
114
+ 4. an entry for the test's `path-title` in the mapfile `plune/ids.json` (what `plune ids --write`
115
+ writes), so a case id survives renaming the test without editing the source. Looked up under the
116
+ directory the run starts in; `PLUNE_IDS_FILE` or the `idsFile` option names another path. A missing
117
+ file is skipped, an invalid one is warned about once and skipped;
118
+ 5. the Playwright test id (`playwright-id`), stable across shards and merges;
119
+ 6. the file and title path (`path-title`) — the spec file relative to your `testDir`, then each
113
120
  `describe` and the test title, e.g. `cart.spec.ts#cart#rejects a negative quantity`.
114
121
 
115
122
  ```ts
@@ -129,9 +136,68 @@ under the name it was attached with: `testInfo.attach('checkout', { path })` arr
129
136
  `checkout.png`.
130
137
 
131
138
  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 are
133
- not uploaded, and neither is an image attached as a `body` rather than a file — attach it with `path`.
134
- A screenshot that does not arrive never costs its result or your run's exit code.
139
+ skipped: the run summary counts it and says why, once per reason. Traces, videos and other files
140
+ need a storage bucket (see below); an image attached as a `body` rather than a file is not uploaded
141
+ — attach it with `path`. A screenshot that does not arrive never costs its result or your run's exit
142
+ code.
143
+
144
+ ## JSON and text files
145
+
146
+ What a test attaches as JSON or plain text — the answer of an API, a log — is uploaded to its result
147
+ as well, beside the screenshots and for a test that passed as much as one that failed. Attach it with
148
+ a `body` or with a `path`; both are read:
149
+
150
+ ```ts
151
+ await testInfo.attach('api-response', { body: JSON.stringify(data), contentType: 'application/json' });
152
+ await testInfo.attach('server.log', { path: 'logs/server.log', contentType: 'text/plain' });
153
+ ```
154
+
155
+ Name the type: `application/json` or `text/plain` (a log is `text/plain`, whatever its file is
156
+ called). An attachment that names none is not uploaded, and its extension is not guessed at;
157
+ Markdown, HTML and CSV are not uploaded as text either. Plune takes UTF-8 text without NUL
158
+ bytes, up to 512 KiB a file and 10 a result — apart from the screenshots' 20. A text outside those
159
+ limits, an empty one, or one whose name starts with an underscore is skipped: the run summary counts
160
+ it and says why, once per reason. The reporter sends a file as it is; Plune cleans the credentials it
161
+ recognises out of a text before it keeps it. A file that does not arrive never costs its result or
162
+ your run's exit code.
163
+
164
+ A text attached as a `body` exists only in memory: it is uploaded once Plune has stored the result,
165
+ and is never written to `.plune/pending-results.jsonl`, so a result sent again with `plune run report`
166
+ goes without it.
167
+
168
+ ## Traces and videos: your own bucket
169
+
170
+ A trace or a video is too big for Plune's own storage. Once your project has a storage bucket
171
+ connected in Plune, the reporter uploads them, and every other file a test kept, straight into it.
172
+ Ask Playwright to keep them in `playwright.config.ts`:
173
+
174
+ ```ts
175
+ import { defineConfig } from '@playwright/test';
176
+
177
+ export default defineConfig({
178
+ retries: 1,
179
+ reporter: [['list'], ['@plune-ai/playwright']],
180
+ use: {
181
+ trace: 'on-first-retry', // the trace of the first retry of a failed test
182
+ video: 'retain-on-failure', // the video of a failed test, dropped when it passes
183
+ },
184
+ });
185
+ ```
186
+
187
+ A trace is kept only when the test is retried, so `retries` must be at least 1 for `on-first-retry`
188
+ to produce one; `trace: 'retain-on-failure'` keeps one for every failed attempt without retries.
189
+
190
+ Each file goes to its own short-lived link Plune hands out, from disk, up to four at a time; a file of
191
+ 100 MB is never read into memory. The links are write keys to your bucket, so they are never
192
+ printed: not in the log, not in an error. The first time a run finds the bucket it says so in one
193
+ line, and the summary reads `N file(s) uploaded to your bucket`, with `, K skipped` and
194
+ `, M failed to upload` when there are any.
195
+
196
+ The limits in a bucket are larger than in Plune's storage: 10 MiB for an image, 5 MiB for a text,
197
+ 50 MiB for any other file, 100 MiB for a trace or a video, and 30 files a result. A file over its
198
+ limit, or one the bucket refuses, is a warning that names the file and a code. It never costs the
199
+ result or your run's exit code. Without a bucket, a trace or a video is not stored: the log says so
200
+ once, naming the first one, and the summary counts them.
135
201
 
136
202
  ## When Plune is unreachable
137
203