@plune-ai/playwright 0.1.0 → 0.2.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 +18 -3
- package/dist/index.cjs +75 -8
- package/dist/index.js +75 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,12 +52,27 @@ fills in what you left out. Anything set in the config file wins.
|
|
|
52
52
|
| `PLUNE_PROCEED` | the job closes the run itself, later |
|
|
53
53
|
| `PLUNE_BATCH_SIZE` | results per request (default 100, max 500) |
|
|
54
54
|
| `PLUNE_FALLBACK` | where unsent batches are written |
|
|
55
|
+
| `PLUNE_RUN_TITLE` | what to call the run in the list |
|
|
56
|
+
| `PLUNE_ENV` | where it ran — `staging`, `prod`, a preview name |
|
|
57
|
+
| `PLUNE_LABELS` | comma-separated marks: `smoke,nightly` |
|
|
58
|
+
| `PLUNE_CREATE` | offer tests Plune has no case for to the review queue |
|
|
55
59
|
|
|
56
60
|
Flags are read by value, not by presence: `PLUNE_PROCEED=0` in a matrix cell means off.
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
The first shard to set a title owns it; a shard arriving later fills a field the first one left
|
|
63
|
+
empty rather than overwriting it. Blank entries in `PLUNE_LABELS` are dropped — `a,,b` is a template
|
|
64
|
+
that had nothing for the middle slot, not a request for an empty label.
|
|
65
|
+
|
|
66
|
+
`PLUNE_CREATE=1` sends every test that resolved to no case to the review queue — the keys it was
|
|
67
|
+
looked up by, its title, its file and line, and how it went. Never steps and never an expected
|
|
68
|
+
result: a reporter sees a test's result, not its source, and a body nobody wrote is exactly what the
|
|
69
|
+
queue exists to keep out. A person decides whether the project tracks the test; approving attaches
|
|
70
|
+
the keys, so the next run resolves instead of offering it again.
|
|
71
|
+
|
|
72
|
+
`PLUNE_GROUP` is **not supported yet** — a group of runs is a Plune feature that does not exist, and
|
|
73
|
+
a group of one run means nothing. Setting it prints a line saying it was ignored, rather than
|
|
74
|
+
accepting it and quietly dropping it. If you report to a deployment older than run titles, the
|
|
75
|
+
reporter says that too: the run is recorded in full, the description is not.
|
|
61
76
|
|
|
62
77
|
## Sharding
|
|
63
78
|
|
package/dist/index.cjs
CHANGED
|
@@ -119,12 +119,7 @@ function createClient(opts) {
|
|
|
119
119
|
}
|
|
120
120
|
return { post };
|
|
121
121
|
}
|
|
122
|
-
var UNSUPPORTED_VARS = [
|
|
123
|
-
"PLUNE_RUN_TITLE",
|
|
124
|
-
"PLUNE_ENV",
|
|
125
|
-
"PLUNE_LABELS",
|
|
126
|
-
"PLUNE_GROUP"
|
|
127
|
-
];
|
|
122
|
+
var UNSUPPORTED_VARS = ["PLUNE_GROUP"];
|
|
128
123
|
function value(env, name) {
|
|
129
124
|
const raw = env[name]?.trim();
|
|
130
125
|
return raw === void 0 || raw === "" ? void 0 : raw;
|
|
@@ -139,19 +134,35 @@ function count(env, name) {
|
|
|
139
134
|
const n = Number(raw);
|
|
140
135
|
return Number.isInteger(n) && n > 0 ? n : void 0;
|
|
141
136
|
}
|
|
137
|
+
function list(env, name) {
|
|
138
|
+
const raw = value(env, name);
|
|
139
|
+
if (raw === void 0) return void 0;
|
|
140
|
+
const items = raw.split(",").map((s) => s.trim()).filter((s) => s !== "");
|
|
141
|
+
return items.length === 0 ? void 0 : items;
|
|
142
|
+
}
|
|
142
143
|
function readEnv(env = process.env) {
|
|
143
144
|
const externalKey = value(env, "PLUNE_RUN");
|
|
144
145
|
const token = value(env, "PLUNE_TOKEN");
|
|
145
146
|
const apiUrl = value(env, "PLUNE_API_URL");
|
|
146
147
|
const fallbackPath = value(env, "PLUNE_FALLBACK");
|
|
147
148
|
const batchSize = count(env, "PLUNE_BATCH_SIZE");
|
|
149
|
+
const title = value(env, "PLUNE_RUN_TITLE");
|
|
150
|
+
const environment = value(env, "PLUNE_ENV");
|
|
151
|
+
const labels = list(env, "PLUNE_LABELS");
|
|
152
|
+
const offerDiscovered = flag(env, "PLUNE_CREATE");
|
|
148
153
|
return {
|
|
149
154
|
config: {
|
|
150
155
|
...externalKey !== void 0 ? { externalKey } : {},
|
|
151
156
|
...token !== void 0 ? { token } : {},
|
|
152
157
|
...apiUrl !== void 0 ? { apiUrl } : {},
|
|
153
158
|
...fallbackPath !== void 0 ? { fallbackPath } : {},
|
|
154
|
-
...batchSize !== void 0 ? { batchSize } : {}
|
|
159
|
+
...batchSize !== void 0 ? { batchSize } : {},
|
|
160
|
+
...title !== void 0 ? { title } : {},
|
|
161
|
+
...environment !== void 0 ? { environment } : {},
|
|
162
|
+
...labels !== void 0 ? { labels } : {},
|
|
163
|
+
// Only when set: `false` here would outrank a config file that asked for it, and an unset
|
|
164
|
+
// variable is not an instruction.
|
|
165
|
+
...offerDiscovered ? { offerDiscovered } : {}
|
|
155
166
|
},
|
|
156
167
|
// Two names for two situations that end the same way. `SHARED_RUN` says other processes are
|
|
157
168
|
// reporting into this run; `PROCEED` says the job will close it on its own schedule. Either
|
|
@@ -174,6 +185,7 @@ function appendBatch(file, batch) {
|
|
|
174
185
|
}
|
|
175
186
|
var RESOLVE_CHUNK = 500;
|
|
176
187
|
var BATCH_MAX = 500;
|
|
188
|
+
var DISCOVER_MAX = 500;
|
|
177
189
|
var BATCH_DEFAULT = 100;
|
|
178
190
|
var EXPECTED_MAX = 1e4;
|
|
179
191
|
function chunk(items, size) {
|
|
@@ -181,6 +193,14 @@ function chunk(items, size) {
|
|
|
181
193
|
for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size));
|
|
182
194
|
return out;
|
|
183
195
|
}
|
|
196
|
+
function warnIfDropped(sent, run, log) {
|
|
197
|
+
const names = Object.keys(sent);
|
|
198
|
+
if (names.length === 0) return;
|
|
199
|
+
if (names.some((name) => run[name] != null)) return;
|
|
200
|
+
log(
|
|
201
|
+
`plune: this deployment stored none of ${names.join(", ")} \u2014 it is older than the fields. The run is otherwise reported in full.`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
184
204
|
async function startRun(passed, expected) {
|
|
185
205
|
const env = readEnv();
|
|
186
206
|
const stated = Object.fromEntries(Object.entries(passed).filter(([, v]) => v !== void 0));
|
|
@@ -190,6 +210,7 @@ async function startRun(passed, expected) {
|
|
|
190
210
|
const fallbackPath = cfg.fallbackPath ?? DEFAULT_FALLBACK_PATH;
|
|
191
211
|
const externalKey = cfg.externalKey ?? null;
|
|
192
212
|
const batchSize = Math.min(cfg.batchSize ?? BATCH_DEFAULT, BATCH_MAX);
|
|
213
|
+
const offerDiscovered = cfg.offerDiscovered ?? false;
|
|
193
214
|
const token = cfg.token ?? loadToken() ?? "";
|
|
194
215
|
const client = createClient({
|
|
195
216
|
apiUrl: resolveApiUrl(cfg.apiUrl),
|
|
@@ -202,10 +223,12 @@ async function startRun(passed, expected) {
|
|
|
202
223
|
conflict: 0,
|
|
203
224
|
rejected: 0,
|
|
204
225
|
unresolved: 0,
|
|
226
|
+
offered: 0,
|
|
205
227
|
deferred: 0
|
|
206
228
|
};
|
|
207
229
|
const resolved = /* @__PURE__ */ new Map();
|
|
208
230
|
let buffer = [];
|
|
231
|
+
const discoveries = /* @__PURE__ */ new Map();
|
|
209
232
|
let runId = null;
|
|
210
233
|
let joined = false;
|
|
211
234
|
let offline = token === "";
|
|
@@ -248,16 +271,23 @@ async function startRun(passed, expected) {
|
|
|
248
271
|
if (expected !== void 0 && expected.length > EXPECTED_MAX) {
|
|
249
272
|
log(`plune: ${expected.length} tests is more than the run configuration holds \u2014 reporting the first ${EXPECTED_MAX}.`);
|
|
250
273
|
}
|
|
274
|
+
const described = {
|
|
275
|
+
...cfg.title !== void 0 ? { title: cfg.title } : {},
|
|
276
|
+
...cfg.environment !== void 0 ? { environment: cfg.environment } : {},
|
|
277
|
+
...cfg.labels !== void 0 ? { labels: cfg.labels } : {}
|
|
278
|
+
};
|
|
251
279
|
const start = await client.post("/v1/runs", {
|
|
252
280
|
schemaVersion: 2,
|
|
253
281
|
kind: cfg.kind ?? "automated",
|
|
254
282
|
...externalKey !== null ? { externalKey } : {},
|
|
255
283
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
256
|
-
...configuration !== void 0 ? { configuration } : {}
|
|
284
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
285
|
+
...described
|
|
257
286
|
});
|
|
258
287
|
if (start.ok) {
|
|
259
288
|
runId = start.body.run.id;
|
|
260
289
|
joined = start.status === 200;
|
|
290
|
+
warnIfDropped(described, start.body.run, log);
|
|
261
291
|
} else {
|
|
262
292
|
log(`plune: could not start the run (${start.detail || start.kind}). Results will be written to ${fallbackPath}.`);
|
|
263
293
|
}
|
|
@@ -272,6 +302,32 @@ async function startRun(passed, expected) {
|
|
|
272
302
|
}
|
|
273
303
|
return unanswered ? { kind: "unanswered" } : { kind: "unmatched" };
|
|
274
304
|
}
|
|
305
|
+
function remember(result) {
|
|
306
|
+
if (!offerDiscovered) return;
|
|
307
|
+
if (result.title === void 0 || result.specRef === void 0) return;
|
|
308
|
+
if (result.keys.length === 0) return;
|
|
309
|
+
discoveries.set(result.keys[0].value, {
|
|
310
|
+
keys: result.keys,
|
|
311
|
+
title: result.title,
|
|
312
|
+
source: result.source,
|
|
313
|
+
specRef: result.specRef,
|
|
314
|
+
rawStatus: result.rawStatus
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
async function offer() {
|
|
318
|
+
if (discoveries.size === 0 || offline || runId === null) return;
|
|
319
|
+
for (const batch of chunk([...discoveries.values()], DISCOVER_MAX)) {
|
|
320
|
+
const out = await client.post("/v1/review-items/discovered", {
|
|
321
|
+
discovered: batch,
|
|
322
|
+
runId
|
|
323
|
+
});
|
|
324
|
+
if (!out.ok) {
|
|
325
|
+
log(`plune: could not offer ${batch.length} unknown tests for review (${out.detail || out.kind}).`);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
stats.offered += out.body.results.filter((r) => r.outcome === "queued").length;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
275
331
|
async function flush() {
|
|
276
332
|
if (buffer.length === 0) return;
|
|
277
333
|
const pending = buffer;
|
|
@@ -290,6 +346,7 @@ async function startRun(passed, expected) {
|
|
|
290
346
|
submissions.push({ ...rest, testCaseId: match.testCaseId });
|
|
291
347
|
} else if (match.kind === "unmatched") {
|
|
292
348
|
stats.unresolved += 1;
|
|
349
|
+
remember(result);
|
|
293
350
|
} else {
|
|
294
351
|
unanswered.push(result);
|
|
295
352
|
}
|
|
@@ -323,6 +380,7 @@ async function startRun(passed, expected) {
|
|
|
323
380
|
if (stats.conflict > 0) parts.push(`${stats.conflict} conflicting`);
|
|
324
381
|
if (stats.rejected > 0) parts.push(`${stats.rejected} rejected`);
|
|
325
382
|
if (stats.unresolved > 0) parts.push(`${stats.unresolved} with no matching test case`);
|
|
383
|
+
if (stats.offered > 0) parts.push(`${stats.offered} offered for review`);
|
|
326
384
|
if (stats.deferred > 0) parts.push(`${stats.deferred} written to ${fallbackPath}`);
|
|
327
385
|
log(`plune: ${parts.join(" \xB7 ")}`);
|
|
328
386
|
}
|
|
@@ -345,6 +403,7 @@ async function startRun(passed, expected) {
|
|
|
345
403
|
if (done) return;
|
|
346
404
|
done = true;
|
|
347
405
|
await flush();
|
|
406
|
+
await offer();
|
|
348
407
|
if (runId !== null && !offline) {
|
|
349
408
|
const out = await client.post(`/v1/runs/${runId}/events`, {
|
|
350
409
|
event: "finish",
|
|
@@ -358,6 +417,7 @@ async function startRun(passed, expected) {
|
|
|
358
417
|
if (done) return;
|
|
359
418
|
done = true;
|
|
360
419
|
await flush();
|
|
420
|
+
await offer();
|
|
361
421
|
if (runId !== null) {
|
|
362
422
|
log(`plune: run ${runId} is still open \u2014 close it with "plune run finish ${runId}".`);
|
|
363
423
|
}
|
|
@@ -430,6 +490,13 @@ function pendingFrom(test, result) {
|
|
|
430
490
|
// Anything the test named itself comes before what we derived from its location: a Qase or
|
|
431
491
|
// TestRail id written by a fixture is a deliberate statement, and a file path is a guess.
|
|
432
492
|
keys: [...metadata?.keys ?? [], ...keysFor(test)],
|
|
493
|
+
// Read only if nothing resolves this test, and then it is what the review queue shows (D14).
|
|
494
|
+
// The full `describe > title` path rather than `test.title` alone: two suites in one file
|
|
495
|
+
// routinely share a title, and "adds an item" on its own is not something a person can judge.
|
|
496
|
+
title: titlesOf(test).join(" \u203A "),
|
|
497
|
+
// The line as well as the file. A reviewer's first move on an unknown test is to open it, and
|
|
498
|
+
// `specRef` is the only thing the entry carries that can take them there.
|
|
499
|
+
specRef: `${fileOf(test)}:${test.location.line}`,
|
|
433
500
|
source: SOURCE,
|
|
434
501
|
// The runner's own word, untouched. Mapping it is the platform's job and a project's setting.
|
|
435
502
|
rawStatus: result.status,
|
package/dist/index.js
CHANGED
|
@@ -85,12 +85,7 @@ function createClient(opts) {
|
|
|
85
85
|
}
|
|
86
86
|
return { post };
|
|
87
87
|
}
|
|
88
|
-
var UNSUPPORTED_VARS = [
|
|
89
|
-
"PLUNE_RUN_TITLE",
|
|
90
|
-
"PLUNE_ENV",
|
|
91
|
-
"PLUNE_LABELS",
|
|
92
|
-
"PLUNE_GROUP"
|
|
93
|
-
];
|
|
88
|
+
var UNSUPPORTED_VARS = ["PLUNE_GROUP"];
|
|
94
89
|
function value(env, name) {
|
|
95
90
|
const raw = env[name]?.trim();
|
|
96
91
|
return raw === void 0 || raw === "" ? void 0 : raw;
|
|
@@ -105,19 +100,35 @@ function count(env, name) {
|
|
|
105
100
|
const n = Number(raw);
|
|
106
101
|
return Number.isInteger(n) && n > 0 ? n : void 0;
|
|
107
102
|
}
|
|
103
|
+
function list(env, name) {
|
|
104
|
+
const raw = value(env, name);
|
|
105
|
+
if (raw === void 0) return void 0;
|
|
106
|
+
const items = raw.split(",").map((s) => s.trim()).filter((s) => s !== "");
|
|
107
|
+
return items.length === 0 ? void 0 : items;
|
|
108
|
+
}
|
|
108
109
|
function readEnv(env = process.env) {
|
|
109
110
|
const externalKey = value(env, "PLUNE_RUN");
|
|
110
111
|
const token = value(env, "PLUNE_TOKEN");
|
|
111
112
|
const apiUrl = value(env, "PLUNE_API_URL");
|
|
112
113
|
const fallbackPath = value(env, "PLUNE_FALLBACK");
|
|
113
114
|
const batchSize = count(env, "PLUNE_BATCH_SIZE");
|
|
115
|
+
const title = value(env, "PLUNE_RUN_TITLE");
|
|
116
|
+
const environment = value(env, "PLUNE_ENV");
|
|
117
|
+
const labels = list(env, "PLUNE_LABELS");
|
|
118
|
+
const offerDiscovered = flag(env, "PLUNE_CREATE");
|
|
114
119
|
return {
|
|
115
120
|
config: {
|
|
116
121
|
...externalKey !== void 0 ? { externalKey } : {},
|
|
117
122
|
...token !== void 0 ? { token } : {},
|
|
118
123
|
...apiUrl !== void 0 ? { apiUrl } : {},
|
|
119
124
|
...fallbackPath !== void 0 ? { fallbackPath } : {},
|
|
120
|
-
...batchSize !== void 0 ? { batchSize } : {}
|
|
125
|
+
...batchSize !== void 0 ? { batchSize } : {},
|
|
126
|
+
...title !== void 0 ? { title } : {},
|
|
127
|
+
...environment !== void 0 ? { environment } : {},
|
|
128
|
+
...labels !== void 0 ? { labels } : {},
|
|
129
|
+
// Only when set: `false` here would outrank a config file that asked for it, and an unset
|
|
130
|
+
// variable is not an instruction.
|
|
131
|
+
...offerDiscovered ? { offerDiscovered } : {}
|
|
121
132
|
},
|
|
122
133
|
// Two names for two situations that end the same way. `SHARED_RUN` says other processes are
|
|
123
134
|
// reporting into this run; `PROCEED` says the job will close it on its own schedule. Either
|
|
@@ -140,6 +151,7 @@ function appendBatch(file, batch) {
|
|
|
140
151
|
}
|
|
141
152
|
var RESOLVE_CHUNK = 500;
|
|
142
153
|
var BATCH_MAX = 500;
|
|
154
|
+
var DISCOVER_MAX = 500;
|
|
143
155
|
var BATCH_DEFAULT = 100;
|
|
144
156
|
var EXPECTED_MAX = 1e4;
|
|
145
157
|
function chunk(items, size) {
|
|
@@ -147,6 +159,14 @@ function chunk(items, size) {
|
|
|
147
159
|
for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size));
|
|
148
160
|
return out;
|
|
149
161
|
}
|
|
162
|
+
function warnIfDropped(sent, run, log) {
|
|
163
|
+
const names = Object.keys(sent);
|
|
164
|
+
if (names.length === 0) return;
|
|
165
|
+
if (names.some((name) => run[name] != null)) return;
|
|
166
|
+
log(
|
|
167
|
+
`plune: this deployment stored none of ${names.join(", ")} \u2014 it is older than the fields. The run is otherwise reported in full.`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
150
170
|
async function startRun(passed, expected) {
|
|
151
171
|
const env = readEnv();
|
|
152
172
|
const stated = Object.fromEntries(Object.entries(passed).filter(([, v]) => v !== void 0));
|
|
@@ -156,6 +176,7 @@ async function startRun(passed, expected) {
|
|
|
156
176
|
const fallbackPath = cfg.fallbackPath ?? DEFAULT_FALLBACK_PATH;
|
|
157
177
|
const externalKey = cfg.externalKey ?? null;
|
|
158
178
|
const batchSize = Math.min(cfg.batchSize ?? BATCH_DEFAULT, BATCH_MAX);
|
|
179
|
+
const offerDiscovered = cfg.offerDiscovered ?? false;
|
|
159
180
|
const token = cfg.token ?? loadToken() ?? "";
|
|
160
181
|
const client = createClient({
|
|
161
182
|
apiUrl: resolveApiUrl(cfg.apiUrl),
|
|
@@ -168,10 +189,12 @@ async function startRun(passed, expected) {
|
|
|
168
189
|
conflict: 0,
|
|
169
190
|
rejected: 0,
|
|
170
191
|
unresolved: 0,
|
|
192
|
+
offered: 0,
|
|
171
193
|
deferred: 0
|
|
172
194
|
};
|
|
173
195
|
const resolved = /* @__PURE__ */ new Map();
|
|
174
196
|
let buffer = [];
|
|
197
|
+
const discoveries = /* @__PURE__ */ new Map();
|
|
175
198
|
let runId = null;
|
|
176
199
|
let joined = false;
|
|
177
200
|
let offline = token === "";
|
|
@@ -214,16 +237,23 @@ async function startRun(passed, expected) {
|
|
|
214
237
|
if (expected !== void 0 && expected.length > EXPECTED_MAX) {
|
|
215
238
|
log(`plune: ${expected.length} tests is more than the run configuration holds \u2014 reporting the first ${EXPECTED_MAX}.`);
|
|
216
239
|
}
|
|
240
|
+
const described = {
|
|
241
|
+
...cfg.title !== void 0 ? { title: cfg.title } : {},
|
|
242
|
+
...cfg.environment !== void 0 ? { environment: cfg.environment } : {},
|
|
243
|
+
...cfg.labels !== void 0 ? { labels: cfg.labels } : {}
|
|
244
|
+
};
|
|
217
245
|
const start = await client.post("/v1/runs", {
|
|
218
246
|
schemaVersion: 2,
|
|
219
247
|
kind: cfg.kind ?? "automated",
|
|
220
248
|
...externalKey !== null ? { externalKey } : {},
|
|
221
249
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
222
|
-
...configuration !== void 0 ? { configuration } : {}
|
|
250
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
251
|
+
...described
|
|
223
252
|
});
|
|
224
253
|
if (start.ok) {
|
|
225
254
|
runId = start.body.run.id;
|
|
226
255
|
joined = start.status === 200;
|
|
256
|
+
warnIfDropped(described, start.body.run, log);
|
|
227
257
|
} else {
|
|
228
258
|
log(`plune: could not start the run (${start.detail || start.kind}). Results will be written to ${fallbackPath}.`);
|
|
229
259
|
}
|
|
@@ -238,6 +268,32 @@ async function startRun(passed, expected) {
|
|
|
238
268
|
}
|
|
239
269
|
return unanswered ? { kind: "unanswered" } : { kind: "unmatched" };
|
|
240
270
|
}
|
|
271
|
+
function remember(result) {
|
|
272
|
+
if (!offerDiscovered) return;
|
|
273
|
+
if (result.title === void 0 || result.specRef === void 0) return;
|
|
274
|
+
if (result.keys.length === 0) return;
|
|
275
|
+
discoveries.set(result.keys[0].value, {
|
|
276
|
+
keys: result.keys,
|
|
277
|
+
title: result.title,
|
|
278
|
+
source: result.source,
|
|
279
|
+
specRef: result.specRef,
|
|
280
|
+
rawStatus: result.rawStatus
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
async function offer() {
|
|
284
|
+
if (discoveries.size === 0 || offline || runId === null) return;
|
|
285
|
+
for (const batch of chunk([...discoveries.values()], DISCOVER_MAX)) {
|
|
286
|
+
const out = await client.post("/v1/review-items/discovered", {
|
|
287
|
+
discovered: batch,
|
|
288
|
+
runId
|
|
289
|
+
});
|
|
290
|
+
if (!out.ok) {
|
|
291
|
+
log(`plune: could not offer ${batch.length} unknown tests for review (${out.detail || out.kind}).`);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
stats.offered += out.body.results.filter((r) => r.outcome === "queued").length;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
241
297
|
async function flush() {
|
|
242
298
|
if (buffer.length === 0) return;
|
|
243
299
|
const pending = buffer;
|
|
@@ -256,6 +312,7 @@ async function startRun(passed, expected) {
|
|
|
256
312
|
submissions.push({ ...rest, testCaseId: match.testCaseId });
|
|
257
313
|
} else if (match.kind === "unmatched") {
|
|
258
314
|
stats.unresolved += 1;
|
|
315
|
+
remember(result);
|
|
259
316
|
} else {
|
|
260
317
|
unanswered.push(result);
|
|
261
318
|
}
|
|
@@ -289,6 +346,7 @@ async function startRun(passed, expected) {
|
|
|
289
346
|
if (stats.conflict > 0) parts.push(`${stats.conflict} conflicting`);
|
|
290
347
|
if (stats.rejected > 0) parts.push(`${stats.rejected} rejected`);
|
|
291
348
|
if (stats.unresolved > 0) parts.push(`${stats.unresolved} with no matching test case`);
|
|
349
|
+
if (stats.offered > 0) parts.push(`${stats.offered} offered for review`);
|
|
292
350
|
if (stats.deferred > 0) parts.push(`${stats.deferred} written to ${fallbackPath}`);
|
|
293
351
|
log(`plune: ${parts.join(" \xB7 ")}`);
|
|
294
352
|
}
|
|
@@ -311,6 +369,7 @@ async function startRun(passed, expected) {
|
|
|
311
369
|
if (done) return;
|
|
312
370
|
done = true;
|
|
313
371
|
await flush();
|
|
372
|
+
await offer();
|
|
314
373
|
if (runId !== null && !offline) {
|
|
315
374
|
const out = await client.post(`/v1/runs/${runId}/events`, {
|
|
316
375
|
event: "finish",
|
|
@@ -324,6 +383,7 @@ async function startRun(passed, expected) {
|
|
|
324
383
|
if (done) return;
|
|
325
384
|
done = true;
|
|
326
385
|
await flush();
|
|
386
|
+
await offer();
|
|
327
387
|
if (runId !== null) {
|
|
328
388
|
log(`plune: run ${runId} is still open \u2014 close it with "plune run finish ${runId}".`);
|
|
329
389
|
}
|
|
@@ -396,6 +456,13 @@ function pendingFrom(test, result) {
|
|
|
396
456
|
// Anything the test named itself comes before what we derived from its location: a Qase or
|
|
397
457
|
// TestRail id written by a fixture is a deliberate statement, and a file path is a guess.
|
|
398
458
|
keys: [...metadata?.keys ?? [], ...keysFor(test)],
|
|
459
|
+
// Read only if nothing resolves this test, and then it is what the review queue shows (D14).
|
|
460
|
+
// The full `describe > title` path rather than `test.title` alone: two suites in one file
|
|
461
|
+
// routinely share a title, and "adds an item" on its own is not something a person can judge.
|
|
462
|
+
title: titlesOf(test).join(" \u203A "),
|
|
463
|
+
// The line as well as the file. A reviewer's first move on an unknown test is to open it, and
|
|
464
|
+
// `specRef` is the only thing the entry carries that can take them there.
|
|
465
|
+
specRef: `${fileOf(test)}:${test.location.line}`,
|
|
399
466
|
source: SOURCE,
|
|
400
467
|
// The runner's own word, untouched. Mapping it is the platform's job and a project's setting.
|
|
401
468
|
rawStatus: result.status,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Report Playwright results to Plune — a reporter and, later, a test importer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tsup": "^8.0.0",
|
|
39
39
|
"typescript": "^5.4.0",
|
|
40
40
|
"vitest": "^1.6.0",
|
|
41
|
-
"@plune-ai/cli": "0.
|
|
41
|
+
"@plune-ai/cli": "0.8.0"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|