@vostride/agent-qa-android 0.2.3 → 0.2.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/index.cjs +30 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -92
- package/dist/index.d.ts +7 -92
- package/dist/index.js +30 -119
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlatformAdapter, PlatformConfig,
|
|
1
|
+
import { PlatformAdapter, PlatformConfig, ActionsFor, ActionResult, ConsoleLogEntry, LiveStreamCapability, RecordingCapability } from '@vostride/agent-qa-runner';
|
|
2
2
|
import { ScreenState } from '@vostride/agent-qa-schema';
|
|
3
3
|
|
|
4
4
|
declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
@@ -19,18 +19,11 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
19
19
|
setup(config: PlatformConfig): Promise<void>;
|
|
20
20
|
cleanup(): Promise<void>;
|
|
21
21
|
private hasSeenWebContext;
|
|
22
|
-
observe(
|
|
22
|
+
observe(): Promise<ScreenState>;
|
|
23
23
|
execute(action: ActionsFor<'android'>): Promise<ActionResult>;
|
|
24
24
|
screenshot(): Promise<Buffer | undefined>;
|
|
25
25
|
pollDeviceLogs(): Promise<void>;
|
|
26
26
|
drainConsoleLogs(level?: string): ConsoleLogEntry[];
|
|
27
|
-
/**
|
|
28
|
-
* 428 D-11: the labelled 1s snapshot preview, over `captureScreenshot()` — `takeScreenshot()`
|
|
29
|
-
* and nothing else. Never `screenshot()`: that one switches the Appium context, and a tick
|
|
30
|
-
* landing between a step's context switch and its command would run the command in the wrong
|
|
31
|
-
* context. Declared before the driver exists (a capture then answers `undefined`), so the
|
|
32
|
-
* composition's selection never falls through to `screenshot()`.
|
|
33
|
-
*/
|
|
34
27
|
get liveStream(): LiveStreamCapability;
|
|
35
28
|
get recording(): RecordingCapability | undefined;
|
|
36
29
|
private tryObserveWeb;
|
|
@@ -40,49 +33,19 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
40
33
|
/** Read the live text of a focused element handle; undefined when nothing is readable. */
|
|
41
34
|
private readElementText;
|
|
42
35
|
private focusedMatches;
|
|
43
|
-
/** An empty field's getText() returns its hint
|
|
36
|
+
/** An empty field's getText() returns its hint, so a showing hint reads ''. */
|
|
44
37
|
private readFocusedValue;
|
|
45
|
-
/**
|
|
46
|
-
* The `mobile: shell` route of keyevent and openQuickSettings (437 D-18). A refusal by secure
|
|
47
|
-
* Appium is recorded as unavailable and any other driver error as failed; neither is a pass.
|
|
48
|
-
*/
|
|
49
38
|
private runShell;
|
|
50
|
-
/** The one submit mechanism on every Android path
|
|
39
|
+
/** The one submit mechanism on every Android path; pressed once, never retried. */
|
|
51
40
|
private pressEnter;
|
|
52
|
-
/** 437 FA-2 (owner, 2026-10-08): line breaks into a single-line field are refused before typing. */
|
|
53
41
|
private refuseLineBreaks;
|
|
54
|
-
/**
|
|
55
|
-
* Native fill from the focused handle (437 D-08..D-10, D-12, D-13, D-15, D-17). Delivers once
|
|
56
|
-
* (addValue for append, setValue for replace), reads back from the same handle and records the
|
|
57
|
-
* shared verdict. An unknown append prior or an unreadable read-back is unverified, which never
|
|
58
|
-
* stops a requested Enter; a mismatch or a multi-line field holds it. A driver error during
|
|
59
|
-
* delivery ends the fill: nothing is typed again and no Enter follows. A secure field yields
|
|
60
|
-
* length sentinels only.
|
|
61
|
-
*/
|
|
62
42
|
private fillNativeCompound;
|
|
63
43
|
/** The focused element handle, or undefined when UiAutomator2 reports none or the lookup fails. */
|
|
64
44
|
private focusedField;
|
|
65
|
-
/**
|
|
66
|
-
* 437 D-11 (WR-02): where the focused node is relative to the ref, judged by its read bounds.
|
|
67
|
-
* An unreadable or unparseable value is no evidence, so the native path stays (D-04, D-15).
|
|
68
|
-
* 444.1 D-07: 'elsewhere' needs positive evidence, the bounds of another observed field.
|
|
69
|
-
*/
|
|
70
45
|
private focusIsElsewhere;
|
|
71
|
-
/** Ctrl+A then DEL as key input; clears only the view holding input focus
|
|
46
|
+
/** Ctrl+A then DEL as key input; clears only the view holding input focus. */
|
|
72
47
|
private clearByKeys;
|
|
73
|
-
/**
|
|
74
|
-
* The last-resort keyboard path (437 D-14): the tap left no focused handle. Replace clears by
|
|
75
|
-
* keys, the text goes through one `mobile: type` (Appium's Unicode IME, exact for every D-08
|
|
76
|
-
* text), and the value is read back only when a focused handle can be found afterwards. An
|
|
77
|
-
* append's prior value is unknown, so it is never better than unverified. The field's kind comes
|
|
78
|
-
* from the observed input-type (D-15): only positive evidence refuses line breaks or holds Enter.
|
|
79
|
-
*/
|
|
80
48
|
private fillKeyboardPath;
|
|
81
|
-
/**
|
|
82
|
-
* Native and keyboard clearText (437 D-16): clearValue on the focused handle, or Ctrl+A then DEL
|
|
83
|
-
* when the tap left none, then the hint-aware read-back judged against the empty string. The
|
|
84
|
-
* caller has already checked that a focused handle is the referenced field (WR-02).
|
|
85
|
-
*/
|
|
86
49
|
private clearNativeOrKeyboard;
|
|
87
50
|
private isSecure;
|
|
88
51
|
private settleClear;
|
|
@@ -90,13 +53,8 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
90
53
|
private interruptedClear;
|
|
91
54
|
/** A driver error during delivery ends the fill: nothing is typed again and no Enter follows. */
|
|
92
55
|
private interruptedFill;
|
|
93
|
-
/**
|
|
94
|
-
* The shared end of every Android fill (437 D-09, D-10, D-13, D-15, D-17): records the verdict
|
|
95
|
-
* and, when a submit was requested, holds Enter on a mismatch or a multi-line field and otherwise
|
|
96
|
-
* presses it once through `enter`.
|
|
97
|
-
*/
|
|
98
56
|
private settleFill;
|
|
99
|
-
/** A real W3C touch tap in the WebView context at the ref's CSS-pixel centre
|
|
57
|
+
/** A real W3C touch tap in the WebView context at the ref's CSS-pixel centre. */
|
|
100
58
|
private trustedWebTap;
|
|
101
59
|
/** Whether the tap left an editable field focused at the ref's point; read-only. */
|
|
102
60
|
private probeWebFocus;
|
|
@@ -105,52 +63,14 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
105
63
|
private readWebFieldValue;
|
|
106
64
|
/** Runs a driver call from NATIVE_APP and always returns to the active WebView context. */
|
|
107
65
|
private withNativeContext;
|
|
108
|
-
/** 437 D-11: a tap that left no editable field, or another field, focused writes nothing. */
|
|
109
66
|
private refuseFocus;
|
|
110
|
-
/**
|
|
111
|
-
* WebView clearText (437 D-11, D-16): the same tap and focus probe as the fill, W3C Ctrl+A and
|
|
112
|
-
* Backspace, then a read-back judged against the empty string. Never success without that check.
|
|
113
|
-
*/
|
|
114
67
|
private clearWebViewField;
|
|
115
|
-
/**
|
|
116
|
-
* WebView fill as trusted input (437 D-11): a W3C tap on the ref, a read-only focus probe,
|
|
117
|
-
* W3C Ctrl+A and Backspace for replace, `mobile: type` from NATIVE_APP, a read-only read-back,
|
|
118
|
-
* and one `mobile: pressKey 66` from NATIVE_APP. No script writes the field or fires an event.
|
|
119
|
-
*/
|
|
120
68
|
private fillWebViewCompound;
|
|
121
|
-
/**
|
|
122
|
-
* EXEC-02 platform primitives injected into the shared runner scroll loops (D-02/D-03; 436-02
|
|
123
|
-
* D-25). A native swipe is `mobile: scrollGesture` over the container (the ref's bounds, else the
|
|
124
|
-
* screen), whose boolean is the driver's own boundary signal; in a WebView the touch swipe is
|
|
125
|
-
* measured over every WebView scroller before and after (436-18), paired by identity (436-23).
|
|
126
|
-
* nativeSearchScroll drives the UiAutomator
|
|
127
|
-
* `UiScrollable.scrollIntoView` rung over an injection-escaped selector; readInterimTree is a
|
|
128
|
-
* light page-source parse — NO refMap mint, NO screenshot, lastRefs untouched.
|
|
129
|
-
*/
|
|
130
69
|
private buildAndroidScrollPrimitives;
|
|
131
|
-
/**
|
|
132
|
-
* The WebView scrollers a touch swipe may have acted on (436-18 · D-25), read by the shared
|
|
133
|
-
* WEBVIEW_SCROLLERS_SCRIPT. The touch point cannot be mapped into the WebView's CSS coordinates,
|
|
134
|
-
* so the swipe is judged over all of them.
|
|
135
|
-
* 2026-10-08 (436-23): a frame in view reads unknown; members carry an identity and are paired
|
|
136
|
-
* by it; open shadow roots are walked; only on-screen element scrollers are members.
|
|
137
|
-
*/
|
|
138
70
|
private readWebViewScrollers;
|
|
139
|
-
/**
|
|
140
|
-
* EXEC-03 openApp (D-10/D-11/D-12). Resolve a human name to a package id (or validate an
|
|
141
|
-
* explicit bundleId) over the session-cached registry, then launch via activateApp. On a
|
|
142
|
-
* resolution MISS the registry is re-enumerated exactly once (catches mid-run installs) before
|
|
143
|
-
* erroring with the resolver's candidate ids. Never a best-guess launch (T-359-04).
|
|
144
|
-
*/
|
|
145
71
|
private openApp;
|
|
146
72
|
/** Return the cached registry, enumerating once on first use. Failed enumeration returns null (uncached). */
|
|
147
73
|
private ensureAppRegistry;
|
|
148
|
-
/**
|
|
149
|
-
* Enumerate installed apps through the driver only (ownership contract — no adb/child_process).
|
|
150
|
-
* `mobile: listApps` maps package ids → AppRegistryEntry (labels only when the same call carries
|
|
151
|
-
* them, D-10 — no per-package round-trips). On failure, fall back to `mobile: shell` pm-list ONLY
|
|
152
|
-
* when the AGENT_QA_ANDROID_USE_MOBILE_SHELL gate is '1' (Pitfall 4). Null = enumeration unavailable.
|
|
153
|
-
*/
|
|
154
74
|
private enumerateApps;
|
|
155
75
|
/** Coerce a `mobile: listApps` result (package-id-keyed map, or an array of entries) into the registry. */
|
|
156
76
|
private mapListApps;
|
|
@@ -167,11 +87,6 @@ interface AndroidAdapterConfig extends PlatformConfig {
|
|
|
167
87
|
avd?: string;
|
|
168
88
|
}
|
|
169
89
|
|
|
170
|
-
declare function createAndroidSession(config: AndroidAdapterConfig
|
|
171
|
-
hostname: string;
|
|
172
|
-
port: number;
|
|
173
|
-
path: string;
|
|
174
|
-
capabilities: Record<string, unknown>;
|
|
175
|
-
}): Promise<WebdriverIO.Browser>;
|
|
90
|
+
declare function createAndroidSession(config: AndroidAdapterConfig): Promise<WebdriverIO.Browser>;
|
|
176
91
|
|
|
177
92
|
export { type AndroidAdapterConfig, AndroidPlatformAdapter, createAndroidSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlatformAdapter, PlatformConfig,
|
|
1
|
+
import { PlatformAdapter, PlatformConfig, ActionsFor, ActionResult, ConsoleLogEntry, LiveStreamCapability, RecordingCapability } from '@vostride/agent-qa-runner';
|
|
2
2
|
import { ScreenState } from '@vostride/agent-qa-schema';
|
|
3
3
|
|
|
4
4
|
declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
@@ -19,18 +19,11 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
19
19
|
setup(config: PlatformConfig): Promise<void>;
|
|
20
20
|
cleanup(): Promise<void>;
|
|
21
21
|
private hasSeenWebContext;
|
|
22
|
-
observe(
|
|
22
|
+
observe(): Promise<ScreenState>;
|
|
23
23
|
execute(action: ActionsFor<'android'>): Promise<ActionResult>;
|
|
24
24
|
screenshot(): Promise<Buffer | undefined>;
|
|
25
25
|
pollDeviceLogs(): Promise<void>;
|
|
26
26
|
drainConsoleLogs(level?: string): ConsoleLogEntry[];
|
|
27
|
-
/**
|
|
28
|
-
* 428 D-11: the labelled 1s snapshot preview, over `captureScreenshot()` — `takeScreenshot()`
|
|
29
|
-
* and nothing else. Never `screenshot()`: that one switches the Appium context, and a tick
|
|
30
|
-
* landing between a step's context switch and its command would run the command in the wrong
|
|
31
|
-
* context. Declared before the driver exists (a capture then answers `undefined`), so the
|
|
32
|
-
* composition's selection never falls through to `screenshot()`.
|
|
33
|
-
*/
|
|
34
27
|
get liveStream(): LiveStreamCapability;
|
|
35
28
|
get recording(): RecordingCapability | undefined;
|
|
36
29
|
private tryObserveWeb;
|
|
@@ -40,49 +33,19 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
40
33
|
/** Read the live text of a focused element handle; undefined when nothing is readable. */
|
|
41
34
|
private readElementText;
|
|
42
35
|
private focusedMatches;
|
|
43
|
-
/** An empty field's getText() returns its hint
|
|
36
|
+
/** An empty field's getText() returns its hint, so a showing hint reads ''. */
|
|
44
37
|
private readFocusedValue;
|
|
45
|
-
/**
|
|
46
|
-
* The `mobile: shell` route of keyevent and openQuickSettings (437 D-18). A refusal by secure
|
|
47
|
-
* Appium is recorded as unavailable and any other driver error as failed; neither is a pass.
|
|
48
|
-
*/
|
|
49
38
|
private runShell;
|
|
50
|
-
/** The one submit mechanism on every Android path
|
|
39
|
+
/** The one submit mechanism on every Android path; pressed once, never retried. */
|
|
51
40
|
private pressEnter;
|
|
52
|
-
/** 437 FA-2 (owner, 2026-10-08): line breaks into a single-line field are refused before typing. */
|
|
53
41
|
private refuseLineBreaks;
|
|
54
|
-
/**
|
|
55
|
-
* Native fill from the focused handle (437 D-08..D-10, D-12, D-13, D-15, D-17). Delivers once
|
|
56
|
-
* (addValue for append, setValue for replace), reads back from the same handle and records the
|
|
57
|
-
* shared verdict. An unknown append prior or an unreadable read-back is unverified, which never
|
|
58
|
-
* stops a requested Enter; a mismatch or a multi-line field holds it. A driver error during
|
|
59
|
-
* delivery ends the fill: nothing is typed again and no Enter follows. A secure field yields
|
|
60
|
-
* length sentinels only.
|
|
61
|
-
*/
|
|
62
42
|
private fillNativeCompound;
|
|
63
43
|
/** The focused element handle, or undefined when UiAutomator2 reports none or the lookup fails. */
|
|
64
44
|
private focusedField;
|
|
65
|
-
/**
|
|
66
|
-
* 437 D-11 (WR-02): where the focused node is relative to the ref, judged by its read bounds.
|
|
67
|
-
* An unreadable or unparseable value is no evidence, so the native path stays (D-04, D-15).
|
|
68
|
-
* 444.1 D-07: 'elsewhere' needs positive evidence, the bounds of another observed field.
|
|
69
|
-
*/
|
|
70
45
|
private focusIsElsewhere;
|
|
71
|
-
/** Ctrl+A then DEL as key input; clears only the view holding input focus
|
|
46
|
+
/** Ctrl+A then DEL as key input; clears only the view holding input focus. */
|
|
72
47
|
private clearByKeys;
|
|
73
|
-
/**
|
|
74
|
-
* The last-resort keyboard path (437 D-14): the tap left no focused handle. Replace clears by
|
|
75
|
-
* keys, the text goes through one `mobile: type` (Appium's Unicode IME, exact for every D-08
|
|
76
|
-
* text), and the value is read back only when a focused handle can be found afterwards. An
|
|
77
|
-
* append's prior value is unknown, so it is never better than unverified. The field's kind comes
|
|
78
|
-
* from the observed input-type (D-15): only positive evidence refuses line breaks or holds Enter.
|
|
79
|
-
*/
|
|
80
48
|
private fillKeyboardPath;
|
|
81
|
-
/**
|
|
82
|
-
* Native and keyboard clearText (437 D-16): clearValue on the focused handle, or Ctrl+A then DEL
|
|
83
|
-
* when the tap left none, then the hint-aware read-back judged against the empty string. The
|
|
84
|
-
* caller has already checked that a focused handle is the referenced field (WR-02).
|
|
85
|
-
*/
|
|
86
49
|
private clearNativeOrKeyboard;
|
|
87
50
|
private isSecure;
|
|
88
51
|
private settleClear;
|
|
@@ -90,13 +53,8 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
90
53
|
private interruptedClear;
|
|
91
54
|
/** A driver error during delivery ends the fill: nothing is typed again and no Enter follows. */
|
|
92
55
|
private interruptedFill;
|
|
93
|
-
/**
|
|
94
|
-
* The shared end of every Android fill (437 D-09, D-10, D-13, D-15, D-17): records the verdict
|
|
95
|
-
* and, when a submit was requested, holds Enter on a mismatch or a multi-line field and otherwise
|
|
96
|
-
* presses it once through `enter`.
|
|
97
|
-
*/
|
|
98
56
|
private settleFill;
|
|
99
|
-
/** A real W3C touch tap in the WebView context at the ref's CSS-pixel centre
|
|
57
|
+
/** A real W3C touch tap in the WebView context at the ref's CSS-pixel centre. */
|
|
100
58
|
private trustedWebTap;
|
|
101
59
|
/** Whether the tap left an editable field focused at the ref's point; read-only. */
|
|
102
60
|
private probeWebFocus;
|
|
@@ -105,52 +63,14 @@ declare class AndroidPlatformAdapter implements PlatformAdapter<'android'> {
|
|
|
105
63
|
private readWebFieldValue;
|
|
106
64
|
/** Runs a driver call from NATIVE_APP and always returns to the active WebView context. */
|
|
107
65
|
private withNativeContext;
|
|
108
|
-
/** 437 D-11: a tap that left no editable field, or another field, focused writes nothing. */
|
|
109
66
|
private refuseFocus;
|
|
110
|
-
/**
|
|
111
|
-
* WebView clearText (437 D-11, D-16): the same tap and focus probe as the fill, W3C Ctrl+A and
|
|
112
|
-
* Backspace, then a read-back judged against the empty string. Never success without that check.
|
|
113
|
-
*/
|
|
114
67
|
private clearWebViewField;
|
|
115
|
-
/**
|
|
116
|
-
* WebView fill as trusted input (437 D-11): a W3C tap on the ref, a read-only focus probe,
|
|
117
|
-
* W3C Ctrl+A and Backspace for replace, `mobile: type` from NATIVE_APP, a read-only read-back,
|
|
118
|
-
* and one `mobile: pressKey 66` from NATIVE_APP. No script writes the field or fires an event.
|
|
119
|
-
*/
|
|
120
68
|
private fillWebViewCompound;
|
|
121
|
-
/**
|
|
122
|
-
* EXEC-02 platform primitives injected into the shared runner scroll loops (D-02/D-03; 436-02
|
|
123
|
-
* D-25). A native swipe is `mobile: scrollGesture` over the container (the ref's bounds, else the
|
|
124
|
-
* screen), whose boolean is the driver's own boundary signal; in a WebView the touch swipe is
|
|
125
|
-
* measured over every WebView scroller before and after (436-18), paired by identity (436-23).
|
|
126
|
-
* nativeSearchScroll drives the UiAutomator
|
|
127
|
-
* `UiScrollable.scrollIntoView` rung over an injection-escaped selector; readInterimTree is a
|
|
128
|
-
* light page-source parse — NO refMap mint, NO screenshot, lastRefs untouched.
|
|
129
|
-
*/
|
|
130
69
|
private buildAndroidScrollPrimitives;
|
|
131
|
-
/**
|
|
132
|
-
* The WebView scrollers a touch swipe may have acted on (436-18 · D-25), read by the shared
|
|
133
|
-
* WEBVIEW_SCROLLERS_SCRIPT. The touch point cannot be mapped into the WebView's CSS coordinates,
|
|
134
|
-
* so the swipe is judged over all of them.
|
|
135
|
-
* 2026-10-08 (436-23): a frame in view reads unknown; members carry an identity and are paired
|
|
136
|
-
* by it; open shadow roots are walked; only on-screen element scrollers are members.
|
|
137
|
-
*/
|
|
138
70
|
private readWebViewScrollers;
|
|
139
|
-
/**
|
|
140
|
-
* EXEC-03 openApp (D-10/D-11/D-12). Resolve a human name to a package id (or validate an
|
|
141
|
-
* explicit bundleId) over the session-cached registry, then launch via activateApp. On a
|
|
142
|
-
* resolution MISS the registry is re-enumerated exactly once (catches mid-run installs) before
|
|
143
|
-
* erroring with the resolver's candidate ids. Never a best-guess launch (T-359-04).
|
|
144
|
-
*/
|
|
145
71
|
private openApp;
|
|
146
72
|
/** Return the cached registry, enumerating once on first use. Failed enumeration returns null (uncached). */
|
|
147
73
|
private ensureAppRegistry;
|
|
148
|
-
/**
|
|
149
|
-
* Enumerate installed apps through the driver only (ownership contract — no adb/child_process).
|
|
150
|
-
* `mobile: listApps` maps package ids → AppRegistryEntry (labels only when the same call carries
|
|
151
|
-
* them, D-10 — no per-package round-trips). On failure, fall back to `mobile: shell` pm-list ONLY
|
|
152
|
-
* when the AGENT_QA_ANDROID_USE_MOBILE_SHELL gate is '1' (Pitfall 4). Null = enumeration unavailable.
|
|
153
|
-
*/
|
|
154
74
|
private enumerateApps;
|
|
155
75
|
/** Coerce a `mobile: listApps` result (package-id-keyed map, or an array of entries) into the registry. */
|
|
156
76
|
private mapListApps;
|
|
@@ -167,11 +87,6 @@ interface AndroidAdapterConfig extends PlatformConfig {
|
|
|
167
87
|
avd?: string;
|
|
168
88
|
}
|
|
169
89
|
|
|
170
|
-
declare function createAndroidSession(config: AndroidAdapterConfig
|
|
171
|
-
hostname: string;
|
|
172
|
-
port: number;
|
|
173
|
-
path: string;
|
|
174
|
-
capabilities: Record<string, unknown>;
|
|
175
|
-
}): Promise<WebdriverIO.Browser>;
|
|
90
|
+
declare function createAndroidSession(config: AndroidAdapterConfig): Promise<WebdriverIO.Browser>;
|
|
176
91
|
|
|
177
92
|
export { type AndroidAdapterConfig, AndroidPlatformAdapter, createAndroidSession };
|