@plune-ai/playwright 0.6.0 → 0.7.1
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 +35 -0
- package/dist/index.cjs +40 -12
- package/dist/index.js +40 -12
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ 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 |
|
|
55
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`) |
|
|
@@ -102,6 +103,40 @@ A shard **never closes the run** — it cannot know the others have finished. Wh
|
|
|
102
103
|
closes it: your `merge-reports` step, or `plune run finish <id>`. Until then the run reads as
|
|
103
104
|
still running, which is the truth.
|
|
104
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
|
+
|
|
105
140
|
## How a result finds its test case
|
|
106
141
|
|
|
107
142
|
In order, first match wins:
|
package/dist/index.cjs
CHANGED
|
@@ -305,6 +305,25 @@ function shardOf(env) {
|
|
|
305
305
|
error: `PLUNE_SHARD=${JSON.stringify(raw.slice(0, 40))} is not "k/N" with 1 <= k <= N <= ${SHARDS_MAX} (for example 2/4) - nothing was sent.`
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
+
function configurationOf(env) {
|
|
309
|
+
const raw = value(env, "PLUNE_CONFIGURATION");
|
|
310
|
+
if (raw === void 0) return {};
|
|
311
|
+
const pairs = [];
|
|
312
|
+
for (const pair of raw.split(";").map((s) => s.trim()).filter((s) => s !== "")) {
|
|
313
|
+
const at = pair.indexOf("=");
|
|
314
|
+
const name = at < 0 ? "" : pair.slice(0, at).trim();
|
|
315
|
+
const label = at < 0 ? "" : pair.slice(at + 1).trim();
|
|
316
|
+
const twice = pairs.find(([seen]) => seen.toLowerCase() === name.toLowerCase());
|
|
317
|
+
const why = at < 0 ? 'has no "="' : name === "" ? "has no group name" : label === "" ? "has no value" : twice !== void 0 ? `names the group ${JSON.stringify(twice[0])} a second time` : void 0;
|
|
318
|
+
if (why !== void 0) {
|
|
319
|
+
return {
|
|
320
|
+
error: `PLUNE_CONFIGURATION: ${JSON.stringify(pair.slice(0, 40))} ${why} - write it as "Group=Value;Group=Value" (for example "Browser=Chrome;Operating system=Windows") - nothing was sent.`
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
pairs.push([name, label]);
|
|
324
|
+
}
|
|
325
|
+
return pairs.length === 0 ? {} : { configuration: Object.fromEntries(pairs) };
|
|
326
|
+
}
|
|
308
327
|
var UPLOAD_CONCURRENCY = { min: 1, max: 32, default: 16 };
|
|
309
328
|
var UPLOAD_RETRIES = { min: 0, max: 20, default: 6 };
|
|
310
329
|
var IMPORT_TIMEOUT = { min: 0, max: 86400, default: 600 };
|
|
@@ -352,6 +371,7 @@ function readEnv(env = process.env) {
|
|
|
352
371
|
const offerDiscovered = flag(env, "PLUNE_CREATE");
|
|
353
372
|
const full = flag(env, "PLUNE_FULL_RUN");
|
|
354
373
|
const { shard, error: shardError } = shardOf(env);
|
|
374
|
+
const { configuration, error: configurationError } = configurationOf(env);
|
|
355
375
|
return {
|
|
356
376
|
config: {
|
|
357
377
|
...externalKey !== void 0 ? { externalKey } : {},
|
|
@@ -364,6 +384,7 @@ function readEnv(env = process.env) {
|
|
|
364
384
|
...title !== void 0 ? { title } : {},
|
|
365
385
|
...environment !== void 0 ? { environment } : {},
|
|
366
386
|
...labels !== void 0 ? { labels } : {},
|
|
387
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
367
388
|
// Only when set: `false` here would outrank a config file that asked for it, and an unset
|
|
368
389
|
// variable is not an instruction.
|
|
369
390
|
...offerDiscovered ? { offerDiscovered } : {},
|
|
@@ -377,6 +398,7 @@ function readEnv(env = process.env) {
|
|
|
377
398
|
keepOpen: flag(env, "PLUNE_SHARED_RUN") || flag(env, "PLUNE_PROCEED") || shard !== void 0 || shardError !== void 0,
|
|
378
399
|
...shard !== void 0 ? { shard } : {},
|
|
379
400
|
...shardError !== void 0 ? { shardError } : {},
|
|
401
|
+
...configurationError !== void 0 ? { configurationError } : {},
|
|
380
402
|
...importTimeout !== void 0 ? { importTimeout } : {},
|
|
381
403
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0),
|
|
382
404
|
warnings
|
|
@@ -570,6 +592,7 @@ function appendBatch(file, batch) {
|
|
|
570
592
|
externalKey: batch.externalKey,
|
|
571
593
|
...batch.session !== void 0 ? { session: batch.session } : {},
|
|
572
594
|
...batch.meta !== void 0 ? { meta: batch.meta } : {},
|
|
595
|
+
...batch.configuration !== void 0 ? { configuration: batch.configuration } : {},
|
|
573
596
|
results: batch.results
|
|
574
597
|
};
|
|
575
598
|
fs.appendFileSync(file, `${JSON.stringify(line)}
|
|
@@ -674,6 +697,7 @@ function boundKey(key) {
|
|
|
674
697
|
if (/[\uD800-\uDBFF]$/.test(head)) head = head.slice(0, -1);
|
|
675
698
|
return { ...key, value: `${head}#${digest}` };
|
|
676
699
|
}
|
|
700
|
+
var keyId = (key) => `${key.kind ?? ""}\0${key.value}`;
|
|
677
701
|
function whyUnoffered(out) {
|
|
678
702
|
if (out.ok || out.status !== 429) return "other";
|
|
679
703
|
if (/review queue quota reached/i.test(out.detail)) return "queue";
|
|
@@ -718,8 +742,10 @@ function warnIfDropped(sent, run, log) {
|
|
|
718
742
|
async function startRun(passed, declared2) {
|
|
719
743
|
const env = readEnv();
|
|
720
744
|
if (env.shardError !== void 0) throw new Error(env.shardError);
|
|
745
|
+
if (env.configurationError !== void 0 && passed.configuration === void 0) throw new Error(env.configurationError);
|
|
721
746
|
const stated = Object.fromEntries(Object.entries(passed).filter(([, v]) => v !== void 0));
|
|
722
747
|
const cfg = { ...env.config, ...stated };
|
|
748
|
+
const configuration = cfg.configuration !== void 0 && Object.keys(cfg.configuration).length > 0 ? cfg.configuration : void 0;
|
|
723
749
|
const log = cfg.log ?? ((line) => void process.stderr.write(`${line}
|
|
724
750
|
`));
|
|
725
751
|
const fallbackPath = cfg.fallbackPath ?? DEFAULT_FALLBACK_PATH;
|
|
@@ -803,12 +829,13 @@ async function startRun(passed, declared2) {
|
|
|
803
829
|
externalKey,
|
|
804
830
|
session: sessionMarker,
|
|
805
831
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
832
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
806
833
|
results: results.map(onDisk)
|
|
807
834
|
});
|
|
808
835
|
stats.deferred += results.length;
|
|
809
836
|
}
|
|
810
837
|
async function resolveKeys(values) {
|
|
811
|
-
const unknown = values.filter((k) => !resolved.has(k
|
|
838
|
+
const unknown = values.filter((k) => !resolved.has(keyId(k)));
|
|
812
839
|
if (unknown.length === 0 || offline) return;
|
|
813
840
|
for (const part of chunk(unknown, RESOLVE_CHUNK)) {
|
|
814
841
|
const out = await client.post(
|
|
@@ -820,16 +847,16 @@ async function startRun(passed, declared2) {
|
|
|
820
847
|
return;
|
|
821
848
|
}
|
|
822
849
|
for (const row of out.body.results) {
|
|
823
|
-
if (typeof row?.key?.value === "string") resolved.set(row.key
|
|
850
|
+
if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
|
|
824
851
|
}
|
|
825
852
|
}
|
|
826
853
|
}
|
|
827
854
|
if (!offline) {
|
|
828
855
|
if (expected !== void 0) await resolveKeys(expected.flat());
|
|
829
856
|
const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
|
|
830
|
-
const
|
|
857
|
+
const configuration2 = stated2.length === 0 ? void 0 : {
|
|
831
858
|
expected: stated2.flatMap((keys) => {
|
|
832
|
-
const hit = keys.map((k) => resolved.get(k
|
|
859
|
+
const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
|
|
833
860
|
if (typeof hit === "string") return [{ testCaseId: hit }];
|
|
834
861
|
return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
|
|
835
862
|
}),
|
|
@@ -851,7 +878,7 @@ async function startRun(passed, declared2) {
|
|
|
851
878
|
kind: cfg.kind ?? "automated",
|
|
852
879
|
...externalKey !== null ? { externalKey } : {},
|
|
853
880
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
854
|
-
...
|
|
881
|
+
...configuration2 !== void 0 ? { configuration: configuration2 } : {},
|
|
855
882
|
// Named even when nobody named it — the list has to read without opening a row. Only what
|
|
856
883
|
// the caller DESCRIBED goes to `warnIfDropped` below: a title this side invented is not one
|
|
857
884
|
// a person will miss, and a deployment older than the field must not be nagged on every run.
|
|
@@ -859,7 +886,7 @@ async function startRun(passed, declared2) {
|
|
|
859
886
|
...described
|
|
860
887
|
};
|
|
861
888
|
let start = await client.post("/v1/runs", request);
|
|
862
|
-
if (!start.ok && start.status === 413 &&
|
|
889
|
+
if (!start.ok && start.status === 413 && configuration2 !== void 0) {
|
|
863
890
|
log(
|
|
864
891
|
`plune: the platform refused the run's list of expected tests as too large (${start.detail || start.kind}) \u2014 starting without it: the results still land, but this run counts no tests that did not run, and claims no full run.`
|
|
865
892
|
);
|
|
@@ -878,7 +905,7 @@ async function startRun(passed, declared2) {
|
|
|
878
905
|
if (result.testCaseId !== void 0) return { kind: "found", testCaseId: result.testCaseId };
|
|
879
906
|
let unanswered = false;
|
|
880
907
|
for (const key of result.keys) {
|
|
881
|
-
const hit = resolved.get(key
|
|
908
|
+
const hit = resolved.get(keyId(key));
|
|
882
909
|
if (typeof hit === "string") return { kind: "found", testCaseId: hit };
|
|
883
910
|
if (hit === void 0) unanswered = true;
|
|
884
911
|
}
|
|
@@ -890,14 +917,14 @@ async function startRun(passed, declared2) {
|
|
|
890
917
|
if (result.keys.length === 0) return;
|
|
891
918
|
const title = boundTitle(result.title);
|
|
892
919
|
if (title !== result.title) shortened.add(result.title);
|
|
893
|
-
discoveries.set(result.keys[0]
|
|
920
|
+
discoveries.set(keyId(result.keys[0]), {
|
|
894
921
|
keys: result.keys,
|
|
895
922
|
title,
|
|
896
923
|
source: result.source,
|
|
897
924
|
specRef: result.specRef,
|
|
898
925
|
rawStatus: result.rawStatus
|
|
899
926
|
});
|
|
900
|
-
|
|
927
|
+
for (const key of result.keys) held.set(keyId(key), result);
|
|
901
928
|
}
|
|
902
929
|
async function offer() {
|
|
903
930
|
if (discoveries.size === 0 || offline || runId === null) return;
|
|
@@ -921,9 +948,9 @@ async function startRun(passed, declared2) {
|
|
|
921
948
|
const submissions = [];
|
|
922
949
|
const filesByKey = /* @__PURE__ */ new Map();
|
|
923
950
|
for (const r of made) {
|
|
924
|
-
const pending = typeof r.id === "string" && r.id !== "" ? held.get(r.key
|
|
951
|
+
const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
|
|
925
952
|
if (pending === void 0) continue;
|
|
926
|
-
held.delete(
|
|
953
|
+
for (const key of pending.keys) held.delete(keyId(key));
|
|
927
954
|
const { keys: _keys, files, ...rest } = pending;
|
|
928
955
|
submissions.push({ ...rest, testCaseId: r.id });
|
|
929
956
|
if (files !== void 0) filesByKey.set(pending.resultKey, files);
|
|
@@ -1405,7 +1432,8 @@ async function startRun(passed, declared2) {
|
|
|
1405
1432
|
}
|
|
1406
1433
|
const out = await client.post(
|
|
1407
1434
|
`/v1/runs/${runId}/results`,
|
|
1408
|
-
|
|
1435
|
+
// The job's combination on every batch (plune-ai/plune#1251); a refusal of it is a 422 said below as it came.
|
|
1436
|
+
{ results: part, ...configuration !== void 0 ? { configuration } : {} }
|
|
1409
1437
|
);
|
|
1410
1438
|
const counts = out.ok ? out.body?.counts : void 0;
|
|
1411
1439
|
const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
|
package/dist/index.js
CHANGED
|
@@ -271,6 +271,25 @@ function shardOf(env) {
|
|
|
271
271
|
error: `PLUNE_SHARD=${JSON.stringify(raw.slice(0, 40))} is not "k/N" with 1 <= k <= N <= ${SHARDS_MAX} (for example 2/4) - nothing was sent.`
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
+
function configurationOf(env) {
|
|
275
|
+
const raw = value(env, "PLUNE_CONFIGURATION");
|
|
276
|
+
if (raw === void 0) return {};
|
|
277
|
+
const pairs = [];
|
|
278
|
+
for (const pair of raw.split(";").map((s) => s.trim()).filter((s) => s !== "")) {
|
|
279
|
+
const at = pair.indexOf("=");
|
|
280
|
+
const name = at < 0 ? "" : pair.slice(0, at).trim();
|
|
281
|
+
const label = at < 0 ? "" : pair.slice(at + 1).trim();
|
|
282
|
+
const twice = pairs.find(([seen]) => seen.toLowerCase() === name.toLowerCase());
|
|
283
|
+
const why = at < 0 ? 'has no "="' : name === "" ? "has no group name" : label === "" ? "has no value" : twice !== void 0 ? `names the group ${JSON.stringify(twice[0])} a second time` : void 0;
|
|
284
|
+
if (why !== void 0) {
|
|
285
|
+
return {
|
|
286
|
+
error: `PLUNE_CONFIGURATION: ${JSON.stringify(pair.slice(0, 40))} ${why} - write it as "Group=Value;Group=Value" (for example "Browser=Chrome;Operating system=Windows") - nothing was sent.`
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
pairs.push([name, label]);
|
|
290
|
+
}
|
|
291
|
+
return pairs.length === 0 ? {} : { configuration: Object.fromEntries(pairs) };
|
|
292
|
+
}
|
|
274
293
|
var UPLOAD_CONCURRENCY = { min: 1, max: 32, default: 16 };
|
|
275
294
|
var UPLOAD_RETRIES = { min: 0, max: 20, default: 6 };
|
|
276
295
|
var IMPORT_TIMEOUT = { min: 0, max: 86400, default: 600 };
|
|
@@ -318,6 +337,7 @@ function readEnv(env = process.env) {
|
|
|
318
337
|
const offerDiscovered = flag(env, "PLUNE_CREATE");
|
|
319
338
|
const full = flag(env, "PLUNE_FULL_RUN");
|
|
320
339
|
const { shard, error: shardError } = shardOf(env);
|
|
340
|
+
const { configuration, error: configurationError } = configurationOf(env);
|
|
321
341
|
return {
|
|
322
342
|
config: {
|
|
323
343
|
...externalKey !== void 0 ? { externalKey } : {},
|
|
@@ -330,6 +350,7 @@ function readEnv(env = process.env) {
|
|
|
330
350
|
...title !== void 0 ? { title } : {},
|
|
331
351
|
...environment !== void 0 ? { environment } : {},
|
|
332
352
|
...labels !== void 0 ? { labels } : {},
|
|
353
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
333
354
|
// Only when set: `false` here would outrank a config file that asked for it, and an unset
|
|
334
355
|
// variable is not an instruction.
|
|
335
356
|
...offerDiscovered ? { offerDiscovered } : {},
|
|
@@ -343,6 +364,7 @@ function readEnv(env = process.env) {
|
|
|
343
364
|
keepOpen: flag(env, "PLUNE_SHARED_RUN") || flag(env, "PLUNE_PROCEED") || shard !== void 0 || shardError !== void 0,
|
|
344
365
|
...shard !== void 0 ? { shard } : {},
|
|
345
366
|
...shardError !== void 0 ? { shardError } : {},
|
|
367
|
+
...configurationError !== void 0 ? { configurationError } : {},
|
|
346
368
|
...importTimeout !== void 0 ? { importTimeout } : {},
|
|
347
369
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0),
|
|
348
370
|
warnings
|
|
@@ -536,6 +558,7 @@ function appendBatch(file, batch) {
|
|
|
536
558
|
externalKey: batch.externalKey,
|
|
537
559
|
...batch.session !== void 0 ? { session: batch.session } : {},
|
|
538
560
|
...batch.meta !== void 0 ? { meta: batch.meta } : {},
|
|
561
|
+
...batch.configuration !== void 0 ? { configuration: batch.configuration } : {},
|
|
539
562
|
results: batch.results
|
|
540
563
|
};
|
|
541
564
|
fs.appendFileSync(file, `${JSON.stringify(line)}
|
|
@@ -640,6 +663,7 @@ function boundKey(key) {
|
|
|
640
663
|
if (/[\uD800-\uDBFF]$/.test(head)) head = head.slice(0, -1);
|
|
641
664
|
return { ...key, value: `${head}#${digest}` };
|
|
642
665
|
}
|
|
666
|
+
var keyId = (key) => `${key.kind ?? ""}\0${key.value}`;
|
|
643
667
|
function whyUnoffered(out) {
|
|
644
668
|
if (out.ok || out.status !== 429) return "other";
|
|
645
669
|
if (/review queue quota reached/i.test(out.detail)) return "queue";
|
|
@@ -684,8 +708,10 @@ function warnIfDropped(sent, run, log) {
|
|
|
684
708
|
async function startRun(passed, declared2) {
|
|
685
709
|
const env = readEnv();
|
|
686
710
|
if (env.shardError !== void 0) throw new Error(env.shardError);
|
|
711
|
+
if (env.configurationError !== void 0 && passed.configuration === void 0) throw new Error(env.configurationError);
|
|
687
712
|
const stated = Object.fromEntries(Object.entries(passed).filter(([, v]) => v !== void 0));
|
|
688
713
|
const cfg = { ...env.config, ...stated };
|
|
714
|
+
const configuration = cfg.configuration !== void 0 && Object.keys(cfg.configuration).length > 0 ? cfg.configuration : void 0;
|
|
689
715
|
const log = cfg.log ?? ((line) => void process.stderr.write(`${line}
|
|
690
716
|
`));
|
|
691
717
|
const fallbackPath = cfg.fallbackPath ?? DEFAULT_FALLBACK_PATH;
|
|
@@ -769,12 +795,13 @@ async function startRun(passed, declared2) {
|
|
|
769
795
|
externalKey,
|
|
770
796
|
session: sessionMarker,
|
|
771
797
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
798
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
772
799
|
results: results.map(onDisk)
|
|
773
800
|
});
|
|
774
801
|
stats.deferred += results.length;
|
|
775
802
|
}
|
|
776
803
|
async function resolveKeys(values) {
|
|
777
|
-
const unknown = values.filter((k) => !resolved.has(k
|
|
804
|
+
const unknown = values.filter((k) => !resolved.has(keyId(k)));
|
|
778
805
|
if (unknown.length === 0 || offline) return;
|
|
779
806
|
for (const part of chunk(unknown, RESOLVE_CHUNK)) {
|
|
780
807
|
const out = await client.post(
|
|
@@ -786,16 +813,16 @@ async function startRun(passed, declared2) {
|
|
|
786
813
|
return;
|
|
787
814
|
}
|
|
788
815
|
for (const row of out.body.results) {
|
|
789
|
-
if (typeof row?.key?.value === "string") resolved.set(row.key
|
|
816
|
+
if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
|
|
790
817
|
}
|
|
791
818
|
}
|
|
792
819
|
}
|
|
793
820
|
if (!offline) {
|
|
794
821
|
if (expected !== void 0) await resolveKeys(expected.flat());
|
|
795
822
|
const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
|
|
796
|
-
const
|
|
823
|
+
const configuration2 = stated2.length === 0 ? void 0 : {
|
|
797
824
|
expected: stated2.flatMap((keys) => {
|
|
798
|
-
const hit = keys.map((k) => resolved.get(k
|
|
825
|
+
const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
|
|
799
826
|
if (typeof hit === "string") return [{ testCaseId: hit }];
|
|
800
827
|
return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
|
|
801
828
|
}),
|
|
@@ -817,7 +844,7 @@ async function startRun(passed, declared2) {
|
|
|
817
844
|
kind: cfg.kind ?? "automated",
|
|
818
845
|
...externalKey !== null ? { externalKey } : {},
|
|
819
846
|
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
820
|
-
...
|
|
847
|
+
...configuration2 !== void 0 ? { configuration: configuration2 } : {},
|
|
821
848
|
// Named even when nobody named it — the list has to read without opening a row. Only what
|
|
822
849
|
// the caller DESCRIBED goes to `warnIfDropped` below: a title this side invented is not one
|
|
823
850
|
// a person will miss, and a deployment older than the field must not be nagged on every run.
|
|
@@ -825,7 +852,7 @@ async function startRun(passed, declared2) {
|
|
|
825
852
|
...described
|
|
826
853
|
};
|
|
827
854
|
let start = await client.post("/v1/runs", request);
|
|
828
|
-
if (!start.ok && start.status === 413 &&
|
|
855
|
+
if (!start.ok && start.status === 413 && configuration2 !== void 0) {
|
|
829
856
|
log(
|
|
830
857
|
`plune: the platform refused the run's list of expected tests as too large (${start.detail || start.kind}) \u2014 starting without it: the results still land, but this run counts no tests that did not run, and claims no full run.`
|
|
831
858
|
);
|
|
@@ -844,7 +871,7 @@ async function startRun(passed, declared2) {
|
|
|
844
871
|
if (result.testCaseId !== void 0) return { kind: "found", testCaseId: result.testCaseId };
|
|
845
872
|
let unanswered = false;
|
|
846
873
|
for (const key of result.keys) {
|
|
847
|
-
const hit = resolved.get(key
|
|
874
|
+
const hit = resolved.get(keyId(key));
|
|
848
875
|
if (typeof hit === "string") return { kind: "found", testCaseId: hit };
|
|
849
876
|
if (hit === void 0) unanswered = true;
|
|
850
877
|
}
|
|
@@ -856,14 +883,14 @@ async function startRun(passed, declared2) {
|
|
|
856
883
|
if (result.keys.length === 0) return;
|
|
857
884
|
const title = boundTitle(result.title);
|
|
858
885
|
if (title !== result.title) shortened.add(result.title);
|
|
859
|
-
discoveries.set(result.keys[0]
|
|
886
|
+
discoveries.set(keyId(result.keys[0]), {
|
|
860
887
|
keys: result.keys,
|
|
861
888
|
title,
|
|
862
889
|
source: result.source,
|
|
863
890
|
specRef: result.specRef,
|
|
864
891
|
rawStatus: result.rawStatus
|
|
865
892
|
});
|
|
866
|
-
|
|
893
|
+
for (const key of result.keys) held.set(keyId(key), result);
|
|
867
894
|
}
|
|
868
895
|
async function offer() {
|
|
869
896
|
if (discoveries.size === 0 || offline || runId === null) return;
|
|
@@ -887,9 +914,9 @@ async function startRun(passed, declared2) {
|
|
|
887
914
|
const submissions = [];
|
|
888
915
|
const filesByKey = /* @__PURE__ */ new Map();
|
|
889
916
|
for (const r of made) {
|
|
890
|
-
const pending = typeof r.id === "string" && r.id !== "" ? held.get(r.key
|
|
917
|
+
const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
|
|
891
918
|
if (pending === void 0) continue;
|
|
892
|
-
held.delete(
|
|
919
|
+
for (const key of pending.keys) held.delete(keyId(key));
|
|
893
920
|
const { keys: _keys, files, ...rest } = pending;
|
|
894
921
|
submissions.push({ ...rest, testCaseId: r.id });
|
|
895
922
|
if (files !== void 0) filesByKey.set(pending.resultKey, files);
|
|
@@ -1371,7 +1398,8 @@ async function startRun(passed, declared2) {
|
|
|
1371
1398
|
}
|
|
1372
1399
|
const out = await client.post(
|
|
1373
1400
|
`/v1/runs/${runId}/results`,
|
|
1374
|
-
|
|
1401
|
+
// The job's combination on every batch (plune-ai/plune#1251); a refusal of it is a 422 said below as it came.
|
|
1402
|
+
{ results: part, ...configuration !== void 0 ? { configuration } : {} }
|
|
1375
1403
|
);
|
|
1376
1404
|
const counts = out.ok ? out.body?.counts : void 0;
|
|
1377
1405
|
const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
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.32.2"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|