@midscene/test 1.12.10-beta-20260920031616.0 → 1.13.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.
@@ -1,22 +1,51 @@
1
+ import { actionInputSchema } from '@midscene/core/agent/test';
2
+ import { ActionNodeInput } from '@midscene/core/agent/test';
1
3
  import { AgentTestRunnerNodeDefinition } from '@midscene/core/agent/test';
2
4
  import { AgentTestRunnerNodeProvider } from '@midscene/core/agent/test';
3
5
  import { aiActInputSchema } from '@midscene/core/agent/test';
4
6
  import { aiActOptionsInputSchema } from '@midscene/core/agent/test';
5
7
  import { aiAssertInputSchema } from '@midscene/core/agent/test';
6
8
  import { aiAssertOptionsInputSchema } from '@midscene/core/agent/test';
9
+ import { aiDragAndDropInputSchema } from '@midscene/core/agent/test';
10
+ import { AiDragAndDropNodeInput } from '@midscene/core/agent/test';
11
+ import { aiInputInputSchema } from '@midscene/core/agent/test';
12
+ import { AiInputNodeInput } from '@midscene/core/agent/test';
13
+ import { aiKeyboardPressInputSchema } from '@midscene/core/agent/test';
14
+ import { AiKeyboardPressNodeInput } from '@midscene/core/agent/test';
15
+ import { aiLongPressInputSchema } from '@midscene/core/agent/test';
16
+ import { AiLongPressNodeInput } from '@midscene/core/agent/test';
17
+ import { aiPinchInputSchema } from '@midscene/core/agent/test';
18
+ import { AiPinchNodeInput } from '@midscene/core/agent/test';
19
+ import { aiQueryInputSchema } from '@midscene/core/agent/test';
20
+ import { AiQueryNodeInput } from '@midscene/core/agent/test';
21
+ import { aiScrollInputSchema } from '@midscene/core/agent/test';
22
+ import { AiScrollNodeInput } from '@midscene/core/agent/test';
7
23
  import { aiTapInputSchema } from '@midscene/core/agent/test';
24
+ import { aiWaitForInputSchema } from '@midscene/core/agent/test';
25
+ import { AiWaitForNodeInput } from '@midscene/core/agent/test';
26
+ import { Awaitable } from '@midscene/core/internal/test-runner';
8
27
  import { CommonAgentTestRunnerApi } from '@midscene/core/agent/test';
28
+ import type * as Core from '@midscene/core/internal/test-runner';
9
29
  import { insightInputSchema } from '@midscene/core/agent/test';
10
30
  import { insightOptionsInputSchema } from '@midscene/core/agent/test';
31
+ import { javascriptInputSchema } from '@midscene/core/agent/test';
32
+ import { JavascriptNodeInput } from '@midscene/core/agent/test';
11
33
  import { locateOptionsInputSchema } from '@midscene/core/agent/test';
12
34
  import { promptImageInputSchema } from '@midscene/core/agent/test';
13
35
  import { recordToReportInputSchema } from '@midscene/core/agent/test';
14
36
  import { recordToReportOptionsInputSchema } from '@midscene/core/agent/test';
15
37
  import { reportScreenshotInputSchema } from '@midscene/core/agent/test';
38
+ import { runGherkinScenarioInputSchema } from '@midscene/core/agent/test';
39
+ import { RunGherkinScenarioNodeInput } from '@midscene/core/agent/test';
16
40
  import { structuredUserPromptInputSchema } from '@midscene/core/agent/test';
17
41
  import { userPromptInputSchema } from '@midscene/core/agent/test';
42
+ import { WorkflowReportSource } from '@midscene/core/internal/test-runner';
18
43
  import { z } from 'zod/v4';
19
44
 
