@midscene/test 1.12.5 → 1.12.6-beta-20260909034232.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.
Files changed (40) hide show
  1. package/dist/es/1~891.mjs +1 -3
  2. package/dist/es/1~891.mjs.map +1 -1
  3. package/dist/es/android/index.mjs +71 -4
  4. package/dist/es/android/index.mjs.map +1 -1
  5. package/dist/es/cli/index.mjs +499 -25
  6. package/dist/es/cli/index.mjs.map +1 -1
  7. package/dist/es/harmony/index.mjs +71 -4
  8. package/dist/es/harmony/index.mjs.map +1 -1
  9. package/dist/es/index.mjs +478 -25
  10. package/dist/es/index.mjs.map +1 -1
  11. package/dist/es/ios/index.mjs +71 -4
  12. package/dist/es/ios/index.mjs.map +1 -1
  13. package/dist/es/midscene/index.mjs +71 -4
  14. package/dist/es/midscene/index.mjs.map +1 -1
  15. package/dist/es/test-cli.mjs +500 -25
  16. package/dist/es/test-cli.mjs.map +1 -1
  17. package/dist/lib/0~458.js +1 -3
  18. package/dist/lib/0~458.js.map +1 -1
  19. package/dist/lib/android/index.js +72 -4
  20. package/dist/lib/android/index.js.map +1 -1
  21. package/dist/lib/cli/index.js +499 -25
  22. package/dist/lib/cli/index.js.map +1 -1
  23. package/dist/lib/harmony/index.js +72 -4
  24. package/dist/lib/harmony/index.js.map +1 -1
  25. package/dist/lib/index.js +494 -26
  26. package/dist/lib/index.js.map +1 -1
  27. package/dist/lib/ios/index.js +72 -4
  28. package/dist/lib/ios/index.js.map +1 -1
  29. package/dist/lib/midscene/index.js +72 -4
  30. package/dist/lib/midscene/index.js.map +1 -1
  31. package/dist/lib/test-cli.js +500 -25
  32. package/dist/lib/test-cli.js.map +1 -1
  33. package/dist/types/android/index.d.ts +13 -0
  34. package/dist/types/cli/index.d.ts +25 -1
  35. package/dist/types/harmony/index.d.ts +13 -0
  36. package/dist/types/index.d.ts +91 -0
  37. package/dist/types/ios/index.d.ts +13 -0
  38. package/dist/types/midscene/index.d.ts +20 -1
  39. package/dist/types/playwright/index.d.ts +13 -0
  40. package/package.json +11 -10
@@ -89,12 +89,25 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
89
89
  context: TContext;
90
90
  /** Register resource cleanup for the current case attempt or document. */
91
91
  onTeardown(teardown: NodeScopeTeardown): void;
92
+ /** Attach report detail references to the current Step result. */
93
+ report: NodeReportCollector;
92
94
  }
93
95
 
94
96
  declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
95
97
 
96
98
  declare type NodeInputSchema = z.ZodObject;
97
99
 
