@midscene/test 1.12.6-beta-20260910093036.0 → 1.12.6

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 (44) hide show
  1. package/dist/es/1~891.mjs +19 -39
  2. package/dist/es/1~891.mjs.map +1 -1
  3. package/dist/es/cli/index.mjs +26 -44
  4. package/dist/es/cli/index.mjs.map +1 -1
  5. package/dist/es/index.mjs +0 -3
  6. package/dist/es/index.mjs.map +1 -1
  7. package/dist/es/midscene/index.mjs +43 -32
  8. package/dist/es/midscene/index.mjs.map +1 -1
  9. package/dist/es/test-cli.mjs +37 -49
  10. package/dist/es/test-cli.mjs.map +1 -1
  11. package/dist/lib/0~458.js +19 -39
  12. package/dist/lib/0~458.js.map +1 -1
  13. package/dist/lib/cli/index.js +26 -44
  14. package/dist/lib/cli/index.js.map +1 -1
  15. package/dist/lib/index.js +0 -3
  16. package/dist/lib/index.js.map +1 -1
  17. package/dist/lib/midscene/index.js +253 -262
  18. package/dist/lib/midscene/index.js.map +1 -1
  19. package/dist/lib/test-cli.js +37 -49
  20. package/dist/lib/test-cli.js.map +1 -1
  21. package/dist/types/cli/index.d.ts +12 -13
  22. package/dist/types/index.d.ts +1 -7
  23. package/dist/types/midscene/index.d.ts +21 -21
  24. package/package.json +8 -48
  25. package/dist/es/android/index.mjs +0 -182
  26. package/dist/es/android/index.mjs.map +0 -1
  27. package/dist/es/harmony/index.mjs +0 -182
  28. package/dist/es/harmony/index.mjs.map +0 -1
  29. package/dist/es/ios/index.mjs +0 -182
  30. package/dist/es/ios/index.mjs.map +0 -1
  31. package/dist/es/playwright/index.mjs +0 -366
  32. package/dist/es/playwright/index.mjs.map +0 -1
  33. package/dist/lib/android/index.js +0 -255
  34. package/dist/lib/android/index.js.map +0 -1
  35. package/dist/lib/harmony/index.js +0 -252
  36. package/dist/lib/harmony/index.js.map +0 -1
  37. package/dist/lib/ios/index.js +0 -255
  38. package/dist/lib/ios/index.js.map +0 -1
  39. package/dist/lib/playwright/index.js +0 -412
  40. package/dist/lib/playwright/index.js.map +0 -1
  41. package/dist/types/android/index.d.ts +0 -140
  42. package/dist/types/harmony/index.d.ts +0 -137
  43. package/dist/types/ios/index.d.ts +0 -143
  44. package/dist/types/playwright/index.d.ts +0 -229
