@midscene/test 1.12.4-beta-20260903111111.0 → 1.12.4
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/es/android/index.mjs +50 -106
- package/dist/es/android/index.mjs.map +1 -1
- package/dist/es/cli/index.mjs +99 -149
- package/dist/es/cli/index.mjs.map +1 -1
- package/dist/es/harmony/index.mjs +119 -0
- package/dist/es/harmony/index.mjs.map +1 -0
- package/dist/es/index.mjs +36 -87
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/ios/index.mjs +51 -101
- package/dist/es/ios/index.mjs.map +1 -1
- package/dist/es/midscene/index.mjs +37 -235
- package/dist/es/midscene/index.mjs.map +1 -1
- package/dist/es/playwright/index.mjs +14 -10
- package/dist/es/playwright/index.mjs.map +1 -1
- package/dist/es/test-cli.mjs +102 -150
- package/dist/es/test-cli.mjs.map +1 -1
- package/dist/lib/android/index.js +151 -178
- package/dist/lib/android/index.js.map +1 -1
- package/dist/lib/cli/index.js +99 -149
- package/dist/lib/cli/index.js.map +1 -1
- package/dist/lib/harmony/index.js +188 -0
- package/dist/lib/harmony/index.js.map +1 -0
- package/dist/lib/index.js +37 -100
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/ios/index.js +152 -173
- package/dist/lib/ios/index.js.map +1 -1
- package/dist/lib/midscene/index.js +264 -412
- package/dist/lib/midscene/index.js.map +1 -1
- package/dist/lib/playwright/index.js +14 -10
- package/dist/lib/playwright/index.js.map +1 -1
- package/dist/lib/test-cli.js +102 -150
- package/dist/lib/test-cli.js.map +1 -1
- package/dist/types/android/index.d.ts +27 -101
- package/dist/types/cli/index.d.ts +9 -32
- package/dist/types/harmony/index.d.ts +124 -0
- package/dist/types/index.d.ts +18 -45
- package/dist/types/ios/index.d.ts +28 -107
- package/dist/types/midscene/index.d.ts +54 -153
- package/dist/types/playwright/index.d.ts +9 -63
- package/package.json +25 -6
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import type { AndroidAgent } from '@midscene/android';
|
|
2
|
+
import { launchInputSchema } from '@midscene/android/test-runner';
|
|
3
|
+
import { LaunchNodeInput } from '@midscene/android/test-runner';
|
|
4
|
+
import { runAdbShellInputSchema } from '@midscene/android/test-runner';
|
|
5
|
+
import { RunAdbShellNodeInput } from '@midscene/android/test-runner';
|
|
6
|
+
import { runAdbShellOptionsInputSchema } from '@midscene/android/test-runner';
|
|
7
|
+
import { terminateInputSchema } from '@midscene/android/test-runner';
|
|
8
|
+
import { TerminateNodeInput } from '@midscene/android/test-runner';
|
|
9
|
+
import type { z } from 'zod/v4';
|
|
10
|
+
|
|
11
|
+
export declare type AndroidRunnerAgent = Pick<AndroidAgent, 'launch' | 'terminate' | 'runAdbShell' | 'back' | 'home' | 'recentApps'>;
|
|
10
12
|
|
|
11
13
|
declare type Awaitable<T> = T | Promise<T>;
|
|
12
14
|
|
|
@@ -18,56 +20,37 @@ declare interface CaseExecutionContext {
|
|
|
18
20
|
readonly name: string;
|
|
19
21
|
readonly sourcePath: string;
|
|
20
22
|
readonly caseIndex: number;
|
|
21
|
-
readonly completedSteps: readonly StepRunResult[];
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
declare type CaseNodePhase = 'beforeEach' | 'steps' | 'afterEach';
|
|
25
26
|
|
|
26
|
-
declare interface CommonNodeInput {
|
|
27
|
-
prompt?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Create the P0 Android preset Nodes for an injected Android Agent. */
|
|
31
27
|
export declare function createAndroidNodes<TContext>(options: CreateAndroidNodesOptions<TContext>): readonly NodeDefinition<any, any, TContext>[];
|
|
32
28
|
|
|
33
|
-
/** Dependencies used by the Android preset Nodes. */
|
|
34
29
|
export declare interface CreateAndroidNodesOptions<TContext> {
|
|
35
|
-
|
|
36
|
-
getAgent(ctx: NodeContext<TContext>): Awaitable<AndroidRunnerAgent>;
|
|
30
|
+
getAgent(ctx: NodeExecutionContext<unknown, TContext>): Awaitable<AndroidRunnerAgent>;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TContext = unknown> {
|
|
40
34
|
name: string;
|
|
41
35
|
title?: string;
|
|
42
36
|
description?: string;
|
|
37
|
+
/** Object field populated by string shorthand. Omit or set false to disable it. */
|
|
38
|
+
stringInputKey?: string | false;
|
|
43
39
|
inputSchema?: NodeInputSchema;
|
|
44
40
|
execute(ctx: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
/** Device capabilities required by Android and iOS lifecycle Nodes. */
|
|
48
|
-
declare interface DeviceLifecycleAgent {
|
|
49
|
-
launch(uri: string): Promise<void>;
|
|
50
|
-
terminate(uri: string): Promise<void>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
43
|
declare type DocumentNodePhase = 'beforeAll' | 'afterAll';
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
export declare const launchInputSchema: z.ZodObject<{
|
|
57
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
58
|
-
uri: z.ZodOptional<z.ZodString>;
|
|
59
|
-
}, z.core.$strict>;
|
|
45
|
+
export { launchInputSchema }
|
|
60
46
|
|
|
61
|
-
export
|
|
47
|
+
export { LaunchNodeInput }
|
|
62
48
|
|
|
63
49
|
declare interface NodeCaseContext extends CaseExecutionContext {
|
|
64
50
|
readonly phase: CaseNodePhase;
|
|
65
51
|
readonly stepIndex: number;
|
|
66
|
-
readonly completedNodes: readonly StepRunResult[];
|
|
67
52
|
}
|
|
68
53
|
|
|
69
|
-
declare type NodeContext<TContext> = NodeExecutionContext<unknown, TContext>;
|
|
70
|
-
|
|
71
54
|
declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
|
|
72
55
|
}
|
|
73
56
|
|
|
@@ -79,64 +62,43 @@ declare interface NodeDocumentContext {
|
|
|
79
62
|
readonly sourcePath: string;
|
|
80
63
|
readonly phase: DocumentNodePhase;
|
|
81
64
|
readonly stepIndex: number;
|
|
82
|
-
readonly completedNodes: readonly StepRunResult[];
|
|
83
65
|
}
|
|
84
66
|
|
|
85
67
|
declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
|
|
86
68
|
/** The node is running for one case. */
|
|
87
69
|
scope: 'case';
|
|
88
|
-
/** Identity and
|
|
70
|
+
/** Identity and phase information for the case being executed. */
|
|
89
71
|
case: NodeCaseContext;
|
|
90
72
|
document?: never;
|
|
91
73
|
} | {
|
|
92
74
|
/** The node is running for the workflow document. */
|
|
93
75
|
scope: 'document';
|
|
94
|
-
/** Identity and
|
|
76
|
+
/** Identity and phase information for the document being executed. */
|
|
95
77
|
document: NodeDocumentContext;
|
|
96
78
|
case?: never;
|
|
97
79
|
});
|
|
98
80
|
|
|
99
81
|
declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
|
|
100
|
-
/** The node input without
|
|
101
|
-
input: TInput
|
|
82
|
+
/** The validated node input without `$`. */
|
|
83
|
+
input: TInput;
|
|
102
84
|
/** The normalized engine metadata for this step. */
|
|
103
85
|
$: Readonly<NormalizedStepMeta>;
|
|
104
86
|
/** The timeout and cancellation signal for this step. */
|
|
105
87
|
signal: AbortSignal;
|
|
106
88
|
/** Resources shared by the current workflow document. */
|
|
107
89
|
context: TContext;
|
|
108
|
-
/** Read-only results completed in the current document/case scope. */
|
|
109
|
-
history: readonly NodeHistoryEntry[];
|
|
110
90
|
/** Register resource cleanup for the current case attempt or document. */
|
|
111
91
|
onTeardown(teardown: NodeScopeTeardown): void;
|
|
112
92
|
}
|
|
113
93
|
|
|
114
|
-
declare type NodeExecutionPhase = CaseNodePhase | DocumentNodePhase;
|
|
115
|
-
|
|
116
94
|
declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
|
|
117
95
|
|
|
118
|
-
declare interface NodeHistoryEntry {
|
|
119
|
-
readonly scope: 'document' | 'case';
|
|
120
|
-
readonly phase: NodeExecutionPhase;
|
|
121
|
-
readonly stepIndex: number;
|
|
122
|
-
readonly node: string;
|
|
123
|
-
readonly input?: unknown;
|
|
124
|
-
readonly intent?: string;
|
|
125
|
-
readonly status: 'passed' | 'failed' | 'skipped';
|
|
126
|
-
readonly summary?: string;
|
|
127
|
-
readonly data?: unknown;
|
|
128
|
-
readonly error?: {
|
|
129
|
-
readonly name: string;
|
|
130
|
-
readonly message: string;
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
96
|
declare type NodeInputSchema = z.ZodObject;
|
|
135
97
|
|
|
136
98
|
declare interface NodeResult<TData = unknown> {
|
|
137
|
-
/** Human-readable summary for reports
|
|
99
|
+
/** Human-readable summary for reports. */
|
|
138
100
|
summary?: string;
|
|
139
|
-
/** Structured data
|
|
101
|
+
/** Structured data included in the step result. */
|
|
140
102
|
data?: TData;
|
|
141
103
|
}
|
|
142
104
|
|
|
@@ -152,50 +114,14 @@ declare interface NormalizedStepMeta {
|
|
|
152
114
|
continueOnError: boolean;
|
|
153
115
|
}
|
|
154
116
|
|
|
155
|
-
|
|
156
|
-
export declare const runAdbShellInputSchema: z.ZodObject<{
|
|
157
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
158
|
-
command: z.ZodOptional<z.ZodString>;
|
|
159
|
-
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
160
|
-
}, z.core.$strict>;
|
|
161
|
-
|
|
162
|
-
/** Validated input accepted by the Android runAdbShell Node. */
|
|
163
|
-
export declare type RunAdbShellNodeInput = z.infer<typeof runAdbShellInputSchema>;
|
|
164
|
-
|
|
165
|
-
declare interface StepRunResult<TOutputData = unknown> {
|
|
166
|
-
phase: NodeExecutionPhase;
|
|
167
|
-
stepIndex: number;
|
|
168
|
-
node: string;
|
|
169
|
-
input: unknown;
|
|
170
|
-
meta: NormalizedStepMeta;
|
|
171
|
-
status: 'success' | 'failed';
|
|
172
|
-
continuedAfterError: boolean;
|
|
173
|
-
startedAt: string;
|
|
174
|
-
endedAt: string;
|
|
175
|
-
durationMs: number;
|
|
176
|
-
output?: NodeResult<TOutputData>;
|
|
177
|
-
error?: WorkflowError;
|
|
178
|
-
}
|
|
117
|
+
export { runAdbShellInputSchema }
|
|
179
118
|
|
|
180
|
-
|
|
181
|
-
export declare const terminateInputSchema: z.ZodObject<{
|
|
182
|
-
prompt: z.ZodOptional<z.ZodString>;
|
|
183
|
-
uri: z.ZodOptional<z.ZodString>;
|
|
184
|
-
}, z.core.$strict>;
|
|
119
|
+
export { RunAdbShellNodeInput }
|
|
185
120
|
|
|
186
|
-
export
|
|
121
|
+
export { runAdbShellOptionsInputSchema }
|
|
187
122
|
|
|
188
|
-
|
|
189
|
-
readonly code: string;
|
|
190
|
-
readonly details?: unknown;
|
|
191
|
-
constructor(message: string, options?: WorkflowErrorOptions);
|
|
192
|
-
toJSON(): Record<string, unknown>;
|
|
193
|
-
}
|
|
123
|
+
export { terminateInputSchema }
|
|
194
124
|
|
|
195
|
-
|
|
196
|
-
code?: string;
|
|
197
|
-
details?: unknown;
|
|
198
|
-
cause?: unknown;
|
|
199
|
-
}
|
|
125
|
+
export { TerminateNodeInput }
|
|
200
126
|
|
|
201
127
|
export { }
|
|
@@ -10,7 +10,6 @@ declare interface CaseExecutionContext {
|
|
|
10
10
|
readonly name: string;
|
|
11
11
|
readonly sourcePath: string;
|
|
12
12
|
readonly caseIndex: number;
|
|
13
|
-
readonly completedSteps: readonly StepRunResult[];
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
declare type CaseNodePhase = 'beforeEach' | 'steps' | 'afterEach';
|
|
@@ -48,10 +47,6 @@ declare interface CaseRunResult {
|
|
|
48
47
|
|
|
49
48
|
declare type CaseRunStatus = 'success' | 'failed' | 'not-run';
|
|
50
49
|
|
|
51
|
-
declare interface CommonNodeInput {
|
|
52
|
-
prompt?: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
50
|
export declare const createTestRunId: (date?: Date, uuid?: `${string}-${string}-${string}-${string}-${string}`) => string;
|
|
56
51
|
|
|
57
52
|
export declare const DEFAULT_TEST_FILE_SELECTION: TestFileSelection;
|
|
@@ -60,6 +55,8 @@ declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TContext
|
|
|
60
55
|
name: string;
|
|
61
56
|
title?: string;
|
|
62
57
|
description?: string;
|
|
58
|
+
/** Object field populated by string shorthand. Omit or set false to disable it. */
|
|
59
|
+
stringInputKey?: string | false;
|
|
63
60
|
inputSchema?: NodeInputSchema;
|
|
64
61
|
execute(ctx: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
|
|
65
62
|
}
|
|
@@ -104,7 +101,6 @@ export declare function loadTestProject<TContext = undefined>(configPath?: strin
|
|
|
104
101
|
declare interface NodeCaseContext extends CaseExecutionContext {
|
|
105
102
|
readonly phase: CaseNodePhase;
|
|
106
103
|
readonly stepIndex: number;
|
|
107
|
-
readonly completedNodes: readonly StepRunResult[];
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
|
|
@@ -118,34 +114,31 @@ declare interface NodeDocumentContext {
|
|
|
118
114
|
readonly sourcePath: string;
|
|
119
115
|
readonly phase: DocumentNodePhase;
|
|
120
116
|
readonly stepIndex: number;
|
|
121
|
-
readonly completedNodes: readonly StepRunResult[];
|
|
122
117
|
}
|
|
123
118
|
|
|
124
119
|
declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
|
|
125
120
|
/** The node is running for one case. */
|
|
126
121
|
scope: 'case';
|
|
127
|
-
/** Identity and
|
|
122
|
+
/** Identity and phase information for the case being executed. */
|
|
128
123
|
case: NodeCaseContext;
|
|
129
124
|
document?: never;
|
|
130
125
|
} | {
|
|
131
126
|
/** The node is running for the workflow document. */
|
|
132
127
|
scope: 'document';
|
|
133
|
-
/** Identity and
|
|
128
|
+
/** Identity and phase information for the document being executed. */
|
|
134
129
|
document: NodeDocumentContext;
|
|
135
130
|
case?: never;
|
|
136
131
|
});
|
|
137
132
|
|
|
138
133
|
declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
|
|
139
|
-
/** The node input without
|
|
140
|
-
input: TInput
|
|
134
|
+
/** The validated node input without `$`. */
|
|
135
|
+
input: TInput;
|
|
141
136
|
/** The normalized engine metadata for this step. */
|
|
142
137
|
$: Readonly<NormalizedStepMeta>;
|
|
143
138
|
/** The timeout and cancellation signal for this step. */
|
|
144
139
|
signal: AbortSignal;
|
|
145
140
|
/** Resources shared by the current workflow document. */
|
|
146
141
|
context: TContext;
|
|
147
|
-
/** Read-only results completed in the current document/case scope. */
|
|
148
|
-
history: readonly NodeHistoryEntry[];
|
|
149
142
|
/** Register resource cleanup for the current case attempt or document. */
|
|
150
143
|
onTeardown(teardown: NodeScopeTeardown): void;
|
|
151
144
|
}
|
|
@@ -154,22 +147,6 @@ declare type NodeExecutionPhase = CaseNodePhase | DocumentNodePhase;
|
|
|
154
147
|
|
|
155
148
|
declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
|
|
156
149
|
|
|
157
|
-
declare interface NodeHistoryEntry {
|
|
158
|
-
readonly scope: 'document' | 'case';
|
|
159
|
-
readonly phase: NodeExecutionPhase;
|
|
160
|
-
readonly stepIndex: number;
|
|
161
|
-
readonly node: string;
|
|
162
|
-
readonly input?: unknown;
|
|
163
|
-
readonly intent?: string;
|
|
164
|
-
readonly status: 'passed' | 'failed' | 'skipped';
|
|
165
|
-
readonly summary?: string;
|
|
166
|
-
readonly data?: unknown;
|
|
167
|
-
readonly error?: {
|
|
168
|
-
readonly name: string;
|
|
169
|
-
readonly message: string;
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
150
|
declare type NodeInputSchema = z.ZodObject;
|
|
174
151
|
|
|
175
152
|
declare class NodeRegistry {
|
|
@@ -184,9 +161,9 @@ declare class NodeRegistry {
|
|
|
184
161
|
}
|
|
185
162
|
|
|
186
163
|
declare interface NodeResult<TData = unknown> {
|
|
187
|
-
/** Human-readable summary for reports
|
|
164
|
+
/** Human-readable summary for reports. */
|
|
188
165
|
summary?: string;
|
|
189
|
-
/** Structured data
|
|
166
|
+
/** Structured data included in the step result. */
|
|
190
167
|
data?: TData;
|
|
191
168
|
}
|
|
192
169
|
|
|
@@ -305,7 +282,7 @@ export declare interface TestOutputDefinition {
|
|
|
305
282
|
reportDir?: string;
|
|
306
283
|
}
|
|
307
284
|
|
|
308
|
-
export declare type TestPlatform = 'web' | 'android' | 'ios' | 'computer';
|
|
285
|
+
export declare type TestPlatform = 'web' | 'android' | 'ios' | 'harmony' | 'computer';
|
|
309
286
|
|
|
310
287
|
export declare type TestProjectCaseRunResult = CaseRunOutcome & {
|
|
311
288
|
documentId: string;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { HarmonyAgent } from '@midscene/harmony';
|
|
2
|
+
import { launchInputSchema } from '@midscene/harmony/test-runner';
|
|
3
|
+
import { LaunchNodeInput } from '@midscene/harmony/test-runner';
|
|
4
|
+
import { runHdcShellInputSchema } from '@midscene/harmony/test-runner';
|
|
5
|
+
import { RunHdcShellNodeInput } from '@midscene/harmony/test-runner';
|
|
6
|
+
import { terminateInputSchema } from '@midscene/harmony/test-runner';
|
|
7
|
+
import { TerminateNodeInput } from '@midscene/harmony/test-runner';
|
|
8
|
+
import type { z } from 'zod/v4';
|
|
9
|
+
|
|
10
|
+
declare type Awaitable<T> = T | Promise<T>;
|
|
11
|
+
|
|
12
|
+
declare interface CaseExecutionContext {
|
|
13
|
+
readonly caseId: string;
|
|
14
|
+
readonly runId: string;
|
|
15
|
+
readonly projectName: string;
|
|
16
|
+
readonly attemptIndex: number;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly sourcePath: string;
|
|
19
|
+
readonly caseIndex: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare type CaseNodePhase = 'beforeEach' | 'steps' | 'afterEach';
|
|
23
|
+
|
|
24
|
+
export declare function createHarmonyNodes<TContext>(options: CreateHarmonyNodesOptions<TContext>): readonly NodeDefinition<any, any, TContext>[];
|
|
25
|
+
|
|
26
|
+
export declare interface CreateHarmonyNodesOptions<TContext> {
|
|
27
|
+
getAgent(ctx: NodeExecutionContext<unknown, TContext>): Awaitable<HarmonyRunnerAgent>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TContext = unknown> {
|
|
31
|
+
name: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
/** Object field populated by string shorthand. Omit or set false to disable it. */
|
|
35
|
+
stringInputKey?: string | false;
|
|
36
|
+
inputSchema?: NodeInputSchema;
|
|
37
|
+
execute(ctx: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare type DocumentNodePhase = 'beforeAll' | 'afterAll';
|
|
41
|
+
|
|
42
|
+
export declare type HarmonyRunnerAgent = Pick<HarmonyAgent, 'launch' | 'terminate' | 'runHdcShell' | 'back' | 'home' | 'recentApps'>;
|
|
43
|
+
|
|
44
|
+
export { launchInputSchema }
|
|
45
|
+
|
|
46
|
+
export { LaunchNodeInput }
|
|
47
|
+
|
|
48
|
+
declare interface NodeCaseContext extends CaseExecutionContext {
|
|
49
|
+
readonly phase: CaseNodePhase;
|
|
50
|
+
readonly stepIndex: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare interface NodeDocumentContext {
|
|
57
|
+
readonly documentId: string;
|
|
58
|
+
readonly documentRunId: string;
|
|
59
|
+
readonly projectId: string;
|
|
60
|
+
readonly projectName: string;
|
|
61
|
+
readonly sourcePath: string;
|
|
62
|
+
readonly phase: DocumentNodePhase;
|
|
63
|
+
readonly stepIndex: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
|
|
67
|
+
/** The node is running for one case. */
|
|
68
|
+
scope: 'case';
|
|
69
|
+
/** Identity and phase information for the case being executed. */
|
|
70
|
+
case: NodeCaseContext;
|
|
71
|
+
document?: never;
|
|
72
|
+
} | {
|
|
73
|
+
/** The node is running for the workflow document. */
|
|
74
|
+
scope: 'document';
|
|
75
|
+
/** Identity and phase information for the document being executed. */
|
|
76
|
+
document: NodeDocumentContext;
|
|
77
|
+
case?: never;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
|
|
81
|
+
/** The validated node input without `$`. */
|
|
82
|
+
input: TInput;
|
|
83
|
+
/** The normalized engine metadata for this step. */
|
|
84
|
+
$: Readonly<NormalizedStepMeta>;
|
|
85
|
+
/** The timeout and cancellation signal for this step. */
|
|
86
|
+
signal: AbortSignal;
|
|
87
|
+
/** Resources shared by the current workflow document. */
|
|
88
|
+
context: TContext;
|
|
89
|
+
/** Register resource cleanup for the current case attempt or document. */
|
|
90
|
+
onTeardown(teardown: NodeScopeTeardown): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
|
|
94
|
+
|
|
95
|
+
declare type NodeInputSchema = z.ZodObject;
|
|
96
|
+
|
|
97
|
+
declare interface NodeResult<TData = unknown> {
|
|
98
|
+
/** Human-readable summary for reports. */
|
|
99
|
+
summary?: string;
|
|
100
|
+
/** Structured data included in the step result. */
|
|
101
|
+
data?: TData;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare type NodeScopeTeardown = () => Awaitable<NodeScopeTeardownResult | void>;
|
|
105
|
+
|
|
106
|
+
declare interface NodeScopeTeardownResult {
|
|
107
|
+
/** Absolute paths to Midscene reports produced by this execution scope. */
|
|
108
|
+
reportPaths?: readonly string[];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare interface NormalizedStepMeta {
|
|
112
|
+
timeoutMs?: number;
|
|
113
|
+
continueOnError: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { runHdcShellInputSchema }
|
|
117
|
+
|
|
118
|
+
export { RunHdcShellNodeInput }
|
|
119
|
+
|
|
120
|
+
export { terminateInputSchema }
|
|
121
|
+
|
|
122
|
+
export { TerminateNodeInput }
|
|
123
|
+
|
|
124
|
+
export { }
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { CaseRunResult as CaseRunResult_2 } from './engine/types';
|
|
|
2
2
|
import { WorkflowDocumentRunResult as WorkflowDocumentRunResult_2 } from './engine/types';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
|
-
export declare const assertJsonSerializable: (value: unknown, label: string, node: string) => void;
|
|
6
|
-
|
|
7
5
|
export declare type Awaitable<T> = T | Promise<T>;
|
|
8
6
|
|
|
9
7
|
export declare interface CaseDefinition<TStep = StepInput> {
|
|
@@ -20,7 +18,6 @@ export declare interface CaseExecutionContext {
|
|
|
20
18
|
readonly name: string;
|
|
21
19
|
readonly sourcePath: string;
|
|
22
20
|
readonly caseIndex: number;
|
|
23
|
-
readonly completedSteps: readonly StepRunResult[];
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
export declare class CaseExecutionError extends WorkflowError {
|
|
@@ -113,10 +110,6 @@ export declare interface CollectWorkflowDocumentOptions {
|
|
|
113
110
|
env?: Readonly<NodeJS.ProcessEnv>;
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
export declare interface CommonNodeInput {
|
|
117
|
-
prompt?: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
113
|
export declare const createCaseId: (projectId: string, sourcePath: string, caseIndex: number) => string;
|
|
121
114
|
|
|
122
115
|
export declare function createCaseRunner<TContext = undefined>(options?: CaseRunnerOptions<TContext>): CaseRunner<TContext>;
|
|
@@ -135,8 +128,6 @@ export declare interface CreateDocumentRuntimeOptions<TContext = undefined> {
|
|
|
135
128
|
createDocumentRunId?(): string;
|
|
136
129
|
}
|
|
137
130
|
|
|
138
|
-
export declare const createHistory: (prefix: readonly NodeHistoryEntry[], results: readonly StepRunResult[], scope: NodeHistoryEntry["scope"]) => readonly NodeHistoryEntry[];
|
|
139
|
-
|
|
140
131
|
export declare const createProjectRuntime: <TProjectContext = unknown>(options: ProjectRuntimeOptions<TProjectContext>) => ProjectRuntime<TProjectContext>;
|
|
141
132
|
|
|
142
133
|
export declare const createWorkflowDocumentId: (projectId: string, sourcePath: string) => string;
|
|
@@ -149,6 +140,8 @@ export declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TC
|
|
|
149
140
|
name: string;
|
|
150
141
|
title?: string;
|
|
151
142
|
description?: string;
|
|
143
|
+
/** Object field populated by string shorthand. Omit or set false to disable it. */
|
|
144
|
+
stringInputKey?: string | false;
|
|
152
145
|
inputSchema?: NodeInputSchema;
|
|
153
146
|
execute(ctx: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
|
|
154
147
|
}
|
|
@@ -181,7 +174,6 @@ declare type JsonValue = JsonPrimitive | readonly JsonValue[] | {
|
|
|
181
174
|
export declare interface NodeCaseContext extends CaseExecutionContext {
|
|
182
175
|
readonly phase: CaseNodePhase;
|
|
183
176
|
readonly stepIndex: number;
|
|
184
|
-
readonly completedNodes: readonly StepRunResult[];
|
|
185
177
|
}
|
|
186
178
|
|
|
187
179
|
export declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
|
|
@@ -203,34 +195,31 @@ export declare interface NodeDocumentContext {
|
|
|
203
195
|
readonly sourcePath: string;
|
|
204
196
|
readonly phase: DocumentNodePhase;
|
|
205
197
|
readonly stepIndex: number;
|
|
206
|
-
readonly completedNodes: readonly StepRunResult[];
|
|
207
198
|
}
|
|
208
199
|
|
|
209
200
|
export declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
|
|
210
201
|
/** The node is running for one case. */
|
|
211
202
|
scope: 'case';
|
|
212
|
-
/** Identity and
|
|
203
|
+
/** Identity and phase information for the case being executed. */
|
|
213
204
|
case: NodeCaseContext;
|
|
214
205
|
document?: never;
|
|
215
206
|
} | {
|
|
216
207
|
/** The node is running for the workflow document. */
|
|
217
208
|
scope: 'document';
|
|
218
|
-
/** Identity and
|
|
209
|
+
/** Identity and phase information for the document being executed. */
|
|
219
210
|
document: NodeDocumentContext;
|
|
220
211
|
case?: never;
|
|
221
212
|
});
|
|
222
213
|
|
|
223
214
|
declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
|
|
224
|
-
/** The node input without
|
|
225
|
-
input: TInput
|
|
215
|
+
/** The validated node input without `$`. */
|
|
216
|
+
input: TInput;
|
|
226
217
|
/** The normalized engine metadata for this step. */
|
|
227
218
|
$: Readonly<NormalizedStepMeta>;
|
|
228
219
|
/** The timeout and cancellation signal for this step. */
|
|
229
220
|
signal: AbortSignal;
|
|
230
221
|
/** Resources shared by the current workflow document. */
|
|
231
222
|
context: TContext;
|
|
232
|
-
/** Read-only results completed in the current document/case scope. */
|
|
233
|
-
history: readonly NodeHistoryEntry[];
|
|
234
223
|
/** Register resource cleanup for the current case attempt or document. */
|
|
235
224
|
onTeardown(teardown: NodeScopeTeardown): void;
|
|
236
225
|
}
|
|
@@ -244,22 +233,6 @@ export declare type NodeExecutionPhase = CaseNodePhase | DocumentNodePhase;
|
|
|
244
233
|
|
|
245
234
|
export declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
|
|
246
235
|
|
|
247
|
-
export declare interface NodeHistoryEntry {
|
|
248
|
-
readonly scope: 'document' | 'case';
|
|
249
|
-
readonly phase: NodeExecutionPhase;
|
|
250
|
-
readonly stepIndex: number;
|
|
251
|
-
readonly node: string;
|
|
252
|
-
readonly input?: unknown;
|
|
253
|
-
readonly intent?: string;
|
|
254
|
-
readonly status: 'passed' | 'failed' | 'skipped';
|
|
255
|
-
readonly summary?: string;
|
|
256
|
-
readonly data?: unknown;
|
|
257
|
-
readonly error?: {
|
|
258
|
-
readonly name: string;
|
|
259
|
-
readonly message: string;
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
236
|
export declare type NodeInputSchema = z.ZodObject;
|
|
264
237
|
|
|
265
238
|
export declare class NodeInputValidationError extends WorkflowError {
|
|
@@ -284,9 +257,9 @@ export declare class NodeRegistry {
|
|
|
284
257
|
}
|
|
285
258
|
|
|
286
259
|
export declare interface NodeResult<TData = unknown> {
|
|
287
|
-
/** Human-readable summary for reports
|
|
260
|
+
/** Human-readable summary for reports. */
|
|
288
261
|
summary?: string;
|
|
289
|
-
/** Structured data
|
|
262
|
+
/** Structured data included in the step result. */
|
|
290
263
|
data?: TData;
|
|
291
264
|
}
|
|
292
265
|
|
|
@@ -310,7 +283,7 @@ export declare type NormalizedCaseDefinition = CaseDefinition<NormalizedStep>;
|
|
|
310
283
|
|
|
311
284
|
export declare interface NormalizedStep {
|
|
312
285
|
node: string;
|
|
313
|
-
input: Record<string, unknown
|
|
286
|
+
input: Record<string, unknown>;
|
|
314
287
|
meta: NormalizedStepMeta;
|
|
315
288
|
}
|
|
316
289
|
|
|
@@ -321,9 +294,9 @@ export declare interface NormalizedStepMeta {
|
|
|
321
294
|
|
|
322
295
|
export declare function normalizeNodeExecutionError(error: unknown, node: string): WorkflowError;
|
|
323
296
|
|
|
324
|
-
export declare function normalizeStep(value: unknown, index?: number): NormalizedStep;
|
|
297
|
+
export declare function normalizeStep(value: unknown, index?: number, resolveNode?: ResolveNodeForNormalization): NormalizedStep;
|
|
325
298
|
|
|
326
|
-
export declare function normalizeSteps(steps: unknown): NormalizedStep[];
|
|
299
|
+
export declare function normalizeSteps(steps: unknown, resolveNode?: ResolveNodeForNormalization): NormalizedStep[];
|
|
327
300
|
|
|
328
301
|
export declare interface ProjectRuntime<TProjectContext = unknown> {
|
|
329
302
|
readonly context: TProjectContext | undefined;
|
|
@@ -397,6 +370,8 @@ declare interface ResolvedExecutionProject<TProjectContext = unknown> {
|
|
|
397
370
|
readonly variables: Readonly<Record<string, JsonValue>>;
|
|
398
371
|
}
|
|
399
372
|
|
|
373
|
+
export declare type ResolveNodeForNormalization = (name: string) => StringInputNodeDefinition | undefined;
|
|
374
|
+
|
|
400
375
|
export declare const resolveWorkflowVariables: (value: unknown, options: ResolveWorkflowVariablesOptions) => unknown;
|
|
401
376
|
|
|
402
377
|
export declare interface ResolveWorkflowVariablesOptions {
|
|
@@ -412,7 +387,6 @@ export declare interface RunCollectedCaseOptions<TContext = undefined> {
|
|
|
412
387
|
context?: TContext;
|
|
413
388
|
projectName?: string;
|
|
414
389
|
attemptIndex?: number;
|
|
415
|
-
documentHistory?: readonly NodeHistoryEntry[];
|
|
416
390
|
signal?: AbortSignal;
|
|
417
391
|
defaultTimeoutMs?: number;
|
|
418
392
|
onStepStart?: StepStartHandler;
|
|
@@ -491,22 +465,22 @@ export declare class StepTimeoutError extends WorkflowError {
|
|
|
491
465
|
|
|
492
466
|
export declare type StepValue = string | Record<string, unknown>;
|
|
493
467
|
|
|
468
|
+
declare interface StringInputNodeDefinition {
|
|
469
|
+
stringInputKey?: string | false;
|
|
470
|
+
}
|
|
471
|
+
|
|
494
472
|
declare interface TestFileSelection {
|
|
495
473
|
include: readonly string[];
|
|
496
474
|
exclude?: readonly string[];
|
|
497
475
|
}
|
|
498
476
|
|
|
499
|
-
declare type TestPlatform = 'web' | 'android' | 'ios' | 'computer';
|
|
477
|
+
declare type TestPlatform = 'web' | 'android' | 'ios' | 'harmony' | 'computer';
|
|
500
478
|
|
|
501
479
|
declare interface TestTagSelection {
|
|
502
480
|
include?: readonly string[];
|
|
503
481
|
exclude?: readonly string[];
|
|
504
482
|
}
|
|
505
483
|
|
|
506
|
-
export declare const toHistoryEntry: (result: StepRunResult, scope: NodeHistoryEntry["scope"]) => NodeHistoryEntry;
|
|
507
|
-
|
|
508
|
-
export declare function validateCommonNodeInput(input: Record<string, unknown>, index: number): asserts input is Record<string, unknown> & CommonNodeInput;
|
|
509
|
-
|
|
510
484
|
export declare interface VariableResolutionLocation {
|
|
511
485
|
projectName: string;
|
|
512
486
|
sourcePath: string;
|
|
@@ -551,7 +525,6 @@ export declare interface WorkflowDocumentRunResult {
|
|
|
551
525
|
|
|
552
526
|
export declare interface WorkflowDocumentRuntime<TContext = undefined> {
|
|
553
527
|
readonly context: TContext;
|
|
554
|
-
readonly history: readonly NodeHistoryEntry[];
|
|
555
528
|
readonly canRunCases: boolean;
|
|
556
529
|
start(): Promise<WorkflowDocumentRunResult>;
|
|
557
530
|
finish(): Promise<WorkflowDocumentRunResult>;
|