@testsprite/testsprite-cli 0.16.0 → 0.17.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 +51 -147
- package/dist/commands/agent.d.ts +12 -4
- package/dist/commands/agent.js +48 -63
- package/dist/commands/auth.d.ts +6 -10
- package/dist/commands/auth.js +38 -54
- package/dist/commands/ci.d.ts +23 -100
- package/dist/commands/ci.js +293 -487
- package/dist/commands/conversation.d.ts +27 -0
- package/dist/commands/conversation.js +702 -0
- package/dist/commands/doctor.d.ts +5 -1
- package/dist/commands/doctor.js +129 -34
- package/dist/commands/init.d.ts +4 -45
- package/dist/commands/init.js +108 -66
- package/dist/commands/project-env.d.ts +62 -2
- package/dist/commands/project-env.js +388 -37
- package/dist/commands/project-sign-in.d.ts +0 -48
- package/dist/commands/project-sign-in.js +1 -229
- package/dist/commands/project.d.ts +15 -186
- package/dist/commands/project.js +89 -924
- package/dist/commands/result.d.ts +10 -0
- package/dist/commands/result.js +215 -0
- package/dist/commands/schedule.d.ts +0 -29
- package/dist/commands/schedule.js +28 -87
- package/dist/commands/test.d.ts +301 -1816
- package/dist/commands/test.js +1951 -13902
- package/dist/commands/testlist.d.ts +128 -5
- package/dist/commands/testlist.js +269 -339
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +23 -19
- package/dist/commands/usage.d.ts +12 -45
- package/dist/commands/usage.js +50 -131
- package/dist/index.js +182 -104
- package/dist/lib/agent-detect.js +9 -5
- package/dist/lib/agent-targets.d.ts +21 -2
- package/dist/lib/agent-targets.js +88 -11
- package/dist/lib/args.d.ts +13 -0
- package/dist/lib/args.js +49 -0
- package/dist/lib/basic-auth.d.ts +3 -0
- package/dist/lib/basic-auth.js +15 -0
- package/dist/lib/billing-refusal.js +4 -3
- package/dist/lib/ci-linkage.d.ts +4 -82
- package/dist/lib/ci-linkage.js +4 -157
- package/dist/lib/ci-run.js +1 -1
- package/dist/lib/client-factory.d.ts +10 -2
- package/dist/lib/client-factory.js +38 -26
- package/dist/lib/commit-signal.d.ts +65 -0
- package/dist/lib/commit-signal.js +305 -0
- package/dist/lib/concurrency-limiter.d.ts +6 -0
- package/dist/lib/concurrency-limiter.js +29 -0
- package/dist/lib/config.js +10 -5
- package/dist/lib/conflict-reason.d.ts +9 -3
- package/dist/lib/conflict-reason.js +6 -3
- package/dist/lib/conversation/answers.d.ts +9 -0
- package/dist/lib/conversation/answers.js +49 -0
- package/dist/lib/conversation/api.d.ts +71 -0
- package/dist/lib/conversation/api.js +150 -0
- package/dist/lib/conversation/change.d.ts +31 -0
- package/dist/lib/conversation/change.js +124 -0
- package/dist/lib/conversation/context.d.ts +19 -0
- package/dist/lib/conversation/context.js +70 -0
- package/dist/lib/conversation/environment.d.ts +15 -0
- package/dist/lib/conversation/environment.js +33 -0
- package/dist/lib/conversation/follow.d.ts +24 -0
- package/dist/lib/conversation/follow.js +42 -0
- package/dist/lib/conversation/render.d.ts +33 -0
- package/dist/lib/conversation/render.js +315 -0
- package/dist/lib/conversation/title.d.ts +2 -0
- package/dist/lib/conversation/title.js +18 -0
- package/dist/lib/conversation/types.d.ts +156 -0
- package/dist/lib/conversation/types.js +6 -0
- package/dist/lib/credentials.js +67 -11
- package/dist/lib/cron.d.ts +1 -1
- package/dist/lib/cron.js +2 -2
- package/dist/lib/dispatch-stop.d.ts +20 -0
- package/dist/lib/dispatch-stop.js +30 -0
- package/dist/lib/download.d.ts +71 -0
- package/dist/lib/download.js +274 -0
- package/dist/lib/dry-run/fetch.d.ts +10 -0
- package/dist/lib/dry-run/fetch.js +20 -0
- package/dist/lib/dry-run/samples.d.ts +6 -34
- package/dist/lib/dry-run/samples.js +375 -747
- package/dist/lib/environment-tunnel.d.ts +16 -27
- package/dist/lib/environment-tunnel.js +161 -154
- package/dist/lib/errors.d.ts +20 -4
- package/dist/lib/errors.js +36 -16
- package/dist/lib/facade.d.ts +7 -29
- package/dist/lib/facade.js +7 -36
- package/dist/lib/failing-fe-resolver.d.ts +13 -58
- package/dist/lib/failing-fe-resolver.js +47 -132
- package/dist/lib/first-suite-hint.d.ts +16 -22
- package/dist/lib/first-suite-hint.js +38 -47
- package/dist/lib/gh-output.d.ts +76 -21
- package/dist/lib/gh-output.js +171 -90
- package/dist/lib/git-utils.d.ts +56 -0
- package/dist/lib/git-utils.js +212 -0
- package/dist/lib/github-context.d.ts +2 -0
- package/dist/lib/github-context.js +40 -8
- package/dist/lib/history-retention.d.ts +6 -2
- package/dist/lib/history-retention.js +10 -7
- package/dist/lib/http.d.ts +58 -134
- package/dist/lib/http.js +352 -289
- package/dist/lib/interrupt.d.ts +14 -8
- package/dist/lib/interrupt.js +28 -10
- package/dist/lib/junit-report.d.ts +57 -4
- package/dist/lib/junit-report.js +202 -32
- package/dist/lib/local-target.d.ts +3 -3
- package/dist/lib/local-target.js +3 -3
- package/dist/lib/output.d.ts +1 -40
- package/dist/lib/output.js +11 -49
- package/dist/lib/pagination.d.ts +2 -5
- package/dist/lib/pagination.js +2 -5
- package/dist/lib/presigned-url.d.ts +22 -0
- package/dist/lib/presigned-url.js +90 -0
- package/dist/lib/prompt.js +36 -2
- package/dist/lib/proxy.js +2 -1
- package/dist/lib/redact.d.ts +2 -2
- package/dist/lib/redact.js +3 -4
- package/dist/lib/removed-commands.d.ts +18 -0
- package/dist/lib/removed-commands.js +154 -0
- package/dist/lib/render-error.d.ts +31 -6
- package/dist/lib/render-error.js +88 -25
- package/dist/lib/response-schemas.d.ts +38 -30
- package/dist/lib/response-schemas.js +207 -207
- package/dist/lib/result/api.d.ts +24 -0
- package/dist/lib/result/api.js +28 -0
- package/dist/lib/result/evidence.d.ts +71 -0
- package/dist/lib/result/evidence.js +420 -0
- package/dist/lib/result/render.d.ts +20 -0
- package/dist/lib/result/render.js +194 -0
- package/dist/lib/result/types.d.ts +122 -0
- package/dist/lib/result/types.js +19 -0
- package/dist/lib/run-output.d.ts +275 -0
- package/dist/lib/run-output.js +227 -0
- package/dist/lib/run-render.d.ts +101 -0
- package/dist/lib/run-render.js +183 -0
- package/dist/lib/run-wait.d.ts +192 -0
- package/dist/lib/run-wait.js +452 -0
- package/dist/lib/runs.types.d.ts +118 -367
- package/dist/lib/runs.types.js +0 -14
- package/dist/lib/secret-file.d.ts +1 -1
- package/dist/lib/secret-file.js +11 -2
- package/dist/lib/skill-nudge.d.ts +7 -27
- package/dist/lib/skill-nudge.js +9 -37
- package/dist/lib/target-path.d.ts +15 -0
- package/dist/lib/target-path.js +35 -0
- package/dist/lib/target-url-advisory.d.ts +19 -0
- package/dist/lib/target-url-advisory.js +31 -0
- package/dist/lib/target-url-preflight.d.ts +9 -0
- package/dist/lib/target-url-preflight.js +214 -106
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +6 -16
- package/dist/lib/telemetry.d.ts +31 -11
- package/dist/lib/telemetry.js +37 -8
- package/dist/lib/terminal-text.d.ts +41 -0
- package/dist/lib/terminal-text.js +127 -0
- package/dist/lib/testlist.types.d.ts +16 -8
- package/dist/lib/testlist.types.js +1 -1
- package/dist/lib/text-equality.d.ts +2 -0
- package/dist/lib/text-equality.js +5 -0
- package/dist/lib/text-file.d.ts +16 -0
- package/dist/lib/text-file.js +41 -0
- package/dist/lib/text-table.d.ts +46 -0
- package/dist/lib/text-table.js +72 -4
- package/dist/lib/ticker.d.ts +9 -2
- package/dist/lib/ticker.js +16 -3
- package/dist/lib/transport-failure.d.ts +22 -0
- package/dist/lib/transport-failure.js +126 -0
- package/dist/lib/tunnel-session.d.ts +7 -1
- package/dist/lib/tunnel-session.js +22 -9
- package/dist/lib/update-check.js +3 -2
- package/dist/lib/url-template.d.ts +43 -0
- package/dist/lib/url-template.js +151 -0
- package/dist/lib/validate.d.ts +0 -64
- package/dist/lib/validate.js +2 -131
- package/dist/lib/version-notice.js +4 -3
- package/dist/lib/wait-exit.d.ts +37 -2
- package/dist/lib/wait-exit.js +88 -30
- package/dist/lib/workspace-status.js +10 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -3
- package/skills/testsprite-ci.skill.md +48 -18
- package/skills/testsprite-onboard.skill.md +66 -151
- package/skills/testsprite-verify.codex.md +50 -52
- package/skills/testsprite-verify.skill.md +184 -351
- package/dist/lib/browser.d.ts +0 -6
- package/dist/lib/browser.js +0 -54
- package/dist/lib/bundle.d.ts +0 -234
- package/dist/lib/bundle.js +0 -781
- package/dist/lib/deprecate.d.ts +0 -32
- package/dist/lib/deprecate.js +0 -39
- package/dist/lib/flaky.d.ts +0 -91
- package/dist/lib/flaky.js +0 -71
- package/dist/lib/plan-poll.d.ts +0 -171
- package/dist/lib/plan-poll.js +0 -441
- package/dist/lib/plans.types.d.ts +0 -130
- package/dist/lib/plans.types.js +0 -31
- package/dist/lib/poll.d.ts +0 -100
- package/dist/lib/poll.js +0 -290
- package/dist/lib/rate-throttle.d.ts +0 -49
- package/dist/lib/rate-throttle.js +0 -75
- package/dist/lib/run-progress.d.ts +0 -41
- package/dist/lib/run-progress.js +0 -56
- package/dist/lib/v3-advisory.d.ts +0 -55
- package/dist/lib/v3-advisory.js +0 -74
- package/schemas/plan.schema.json +0 -61
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { terminalSafe, terminalSafeLine } from '../terminal-text.js';
|
|
2
|
+
import { renderTextTable } from '../text-table.js';
|
|
3
|
+
import { RESULT_FILE } from './evidence.js';
|
|
4
|
+
import { isResultRunning, } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Server text in a cell: safe for the terminal, and on one line, since a title
|
|
7
|
+
* the server sent across lines would break one line per result.
|
|
8
|
+
*/
|
|
9
|
+
const cell = (value) => terminalSafeLine(value ?? '') || '-';
|
|
10
|
+
/**
|
|
11
|
+
* A server value with something to print in it, else null: the server sends
|
|
12
|
+
* `''` as well as null for a value a result does not have (a passing test's
|
|
13
|
+
* error, cause and fix), and a value that is only whitespace or escape
|
|
14
|
+
* sequences prints nothing either.
|
|
15
|
+
*/
|
|
16
|
+
const present = (value) => value === null || value === undefined || terminalSafeLine(value) === '' ? null : value;
|
|
17
|
+
function statusCell({ testStatus, processStatus, }) {
|
|
18
|
+
if (isResultRunning(testStatus) && processStatus?.toLowerCase() === 'idle')
|
|
19
|
+
return 'QUEUED';
|
|
20
|
+
return cell(testStatus);
|
|
21
|
+
}
|
|
22
|
+
const LIST_COLUMNS = [
|
|
23
|
+
{ header: 'CREATED', width: 0, render: line => cell(line.created) },
|
|
24
|
+
{ header: 'STATUS', width: 0, render: statusCell },
|
|
25
|
+
{ header: 'RESULT ID', width: 0, render: line => cell(line.resultId) },
|
|
26
|
+
{ header: 'RUN ID', width: 0, render: line => cell(line.runId) },
|
|
27
|
+
{ header: 'ENV', width: 0, render: line => cell(line.environmentName) },
|
|
28
|
+
{ header: 'TITLE', width: 0, render: line => cell(line.title) },
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* One line per result, newest first, under a header: both ids are opaque, so
|
|
32
|
+
* the header is what tells the result id from the run id.
|
|
33
|
+
*/
|
|
34
|
+
export function renderResultList(list) {
|
|
35
|
+
if (list.results.length === 0)
|
|
36
|
+
return 'No results.';
|
|
37
|
+
return renderTextTable(list.results, LIST_COLUMNS);
|
|
38
|
+
}
|
|
39
|
+
/** Wide enough for the longest label, `processStatus:`, and two spaces. */
|
|
40
|
+
const LABEL_WIDTH = 16;
|
|
41
|
+
/**
|
|
42
|
+
* `label: value`, the value made safe for the terminal and the lines after its
|
|
43
|
+
* first indented under it: for prose, which may run over lines. A value that
|
|
44
|
+
* is one line by nature goes through {@link lineField}.
|
|
45
|
+
*/
|
|
46
|
+
function field(label, value) {
|
|
47
|
+
const [first, ...rest] = terminalSafe(value).replace(/\s+$/, '').split('\n');
|
|
48
|
+
const indent = ' '.repeat(LABEL_WIDTH);
|
|
49
|
+
return [`${`${label}:`.padEnd(LABEL_WIDTH)}${first}`, ...rest.map(line => indent + line)].join('\n');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* `label: value` for a value that is one line by nature (an id, a status, a
|
|
53
|
+
* URL): a line break the server put in it becomes a space, as in a cell.
|
|
54
|
+
*/
|
|
55
|
+
const lineField = (label, value) => `${`${label}:`.padEnd(LABEL_WIDTH)}${terminalSafeLine(value)}`;
|
|
56
|
+
/** A step as `<stepIndex> <description>`; the description is the one the server redacted. */
|
|
57
|
+
const stepLine = (step) => `${present(step.stepIndex) ?? '-'} ${present(step.description) ?? '(no description)'}`;
|
|
58
|
+
/** How many lines of a backend test's traceback, and of its output, the text prints. */
|
|
59
|
+
const LOG_LINES = 20;
|
|
60
|
+
/** How many characters of those lines it prints, so one long line cannot flood the terminal. */
|
|
61
|
+
const LOG_CHARS = 2000;
|
|
62
|
+
/** Characters, not UTF-16 code units: a surrogate pair is one character. */
|
|
63
|
+
const charCount = (text) => text.length - (text.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)?.length ?? 0);
|
|
64
|
+
/**
|
|
65
|
+
* `text` cut to its first or last {@link LOG_CHARS} characters, and how many
|
|
66
|
+
* it lost. No character is split: each is at most two code units, so the
|
|
67
|
+
* kept ones lie within twice as many code units from the kept end.
|
|
68
|
+
*/
|
|
69
|
+
function cutChars(text, keep) {
|
|
70
|
+
const cut = charCount(text) - LOG_CHARS;
|
|
71
|
+
if (cut <= 0)
|
|
72
|
+
return { kept: text, cut: 0 };
|
|
73
|
+
const kept = keep === 'first'
|
|
74
|
+
? Array.from(text.slice(0, 2 * LOG_CHARS)).slice(0, LOG_CHARS)
|
|
75
|
+
: Array.from(text.slice(-2 * LOG_CHARS)).slice(-LOG_CHARS);
|
|
76
|
+
return { kept: kept.join(''), cut };
|
|
77
|
+
}
|
|
78
|
+
const plural = (count, noun) => `${count} ${noun}${count === 1 ? '' : 's'}`;
|
|
79
|
+
/**
|
|
80
|
+
* A backend test's traceback or output under its label, cut to
|
|
81
|
+
* {@link LOG_LINES} lines and then to {@link LOG_CHARS} characters: a
|
|
82
|
+
* traceback keeps its `last` ones, where the exception is, and an output its
|
|
83
|
+
* `first`. What was cut is named where the cut is, above a traceback and below
|
|
84
|
+
* an output. Lines are counted in the text made safe for the terminal, where a
|
|
85
|
+
* carriage return is a line break. Blank lines around the value are dropped,
|
|
86
|
+
* and a value with nothing else prints nothing.
|
|
87
|
+
*/
|
|
88
|
+
function logBlock(label, value, keep) {
|
|
89
|
+
const text = terminalSafe(value ?? '')
|
|
90
|
+
.replace(/^\s*\n/, '')
|
|
91
|
+
.trimEnd();
|
|
92
|
+
if (text === '')
|
|
93
|
+
return [];
|
|
94
|
+
const lines = text.split('\n');
|
|
95
|
+
const shown = keep === 'first' ? lines.slice(0, LOG_LINES) : lines.slice(-LOG_LINES);
|
|
96
|
+
const cutLines = lines.length - shown.length;
|
|
97
|
+
const { kept, cut: cutCharacters } = cutChars(shown.join('\n'), keep);
|
|
98
|
+
const keptLines = kept.split('\n');
|
|
99
|
+
// A cut that falls on a line break leaves an empty line at the cut end.
|
|
100
|
+
if (cutCharacters > 0 && keep === 'first' && keptLines.at(-1) === '')
|
|
101
|
+
keptLines.pop();
|
|
102
|
+
if (cutCharacters > 0 && keep === 'last' && keptLines[0] === '')
|
|
103
|
+
keptLines.shift();
|
|
104
|
+
const body = keptLines.map(line => ` ${line}`);
|
|
105
|
+
if (cutLines === 0 && cutCharacters === 0)
|
|
106
|
+
return [`${label}:`, ...body];
|
|
107
|
+
const where = keep === 'first' ? 'more' : 'earlier';
|
|
108
|
+
const what = cutLines === 0
|
|
109
|
+
? plural(cutCharacters, `${where} character`)
|
|
110
|
+
: plural(cutLines, `${where} line`) +
|
|
111
|
+
(cutCharacters === 0 ? '' : ` and ${plural(cutCharacters, 'character')}`);
|
|
112
|
+
const pointer = ` (${what}: --output json, or --out <dir> for ${RESULT_FILE})`;
|
|
113
|
+
return keep === 'first' ? [`${label}:`, ...body, pointer] : [`${label}:`, pointer, ...body];
|
|
114
|
+
}
|
|
115
|
+
function signInLines(signIn) {
|
|
116
|
+
const failed = signIn.steps.find(step => step.status === 'failed');
|
|
117
|
+
const error = present(signIn.error);
|
|
118
|
+
return [
|
|
119
|
+
lineField('signIn', present(signIn.status) ?? '-'),
|
|
120
|
+
...(error !== null ? [field(' error', error)] : []),
|
|
121
|
+
lineField(' stepCount', String(signIn.stepCount ?? signIn.steps.length)),
|
|
122
|
+
...(failed !== undefined ? [field(' failedStep', stepLine(failed))] : []),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* One screen about one result: what happened, why, and the failed step; for a
|
|
127
|
+
* backend test, the end of its traceback and the start of its output. Each
|
|
128
|
+
* step, and both of those in full, are in the JSON (and the evidence
|
|
129
|
+
* download), not here.
|
|
130
|
+
*/
|
|
131
|
+
export function renderResultDetail(detail) {
|
|
132
|
+
const failedSteps = detail.steps.filter(step => step.status === 'failed').length;
|
|
133
|
+
const optional = (label, value) => {
|
|
134
|
+
const shown = present(value);
|
|
135
|
+
return shown !== null ? [field(label, shown)] : [];
|
|
136
|
+
};
|
|
137
|
+
const optionalLine = (label, value) => {
|
|
138
|
+
const shown = present(value);
|
|
139
|
+
return shown !== null ? [lineField(label, shown)] : [];
|
|
140
|
+
};
|
|
141
|
+
return [
|
|
142
|
+
`${statusCell(detail)} ${cell(detail.title)}`,
|
|
143
|
+
lineField('resultId', detail.resultId),
|
|
144
|
+
lineField('runId', present(detail.runId) ?? '-'),
|
|
145
|
+
lineField('caseKey', present(detail.caseKey) ?? '-'),
|
|
146
|
+
// While a result runs, its process status says where it is.
|
|
147
|
+
...(isResultRunning(detail.testStatus)
|
|
148
|
+
? optionalLine('processStatus', detail.processStatus)
|
|
149
|
+
: []),
|
|
150
|
+
...optional('error', detail.error),
|
|
151
|
+
// Some failures carry their reason only here (an integration flow that
|
|
152
|
+
// could not start, say); others repeat the error, which prints once.
|
|
153
|
+
...(present(detail.processErrorMessage) !== present(detail.error)
|
|
154
|
+
? optional('processError', detail.processErrorMessage)
|
|
155
|
+
: []),
|
|
156
|
+
...optional('cause', detail.cause),
|
|
157
|
+
...optional('fix', detail.fix),
|
|
158
|
+
...optional('blockedReason', detail.blockedReason),
|
|
159
|
+
...(detail.failedStep !== null
|
|
160
|
+
? [
|
|
161
|
+
field('failedStep', stepLine(detail.failedStep)),
|
|
162
|
+
...optionalLine(' screenshot', detail.failedStep.screenshotSignedUrl),
|
|
163
|
+
]
|
|
164
|
+
: []),
|
|
165
|
+
field('steps', `${detail.steps.length} (${failedSteps} failed)`),
|
|
166
|
+
...optionalLine('videoUrl', detail.videoUrl),
|
|
167
|
+
...(detail.signIn !== null ? signInLines(detail.signIn) : []),
|
|
168
|
+
...logBlock('trace', detail.trace, 'last'),
|
|
169
|
+
...logBlock('apiOutput', detail.apiOutput, 'first'),
|
|
170
|
+
].join('\n');
|
|
171
|
+
}
|
|
172
|
+
const evidenceFiles = (count) => `${count} evidence file${count === 1 ? '' : 's'}`;
|
|
173
|
+
/**
|
|
174
|
+
* What a download wrote to its directory, one file a line, then each file it
|
|
175
|
+
* could not download with the reason. `preview` is a dry run's plan. It counts
|
|
176
|
+
* evidence files, result.json apart, as the error for a partial download does.
|
|
177
|
+
*/
|
|
178
|
+
export function renderEvidence(evidence, preview = false) {
|
|
179
|
+
const { dir, written, failed } = evidence;
|
|
180
|
+
const got = written.filter(file => file !== RESULT_FILE).length;
|
|
181
|
+
const count = failed.length === 0 ? evidenceFiles(got) : `${got} of ${evidenceFiles(got + failed.length)}`;
|
|
182
|
+
return [
|
|
183
|
+
`${preview ? 'Would write' : 'Wrote'} ${count}, and ${RESULT_FILE}, to ${dir}`,
|
|
184
|
+
...written.map(file => ` ${terminalSafeLine(file)}`),
|
|
185
|
+
...(failed.length > 0
|
|
186
|
+
? [
|
|
187
|
+
'Not downloaded:',
|
|
188
|
+
...failed.map(({ file, reason, kept }) => ` ${terminalSafeLine(file)} ${terminalSafeLine(reason)}` +
|
|
189
|
+
(kept ? ' (the earlier copy is kept)' : '')),
|
|
190
|
+
]
|
|
191
|
+
: []),
|
|
192
|
+
].join('\n');
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shapes of the two result routes, `GET /results` and
|
|
3
|
+
* `GET /results/{resultId}`. A run is one launch; a result is one test's part
|
|
4
|
+
* of it, so `runId` here names the launch and `resultId` the test's result.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Every status the `status` filter of `GET /results` takes. The server leaves
|
|
8
|
+
* cancelled results out unless `status` names them, so a caller that needs
|
|
9
|
+
* every result of a run passes this whole list.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ALL_RESULT_STATUSES: readonly ["passed", "failed", "running", "blocked", "cancelled"];
|
|
12
|
+
/**
|
|
13
|
+
* Whether a result is still running. Every other status is final: it passed,
|
|
14
|
+
* failed, was blocked or was cancelled. The wire spells statuses in upper case.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isResultRunning(testStatus: string): boolean;
|
|
17
|
+
/** `GET /results?run=<runId>` or `?test=<testId>`. */
|
|
18
|
+
export interface ResultList {
|
|
19
|
+
/**
|
|
20
|
+
* A run's listing only: the run itself. Absent from an older backend; null
|
|
21
|
+
* when the server sent one without a readable `runId` and `status`.
|
|
22
|
+
*/
|
|
23
|
+
run?: ResultRun | null;
|
|
24
|
+
/** Newest first. */
|
|
25
|
+
results: ResultLine[];
|
|
26
|
+
/** A test's history only: how many results the plan's history window holds back. */
|
|
27
|
+
hiddenRunCount?: number;
|
|
28
|
+
/** A test's history only. */
|
|
29
|
+
retentionDays?: number | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The run a `GET /results?run=<runId>` listing is of. Only `runId` and
|
|
33
|
+
* `status` are required; every other field is null when the server left it
|
|
34
|
+
* out or sent something this CLI cannot read.
|
|
35
|
+
*/
|
|
36
|
+
export interface ResultRun {
|
|
37
|
+
runId: string;
|
|
38
|
+
/**
|
|
39
|
+
* `running` or `finished`. The server says `finished` once the run has
|
|
40
|
+
* nothing left to add or run, so a backend run's integration results are in
|
|
41
|
+
* the listing by then. Kept open: a value this CLI does not know is not
|
|
42
|
+
* `finished`.
|
|
43
|
+
*/
|
|
44
|
+
status: 'running' | 'finished' | (string & {});
|
|
45
|
+
projectId: string | null;
|
|
46
|
+
/** The run was cancelled. */
|
|
47
|
+
cancelled: boolean | null;
|
|
48
|
+
/** ISO timestamp. */
|
|
49
|
+
created: string | null;
|
|
50
|
+
/** ISO timestamp. */
|
|
51
|
+
modified: string | null;
|
|
52
|
+
targetUrl: string | null;
|
|
53
|
+
/** Server-built; null means no link. */
|
|
54
|
+
dashboardUrl: string | null;
|
|
55
|
+
}
|
|
56
|
+
export interface ResultLine {
|
|
57
|
+
resultId: string;
|
|
58
|
+
runId: string | null;
|
|
59
|
+
caseKey: string | null;
|
|
60
|
+
title: string;
|
|
61
|
+
/** Upper case on the wire: `PASSED`, `FAILED`, `RUNNING`, `BLOCKED`, `CANCELLED`. */
|
|
62
|
+
testStatus: string;
|
|
63
|
+
processStatus: string | null;
|
|
64
|
+
error: string | null;
|
|
65
|
+
blockedReason: string | null;
|
|
66
|
+
environmentName: string | null;
|
|
67
|
+
/** ISO timestamp. */
|
|
68
|
+
created: string;
|
|
69
|
+
/** ISO timestamp of the result's last change. Absent from an older backend. */
|
|
70
|
+
modified?: string;
|
|
71
|
+
}
|
|
72
|
+
/** `GET /results/{resultId}`. */
|
|
73
|
+
export interface ResultDetail {
|
|
74
|
+
resultId: string;
|
|
75
|
+
runId: string | null;
|
|
76
|
+
caseKey: string | null;
|
|
77
|
+
caseHash: string | null;
|
|
78
|
+
title: string;
|
|
79
|
+
type: string;
|
|
80
|
+
testStatus: string;
|
|
81
|
+
processStatus: string | null;
|
|
82
|
+
processErrorMessage: string | null;
|
|
83
|
+
error: string | null;
|
|
84
|
+
cause: string | null;
|
|
85
|
+
fix: string | null;
|
|
86
|
+
blockedReason: string | null;
|
|
87
|
+
/** A backend test's Python traceback; null for a frontend test, absent from an older backend. */
|
|
88
|
+
trace?: string | null;
|
|
89
|
+
/** A backend test's captured output; null for a frontend test, absent from an older backend. */
|
|
90
|
+
apiOutput?: string | null;
|
|
91
|
+
videoUrl: string | null;
|
|
92
|
+
envId: string | null;
|
|
93
|
+
created: string;
|
|
94
|
+
modified: string;
|
|
95
|
+
/** The first step, in numeric order, whose status is `failed`. */
|
|
96
|
+
failedStep: ResultStep | null;
|
|
97
|
+
/** In numeric order. */
|
|
98
|
+
steps: ResultStep[];
|
|
99
|
+
/** The sign-in run behind a result blocked at sign-in; null for every other result. */
|
|
100
|
+
signIn: ResultSignIn | null;
|
|
101
|
+
}
|
|
102
|
+
export interface ResultStep {
|
|
103
|
+
stepIndex: string | null;
|
|
104
|
+
type: string | null;
|
|
105
|
+
action: string | null;
|
|
106
|
+
description: string | null;
|
|
107
|
+
status: 'passed' | 'failed' | null;
|
|
108
|
+
selector: string | null;
|
|
109
|
+
url: string | null;
|
|
110
|
+
healed: boolean;
|
|
111
|
+
screenshotSignedUrl: string | null;
|
|
112
|
+
htmlSignedUrl: string | null;
|
|
113
|
+
}
|
|
114
|
+
export interface ResultSignIn {
|
|
115
|
+
id: string;
|
|
116
|
+
status: string | null;
|
|
117
|
+
videoUrl: string | null;
|
|
118
|
+
finalUrl: string | null;
|
|
119
|
+
stepCount: number | null;
|
|
120
|
+
error: string | null;
|
|
121
|
+
steps: ResultStep[];
|
|
122
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shapes of the two result routes, `GET /results` and
|
|
3
|
+
* `GET /results/{resultId}`. A run is one launch; a result is one test's part
|
|
4
|
+
* of it, so `runId` here names the launch and `resultId` the test's result.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Every status the `status` filter of `GET /results` takes. The server leaves
|
|
8
|
+
* cancelled results out unless `status` names them, so a caller that needs
|
|
9
|
+
* every result of a run passes this whole list.
|
|
10
|
+
*/
|
|
11
|
+
export const ALL_RESULT_STATUSES = ['passed', 'failed', 'running', 'blocked', 'cancelled'];
|
|
12
|
+
/**
|
|
13
|
+
* Whether a result is still running. Every other status is final: it passed,
|
|
14
|
+
* failed, was blocked or was cancelled. The wire spells statuses in upper case.
|
|
15
|
+
*/
|
|
16
|
+
export function isResultRunning(testStatus) {
|
|
17
|
+
return testStatus.toLowerCase() === 'running';
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { summarizeRunRows, type CiSummary } from './gh-output.js';
|
|
2
|
+
import { type ResultRun } from './result/types.js';
|
|
3
|
+
import type { ProjectRunResponse } from './runs.types.js';
|
|
4
|
+
import type { CliTestListRunAccepted } from './testlist.types.js';
|
|
5
|
+
import { type RunWaitOutcome } from './run-wait.js';
|
|
6
|
+
import { type WaitMemberResult } from './wait-exit.js';
|
|
7
|
+
export type RunReceipt = {
|
|
8
|
+
runId: string;
|
|
9
|
+
} & Partial<ResultRun> & Partial<Omit<ProjectRunResponse, keyof ResultRun>> & {
|
|
10
|
+
joined?: boolean;
|
|
11
|
+
cancel?: string;
|
|
12
|
+
};
|
|
13
|
+
interface RunMember extends WaitMemberResult {
|
|
14
|
+
resultId: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
enqueuedAt?: string;
|
|
17
|
+
createdAt?: string;
|
|
18
|
+
dashboardUrl?: string;
|
|
19
|
+
executionUrl?: string;
|
|
20
|
+
}
|
|
21
|
+
export type RunResult = Omit<RunMember, 'error'> & {
|
|
22
|
+
error?: string;
|
|
23
|
+
errorCode?: string;
|
|
24
|
+
};
|
|
25
|
+
interface RunOutputOptions {
|
|
26
|
+
receipts: readonly RunReceipt[];
|
|
27
|
+
outcomes?: ReadonlyMap<string, RunWaitOutcome>;
|
|
28
|
+
joinedScopes?: ReadonlyMap<string, readonly string[] | undefined>;
|
|
29
|
+
/** Results known at dispatch, including list members that have not been listed yet. */
|
|
30
|
+
dispatched?: readonly RunMember[];
|
|
31
|
+
buckets?: Parameters<typeof summarizeRunRows>[1];
|
|
32
|
+
notFoundNote?: string;
|
|
33
|
+
foldSkippedBuckets?: boolean;
|
|
34
|
+
wait: boolean;
|
|
35
|
+
failure?: unknown;
|
|
36
|
+
requestTimedOut?: boolean;
|
|
37
|
+
incompleteDispatch?: boolean;
|
|
38
|
+
cancellation?: (runId: string) => string | undefined;
|
|
39
|
+
}
|
|
40
|
+
/** Normalize the saved-list wire receipt before combining it with listed results. */
|
|
41
|
+
export declare function listResultReceipt(row: CliTestListRunAccepted): RunMember;
|
|
42
|
+
/** Project launches, saved lists and reattached waits share one native output contract. */
|
|
43
|
+
export declare function buildRunOutput(opts: RunOutputOptions): {
|
|
44
|
+
output: {
|
|
45
|
+
partial?: true | undefined;
|
|
46
|
+
runFailures?: {
|
|
47
|
+
runId: string;
|
|
48
|
+
status: "cancelled" | "error" | "timeout";
|
|
49
|
+
message: string;
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
summary?: RunCounts | undefined;
|
|
52
|
+
runs: {
|
|
53
|
+
cancel?: string;
|
|
54
|
+
error?: ({
|
|
55
|
+
code: string;
|
|
56
|
+
message: string;
|
|
57
|
+
exitCode?: number;
|
|
58
|
+
nextAction?: string;
|
|
59
|
+
serverNextAction?: string;
|
|
60
|
+
requestId?: string;
|
|
61
|
+
details?: Record<string, unknown>;
|
|
62
|
+
apiUrl?: string;
|
|
63
|
+
} & {
|
|
64
|
+
exitCode: number;
|
|
65
|
+
}) | undefined;
|
|
66
|
+
timedOut?: boolean | undefined;
|
|
67
|
+
listed?: boolean | undefined;
|
|
68
|
+
status?: "running" | (string & {}) | "finished" | undefined;
|
|
69
|
+
cancelled?: boolean | null | undefined;
|
|
70
|
+
runId: string;
|
|
71
|
+
projectId?: string | null | undefined;
|
|
72
|
+
created?: string | null | undefined;
|
|
73
|
+
modified?: string | null | undefined;
|
|
74
|
+
targetUrl?: string | null | undefined;
|
|
75
|
+
dashboardUrl?: string | null | undefined;
|
|
76
|
+
blocked?: {
|
|
77
|
+
testId: string;
|
|
78
|
+
resultId: string;
|
|
79
|
+
reason: string;
|
|
80
|
+
message?: string;
|
|
81
|
+
}[] | undefined;
|
|
82
|
+
environment?: import("./runs.types.js").RunEnvironmentRef | null | undefined;
|
|
83
|
+
enqueuedAt?: string | undefined;
|
|
84
|
+
total?: number | undefined;
|
|
85
|
+
autoHeal?: boolean | undefined;
|
|
86
|
+
maxConcurrency?: number | undefined;
|
|
87
|
+
tunnelClientId?: string | undefined;
|
|
88
|
+
held?: {
|
|
89
|
+
testId: string;
|
|
90
|
+
runId: string;
|
|
91
|
+
resultId: string;
|
|
92
|
+
}[] | undefined;
|
|
93
|
+
joined?: boolean;
|
|
94
|
+
}[];
|
|
95
|
+
results: RunResult[];
|
|
96
|
+
};
|
|
97
|
+
summary: CiSummary;
|
|
98
|
+
members: {
|
|
99
|
+
testId: string;
|
|
100
|
+
name: string | undefined;
|
|
101
|
+
resultId: string;
|
|
102
|
+
title?: string;
|
|
103
|
+
enqueuedAt?: string;
|
|
104
|
+
createdAt?: string;
|
|
105
|
+
dashboardUrl?: string;
|
|
106
|
+
executionUrl?: string;
|
|
107
|
+
runId?: string;
|
|
108
|
+
joined?: boolean;
|
|
109
|
+
cancel?: string;
|
|
110
|
+
status: string;
|
|
111
|
+
error?: {
|
|
112
|
+
code: string;
|
|
113
|
+
message: string;
|
|
114
|
+
exitCode?: number;
|
|
115
|
+
nextAction?: string;
|
|
116
|
+
serverNextAction?: string;
|
|
117
|
+
requestId?: string;
|
|
118
|
+
details?: Record<string, unknown>;
|
|
119
|
+
apiUrl?: string;
|
|
120
|
+
};
|
|
121
|
+
}[];
|
|
122
|
+
diagnosticRows: ({
|
|
123
|
+
testId: string;
|
|
124
|
+
name: string;
|
|
125
|
+
runId: string;
|
|
126
|
+
status: "cancelled";
|
|
127
|
+
error: {
|
|
128
|
+
code: string;
|
|
129
|
+
message: string;
|
|
130
|
+
exitCode: number;
|
|
131
|
+
};
|
|
132
|
+
} | {
|
|
133
|
+
testId: string;
|
|
134
|
+
name: string;
|
|
135
|
+
runId: string;
|
|
136
|
+
status: "error";
|
|
137
|
+
error: {
|
|
138
|
+
code: string;
|
|
139
|
+
message: string;
|
|
140
|
+
exitCode?: number;
|
|
141
|
+
nextAction?: string;
|
|
142
|
+
serverNextAction?: string;
|
|
143
|
+
requestId?: string;
|
|
144
|
+
details?: Record<string, unknown>;
|
|
145
|
+
apiUrl?: string;
|
|
146
|
+
} & {
|
|
147
|
+
exitCode: number;
|
|
148
|
+
};
|
|
149
|
+
} | {
|
|
150
|
+
testId: string;
|
|
151
|
+
name: string;
|
|
152
|
+
runId: string;
|
|
153
|
+
status: "timeout";
|
|
154
|
+
error: {
|
|
155
|
+
code: string;
|
|
156
|
+
message: string;
|
|
157
|
+
exitCode: number;
|
|
158
|
+
};
|
|
159
|
+
})[];
|
|
160
|
+
unfinishedRuns: {
|
|
161
|
+
cancel?: string;
|
|
162
|
+
error?: ({
|
|
163
|
+
code: string;
|
|
164
|
+
message: string;
|
|
165
|
+
exitCode?: number;
|
|
166
|
+
nextAction?: string;
|
|
167
|
+
serverNextAction?: string;
|
|
168
|
+
requestId?: string;
|
|
169
|
+
details?: Record<string, unknown>;
|
|
170
|
+
apiUrl?: string;
|
|
171
|
+
} & {
|
|
172
|
+
exitCode: number;
|
|
173
|
+
}) | undefined;
|
|
174
|
+
timedOut?: boolean | undefined;
|
|
175
|
+
listed?: boolean | undefined;
|
|
176
|
+
status?: "running" | (string & {}) | "finished" | undefined;
|
|
177
|
+
cancelled?: boolean | null | undefined;
|
|
178
|
+
runId: string;
|
|
179
|
+
projectId?: string | null | undefined;
|
|
180
|
+
created?: string | null | undefined;
|
|
181
|
+
modified?: string | null | undefined;
|
|
182
|
+
targetUrl?: string | null | undefined;
|
|
183
|
+
dashboardUrl?: string | null | undefined;
|
|
184
|
+
blocked?: {
|
|
185
|
+
testId: string;
|
|
186
|
+
resultId: string;
|
|
187
|
+
reason: string;
|
|
188
|
+
message?: string;
|
|
189
|
+
}[] | undefined;
|
|
190
|
+
environment?: import("./runs.types.js").RunEnvironmentRef | null | undefined;
|
|
191
|
+
enqueuedAt?: string | undefined;
|
|
192
|
+
total?: number | undefined;
|
|
193
|
+
autoHeal?: boolean | undefined;
|
|
194
|
+
maxConcurrency?: number | undefined;
|
|
195
|
+
tunnelClientId?: string | undefined;
|
|
196
|
+
held?: {
|
|
197
|
+
testId: string;
|
|
198
|
+
runId: string;
|
|
199
|
+
resultId: string;
|
|
200
|
+
}[] | undefined;
|
|
201
|
+
joined?: boolean;
|
|
202
|
+
}[];
|
|
203
|
+
};
|
|
204
|
+
export type RunCounts = Omit<CiSummary, 'results' | 'runFailures' | 'executionReport'>;
|
|
205
|
+
export declare function runCounts({ results: _results, runFailures: _runFailures, executionReport: _executionReport, ...counts }: CiSummary): RunCounts;
|
|
206
|
+
/** The poll descriptor used by all run previews. Only supplied ids need escaping. */
|
|
207
|
+
export declare function runListingPath(runId?: string): string;
|
|
208
|
+
export declare function previewRun(requests: Array<{
|
|
209
|
+
method: 'GET' | 'POST';
|
|
210
|
+
path: string;
|
|
211
|
+
body?: unknown;
|
|
212
|
+
idempotencyKey?: string;
|
|
213
|
+
}>, wait: boolean, thenPoll?: boolean): {
|
|
214
|
+
thenPoll?: string | undefined;
|
|
215
|
+
dryRun: boolean;
|
|
216
|
+
requests: {
|
|
217
|
+
method: "GET" | "POST";
|
|
218
|
+
path: string;
|
|
219
|
+
body?: unknown;
|
|
220
|
+
idempotencyKey?: string;
|
|
221
|
+
}[];
|
|
222
|
+
partial?: true | undefined;
|
|
223
|
+
runFailures?: {
|
|
224
|
+
runId: string;
|
|
225
|
+
status: "cancelled" | "error" | "timeout";
|
|
226
|
+
message: string;
|
|
227
|
+
}[] | undefined;
|
|
228
|
+
summary?: RunCounts | undefined;
|
|
229
|
+
runs: {
|
|
230
|
+
cancel?: string;
|
|
231
|
+
error?: ({
|
|
232
|
+
code: string;
|
|
233
|
+
message: string;
|
|
234
|
+
exitCode?: number;
|
|
235
|
+
nextAction?: string;
|
|
236
|
+
serverNextAction?: string;
|
|
237
|
+
requestId?: string;
|
|
238
|
+
details?: Record<string, unknown>;
|
|
239
|
+
apiUrl?: string;
|
|
240
|
+
} & {
|
|
241
|
+
exitCode: number;
|
|
242
|
+
}) | undefined;
|
|
243
|
+
timedOut?: boolean | undefined;
|
|
244
|
+
listed?: boolean | undefined;
|
|
245
|
+
status?: "running" | (string & {}) | "finished" | undefined;
|
|
246
|
+
cancelled?: boolean | null | undefined;
|
|
247
|
+
runId: string;
|
|
248
|
+
projectId?: string | null | undefined;
|
|
249
|
+
created?: string | null | undefined;
|
|
250
|
+
modified?: string | null | undefined;
|
|
251
|
+
targetUrl?: string | null | undefined;
|
|
252
|
+
dashboardUrl?: string | null | undefined;
|
|
253
|
+
blocked?: {
|
|
254
|
+
testId: string;
|
|
255
|
+
resultId: string;
|
|
256
|
+
reason: string;
|
|
257
|
+
message?: string;
|
|
258
|
+
}[] | undefined;
|
|
259
|
+
environment?: import("./runs.types.js").RunEnvironmentRef | null | undefined;
|
|
260
|
+
enqueuedAt?: string | undefined;
|
|
261
|
+
total?: number | undefined;
|
|
262
|
+
autoHeal?: boolean | undefined;
|
|
263
|
+
maxConcurrency?: number | undefined;
|
|
264
|
+
tunnelClientId?: string | undefined;
|
|
265
|
+
held?: {
|
|
266
|
+
testId: string;
|
|
267
|
+
runId: string;
|
|
268
|
+
resultId: string;
|
|
269
|
+
}[] | undefined;
|
|
270
|
+
joined?: boolean;
|
|
271
|
+
}[];
|
|
272
|
+
results: RunResult[];
|
|
273
|
+
};
|
|
274
|
+
export declare function renderRunResults(runs: readonly RunReceipt[], results: readonly RunResult[], summary?: CiSummary, notes?: readonly string[]): string;
|
|
275
|
+
export {};
|