@@ -1,137 +0,0 @@
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
- /** Attach report detail references to the current Step result. */
92
- report: NodeReportCollector;
93
- }
94
-
95
- declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
96
-
97
- declare type NodeInputSchema = z.ZodObject;
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
-
110
- declare interface NodeResult<TData = unknown> {
111
- /** Human-readable summary for reports. */
112
- summary?: string;
113
- /** Structured data included in the step result. */
114
- data?: TData;
115
- }
116
-
117
- declare type NodeScopeTeardown = () => Awaitable<NodeScopeTeardownResult | void>;
118
-
119
- declare interface NodeScopeTeardownResult {
120
- /** Absolute paths to Midscene reports produced by this execution scope. */
121
- reportPaths?: readonly string[];
122
- }
123
-
124
- declare interface NormalizedStepMeta {
125
- timeoutMs?: number;
126
- continueOnError: boolean;
127
- }
128
-
129
- export { runHdcShellInputSchema }
130
-
131
- export { RunHdcShellNodeInput }
132
-
133
- export { terminateInputSchema }
134
-
135
- export { TerminateNodeInput }
136
-
137
- export { }
@@ -1,143 +0,0 @@
1
- import type { IOSAgent } from '@midscene/ios';
2
- import { launchInputSchema } from '@midscene/ios/test-runner';
3
- import { LaunchNodeInput } from '@midscene/ios/test-runner';
4
- import { runWdaRequestInputSchema } from '@midscene/ios/test-runner';
5
- import { RunWdaRequestNodeInput } from '@midscene/ios/test-runner';
6
- import { terminateInputSchema } from '@midscene/ios/test-runner';
7
- import { TerminateNodeInput } from '@midscene/ios/test-runner';
8
- import { WDAHttpMethod } from '@midscene/ios/test-runner';
9
- import { wdaRequestInputSchema } from '@midscene/ios/test-runner';
10
- import type { z } from 'zod/v4';
11
-
12
- declare type Awaitable<T> = T | Promise<T>;
13
-
14
- declare interface CaseExecutionContext {
15
- readonly caseId: string;
16
- readonly runId: string;
17
- readonly projectName: string;
18
- readonly attemptIndex: number;
19
- readonly name: string;
20
- readonly sourcePath: string;
21
- readonly caseIndex: number;
22
- }
23
-
24
- declare type CaseNodePhase = 'beforeEach' | 'steps' | 'afterEach';
25
-
26
- export declare function createIOSNodes<TContext>(options: CreateIOSNodesOptions<TContext>): readonly NodeDefinition<any, any, TContext>[];
27
-
28
- export declare interface CreateIOSNodesOptions<TContext> {
29
- getAgent(ctx: NodeExecutionContext<unknown, TContext>): Awaitable<IOSRunnerAgent>;
30
- }
31
-
32
- declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TContext = unknown> {
33
- name: string;
34
- title?: string;
35
- description?: string;
36
- /** Object field populated by string shorthand. Omit or set false to disable it. */
37
- stringInputKey?: string | false;
38
- inputSchema?: NodeInputSchema;
39
- execute(ctx: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
40
- }
41
-
42
- declare type DocumentNodePhase = 'beforeAll' | 'afterAll';
43
-
44
- export declare type IOSRunnerAgent = Pick<IOSAgent, 'launch' | 'terminate' | 'runWdaRequest' | 'home' | 'appSwitcher'>;
45
-
46
- export { launchInputSchema }
47
-
48
- export { LaunchNodeInput }
49
-
50
- declare interface NodeCaseContext extends CaseExecutionContext {
51
- readonly phase: CaseNodePhase;
52
- readonly stepIndex: number;
53
- }
54
-
55
- declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
56
- }
57
-
58
- declare interface NodeDocumentContext {
59
- readonly documentId: string;
60
- readonly documentRunId: string;
61
- readonly projectId: string;
62
- readonly projectName: string;
63
- readonly sourcePath: string;
64
- readonly phase: DocumentNodePhase;
65
- readonly stepIndex: number;
66
- }
67
-
68
- declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
69
- /** The node is running for one case. */
70
- scope: 'case';
71
- /** Identity and phase information for the case being executed. */
72
- case: NodeCaseContext;
73
- document?: never;
74
- } | {
75
- /** The node is running for the workflow document. */
76
- scope: 'document';
77
- /** Identity and phase information for the document being executed. */
78
- document: NodeDocumentContext;
79
- case?: never;
80
- });
81
-
82
- declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
83
- /** The validated node input without `$`. */
84
- input: TInput;
85
- /** The normalized engine metadata for this step. */
86
- $: Readonly<NormalizedStepMeta>;
87
- /** The timeout and cancellation signal for this step. */
88
- signal: AbortSignal;
89
- /** Resources shared by the current workflow document. */
90
- context: TContext;
91
- /** Register resource cleanup for the current case attempt or document. */
92
- onTeardown(teardown: NodeScopeTeardown): void;
93
- /** Attach report detail references to the current Step result. */
94
- report: NodeReportCollector;
95
- }
96
-
97
- declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
98
-
99
- declare type NodeInputSchema = z.ZodObject;
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
-
112
- declare interface NodeResult<TData = unknown> {
113
- /** Human-readable summary for reports. */
114
- summary?: string;
115
- /** Structured data included in the step result. */
116
- data?: TData;
117
- }
118
-
119
- declare type NodeScopeTeardown = () => Awaitable<NodeScopeTeardownResult | void>;
120
-
121
- declare interface NodeScopeTeardownResult {
122
- /** Absolute paths to Midscene reports produced by this execution scope. */
123
- reportPaths?: readonly string[];
124
- }
125
-
126
- declare interface NormalizedStepMeta {
127
- timeoutMs?: number;
128
- continueOnError: boolean;
129
- }
130
-
131
- export { runWdaRequestInputSchema }
132
-
133
- export { RunWdaRequestNodeInput }
134
-
135
- export { terminateInputSchema }
136
-
137
- export { TerminateNodeInput }
138
-
139
- export { WDAHttpMethod }
140
-
141
- export { wdaRequestInputSchema }
142
-
143
- export { }
@@ -1,229 +0,0 @@
1
- import type { BrowserContext } from 'playwright';
2
- import type { Page } from 'playwright';
3
- import { z } from 'zod/v4';
4
-
5
- declare type Awaitable<T> = T | Promise<T>;
6
-
7
- declare interface CaseExecutionContext {
8
- readonly caseId: string;
9
- readonly runId: string;
10
- readonly projectName: string;
11
- readonly attemptIndex: number;
12
- readonly name: string;
13
- readonly sourcePath: string;
14
- readonly caseIndex: number;
15
- }
16
-
17
- declare type CaseNodePhase = 'beforeEach' | 'steps' | 'afterEach';
18
-
19
- /** Input schema for the Playwright clearCookies Node. */
20
- export declare const clearCookiesInputSchema: z.ZodObject<{
21
- name: z.ZodOptional<z.ZodString>;
22
- domain: z.ZodOptional<z.ZodString>;
23
- path: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strict>;
25
-
26
- /** Validated input accepted by the Playwright clearCookies Node. */
27
- export declare type ClearCookiesNodeInput = z.infer<typeof clearCookiesInputSchema>;
28
-
29
- declare type CookieSourceReference = {
30
- kind: 'env';
31
- name: string;
32
- } | {
33
- kind: 'profile';
34
- name: string;
35
- } | {
36
- kind: 'storage-state';
37
- name: string;
38
- };
39
-
40
- /**
41
- * Create the P0 Playwright preset Nodes without assuming Project Context field
42
- * names. Cookie values must be resolved through configured references and are
43
- * never accepted as inline Node input.
44
- */
45
- export declare function createPlaywrightNodes<TContext>(options: CreatePlaywrightNodesOptions<TContext>): readonly NodeDefinition<any, any, TContext>[];
46
-
47
- /** Dependencies and source resolvers used by the Playwright preset Nodes. */
48
- export declare interface CreatePlaywrightNodesOptions<TContext> {
49
- /** Return the Playwright Page associated with the current workflow. */
50
- getPage(ctx: PlaywrightNodeContext<TContext>): Awaitable<Page>;
51
- /** Return the base URL used to resolve relative gotoUrl inputs. */
52
- getBaseUrl?(ctx: PlaywrightNodeContext<TContext>): Awaitable<string | undefined>;
53
- /**
54
- * Return the environment used by setCookies. Defaults to process.env when
55
- * omitted.
56
- */
57
- getEnv?(ctx: PlaywrightNodeContext<TContext>): Awaitable<Readonly<Record<string, string | undefined>>>;
58
- /** Resolve a named cookie profile without placing cookie values in YAML. */
59
- getCookieProfile?(input: PlaywrightCookieProfileContext<TContext>): Awaitable<readonly PlaywrightCookie[]>;
60
- /**
61
- * Resolve a storage-state reference to a file path. References are resolved
62
- * from process.cwd() when omitted.
63
- */
64
- resolveStorageStatePath?(path: string, ctx: PlaywrightNodeContext<TContext>): Awaitable<string>;
65
- }
66
-
67
- declare interface DefineNodeOptions<TInput = unknown, TData = unknown, TContext = unknown> {
68
- name: string;
69
- title?: string;
70
- description?: string;
71
- /** Object field populated by string shorthand. Omit or set false to disable it. */
72
- stringInputKey?: string | false;
73
- inputSchema?: NodeInputSchema;
74
- execute(ctx: NodeExecutionContext<TInput, TContext>): NodeExecutionReturn<TData>;
75
- }
76
-
77
- declare type DocumentNodePhase = 'beforeAll' | 'afterAll';
78
-
79
- /** Input schema for the Playwright gotoUrl Node. */
80
- export declare const gotoUrlInputSchema: z.ZodObject<{
81
- url: z.ZodString;
82
- waitUntil: z.ZodDefault<z.ZodEnum<{
83
- domcontentloaded: "domcontentloaded";
84
- commit: "commit";
85
- load: "load";
86
- networkidle: "networkidle";
87
- }>>;
88
- timeoutMs: z.ZodDefault<z.ZodNumber>;
89
- }, z.core.$strict>;
90
-
91
- /** Validated input accepted by the Playwright gotoUrl Node. */
92
- export declare type GotoUrlNodeInput = z.infer<typeof gotoUrlInputSchema>;
93
-
94
- /** Structured navigation details returned by the Playwright gotoUrl Node. */
95
- export declare interface GotoUrlNodeResult {
96
- /** Final Page URL after navigation and redirects. */
97
- url: string;
98
- /** Main-resource HTTP status, or null when Playwright returns no response. */
99
- status: number | null;
100
- /** Document title after navigation completes. */
101
- title: string;
102
- }
103
-
104
- declare interface NodeCaseContext extends CaseExecutionContext {
105
- readonly phase: CaseNodePhase;
106
- readonly stepIndex: number;
107
- }
108
-
109
- declare interface NodeDefinition<TInput = unknown, TData = unknown, TContext = unknown> extends DefineNodeOptions<TInput, TData, TContext> {
110
- }
111
-
112
- declare interface NodeDocumentContext {
113
- readonly documentId: string;
114
- readonly documentRunId: string;
115
- readonly projectId: string;
116
- readonly projectName: string;
117
- readonly sourcePath: string;
118
- readonly phase: DocumentNodePhase;
119
- readonly stepIndex: number;
120
- }
121
-
122
- declare type NodeExecutionContext<TInput = unknown, TContext = unknown> = NodeExecutionContextBase<TInput, TContext> & ({
123
- /** The node is running for one case. */
124
- scope: 'case';
125
- /** Identity and phase information for the case being executed. */
126
- case: NodeCaseContext;
127
- document?: never;
128
- } | {
129
- /** The node is running for the workflow document. */
130
- scope: 'document';
131
- /** Identity and phase information for the document being executed. */
132
- document: NodeDocumentContext;
133
- case?: never;
134
- });
135
-
136
- declare interface NodeExecutionContextBase<TInput = unknown, TContext = unknown> {
137
- /** The validated node input without `$`. */
138
- input: TInput;
139
- /** The normalized engine metadata for this step. */
140
- $: Readonly<NormalizedStepMeta>;
141
- /** The timeout and cancellation signal for this step. */
142
- signal: AbortSignal;
143
- /** Resources shared by the current workflow document. */
144
- context: TContext;
145
- /** Register resource cleanup for the current case attempt or document. */
146
- onTeardown(teardown: NodeScopeTeardown): void;
147
- /** Attach report detail references to the current Step result. */
148
- report: NodeReportCollector;
149
- }
150
-
151
- declare type NodeExecutionReturn<TData = unknown> = Promise<NodeResult<TData> | void> | NodeResult<TData> | void;
152
-
153
- declare type NodeInputSchema = z.ZodObject;
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
-
166
- declare interface NodeResult<TData = unknown> {
167
- /** Human-readable summary for reports. */
168
- summary?: string;
169
- /** Structured data included in the step result. */
170
- data?: TData;
171
- }
172
-
173
- declare type NodeScopeTeardown = () => Awaitable<NodeScopeTeardownResult | void>;
174
-
175
- declare interface NodeScopeTeardownResult {
176
- /** Absolute paths to Midscene reports produced by this execution scope. */
177
- reportPaths?: readonly string[];
178
- }
179
-
180
- declare interface NormalizedStepMeta {
181
- timeoutMs?: number;
182
- continueOnError: boolean;
183
- }
184
-
185
- declare type PlaywrightCookie = Parameters<BrowserContext['addCookies']>[0][number];
186
-
187
- /** Context passed to a configured Playwright cookie profile resolver. */
188
- export declare interface PlaywrightCookieProfileContext<TContext> {
189
- /** Profile reference from the setCookies Node input. */
190
- profile: string;
191
- /** Project Context for the current workflow. */
192
- context: TContext;
193
- /** Cancellation signal for the current Node execution. */
194
- signal: AbortSignal;
195
- }
196
-
197
- declare type PlaywrightNodeContext<TContext> = NodeExecutionContext<unknown, TContext>;
198
-
199
- /** Input schema for the Playwright setCookies Node. */
200
- export declare const setCookiesInputSchema: z.ZodObject<{
201
- cookiesEnv: z.ZodOptional<z.ZodString>;
202
- profile: z.ZodOptional<z.ZodString>;
203
- storageStatePath: z.ZodOptional<z.ZodString>;
204
- url: z.ZodOptional<z.ZodString>;
205
- }, z.core.$strict>;
206
-
207
- /** Validated input accepted by the Playwright setCookies Node. */
208
- export declare type SetCookiesNodeInput = z.infer<typeof setCookiesInputSchema>;
209
-
210
- /** Secret-free metadata returned by the Playwright setCookies Node. */
211
- export declare interface SetCookiesNodeResult {
212
- /** Kind of configured reference used to resolve the cookies. */
213
- source: CookieSourceReference['kind'];
214
- /** Environment variable, profile, or storage-state reference name. */
215
- sourceName: string;
216
- /** Number of cookies passed to the BrowserContext. */
217
- count: number;
218
- }
219
-
220
- /** Input schema for the Playwright setViewportSize Node. */
221
- export declare const setViewportSizeInputSchema: z.ZodObject<{
222
- width: z.ZodNumber;
223
- height: z.ZodNumber;
224
- }, z.core.$strict>;
225
-
226
- /** Validated input accepted by the Playwright setViewportSize Node. */
227
- export declare type SetViewportSizeNodeInput = z.infer<typeof setViewportSizeInputSchema>;
228
-
229
- export { }