45
+ export { actionInputSchema }
46
+
47
+ export { ActionNodeInput }
48
+
20
49
  export declare interface AgentProvider<TContext> {
21
50
  getAgent(runId: string, execution: NodeExecutionContext<unknown, TContext>): Awaitable<MidsceneUIAgent>;
22
51
  releaseAgent?(runId: string): Awaitable<AgentReleaseResult | void>;
@@ -40,26 +69,44 @@ export declare type AiAssertNodeInput = z.infer<typeof aiAssertInputSchema>;
40
69
 
41
70
  export { aiAssertOptionsInputSchema }
42
71
 
72
+ export { aiDragAndDropInputSchema }
73
+
74
+ export { AiDragAndDropNodeInput }
75
+
76
+ export { aiInputInputSchema }
77
+
78
+ export { AiInputNodeInput }
79
+
80
+ export { aiKeyboardPressInputSchema }
81
+
82
+ export { AiKeyboardPressNodeInput }
83
+
84
+ export { aiLongPressInputSchema }
85
+
86
+ export { AiLongPressNodeInput }
87
+
88
+ export { aiPinchInputSchema }
89
+
90
+ export { AiPinchNodeInput }
91
+
92
+ export { aiQueryInputSchema }
93
+
94
+ export { AiQueryNodeInput }
95
+
96
+ export { aiScrollInputSchema }
97
+
98
+ export { AiScrollNodeInput }
99
+
43
100
  export { aiTapInputSchema }
44
101
 
45
102
  export declare type AiTapNodeInput = z.infer<typeof aiTapInputSchema>;
46
103
 
47
- declare type Awaitable<T> = T | Promise<T>;
48
-
49
- declare interface CaseExecutionContext {
50
- readonly caseId: string;
51
- readonly runId: string;
52
- readonly projectName: string;
53
- readonly attemptIndex: number;
54
- readonly name: string;
55
- readonly sourcePath: string;
56
- readonly caseIndex: number;
57
- }
104
+ export { aiWaitForInputSchema }
58
105
 
59
- declare type CaseNodePhase = 'beforeEach' | 'steps' | 'afterEach';
106
+ export { AiWaitForNodeInput }
60
107
 
61
108
  /** Adapt Agent-owned descriptions to executable Midscene Test Nodes. */
62
- export declare const createAgentTestRunnerNodes: <TContext>(definitions: readonly AgentTestRunnerNodeDefinition[], getAgent: (execution: NodeExecutionContext<unknown, TContext>) => Awaitable<unknown>) => readonly NodeDefinition<any, any, TContext>[];
109
+ export declare const createAgentTestRunnerNodes: <TContext>(definitions: readonly AgentTestRunnerNodeDefinition[], getAgent: (ctx: NodeExecutionContext<unknown, TContext>) => Awaitable<unknown>) => readonly NodeDefinition<any, any, TContext>[];
63
110
 
64
111
  export declare function createMidsceneNodes<TContext>(options: CreateMidsceneNodesOptions<TContext>): readonly NodeDefinition<any, any, TContext>[];
65
112
 
@@ -70,17 +117,9 @@ export declare interface CreateMidsceneNodesOptions<TContext> {
70
117
  agentClass: AgentTestRunnerNodeProvider;
71
118
  }
72
119
 
73
- declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TContext = unknown> {
74
- name: string;
75
- title?: string;
76
- description?: string;
77
- /** Object field populated by string shorthand. Omit or set false to disable it. */
78
- stringInputKey?: string | false;
79
- inputSchema?: NodeInputSchema;
80
- execute(execution: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
81
- }
82
-
83
- declare type DocumentNodePhase = 'beforeAll' | 'afterAll';
120
+ declare type DefineNodeOptions<TInput = unknown, TData = unknown, TContext = unknown> = Omit<Core.DefineNodeOptions<TInput, TData, TContext>, 'execute'> & {
121
+ execute(ctx: NodeExecutionContext<TInput, TContext>): Core.NodeExecutionReturn<TData>;
122
+ };
84
123
 
85
124
  export { insightInputSchema }
86
125
 
@@ -88,6 +127,10 @@ export declare type InsightNodeInput = z.infer<typeof insightInputSchema>;
88
127
 
89
128
  export { insightOptionsInputSchema }
90
129
 
130
+ export { javascriptInputSchema }
131
+
132
+ export { JavascriptNodeInput }
133
+
91
134
  export { locateOptionsInputSchema }
92
135
 
93
136
  export declare interface MidsceneExecutionRef {
@@ -95,89 +138,28 @@ export declare interface MidsceneExecutionRef {
95
138
  }
96
139
 
97
140
  export declare type MidsceneUIAgent = CommonAgentTestRunnerApi & {
141
+ _prepareForTestRunner?(): void;
142
+ _createReportSource?(scopeId: string): Promise<WorkflowReportSource | undefined>;
143
+ flushReport?(): Promise<string | undefined>;
98
144
  addDumpUpdateListener?(listener: (dump: string, execution?: MidsceneExecutionRef) => void): () => void;
99
145
  };
100
146
 
101
- declare interface NodeCaseContext extends CaseExecutionContext {
102
- readonly phase: CaseNodePhase;
103
- readonly stepIndex: number;
104
- }
105
-
106
- declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
107
- }
108
-
109
- declare interface NodeDocumentContext {
110
- readonly documentId: string;
111
- readonly documentRunId: string;
112
- readonly projectId: string;
113
- readonly projectName: string;
114
- readonly sourcePath: string;
115
- readonly phase: DocumentNodePhase;
116
- readonly stepIndex: number;
117
- }
118
-
119
- declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
120
- /** The node is running for one case. */
121
- scope: 'case';
122
- /** Identity and phase information for the case being executed. */
123
- case: NodeCaseContext;
124
- document?: never;
125
- } | {
126
- /** The node is running for the workflow document. */
127
- scope: 'document';
128
- /** Identity and phase information for the document being executed. */
129
- document: NodeDocumentContext;
130
- case?: never;
131
- });
132
-
133
- declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
134
- /** The validated node input without `$`. */
135
- input: TInput;
136
- /** The normalized engine metadata for this step. */
147
+ declare type NativeNodeContext<T> = T extends unknown ? Omit<T, '$' | 'onTeardown'> & {
137
148
  $: Readonly<NormalizedStepMeta>;
138
- /** The timeout and cancellation signal for this step. */
139
- signal: AbortSignal;
140
- /** Resources shared by the current workflow document. */
141
- context: TContext;
142
- /** Register resource cleanup for the current case attempt or document. */
143
149
  onTeardown(teardown: NodeScopeTeardown): void;
144
- /** Attach report detail references to the current Step result. */
145
- report: NodeReportCollector;
146
- }
150
+ } : never;
147
151
 
