@devicecloud.dev/dcd 5.11.0-beta.6 → 5.11.0-beta.8
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/dist/commands/cloud.js +6 -1
- package/dist/commands/device.js +31 -3
- package/dist/gateways/device-gateway.d.ts +1 -1
- package/dist/gateways/device-gateway.js +2 -2
- package/dist/mcp/bridge.js +7 -2
- package/dist/mcp/tools/run-cloud-test.js +1 -1
- package/dist/services/execution-plan.service.d.ts +27 -0
- package/dist/services/execution-plan.service.js +9 -1
- package/dist/types/domain/device-session.types.d.ts +14 -0
- package/dist/utils/device-bundle.d.ts +16 -3
- package/dist/utils/device-bundle.js +75 -9
- package/dist/utils/device-run.js +8 -0
- package/package.json +1 -1
package/dist/commands/cloud.js
CHANGED
|
@@ -6,7 +6,7 @@ import { flags as allFlags } from '../constants.js';
|
|
|
6
6
|
import { ApiGateway } from '../gateways/api-gateway.js';
|
|
7
7
|
import { uploadBinary, uploadFlowZip, verifyAppZip, writeJSONFile, } from '../methods.js';
|
|
8
8
|
import { DeviceValidationService } from '../services/device-validation.service.js';
|
|
9
|
-
import { plan } from '../services/execution-plan.service.js';
|
|
9
|
+
import { countExtendedRuntimeFlows, plan } from '../services/execution-plan.service.js';
|
|
10
10
|
import { isSubmitEndpointMissing, submitWithRetry, } from '../services/flow-submit.service.js';
|
|
11
11
|
import { buildTestMetadataMap, computeCommonRoot, } from '../services/flow-paths.js';
|
|
12
12
|
import { MoropoService } from '../services/moropo.service.js';
|
|
@@ -523,6 +523,11 @@ export const cloudCommand = defineCommand({
|
|
|
523
523
|
submitRows.push(colors.dim(`${flowPath.replace(process.cwd(), '.')}:`));
|
|
524
524
|
submitRows.push(...ui.fields(Object.entries(overrides).map(([key, value]) => [key, colors.highlight(String(value))])));
|
|
525
525
|
}
|
|
526
|
+
// The 2x is charged per flow, so say it before the run, not on the bill.
|
|
527
|
+
const extendedFlows = countExtendedRuntimeFlows(flowOverrides);
|
|
528
|
+
if (extendedFlows > 0) {
|
|
529
|
+
submitRows.push('', ui.note(`${extendedFlows} flow${extendedFlows === 1 ? '' : 's'} with extended runtime: up to 20 min each, billed at 2×`));
|
|
530
|
+
}
|
|
526
531
|
}
|
|
527
532
|
out(ui.section('Submitting new job'));
|
|
528
533
|
out(ui.branch(submitRows));
|
package/dist/commands/device.js
CHANGED
|
@@ -583,13 +583,21 @@ const modelsSub = defineCommand({
|
|
|
583
583
|
});
|
|
584
584
|
const inspectSub = defineCommand({
|
|
585
585
|
meta: { name: 'inspect', description: 'The screen as compact JSON: each element with text, an id or a label' },
|
|
586
|
-
args: {
|
|
586
|
+
args: {
|
|
587
|
+
...commonArgs,
|
|
588
|
+
id: idArg,
|
|
589
|
+
all: {
|
|
590
|
+
type: 'boolean',
|
|
591
|
+
default: false,
|
|
592
|
+
description: 'Also list the keyboard keys and the System UI (status and navigation bars)',
|
|
593
|
+
},
|
|
594
|
+
},
|
|
587
595
|
async run({ args }) {
|
|
588
596
|
const json = Boolean(args.json);
|
|
589
597
|
await runDeviceCommand(json, async () => {
|
|
590
598
|
const ctx = await context(args);
|
|
591
599
|
const id = await resolveSessionId(ctx.apiUrl, ctx.auth, args.id);
|
|
592
|
-
const { screen, session } = await DeviceGateway.inspect(ctx.apiUrl, ctx.auth, id);
|
|
600
|
+
const { screen, session } = await DeviceGateway.inspect(ctx.apiUrl, ctx.auth, id, Boolean(args.all));
|
|
593
601
|
return {
|
|
594
602
|
session,
|
|
595
603
|
data: { screen },
|
|
@@ -597,6 +605,14 @@ const inspectSub = defineCommand({
|
|
|
597
605
|
logger.log(ui.section(`Screen ${screen.width}x${screen.height}, ${screen.elements.length} elements` +
|
|
598
606
|
(screen.fresh ? '' : colors.dim(' (no new frame; this is the latest)'))));
|
|
599
607
|
logger.log(ui.branch(screen.elements.map((el) => formatElement(el))));
|
|
608
|
+
const notes = [];
|
|
609
|
+
if (screen.keyboard_open)
|
|
610
|
+
notes.push('A keyboard is open.');
|
|
611
|
+
if (screen.hidden && (screen.hidden.keyboard > 0 || screen.hidden.system > 0)) {
|
|
612
|
+
notes.push(`Left out ${screen.hidden.keyboard} keyboard and ${screen.hidden.system} System UI elements (--all shows them).`);
|
|
613
|
+
}
|
|
614
|
+
if (notes.length > 0)
|
|
615
|
+
logger.log(ui.note(notes.join(' ')));
|
|
600
616
|
},
|
|
601
617
|
};
|
|
602
618
|
});
|
|
@@ -613,6 +629,12 @@ export function formatElement(el) {
|
|
|
613
629
|
parts.push(`id:${el.rid}`);
|
|
614
630
|
if (el.hint)
|
|
615
631
|
parts.push(`hint:"${el.hint}"`);
|
|
632
|
+
for (const state of ['checked', 'selected', 'focused']) {
|
|
633
|
+
if (el[state])
|
|
634
|
+
parts.push(state);
|
|
635
|
+
}
|
|
636
|
+
if (el.enabled === false)
|
|
637
|
+
parts.push('disabled');
|
|
616
638
|
return `${parts.join(' ')} ${colors.dim(el.b)}`;
|
|
617
639
|
}
|
|
618
640
|
/** `data:image/jpeg;base64,...` to bytes and a file extension. */
|
|
@@ -745,7 +767,13 @@ const runSub = defineCommand({
|
|
|
745
767
|
let body;
|
|
746
768
|
if (dir) {
|
|
747
769
|
ctx.progress(ui.running(`Uploading the flows in ${colors.highlight(dir)}…`));
|
|
748
|
-
const bundle = await uploadFlowBundle({
|
|
770
|
+
const bundle = await uploadFlowBundle({
|
|
771
|
+
apiUrl: ctx.apiUrl,
|
|
772
|
+
auth: ctx.auth,
|
|
773
|
+
dir,
|
|
774
|
+
entry,
|
|
775
|
+
log: ctx.progress,
|
|
776
|
+
});
|
|
749
777
|
ctx.progress(ui.success(`Uploaded ${bundle.files} files`));
|
|
750
778
|
body = {
|
|
751
779
|
flowUploadId: bundle.id,
|
|
@@ -22,7 +22,7 @@ export declare const DeviceGateway: {
|
|
|
22
22
|
human: DeviceHumanStatus;
|
|
23
23
|
session: DeviceSession;
|
|
24
24
|
}>;
|
|
25
|
-
inspect(baseUrl: string, auth: AuthContext, id: string): Promise<{
|
|
25
|
+
inspect(baseUrl: string, auth: AuthContext, id: string, all?: boolean): Promise<{
|
|
26
26
|
screen: DeviceScreen;
|
|
27
27
|
session: DeviceSession;
|
|
28
28
|
}>;
|
|
@@ -97,8 +97,8 @@ export const DeviceGateway = {
|
|
|
97
97
|
human(baseUrl, auth, id) {
|
|
98
98
|
return request(baseUrl, auth, 'GET', `${sessionPath(id)}/human`);
|
|
99
99
|
},
|
|
100
|
-
inspect(baseUrl, auth, id) {
|
|
101
|
-
return request(baseUrl, auth, 'GET', `${sessionPath(id)}/inspect`);
|
|
100
|
+
inspect(baseUrl, auth, id, all = false) {
|
|
101
|
+
return request(baseUrl, auth, 'GET', `${sessionPath(id)}/inspect${all ? '?all=true' : ''}`);
|
|
102
102
|
},
|
|
103
103
|
install(baseUrl, auth, id, app) {
|
|
104
104
|
return request(baseUrl, auth, 'POST', `${sessionPath(id)}/install`, app);
|
package/dist/mcp/bridge.js
CHANGED
|
@@ -47,7 +47,7 @@ const LOCAL_INPUTS = {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
run: {
|
|
50
|
-
description: ' Or pass path: a flow file on this machine (sent as yaml), or a directory of flows (
|
|
50
|
+
description: ' Or pass path: a flow file on this machine (sent as yaml), or a directory of flows (flow picks the entry file inside it). Only the YAML files and the files the flows use (scripts, media) are uploaded, not builds or anything else in the directory.',
|
|
51
51
|
properties: {
|
|
52
52
|
path: {
|
|
53
53
|
type: 'string',
|
|
@@ -93,7 +93,12 @@ export async function resolveLocalInputs(name, args, ctx) {
|
|
|
93
93
|
throw new Error(`No such file or directory: ${flowPath}`);
|
|
94
94
|
if (info.isDirectory()) {
|
|
95
95
|
logStderr(`Uploading the flows in ${flowPath}…`);
|
|
96
|
-
const bundle = await uploadFlowBundle({
|
|
96
|
+
const bundle = await uploadFlowBundle({
|
|
97
|
+
...ctx,
|
|
98
|
+
dir: flowPath,
|
|
99
|
+
entry: typeof rest.flow === 'string' ? rest.flow : undefined,
|
|
100
|
+
log: logStderr,
|
|
101
|
+
});
|
|
97
102
|
return { ...rest, flow_upload_id: bundle.id };
|
|
98
103
|
}
|
|
99
104
|
return { ...rest, yaml: await readFile(flowPath, 'utf8') };
|
|
@@ -95,7 +95,7 @@ export function registerRunCloudTest(server) {
|
|
|
95
95
|
.min(30)
|
|
96
96
|
.max(3600)
|
|
97
97
|
.optional()
|
|
98
|
-
.describe('Max seconds to wait when wait is true (default 600)'),
|
|
98
|
+
.describe('Max seconds to wait when wait is true (default 600). A flow with DEVICECLOUD_OVERRIDE_EXTENDED_RUNTIME: true in its env can run for up to 20 minutes, so raise this when the run includes one.'),
|
|
99
99
|
},
|
|
100
100
|
annotations: {
|
|
101
101
|
title: 'Run a cloud test',
|
|
@@ -37,6 +37,33 @@ interface IFlowSequence {
|
|
|
37
37
|
continueOnFailure?: boolean;
|
|
38
38
|
flows: string[];
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* How many flows opt into the extended test runtime (up to 20 minutes, billed
|
|
42
|
+
* accepts: YAML `true` or the string `'true'`.
|
|
43
|
+
* accepts: YAML `true` or the string `'true'`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function countExtendedRuntimeFlows(flowOverrides: Record<string, Record<string, unknown>>): number;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve `config.yaml`'s `includedPaths` globs into absolute file paths.
|
|
48
|
+
*
|
|
49
|
+
* This is the general-purpose escape hatch for shipping files the flow
|
|
50
|
+
* commands don't reference: `assertScreenshot` baselines above all, but also
|
|
51
|
+
* fixtures, test data and certificates. Only `addMedia` / `runFlow` /
|
|
52
|
+
* `runScript` arguments are discovered by walking the flows, so without this
|
|
53
|
+
* key such files are silently absent from the uploaded zip.
|
|
54
|
+
*
|
|
55
|
+
* Glob semantics deliberately mirror `flows:` (`applyFlowGlobs`): patterns
|
|
56
|
+
* resolve against the workspace root, never the config file's directory, so
|
|
57
|
+
* `--config ci/workspace.yaml` behaves identically to an auto-detected config.
|
|
58
|
+
*
|
|
59
|
+
* @param workspaceConfig - Validated workspace config
|
|
60
|
+
* @param normalizedInput - Normalized path to the workspace directory
|
|
61
|
+
* @param warn - Sink for non-fatal problems
|
|
62
|
+
* @param debug - Whether to emit debug logging
|
|
63
|
+
* @returns Absolute paths of every matched file, deduped and sorted
|
|
64
|
+
* @throws Error if a pattern escapes the workspace root
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveIncludedPaths(workspaceConfig: IWorkspaceConfig, normalizedInput: string, warn: (message: string) => void, debug?: boolean): string[];
|
|
40
67
|
/**
|
|
41
68
|
* Generate execution plan for test flows
|
|
42
69
|
*
|
|
@@ -83,6 +83,14 @@ function extractDeviceCloudOverrides(config) {
|
|
|
83
83
|
}
|
|
84
84
|
return overrides;
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* How many flows opt into the extended test runtime (up to 20 minutes, billed
|
|
88
|
+
* accepts: YAML `true` or the string `'true'`.
|
|
89
|
+
* accepts: YAML `true` or the string `'true'`.
|
|
90
|
+
*/
|
|
91
|
+
export function countExtendedRuntimeFlows(flowOverrides) {
|
|
92
|
+
return Object.values(flowOverrides).filter(({ EXTENDED_RUNTIME }) => EXTENDED_RUNTIME === true || EXTENDED_RUNTIME === 'true').length;
|
|
93
|
+
}
|
|
86
94
|
/**
|
|
87
95
|
* Generate execution plan for a single flow file
|
|
88
96
|
* @param normalizedInput - Normalized path to the flow file
|
|
@@ -210,7 +218,7 @@ const INCLUDED_PATHS_BYTES_WARN_THRESHOLD = 50 * 1024 * 1024;
|
|
|
210
218
|
* @returns Absolute paths of every matched file, deduped and sorted
|
|
211
219
|
* @throws Error if a pattern escapes the workspace root
|
|
212
220
|
*/
|
|
213
|
-
function resolveIncludedPaths(workspaceConfig, normalizedInput, warn, debug = false) {
|
|
221
|
+
export function resolveIncludedPaths(workspaceConfig, normalizedInput, warn, debug = false) {
|
|
214
222
|
const patterns = workspaceConfig.includedPaths;
|
|
215
223
|
if (!patterns || patterns.length === 0)
|
|
216
224
|
return [];
|
|
@@ -105,6 +105,8 @@ export interface DeviceCommandResult {
|
|
|
105
105
|
/** Each flow of a run. Absent from APIs older than this field. */
|
|
106
106
|
flows?: DeviceFlowResult[];
|
|
107
107
|
output?: string;
|
|
108
|
+
/** A failed run: the app's visible text just after it failed. */
|
|
109
|
+
screen_text?: string[];
|
|
108
110
|
success: boolean;
|
|
109
111
|
}
|
|
110
112
|
/** One element of the compact screen (Maestro's key names). */
|
|
@@ -112,8 +114,13 @@ export interface DeviceScreenElement {
|
|
|
112
114
|
/** Bounds, "[left,top][right,bottom]". */
|
|
113
115
|
b: string;
|
|
114
116
|
a11y?: string;
|
|
117
|
+
checked?: true;
|
|
118
|
+
/** False when disabled; absent when enabled. */
|
|
119
|
+
enabled?: false;
|
|
120
|
+
focused?: true;
|
|
115
121
|
hint?: string;
|
|
116
122
|
rid?: string;
|
|
123
|
+
selected?: true;
|
|
117
124
|
txt?: string;
|
|
118
125
|
}
|
|
119
126
|
/** GET .../inspect: the elements worth targeting, and what each key means. */
|
|
@@ -122,6 +129,13 @@ export interface DeviceScreen {
|
|
|
122
129
|
/** False when no new frame came in time; this is then the latest. */
|
|
123
130
|
fresh: boolean;
|
|
124
131
|
height: number;
|
|
132
|
+
/** Keyboard keys and System UI left out (only when some were); --all shows them. */
|
|
133
|
+
hidden?: {
|
|
134
|
+
keyboard: number;
|
|
135
|
+
system: number;
|
|
136
|
+
};
|
|
137
|
+
/** An on-screen keyboard is showing (Android). */
|
|
138
|
+
keyboard_open?: true;
|
|
125
139
|
keys: Record<string, string>;
|
|
126
140
|
width: number;
|
|
127
141
|
}
|
|
@@ -2,16 +2,29 @@ import type { AuthContext } from '../types/domain/auth.types.js';
|
|
|
2
2
|
import type { DeviceFlowBundle } from '../types/domain/device-session.types.js';
|
|
3
3
|
/** The API's limit on a bundle (dcd plan 2.5b). */
|
|
4
4
|
export declare const MAX_BUNDLE_BYTES: number;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The files under `dir` a bundle needs, relative to it, in a stable order:
|
|
7
|
+
* every YAML file (flows, subflows, config), the files the flows use
|
|
8
|
+
* (runScript, addMedia, assertScreenshot and the like), and config's
|
|
9
|
+
* includedPaths. Nothing else: an agent's samples folder sent 265 MB of .apk
|
|
10
|
+
* and .zip files with its flows.
|
|
11
|
+
*
|
|
12
|
+
* `entry` is the one flow that will run. Its files must all be inside `dir`.
|
|
13
|
+
* Without an entry every flow may run, so that goes for all of them. Another
|
|
14
|
+
* flow's missing file doesn't stop the entry running, so it is left out.
|
|
15
|
+
*/
|
|
16
|
+
export declare function bundleFiles(dir: string, entry?: string, warn?: (message: string) => void): string[];
|
|
7
17
|
export interface UploadFlowBundleOptions {
|
|
8
18
|
apiUrl: string;
|
|
9
19
|
auth: AuthContext;
|
|
10
20
|
dir: string;
|
|
21
|
+
/** The one flow that will run, a path inside `dir`. Omitted, all of them. */
|
|
22
|
+
entry?: string;
|
|
11
23
|
log: (message: string) => void;
|
|
12
24
|
}
|
|
13
25
|
/**
|
|
14
|
-
* Zip a directory
|
|
26
|
+
* Zip the files a directory's flows need (bundleFiles) and upload them as a
|
|
27
|
+
* flow bundle: ask the API for
|
|
15
28
|
* upload URLs, PUT the zip to both copies, then register it with its
|
|
16
29
|
* SHA-256. Encrypted like `dcd cloud`'s flow zips when the org's default
|
|
17
30
|
* (or DCD_ENCRYPT) says so. Entries are relative to `dir`, so a run's
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { DeviceGateway } from '../gateways/device-gateway.js';
|
|
5
5
|
import { compressFilesFromRelativePath } from '../methods.js';
|
|
6
|
+
import { resolveIncludedPaths } from '../services/execution-plan.service.js';
|
|
7
|
+
import { isWorkspaceConfigFile, loadWorkspaceConfig, processDependencies, readTestYamlFileAsJson, } from '../services/execution-plan.utils.js';
|
|
6
8
|
import { detectCiContext } from './ci.js';
|
|
7
9
|
import { CliError, getCliVersion } from './cli.js';
|
|
8
10
|
import { fetchCompatibilityData } from './compatibility.js';
|
|
@@ -15,13 +17,76 @@ function skipped(relativePath) {
|
|
|
15
17
|
.split(path.sep)
|
|
16
18
|
.some((part) => part === 'node_modules' || (part.startsWith('.') && part !== '.'));
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
const YAML_FILE = /\.ya?ml$/i;
|
|
21
|
+
/** Every file under `dir`, relative to it. */
|
|
22
|
+
function allFiles(dir) {
|
|
20
23
|
return readdirSync(dir, { recursive: true, withFileTypes: true })
|
|
21
24
|
.filter((entry) => entry.isFile())
|
|
22
25
|
.map((entry) => path.relative(dir, path.join(entry.parentPath, entry.name)))
|
|
23
|
-
.filter((file) => !skipped(file))
|
|
24
|
-
|
|
26
|
+
.filter((file) => !skipped(file));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The files under `dir` a bundle needs, relative to it, in a stable order:
|
|
30
|
+
* every YAML file (flows, subflows, config), the files the flows use
|
|
31
|
+
* (runScript, addMedia, assertScreenshot and the like), and config's
|
|
32
|
+
* includedPaths. Nothing else: an agent's samples folder sent 265 MB of .apk
|
|
33
|
+
* and .zip files with its flows.
|
|
34
|
+
*
|
|
35
|
+
* `entry` is the one flow that will run. Its files must all be inside `dir`.
|
|
36
|
+
* Without an entry every flow may run, so that goes for all of them. Another
|
|
37
|
+
* flow's missing file doesn't stop the entry running, so it is left out.
|
|
38
|
+
*/
|
|
39
|
+
export function bundleFiles(dir, entry, warn = () => { }) {
|
|
40
|
+
const root = path.resolve(dir);
|
|
41
|
+
const yamlFiles = allFiles(dir).filter((file) => YAML_FILE.test(file));
|
|
42
|
+
const entryFile = entry === undefined ? undefined : path.normalize(entry);
|
|
43
|
+
if (entryFile !== undefined && !yamlFiles.includes(entryFile)) {
|
|
44
|
+
throw new CliError(`No flow ${entry} in ${dir}.`);
|
|
45
|
+
}
|
|
46
|
+
const needed = new Set(yamlFiles);
|
|
47
|
+
const problems = [];
|
|
48
|
+
const add = (absolute, strict, from) => {
|
|
49
|
+
const relative = path.relative(root, absolute);
|
|
50
|
+
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
51
|
+
if (strict)
|
|
52
|
+
problems.push(`${from} uses ${absolute}, which is outside ${dir}. Pass a directory that holds both.`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
needed.add(relative);
|
|
56
|
+
};
|
|
57
|
+
for (const file of yamlFiles) {
|
|
58
|
+
const absolute = path.join(root, file);
|
|
59
|
+
const strict = entryFile === undefined || entryFile === file;
|
|
60
|
+
if (isWorkspaceConfigFile(absolute))
|
|
61
|
+
continue;
|
|
62
|
+
let deps;
|
|
63
|
+
try {
|
|
64
|
+
const { config, testSteps } = readTestYamlFileAsJson(absolute);
|
|
65
|
+
deps = processDependencies({ config, input: absolute, testSteps });
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
// Not a flow (a data file, say), or one Maestro will report itself.
|
|
69
|
+
if (entryFile === file)
|
|
70
|
+
throw new CliError(error.message);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (strict)
|
|
74
|
+
problems.push(...deps.allErrors);
|
|
75
|
+
for (const dep of deps.allFiles) {
|
|
76
|
+
if (existsSync(dep))
|
|
77
|
+
add(dep, strict, file);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const name of ['config.yaml', 'config.yml']) {
|
|
81
|
+
if (!yamlFiles.includes(name))
|
|
82
|
+
continue;
|
|
83
|
+
const config = loadWorkspaceConfig(path.join(root, name), warn);
|
|
84
|
+
for (const file of resolveIncludedPaths(config, root, warn))
|
|
85
|
+
add(file, true, name);
|
|
86
|
+
}
|
|
87
|
+
if (problems.length > 0)
|
|
88
|
+
throw new CliError(problems.join('\n'));
|
|
89
|
+
return [...needed].sort();
|
|
25
90
|
}
|
|
26
91
|
/** PUT the zip to one signed URL. The URL is the credential. */
|
|
27
92
|
async function put(url, body) {
|
|
@@ -46,16 +111,17 @@ async function put(url, body) {
|
|
|
46
111
|
return false;
|
|
47
112
|
}
|
|
48
113
|
/**
|
|
49
|
-
* Zip a directory
|
|
114
|
+
* Zip the files a directory's flows need (bundleFiles) and upload them as a
|
|
115
|
+
* flow bundle: ask the API for
|
|
50
116
|
* upload URLs, PUT the zip to both copies, then register it with its
|
|
51
117
|
* SHA-256. Encrypted like `dcd cloud`'s flow zips when the org's default
|
|
52
118
|
* (or DCD_ENCRYPT) says so. Entries are relative to `dir`, so a run's
|
|
53
119
|
* `flow` is a path inside it, e.g. `login.yaml`.
|
|
54
120
|
*/
|
|
55
121
|
export async function uploadFlowBundle(opts) {
|
|
56
|
-
const { apiUrl, auth, dir, log } = opts;
|
|
57
|
-
const files = bundleFiles(dir);
|
|
58
|
-
if (!files.some((f) =>
|
|
122
|
+
const { apiUrl, auth, dir, entry, log } = opts;
|
|
123
|
+
const files = bundleFiles(dir, entry, log);
|
|
124
|
+
if (!files.some((f) => YAML_FILE.test(f))) {
|
|
59
125
|
throw new CliError(`No flow files (.yaml) in ${dir}.`);
|
|
60
126
|
}
|
|
61
127
|
const zip = await compressFilesFromRelativePath(dir, files, '');
|
package/dist/utils/device-run.js
CHANGED
|
@@ -65,6 +65,14 @@ export function runFailureMessage(result, report) {
|
|
|
65
65
|
* (a single flow's report has no file name).
|
|
66
66
|
*/
|
|
67
67
|
export function printRunResult(log, passed, result, label) {
|
|
68
|
+
printOutcome(log, passed, result, label);
|
|
69
|
+
// What the app showed after the failure: why an assertion missed.
|
|
70
|
+
if (!passed && result.screen_text?.length) {
|
|
71
|
+
log(ui.section('On screen after the failure'));
|
|
72
|
+
log(ui.branch(result.screen_text.map((t) => `"${t}"`)));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function printOutcome(log, passed, result, label) {
|
|
68
76
|
const report = parseRunReport(result);
|
|
69
77
|
if (!report || report.flows.length === 0) {
|
|
70
78
|
log(passed ? ui.success('Flow passed') : `${ui.statusSymbol('FAILED')} Flow failed`);
|
package/package.json
CHANGED