100
+ /** Collects report references produced while the current Step is executing. */
101
+ declare interface NodeReportCollector {
102
+ addTrace(trace: NodeReportTrace): void;
103
+ }
104
+
105
+ /** A stable reference from one test Step to report detail data. */
106
+ declare interface NodeReportTrace {
107
+ type: 'midscene-execution';
108
+ executionId: string;
109
+ }
110
+
98
111
  declare interface NodeResult<TData = unknown> {
99
112
  /** Human-readable summary for reports. */
100
113
  summary?: string;
@@ -99,7 +99,13 @@ export declare interface LoadedTestProject<TContext = undefined> {
99
99
 
100
100
  export declare function loadTestProject<TContext = undefined>(configPath?: string): Promise<LoadedTestProject<TContext>>;
101
101
 
102
- declare type MidsceneUIAgent = CommonAgentTestRunnerApi;
102
+ declare interface MidsceneExecutionRef {
103
+ id?: string;
104
+ }
105
+
106
+ declare type MidsceneUIAgent = CommonAgentTestRunnerApi & {
107
+ addDumpUpdateListener?(listener: (dump: string, execution?: MidsceneExecutionRef) => void): () => void;
108
+ };
103
109
 
104
110
  declare interface NodeCaseContext extends CaseExecutionContext {
105
111
  readonly phase: CaseNodePhase;
@@ -144,6 +150,8 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
144
150
  context: TContext;
145
151
  /** Register resource cleanup for the current case attempt or document. */
146
152
  onTeardown(teardown: NodeScopeTeardown): void;
153
+ /** Attach report detail references to the current Step result. */
154
+ report: NodeReportCollector;
147
155
  }
148
156
 
149
157
  declare type NodeExecutionPhase = CaseNodePhase | DocumentNodePhase;
@@ -170,6 +178,17 @@ declare class NodeRegistry {
170
178
  definitions(): readonly NodeDefinition<any, any, any>[];
171
179
  }
172
180
 
181
+ /** Collects report references produced while the current Step is executing. */
182
+ declare interface NodeReportCollector {
183
+ addTrace(trace: NodeReportTrace): void;
184
+ }
185
+
186
+ /** A stable reference from one test Step to report detail data. */
187
+ declare interface NodeReportTrace {
188
+ type: 'midscene-execution';
189
+ executionId: string;
190
+ }
191
+
173
192
  declare interface NodeResult<TData = unknown> {
174
193
  /** Human-readable summary for reports. */
175
194
  summary?: string;
@@ -258,6 +277,9 @@ declare interface StepRunResult<TOutputData = unknown> {
258
277
  durationMs: number;
259
278
  output?: NodeResult<TOutputData>;
260
279
  error?: WorkflowError;
280
+ report?: {
281
+ traces: readonly NodeReportTrace[];
282
+ };
261
283
  }
262
284
 
263
285
  export declare interface TestExecutionProjectRunResult {
@@ -333,6 +355,8 @@ export declare interface TestProjectRunResult {
333
355
  resultDir: string;
334
356
  summaryPath: string;
335
357
  reportDir: string;
358
+ /** Absolute path to the unified Midscene Test HTML report. */
359
+ reportPath?: string;
336
360
  summary: TestProjectRunSummary;
337
361
  projects: readonly TestExecutionProjectRunResult[];
338
362
  cases: readonly TestProjectCaseRunResult[];
@@ -88,12 +88,25 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
88
88
  context: TContext;
89
89
  /** Register resource cleanup for the current case attempt or document. */
90
90
  onTeardown(teardown: NodeScopeTeardown): void;
91
+ /** Attach report detail references to the current Step result. */
92
+ report: NodeReportCollector;
91
93
  }
92
94
 
93
95
  declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
94
96
 
95
97
  declare type NodeInputSchema = z.ZodObject;
96
98
 
99
+ /** Collects report references produced while the current Step is executing. */
100
+ declare interface NodeReportCollector {
101
+ addTrace(trace: NodeReportTrace): void;
102
+ }
103
+
104
+ /** A stable reference from one test Step to report detail data. */
105
+ declare interface NodeReportTrace {
106
+ type: 'midscene-execution';
107
+ executionId: string;
108
+ }
109
+
97
110
  declare interface NodeResult<TData = unknown> {
98
111
  /** Human-readable summary for reports. */
99
112
  summary?: string;
@@ -1,9 +1,16 @@
1
1
  import { CaseRunResult as CaseRunResult_2 } from './engine/types';
2
+ import type { TestRunReportDump } from '@midscene/core';
3
+ import type { TestRunReportError } from '@midscene/core';
4
+ import type { TestRunReportSource } from '@midscene/core';
5
+ import type { TestRunReportSourceIndex } from '@midscene/core';
6
+ import type { TestRunReportValue } from '@midscene/core';
2
7
  import { WorkflowDocumentRunResult as WorkflowDocumentRunResult_2 } from './engine/types';
3
8
  import { z } from 'zod/v4';
4
9
 
5
10
  export declare type Awaitable<T> = T | Promise<T>;
6
11
 
12
+ export declare function buildTestRunReportDump(result: TestProjectRunResult, index: TestRunReportSourceIndex): TestRunReportDump;
13
+
7
14
  export declare interface CaseDefinition<TStep = StepInput> {
8
15
  name: string;
9
16
  tags?: readonly string[];
@@ -102,6 +109,8 @@ export declare interface CollectedWorkflowDocument {
102
109
  cases: readonly CollectedCase[];
103
110
  }
104
111
 
112
+ export declare function collectTestRunReportSources(result: TestProjectRunResult): TestRunReportSource[];
113
+
105
114
  export declare function collectWorkflowDocument(source: WorkflowDocumentSource, options: CollectWorkflowDocumentOptions): CollectedWorkflowDocument;
106
115
 
107
116
  export declare interface CollectWorkflowDocumentOptions {
@@ -222,6 +231,8 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
222
231
  context: TContext;
223
232
  /** Register resource cleanup for the current case attempt or document. */
224
233
  onTeardown(teardown: NodeScopeTeardown): void;
234
+ /** Attach report detail references to the current Step result. */
235
+ report: NodeReportCollector;
225
236
  }
226
237
 
227
238
  export declare class NodeExecutionError extends WorkflowError {
@@ -256,6 +267,17 @@ export declare class NodeRegistry {
256
267
  definitions(): readonly NodeDefinition<any, any, any>[];
257
268
  }
258
269
 
270
+ /** Collects report references produced while the current Step is executing. */
271
+ export declare interface NodeReportCollector {
272
+ addTrace(trace: NodeReportTrace): void;
273
+ }
274
+
275
+ /** A stable reference from one test Step to report detail data. */
276
+ export declare interface NodeReportTrace {
277
+ type: 'midscene-execution';
278
+ executionId: string;
279
+ }
280
+
259
281
  export declare interface NodeResult<TData = unknown> {
260
282
  /** Human-readable summary for reports. */
261
283
  summary?: string;
@@ -417,6 +439,13 @@ export declare interface RunWorkflowDocumentOptions<TContext = undefined> {
417
439
  createDocumentRunId?(document: CollectedWorkflowDocument): string;
418
440
  }
419
441
 
442
+ export declare function sanitizeReportError(error: unknown): TestRunReportError;
443
+
444
+ export declare function sanitizeReportText(value: string, maximumLength?: number): string;
445
+
446
+ /** Convert arbitrary Node input/output to a bounded, JSON-safe display value. */
447
+ export declare function sanitizeReportValue(value: unknown): TestRunReportValue;
448
+
420
449
  export declare type StepExecutionInfo = {
421
450
  scope: 'case';
422
451
  node: string;
@@ -453,6 +482,9 @@ export declare interface StepRunResult<TOutputData = unknown> {
453
482
  durationMs: number;
454
483
  output?: NodeResult<TOutputData>;
455
484
  error?: WorkflowError;
485
+ report?: {
486
+ traces: readonly NodeReportTrace[];
487
+ };
456
488
  }
457
489
 
458
490
  export declare type StepStartHandler = (info: StepExecutionInfo) => Awaitable<unknown>;
@@ -469,6 +501,23 @@ declare interface StringInputNodeDefinition {
469
501
  stringInputKey?: string | false;
470
502
  }
471
503
 
504
+ declare interface TestExecutionProjectRunResult {
505
+ projectId: string;
506
+ name: string;
507
+ platform: TestPlatform;
508
+ status: 'success' | 'failed';
509
+ retry: number;
510
+ fileSelection: TestFileSelection;
511
+ tagSelection: Readonly<Required<TestTagSelection>>;
512
+ sourceCount: number;
513
+ selectedCaseCount: number;
514
+ filteredCaseCount: number;
515
+ lifecycle?: ProjectRuntimeResult;
516
+ cases: readonly TestProjectCaseRunResult[];
517
+ documents: readonly WorkflowDocumentRunResult[];
518
+ collectionErrors: readonly TestProjectCollectionError[];
519
+ }
520
+
472
521
  declare interface TestFileSelection {
473
522
  include: readonly string[];
474
523
  exclude?: readonly string[];
@@ -476,6 +525,48 @@ declare interface TestFileSelection {
476
525
 
477
526
  declare type TestPlatform = 'web' | 'android' | 'ios' | 'harmony' | 'computer';
478
527
 
528
+ declare type TestProjectCaseRunResult = CaseRunOutcome & {
529
+ documentId: string;
530
+ };
531
+
532
+ declare interface TestProjectCollectionError {
533
+ projectId: string;
534
+ projectName: string;
535
+ sourcePath: string;
536
+ error: WorkflowError;
537
+ }
538
+
539
+ declare interface TestProjectRunResult {
540
+ schemaVersion: 3;
541
+ runId: string;
542
+ startedAt: string;
543
+ endedAt: string;
544
+ durationMs: number;
545
+ status: 'success' | 'failed';
546
+ exitCode: 0 | 1;
547
+ resultDir: string;
548
+ summaryPath: string;
549
+ reportDir: string;
550
+ /** Absolute path to the unified Midscene Test HTML report. */
551
+ reportPath?: string;
552
+ summary: TestProjectRunSummary;
553
+ projects: readonly TestExecutionProjectRunResult[];
554
+ cases: readonly TestProjectCaseRunResult[];
555
+ documents: readonly WorkflowDocumentRunResult[];
556
+ collectionErrors: readonly TestProjectCollectionError[];
557
+ }
558
+
559
+ declare interface TestProjectRunSummary {
560
+ total: number;
561
+ passed: number;
562
+ failed: number;
563
+ notRun: number;
564
+ filtered: number;
565
+ collectionErrors: number;
566
+ documentFailures: number;
567
+ projectFailures: number;
568
+ }
569
+
479
570
  declare interface TestTagSelection {
480
571
  include?: readonly string[];
481
572
  exclude?: readonly string[];
@@ -90,12 +90,25 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
90
90
  context: TContext;
91
91
  /** Register resource cleanup for the current case attempt or document. */
92
92
  onTeardown(teardown: NodeScopeTeardown): void;
93
+ /** Attach report detail references to the current Step result. */
94
+ report: NodeReportCollector;
93
95
  }
94
96
 
95
97
  declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
96
98
 
97
99
  declare type NodeInputSchema = z.ZodObject;
98
100
 
101
+ /** Collects report references produced while the current Step is executing. */
102
+ declare interface NodeReportCollector {
103
+ addTrace(trace: NodeReportTrace): void;
104
+ }
105
+
106
+ /** A stable reference from one test Step to report detail data. */
107
+ declare interface NodeReportTrace {
108
+ type: 'midscene-execution';
109
+ executionId: string;
110
+ }
111
+
99
112
  declare interface NodeResult<TData = unknown> {
100
113
  /** Human-readable summary for reports. */
101
114
  summary?: string;
@@ -90,7 +90,13 @@ export { insightOptionsInputSchema }
90
90
 
91
91
  export { locateOptionsInputSchema }
92
92
 
93
- export declare type MidsceneUIAgent = CommonAgentTestRunnerApi;
93
+ export declare interface MidsceneExecutionRef {
94
+ id?: string;
95
+ }
96
+
97
+ export declare type MidsceneUIAgent = CommonAgentTestRunnerApi & {
98
+ addDumpUpdateListener?(listener: (dump: string, execution?: MidsceneExecutionRef) => void): () => void;
99
+ };
94
100
 
95
101
  declare interface NodeCaseContext extends CaseExecutionContext {
96
102
  readonly phase: CaseNodePhase;
@@ -135,12 +141,25 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
135
141
  context: TContext;
136
142
  /** Register resource cleanup for the current case attempt or document. */
137
143
  onTeardown(teardown: NodeScopeTeardown): void;
144
+ /** Attach report detail references to the current Step result. */
145
+ report: NodeReportCollector;
138
146
  }
139
147
 
140
148
  declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
141
149
 
142
150
  declare type NodeInputSchema = z.ZodObject;
143
151
 
152
+ /** Collects report references produced while the current Step is executing. */
153
+ declare interface NodeReportCollector {
154
+ addTrace(trace: NodeReportTrace): void;
155
+ }
156
+
157
+ /** A stable reference from one test Step to report detail data. */
158
+ declare interface NodeReportTrace {
159
+ type: 'midscene-execution';
160
+ executionId: string;
161
+ }
162
+
144
163
  declare interface NodeResult<TData = unknown> {
145
164
  /** Human-readable summary for reports. */
146
165
  summary?: string;
@@ -144,12 +144,25 @@ declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown>
144
144
  context: TContext;
145
145
  /** Register resource cleanup for the current case attempt or document. */
146
146
  onTeardown(teardown: NodeScopeTeardown): void;
147
+ /** Attach report detail references to the current Step result. */
148
+ report: NodeReportCollector;
147
149
  }
148
150
 
149
151
  declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
150
152
 
151
153
  declare type NodeInputSchema = z.ZodObject;
152
154
 
155
+ /** Collects report references produced while the current Step is executing. */
156
+ declare interface NodeReportCollector {
157
+ addTrace(trace: NodeReportTrace): void;
158
+ }
159
+
160
+ /** A stable reference from one test Step to report detail data. */
161
+ declare interface NodeReportTrace {
162
+ type: 'midscene-execution';
163
+ executionId: string;
164
+ }
165
+
153
166
  declare interface NodeResult<TData = unknown> {
154
167
  /** Human-readable summary for reports. */
155
168
  summary?: string;
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.5",
4
+ "version": "1.12.6-beta-20260909034232.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -63,7 +63,8 @@
63
63
  "tsx": "^4.19.2",
64
64
  "yargs": "17.7.2",
65
65
  "zod": "^3.25.1",
66
- "@midscene/core": "1.12.5"
66
+ "@midscene/shared": "1.12.6-beta-20260909034232.0",
67
+ "@midscene/core": "1.12.6-beta-20260909034232.0"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@rslib/core": "^0.18.3",
@@ -73,17 +74,17 @@
73
74
  "playwright": "^1.45.0",
74
75
  "typescript": "^5.8.3",
75
76
  "vitest": "3.0.5",
76
- "@midscene/harmony": "1.12.5",
77
- "@midscene/android": "1.12.5",
78
- "@midscene/computer": "1.12.5",
79
- "@midscene/web": "1.12.5",
80
- "@midscene/ios": "1.12.5"
77
+ "@midscene/android": "1.12.6-beta-20260909034232.0",
78
+ "@midscene/computer": "1.12.6-beta-20260909034232.0",
79
+ "@midscene/harmony": "1.12.6-beta-20260909034232.0",
80
+ "@midscene/ios": "1.12.6-beta-20260909034232.0",
81
+ "@midscene/web": "1.12.6-beta-20260909034232.0"
81
82
  },
82
83
  "peerDependencies": {
83
84
  "playwright": "^1.45.0",
84
- "@midscene/ios": "1.12.5",
85
- "@midscene/harmony": "1.12.5",
86
- "@midscene/android": "1.12.5"
85
+ "@midscene/android": "1.12.6-beta-20260909034232.0",
86
+ "@midscene/ios": "1.12.6-beta-20260909034232.0",
87
+ "@midscene/harmony": "1.12.6-beta-20260909034232.0"
87
88
  },
88
89
  "peerDependenciesMeta": {
89
90
  "@midscene/android": {