148
- declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
152
+ declare type NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> = DefineNodeOptions<TInput, TData, TContext>;
149
153
 
150
- declare type NodeInputSchema = z.ZodObject;
154
+ declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NativeNodeContext<Core.NodeExecutionContext<TInput, TContext>>;
151
155
 
152
- /** Collects report references produced while the current Step is executing. */
153
- declare interface NodeReportCollector {
154
- addTrace(trace: NodeReportTrace): void;
155
- }
156
+ declare type NodeScopeTeardown = () => Core.Awaitable<NodeScopeTeardownOutput>;
156
157
 
157
- /** A stable reference from one test Step to report detail data. */
158
- declare interface NodeReportTrace {
159
- type: 'midscene-execution';
160
- executionId: string;
161
- }
158
+ declare type NodeScopeTeardownOutput = NodeScopeTeardownResult | void;
162
159
 
163
- declare interface NodeResult<TData = unknown> {
164
- /** Human-readable summary for reports. */
165
- summary?: string;
166
- /** Structured data included in the step result. */
167
- data?: TData;
168
- }
160
+ declare type NodeScopeTeardownResult = Omit<Core.NodeScopeTeardownResult, 'reportSources'>;
169
161
 
170
- declare type NodeScopeTeardown = () => Awaitable<NodeScopeTeardownResult | void>;
171
-
172
- declare interface NodeScopeTeardownResult {
173
- /** Absolute paths to Midscene reports produced by this execution scope. */
174
- reportPaths?: readonly string[];
175
- }
176
-
177
- declare interface NormalizedStepMeta {
178
- timeoutMs?: number;
179
- continueOnError: boolean;
180
- }
162
+ declare type NormalizedStepMeta = Omit<Core.NormalizedStepMeta, 'captureResult' | 'resultName'>;
181
163
 
182
164
  export { promptImageInputSchema }
183
165
 
@@ -189,6 +171,10 @@ export { recordToReportOptionsInputSchema }
189
171
 
190
172
  export { reportScreenshotInputSchema }
191
173
 
174
+ export { runGherkinScenarioInputSchema }
175
+
176
+ export { RunGherkinScenarioNodeInput }
177
+
192
178
  export { structuredUserPromptInputSchema }
193
179
 
194
180
  export { userPromptInputSchema }
@@ -0,0 +1,52 @@
1
+ import type { Agent } from '@midscene/core/agent';
2
+ import type { FreeFn } from '@midscene/core';
3
+ import type { MidsceneYamlScript } from '@midscene/core';
4
+ import type { MidsceneYamlScriptEnv } from '@midscene/core';
5
+ import { ScriptPlayer } from '@midscene/core/yaml';
6
+ import type { Server } from 'node:http';
7
+
8
+ /** Launch any YAML-supported platform for a native Test setup or another host. */
9
+ export declare function createYamlAgent(file: string, script: YamlAgentConfig, options?: CreateYamlPlayerOptions, reportFileName?: string): Promise<{
10
+ agent: Agent;
11
+ freeFn: FreeFn[];
12
+ }>;
13
+
14
+ export declare function createYamlPlayer(file: string, script?: MidsceneYamlScript, options?: CreateYamlPlayerOptions): Promise<ScriptPlayer<MidsceneYamlScriptEnv>>;
15
+
16
+ export declare interface CreateYamlPlayerOptions {
17
+ /** Borrow an existing Agent; its owner remains responsible for teardown. */
18
+ agent?: Agent;
19
+ headed?: boolean;
20
+ keepWindow?: boolean;
21
+ /** Puppeteer handles. Platform-specific types are optional for other hosts. */
22
+ browser?: object;
23
+ page?: object;
24
+ browserContext?: object;
25
+ testId?: string;
26
+ }
27
+
28
+ export declare interface DotenvLoadOptions {
29
+ dotenvOverride?: boolean;
30
+ dotenvDebug?: boolean;
31
+ cwd?: string;
32
+ log?: (message: string) => void;
33
+ }
34
+
35
+ export declare const launchServer: (dir: string) => Promise<YamlStaticServer>;
36
+
37
+ export declare function loadDotenvConfig(options?: DotenvLoadOptions): void;
38
+
39
+ export declare interface SingleYamlExecutionResult {
40
+ success: boolean;
41
+ file: string;
42
+ player: ScriptPlayer<MidsceneYamlScriptEnv>;
43
+ }
44
+
45
+ export declare type YamlAgentConfig = Omit<MidsceneYamlScript, 'tasks'>;
46
+
47
+ export declare interface YamlStaticServer {
48
+ server: Server;
49
+ listen(port: number, host: string, callback: () => void): void;
50
+ }
51
+
52
+ export { }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midscene/test",
3
3
  "description": "Midscene Test: an extensible YAML testing framework and Node SDK.",
4
- "version": "1.12.10-beta-20260920031616.0",
4
+ "version": "1.13.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -29,6 +29,11 @@
29
29
  "types": "./dist/types/midscene/index.d.ts",
30
30
  "import": "./dist/es/midscene/index.mjs",
31
31
  "require": "./dist/lib/midscene/index.js"
32
+ },
33
+ "./internal/yaml-runtime": {
34
+ "types": "./dist/types/runtime/index.d.ts",
35
+ "import": "./dist/es/runtime/index.mjs",
36
+ "require": "./dist/lib/runtime/index.js"
32
37
  }
33
38
  },
34
39
  "files": [
@@ -37,28 +42,66 @@
37
42
  ],
38
43
  "dependencies": {
39
44
  "@inquirer/prompts": "^7.8.6",
45
+ "dotenv": "^16.4.5",
40
46
  "execa": "9.3.0",
47
+ "glob": "11.0.0",
48
+ "http-server": "14.1.1",
41
49
  "js-yaml": "4.1.0",
50
+ "lodash.merge": "4.6.2",
42
51
  "tinyglobby": "0.2.15",
43
52
  "tsx": "^4.19.2",
44
53
  "yargs": "17.7.2",
45
54
  "zod": "^3.25.1",
46
- "@midscene/core": "1.12.10-beta-20260920031616.0",
47
- "@midscene/shared": "1.12.10-beta-20260920031616.0"
55
+ "@midscene/core": "1.13.0",
56
+ "@midscene/shared": "1.13.0"
48
57
  },
49
58
  "devDependencies": {
50
59
  "@rslib/core": "^0.18.3",
51
60
  "@types/js-yaml": "4.0.9",
61
+ "@types/lodash.merge": "4.6.9",
52
62
  "@types/node": "^18.0.0",
53
63
  "@types/yargs": "17.0.32",
54
64
  "playwright": "^1.45.0",
65
+ "puppeteer": "24.6.0",
55
66
  "typescript": "^5.8.3",
56
67
  "vitest": "3.0.5",
57
- "@midscene/android": "1.12.10-beta-20260920031616.0",
58
- "@midscene/computer": "1.12.10-beta-20260920031616.0",
59
- "@midscene/harmony": "1.12.10-beta-20260920031616.0",
60
- "@midscene/ios": "1.12.10-beta-20260920031616.0",
61
- "@midscene/web": "1.12.10-beta-20260920031616.0"
68
+ "@midscene/computer": "1.13.0",
69
+ "@midscene/harmony": "1.13.0",
70
+ "@midscene/ios": "1.13.0",
71
+ "@midscene/android": "1.13.0",
72
+ "@midscene/web": "1.13.0"
73
+ },
74
+ "peerDependencies": {
75
+ "playwright": "^1.45.0",
76
+ "puppeteer": "24.6.0",
77
+ "@midscene/android": "1.13.0",
78
+ "@midscene/harmony": "1.13.0",
79
+ "@midscene/computer": "1.13.0",
80
+ "@midscene/ios": "1.13.0",
81
+ "@midscene/web": "1.13.0"
82
+ },
83
+ "peerDependenciesMeta": {
84
+ "@midscene/android": {
85
+ "optional": true
86
+ },
87
+ "@midscene/harmony": {
88
+ "optional": true
89
+ },
90
+ "@midscene/ios": {
91
+ "optional": true
92
+ },
93
+ "playwright": {
94
+ "optional": true
95
+ },
96
+ "@midscene/computer": {
97
+ "optional": true
98
+ },
99
+ "@midscene/web": {
100
+ "optional": true
101
+ },
102
+ "puppeteer": {
103
+ "optional": true
104
+ }
62
105
  },
63
106
  "engines": {
64
107
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0"