doc-detective 4.35.0 → 4.36.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.
- package/dist/common/src/schemas/schemas.json +337 -337
- package/dist/common/src/types/generated/closeSurface_v3.d.ts +2 -2
- package/dist/common/src/types/generated/screenshot_v3.d.ts +1 -1
- package/dist/common/src/types/generated/step_v3.d.ts +6 -6
- package/dist/common/src/types/generated/surface_v3.d.ts +1 -1
- package/dist/common/src/types/generated/swipe_v3.d.ts +2 -2
- package/dist/common/src/types/generated/test_v3.d.ts +12 -12
- package/dist/common/src/types/generated/type_v3.d.ts +1 -1
- package/dist/core/tests/activeSurface.d.ts +46 -0
- package/dist/core/tests/activeSurface.d.ts.map +1 -0
- package/dist/core/tests/activeSurface.js +141 -0
- package/dist/core/tests/activeSurface.js.map +1 -0
- package/dist/core/tests/appSurface.d.ts +2 -0
- package/dist/core/tests/appSurface.d.ts.map +1 -1
- package/dist/core/tests/appSurface.js +24 -13
- package/dist/core/tests/appSurface.js.map +1 -1
- package/dist/core/tests/browserSessions.d.ts +3 -0
- package/dist/core/tests/browserSessions.d.ts.map +1 -1
- package/dist/core/tests/browserSessions.js +3 -0
- package/dist/core/tests/browserSessions.js.map +1 -1
- package/dist/core/tests/click.d.ts +3 -1
- package/dist/core/tests/click.d.ts.map +1 -1
- package/dist/core/tests/click.js +3 -1
- package/dist/core/tests/click.js.map +1 -1
- package/dist/core/tests/findElement.d.ts +4 -1
- package/dist/core/tests/findElement.d.ts.map +1 -1
- package/dist/core/tests/findElement.js +52 -27
- package/dist/core/tests/findElement.js.map +1 -1
- package/dist/core/tests/saveScreenshot.d.ts +4 -1
- package/dist/core/tests/saveScreenshot.d.ts.map +1 -1
- package/dist/core/tests/saveScreenshot.js +70 -54
- package/dist/core/tests/saveScreenshot.js.map +1 -1
- package/dist/core/tests/startSurface.d.ts +3 -1
- package/dist/core/tests/startSurface.d.ts.map +1 -1
- package/dist/core/tests/startSurface.js +36 -2
- package/dist/core/tests/startSurface.js.map +1 -1
- package/dist/core/tests/swipe.d.ts +4 -1
- package/dist/core/tests/swipe.d.ts.map +1 -1
- package/dist/core/tests/swipe.js +37 -25
- package/dist/core/tests/swipe.js.map +1 -1
- package/dist/core/tests/typeKeys.d.ts +3 -1
- package/dist/core/tests/typeKeys.d.ts.map +1 -1
- package/dist/core/tests/typeKeys.js +42 -36
- package/dist/core/tests/typeKeys.js.map +1 -1
- package/dist/core/tests.d.ts +3 -1
- package/dist/core/tests.d.ts.map +1 -1
- package/dist/core/tests.js +38 -9
- package/dist/core/tests.js.map +1 -1
- package/dist/hints/context.d.ts +3 -0
- package/dist/hints/context.d.ts.map +1 -1
- package/dist/hints/context.js +25 -0
- package/dist/hints/context.js.map +1 -1
- package/dist/hints/hints.d.ts.map +1 -1
- package/dist/hints/hints.js +19 -0
- package/dist/hints/hints.js.map +1 -1
- package/dist/hints/types.d.ts +7 -0
- package/dist/hints/types.d.ts.map +1 -1
- package/dist/index.cjs +684 -470
- package/dist/runtime/browserStepKeys.d.ts +37 -0
- package/dist/runtime/browserStepKeys.d.ts.map +1 -1
- package/dist/runtime/browserStepKeys.js +73 -0
- package/dist/runtime/browserStepKeys.js.map +1 -1
- package/dist/runtime/inferRuntimeNeeds.d.ts.map +1 -1
- package/dist/runtime/inferRuntimeNeeds.js +18 -11
- package/dist/runtime/inferRuntimeNeeds.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type CloseSurface = Surface | [Surface1, ...Surface1[]];
|
|
9
9
|
/**
|
|
10
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
10
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
11
11
|
*/
|
|
12
12
|
export type Surface = SurfaceByName | ProcessSurface | BrowserSurface | AppSurface;
|
|
13
13
|
/**
|
|
@@ -51,7 +51,7 @@ export type ByIndex2 = number;
|
|
|
51
51
|
*/
|
|
52
52
|
export type ByName2 = string;
|
|
53
53
|
/**
|
|
54
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
54
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
55
55
|
*/
|
|
56
56
|
export type Surface1 = SurfaceByName1 | ProcessSurface1 | BrowserSurface1 | AppSurface1;
|
|
57
57
|
/**
|
|
@@ -172,7 +172,7 @@ export type ExactlyOneAnnotationType = {
|
|
|
172
172
|
export type CaptureScreenshot = boolean;
|
|
173
173
|
export interface CaptureScreenshotFields {
|
|
174
174
|
/**
|
|
175
|
-
* The browser window/tab or app window to capture. Omit to capture the active
|
|
175
|
+
* The browser window/tab or app window to capture. Omit to capture the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be captured). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }). App captures don't support `crop` yet.
|
|
176
176
|
*/
|
|
177
177
|
surface?: SurfaceByBrowserEngine | BrowserSurface | AppSurface;
|
|
178
178
|
path?: ScreenshotSimple1;
|
|
@@ -545,7 +545,7 @@ export type TypeKeysDetailed = {
|
|
|
545
545
|
*/
|
|
546
546
|
export type TypeKeysSimple1 = string | string[];
|
|
547
547
|
/**
|
|
548
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
548
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
549
549
|
*/
|
|
550
550
|
export type Surface = SurfaceByName | ProcessSurface | BrowserSurface2 | AppSurface;
|
|
551
551
|
/**
|
|
@@ -1029,7 +1029,7 @@ export type Routing55 = {
|
|
|
1029
1029
|
*/
|
|
1030
1030
|
export type CloseSurface1 = Surface1 | [Surface2, ...Surface2[]];
|
|
1031
1031
|
/**
|
|
1032
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
1032
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
1033
1033
|
*/
|
|
1034
1034
|
export type Surface1 = SurfaceByName1 | ProcessSurface1 | BrowserSurface5 | AppSurface3;
|
|
1035
1035
|
/**
|
|
@@ -1073,7 +1073,7 @@ export type ByIndex15 = number;
|
|
|
1073
1073
|
*/
|
|
1074
1074
|
export type ByName15 = string;
|
|
1075
1075
|
/**
|
|
1076
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
1076
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
1077
1077
|
*/
|
|
1078
1078
|
export type Surface2 = SurfaceByName2 | ProcessSurface2 | BrowserSurface6 | AppSurface4;
|
|
1079
1079
|
/**
|
|
@@ -3589,7 +3589,7 @@ export interface Screenshot {
|
|
|
3589
3589
|
}
|
|
3590
3590
|
export interface CaptureScreenshotFields {
|
|
3591
3591
|
/**
|
|
3592
|
-
* The browser window/tab or app window to capture. Omit to capture the active
|
|
3592
|
+
* The browser window/tab or app window to capture. Omit to capture the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be captured). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }). App captures don't support `crop` yet.
|
|
3593
3593
|
*/
|
|
3594
3594
|
surface?: SurfaceByBrowserEngine2 | BrowserSurface3 | AppSurface1;
|
|
3595
3595
|
path?: ScreenshotSimple1;
|
|
@@ -6155,7 +6155,7 @@ export interface SwipeDirectional {
|
|
|
6155
6155
|
*/
|
|
6156
6156
|
duration?: number;
|
|
6157
6157
|
/**
|
|
6158
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
6158
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
6159
6159
|
*/
|
|
6160
6160
|
surface?: SurfaceByBrowserEngine5 | BrowserSurface8 | AppSurface5;
|
|
6161
6161
|
}
|
|
@@ -6236,7 +6236,7 @@ export interface SwipePointToPoint {
|
|
|
6236
6236
|
*/
|
|
6237
6237
|
duration?: number;
|
|
6238
6238
|
/**
|
|
6239
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
6239
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
6240
6240
|
*/
|
|
6241
6241
|
surface?: SurfaceByBrowserEngine6 | BrowserSurface9 | AppSurface6;
|
|
6242
6242
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
6
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
7
7
|
*/
|
|
8
8
|
export type Surface = SurfaceByName | ProcessSurface | BrowserSurface | AppSurface;
|
|
9
9
|
/**
|
|
@@ -105,7 +105,7 @@ export interface SwipeDirectional {
|
|
|
105
105
|
*/
|
|
106
106
|
duration?: number;
|
|
107
107
|
/**
|
|
108
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
108
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
109
109
|
*/
|
|
110
110
|
surface?: SurfaceByBrowserEngine | BrowserSurface | AppSurface;
|
|
111
111
|
}
|
|
@@ -186,7 +186,7 @@ export interface SwipePointToPoint {
|
|
|
186
186
|
*/
|
|
187
187
|
duration?: number;
|
|
188
188
|
/**
|
|
189
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
189
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
190
190
|
*/
|
|
191
191
|
surface?: SurfaceByBrowserEngine1 | BrowserSurface1 | AppSurface1;
|
|
192
192
|
}
|
|
@@ -975,7 +975,7 @@ export type TypeKeysDetailed = {
|
|
|
975
975
|
*/
|
|
976
976
|
export type TypeKeysSimple1 = string | string[];
|
|
977
977
|
/**
|
|
978
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
978
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
979
979
|
*/
|
|
980
980
|
export type Surface = SurfaceByName | ProcessSurface | BrowserSurface2 | AppSurface;
|
|
981
981
|
/**
|
|
@@ -1739,7 +1739,7 @@ export type Routing59 = {
|
|
|
1739
1739
|
*/
|
|
1740
1740
|
export type CloseSurface1 = Surface1 | [Surface2, ...Surface2[]];
|
|
1741
1741
|
/**
|
|
1742
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
1742
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
1743
1743
|
*/
|
|
1744
1744
|
export type Surface1 = SurfaceByName1 | ProcessSurface1 | BrowserSurface5 | AppSurface3;
|
|
1745
1745
|
/**
|
|
@@ -1783,7 +1783,7 @@ export type ByIndex15 = number;
|
|
|
1783
1783
|
*/
|
|
1784
1784
|
export type ByName15 = string;
|
|
1785
1785
|
/**
|
|
1786
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
1786
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
1787
1787
|
*/
|
|
1788
1788
|
export type Surface2 = SurfaceByName2 | ProcessSurface2 | BrowserSurface6 | AppSurface4;
|
|
1789
1789
|
/**
|
|
@@ -3771,7 +3771,7 @@ export type TypeKeysDetailed1 = {
|
|
|
3771
3771
|
*/
|
|
3772
3772
|
export type TypeKeysSimple3 = string | string[];
|
|
3773
3773
|
/**
|
|
3774
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
3774
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
3775
3775
|
*/
|
|
3776
3776
|
export type Surface3 = SurfaceByName3 | ProcessSurface3 | BrowserSurface12 | AppSurface7;
|
|
3777
3777
|
/**
|
|
@@ -4535,7 +4535,7 @@ export type Routing143 = {
|
|
|
4535
4535
|
*/
|
|
4536
4536
|
export type CloseSurface3 = Surface4 | [Surface5, ...Surface5[]];
|
|
4537
4537
|
/**
|
|
4538
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
4538
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
4539
4539
|
*/
|
|
4540
4540
|
export type Surface4 = SurfaceByName4 | ProcessSurface4 | BrowserSurface15 | AppSurface10;
|
|
4541
4541
|
/**
|
|
@@ -4579,7 +4579,7 @@ export type ByIndex42 = number;
|
|
|
4579
4579
|
*/
|
|
4580
4580
|
export type ByName42 = string;
|
|
4581
4581
|
/**
|
|
4582
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
4582
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
4583
4583
|
*/
|
|
4584
4584
|
export type Surface5 = SurfaceByName5 | ProcessSurface5 | BrowserSurface16 | AppSurface11;
|
|
4585
4585
|
/**
|
|
@@ -8050,7 +8050,7 @@ export interface Screenshot {
|
|
|
8050
8050
|
}
|
|
8051
8051
|
export interface CaptureScreenshotFields {
|
|
8052
8052
|
/**
|
|
8053
|
-
* The browser window/tab or app window to capture. Omit to capture the active
|
|
8053
|
+
* The browser window/tab or app window to capture. Omit to capture the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be captured). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }). App captures don't support `crop` yet.
|
|
8054
8054
|
*/
|
|
8055
8055
|
surface?: SurfaceByBrowserEngine2 | BrowserSurface3 | AppSurface1;
|
|
8056
8056
|
path?: ScreenshotSimple1;
|
|
@@ -10616,7 +10616,7 @@ export interface SwipeDirectional {
|
|
|
10616
10616
|
*/
|
|
10617
10617
|
duration?: number;
|
|
10618
10618
|
/**
|
|
10619
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
10619
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
10620
10620
|
*/
|
|
10621
10621
|
surface?: SurfaceByBrowserEngine5 | BrowserSurface8 | AppSurface5;
|
|
10622
10622
|
}
|
|
@@ -10697,7 +10697,7 @@ export interface SwipePointToPoint {
|
|
|
10697
10697
|
*/
|
|
10698
10698
|
duration?: number;
|
|
10699
10699
|
/**
|
|
10700
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
10700
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
10701
10701
|
*/
|
|
10702
10702
|
surface?: SurfaceByBrowserEngine6 | BrowserSurface9 | AppSurface6;
|
|
10703
10703
|
}
|
|
@@ -13885,7 +13885,7 @@ export interface Screenshot2 {
|
|
|
13885
13885
|
}
|
|
13886
13886
|
export interface CaptureScreenshotFields1 {
|
|
13887
13887
|
/**
|
|
13888
|
-
* The browser window/tab or app window to capture. Omit to capture the active
|
|
13888
|
+
* The browser window/tab or app window to capture. Omit to capture the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be captured). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }). App captures don't support `crop` yet.
|
|
13889
13889
|
*/
|
|
13890
13890
|
surface?: SurfaceByBrowserEngine9 | BrowserSurface13 | AppSurface8;
|
|
13891
13891
|
path?: ScreenshotSimple3;
|
|
@@ -16451,7 +16451,7 @@ export interface SwipeDirectional1 {
|
|
|
16451
16451
|
*/
|
|
16452
16452
|
duration?: number;
|
|
16453
16453
|
/**
|
|
16454
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
16454
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
16455
16455
|
*/
|
|
16456
16456
|
surface?: SurfaceByBrowserEngine12 | BrowserSurface18 | AppSurface12;
|
|
16457
16457
|
}
|
|
@@ -16532,7 +16532,7 @@ export interface SwipePointToPoint1 {
|
|
|
16532
16532
|
*/
|
|
16533
16533
|
duration?: number;
|
|
16534
16534
|
/**
|
|
16535
|
-
* The browser window/tab or app window this step acts on. Omit to act on the active
|
|
16535
|
+
* The browser window/tab or app window this step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind (a background process can't be swiped). Specifying a surface switches the active surface for the steps that follow. App surfaces use the object form ({ "app": … }).
|
|
16536
16536
|
*/
|
|
16537
16537
|
surface?: SurfaceByBrowserEngine13 | BrowserSurface19 | AppSurface13;
|
|
16538
16538
|
}
|
|
@@ -61,7 +61,7 @@ export type TypeKeysDetailed = {
|
|
|
61
61
|
*/
|
|
62
62
|
export type TypeKeysSimple1 = string | string[];
|
|
63
63
|
/**
|
|
64
|
-
* The surface a step acts on. Omit to act on the active surface. Supports background processes, browser windows/tabs, and native app windows.
|
|
64
|
+
* The surface a step acts on. Omit to act on the active surface — the most recently opened, focused, or explicitly targeted surface, whatever its kind. Specifying a surface switches the active surface for the steps that follow. Supports background processes, browser windows/tabs, and native app windows.
|
|
65
65
|
*/
|
|
66
66
|
export type Surface = SurfaceByName | ProcessSurface | BrowserSurface | AppSurface;
|
|
67
67
|
/**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { createActiveSurfaceTracker, activateSurface, currentSurface, resolveTargetSurface, };
|
|
2
|
+
export type { ActiveSurfaceTracker, SurfaceHandle, SurfaceTarget };
|
|
3
|
+
type SurfaceKind = "browser" | "app" | "process";
|
|
4
|
+
interface SurfaceHandle {
|
|
5
|
+
kind: SurfaceKind;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
interface ActiveSurfaceTracker {
|
|
9
|
+
mru: SurfaceHandle[];
|
|
10
|
+
}
|
|
11
|
+
interface SurfaceRegistries {
|
|
12
|
+
browserRegistry?: {
|
|
13
|
+
sessions: Map<string, any>;
|
|
14
|
+
};
|
|
15
|
+
appSession?: {
|
|
16
|
+
surfaces: Map<string, any>;
|
|
17
|
+
activeApp?: string;
|
|
18
|
+
};
|
|
19
|
+
processRegistry?: Map<string, any>;
|
|
20
|
+
}
|
|
21
|
+
type SurfaceTarget = {
|
|
22
|
+
kind: "app";
|
|
23
|
+
entry: any;
|
|
24
|
+
window?: any;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "browser";
|
|
27
|
+
surface?: any;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "process";
|
|
30
|
+
name: string;
|
|
31
|
+
entry?: any;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "error";
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
declare function createActiveSurfaceTracker(): ActiveSurfaceTracker;
|
|
37
|
+
declare function activateSurface(tracker: ActiveSurfaceTracker | undefined, handle: SurfaceHandle): void;
|
|
38
|
+
declare function currentSurface(tracker: ActiveSurfaceTracker | undefined, registries: SurfaceRegistries): SurfaceHandle | null;
|
|
39
|
+
declare function resolveTargetSurface({ surface, tracker, driver, appSession, processRegistry, }: {
|
|
40
|
+
surface?: any;
|
|
41
|
+
tracker?: ActiveSurfaceTracker;
|
|
42
|
+
driver?: any;
|
|
43
|
+
appSession?: SurfaceRegistries["appSession"];
|
|
44
|
+
processRegistry?: Map<string, any>;
|
|
45
|
+
}): SurfaceTarget;
|
|
46
|
+
//# sourceMappingURL=activeSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activeSurface.d.ts","sourceRoot":"","sources":["../../../src/core/tests/activeSurface.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,cAAc,EACd,oBAAoB,GACrB,CAAC;AACF,YAA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KtB;AAUD,iBAAS,oBAAoB,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,eAAe,GAChB,EAAE;IACD,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC,GAAG,aAAa,CAsFhB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Uniform active-surface routing (ADR 01081). One per-context MRU tracker
|
|
2
|
+
// covers every surface kind — browser sessions, app surfaces, background
|
|
3
|
+
// processes — and one resolver classifies each surface-sensitive step's
|
|
4
|
+
// target. The routing rule is kind-agnostic: an explicit `surface` reference
|
|
5
|
+
// switches to that surface; an omitted `surface` acts on the most recently
|
|
6
|
+
// active one, whatever its kind. Only EXECUTION differs per kind (an element
|
|
7
|
+
// find on a driver vs. stdin bytes to a process), and a step whose action the
|
|
8
|
+
// resolved kind can't perform fails with a capability error — routing never
|
|
9
|
+
// silently reroutes to another kind.
|
|
10
|
+
//
|
|
11
|
+
// The module is dependency-free (registries are duck-typed), so the browser
|
|
12
|
+
// session registry and the app session can both import `activateSurface`
|
|
13
|
+
// without a cycle, and unit tests drive it with plain objects.
|
|
14
|
+
export { createActiveSurfaceTracker, activateSurface, currentSurface, resolveTargetSurface, };
|
|
15
|
+
const ENGINE_KEYWORDS = new Set(["chrome", "firefox", "safari", "webkit", "edge"]);
|
|
16
|
+
const NO_ACTIVE_SURFACE_MESSAGE = "No active surface to act on. Open one first with a startSurface step (or a goTo step for a browser), or target a surface explicitly with `surface`.";
|
|
17
|
+
function createActiveSurfaceTracker() {
|
|
18
|
+
return { mru: [] };
|
|
19
|
+
}
|
|
20
|
+
// Move-to-front activation, deduped by kind+name. Tolerates an undefined
|
|
21
|
+
// tracker so callers outside runContext (unit tests, embedders) need no
|
|
22
|
+
// guards.
|
|
23
|
+
function activateSurface(tracker, handle) {
|
|
24
|
+
if (!tracker)
|
|
25
|
+
return;
|
|
26
|
+
tracker.mru = [
|
|
27
|
+
handle,
|
|
28
|
+
...tracker.mru.filter((h) => !(h.kind === handle.kind && h.name === handle.name)),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
function isLive(handle, registries) {
|
|
32
|
+
if (handle.kind === "browser")
|
|
33
|
+
return !!registries.browserRegistry?.sessions?.has(handle.name);
|
|
34
|
+
if (handle.kind === "app")
|
|
35
|
+
return !!registries.appSession?.surfaces?.has(handle.name);
|
|
36
|
+
return !!registries.processRegistry?.has(handle.name);
|
|
37
|
+
}
|
|
38
|
+
// The active surface: the most recently activated handle whose surface is
|
|
39
|
+
// still open. Dead entries (closed surfaces) are pruned as they're passed
|
|
40
|
+
// over, so closes never have to touch the tracker.
|
|
41
|
+
function currentSurface(tracker, registries) {
|
|
42
|
+
if (!tracker)
|
|
43
|
+
return null;
|
|
44
|
+
const live = tracker.mru.filter((h) => isLive(h, registries));
|
|
45
|
+
tracker.mru = live;
|
|
46
|
+
return live[0] ?? null;
|
|
47
|
+
}
|
|
48
|
+
// Classify a step's surface target. Explicit references resolve by shape —
|
|
49
|
+
// `{ app }` / `{ browser }` / `{ process }` are authoritative by key; a bare
|
|
50
|
+
// string is an engine keyword (browser) or a unique cross-registry name
|
|
51
|
+
// lookup (names are unique across kinds per context) — and a surface-less
|
|
52
|
+
// step resolves to the active surface. Pure classification: activation side
|
|
53
|
+
// effects stay in the kinds' execution paths (switchToSurface's session
|
|
54
|
+
// activation, ensureAppForeground, the process lanes), so a reference that
|
|
55
|
+
// fails to act never becomes the active surface.
|
|
56
|
+
function resolveTargetSurface({ surface, tracker, driver, appSession, processRegistry, }) {
|
|
57
|
+
const browserRegistry = driver?.state?.sessionRegistry;
|
|
58
|
+
const registries = {
|
|
59
|
+
browserRegistry,
|
|
60
|
+
appSession,
|
|
61
|
+
processRegistry,
|
|
62
|
+
};
|
|
63
|
+
if (surface !== undefined && surface !== null) {
|
|
64
|
+
// Object forms: the key names the kind.
|
|
65
|
+
if (typeof surface === "object") {
|
|
66
|
+
if (typeof surface.app === "string") {
|
|
67
|
+
const name = surface.app.trim();
|
|
68
|
+
if (!appSession) {
|
|
69
|
+
return {
|
|
70
|
+
kind: "error",
|
|
71
|
+
message: `The surface names an app ("${name}"), but no app session is active in this context. Open the app first with startSurface.`,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const entry = appSession.surfaces.get(name);
|
|
75
|
+
if (!entry) {
|
|
76
|
+
return {
|
|
77
|
+
kind: "error",
|
|
78
|
+
message: `No app surface named "${name}" is open. Open it first with startSurface.`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return { kind: "app", entry, window: surface.window };
|
|
82
|
+
}
|
|
83
|
+
if (typeof surface.process === "string") {
|
|
84
|
+
const name = surface.process.trim();
|
|
85
|
+
return { kind: "process", name, entry: processRegistry?.get(name) };
|
|
86
|
+
}
|
|
87
|
+
// { browser: … } and any other object shape resolve in the browser
|
|
88
|
+
// execution path (session + window/tab sub-resolution).
|
|
89
|
+
return { kind: "browser", surface };
|
|
90
|
+
}
|
|
91
|
+
if (typeof surface === "string") {
|
|
92
|
+
const name = surface.trim();
|
|
93
|
+
if (ENGINE_KEYWORDS.has(name.toLowerCase())) {
|
|
94
|
+
return { kind: "browser", surface };
|
|
95
|
+
}
|
|
96
|
+
// Bare-string identity lookup. Names are unique across kinds per
|
|
97
|
+
// context (registries enforce cross-kind collisions at open time), so
|
|
98
|
+
// the precedence below only decides ties left by pre-uniqueness runs:
|
|
99
|
+
// app registry (authoritative for its names, matching the pre-ADR
|
|
100
|
+
// handler order), then browser sessions, then processes.
|
|
101
|
+
if (appSession?.surfaces?.has(name)) {
|
|
102
|
+
return { kind: "app", entry: appSession.surfaces.get(name) };
|
|
103
|
+
}
|
|
104
|
+
if (browserRegistry?.sessions?.has(name)) {
|
|
105
|
+
return { kind: "browser", surface };
|
|
106
|
+
}
|
|
107
|
+
if (processRegistry?.has(name)) {
|
|
108
|
+
return { kind: "process", name, entry: processRegistry.get(name) };
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
kind: "error",
|
|
112
|
+
message: `No surface named "${name}" is open in this context. Open it first with a startSurface step (or a goTo step for a browser).`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Surface-less: the active surface, whatever its kind.
|
|
117
|
+
const active = currentSurface(tracker, registries);
|
|
118
|
+
if (active) {
|
|
119
|
+
if (active.kind === "app") {
|
|
120
|
+
return { kind: "app", entry: appSession.surfaces.get(active.name) };
|
|
121
|
+
}
|
|
122
|
+
if (active.kind === "process") {
|
|
123
|
+
return {
|
|
124
|
+
kind: "process",
|
|
125
|
+
name: active.name,
|
|
126
|
+
entry: processRegistry?.get(active.name),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return { kind: "browser" };
|
|
130
|
+
}
|
|
131
|
+
// No tracker, or nothing live in it: legacy defaults so handlers invoked
|
|
132
|
+
// outside runContext keep their pre-ADR behavior — a live driver means the
|
|
133
|
+
// browser, an app session with an active app means that app.
|
|
134
|
+
if (driver)
|
|
135
|
+
return { kind: "browser" };
|
|
136
|
+
if (appSession?.activeApp && appSession.surfaces?.has(appSession.activeApp)) {
|
|
137
|
+
return { kind: "app", entry: appSession.surfaces.get(appSession.activeApp) };
|
|
138
|
+
}
|
|
139
|
+
return { kind: "error", message: NO_ACTIVE_SURFACE_MESSAGE };
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=activeSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activeSurface.js","sourceRoot":"","sources":["../../../src/core/tests/activeSurface.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,6EAA6E;AAC7E,2EAA2E;A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C,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;IAC/E,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveHeavyDepPath, resolveHeavyDepPathInCache, resolveHeavyDepSource, ensureRuntimeInstalled } from "../../runtime/loader.js";
|
|
2
2
|
import { type ManagedWdaHit } from "../../runtime/wdaProducts.js";
|
|
3
3
|
import { stepTargetsAppSurface } from "../../runtime/browserStepKeys.js";
|
|
4
|
+
import { type ActiveSurfaceTracker } from "./activeSurface.js";
|
|
4
5
|
export { classifyAppIdentifier, defaultAppSurfaceName, classifyNativeSelector, buildUiaLocator, buildAxLocator, buildUiAutomator2Locator, buildXCUITestLocator, createAppSessionState, appSurfacePreflight, probeMacAccessibility, isAppDriverRequired, stepTargetsAppSurface, resolveAppSurfaceRef, ensureAppForeground, startAppSurface, findAppElement, buildAppLocator, closeAppSurface, teardownAppSession, snapshotAppServerDescendants, reapConsoleOrphans, listWindowsDescendantPids, invalidateStaleAppiumManifest, probeIosToolchain, };
|
|
5
6
|
export type { AppSessionState, AppSurfaceEntry };
|
|
6
7
|
type AppIdentifierKind = "path" | "aumid" | "id";
|
|
@@ -111,6 +112,7 @@ interface AppSessionState {
|
|
|
111
112
|
appiumHome?: string;
|
|
112
113
|
surfaces: Map<string, AppSurfaceEntry>;
|
|
113
114
|
activeApp?: string;
|
|
115
|
+
tracker?: ActiveSurfaceTracker;
|
|
114
116
|
recordingHost: {
|
|
115
117
|
state: {
|
|
116
118
|
recordings: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appSurface.d.ts","sourceRoot":"","sources":["../../../src/core/tests/appSurface.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,yBAAyB,CA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,GAAE,kBAAuB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
|
@@ -20,6 +20,7 @@ import { normalizeDeviceDescriptor } from "./androidEmulator.js";
|
|
|
20
20
|
import { APP_GESTURES } from "./appGestures.js";
|
|
21
21
|
import { isMobileTargetPlatform } from "./mobilePlatform.js";
|
|
22
22
|
import { stepTargetsAppSurface, stepOpensAppSurface, } from "../../runtime/browserStepKeys.js";
|
|
23
|
+
import { activateSurface, } from "./activeSurface.js";
|
|
23
24
|
import { validate } from "../../common/src/validate.js";
|
|
24
25
|
export { classifyAppIdentifier, defaultAppSurfaceName, classifyNativeSelector, buildUiaLocator, buildAxLocator, buildUiAutomator2Locator, buildXCUITestLocator, createAppSessionState, appSurfacePreflight,
|
|
25
26
|
// Exported as a test seam: the JXA probe must return a definitive boolean
|
|
@@ -1100,6 +1101,7 @@ async function startAppSurface({ config, step, appSession, platform, serverDeps,
|
|
|
1100
1101
|
deviceName,
|
|
1101
1102
|
});
|
|
1102
1103
|
appSession.activeApp = name;
|
|
1104
|
+
activateSurface(appSession.tracker, { kind: "app", name });
|
|
1103
1105
|
// Window-selector baseline (ADR 01036, desktop): capture the main window
|
|
1104
1106
|
// handle / pid / known-vs-foreign handles (Windows) or the (title, frame)
|
|
1105
1107
|
// baseline (macOS) so `-1` "newest window" diffs and pid-filtered adoption
|
|
@@ -1169,11 +1171,19 @@ async function startAppSurface({ config, step, appSession, platform, serverDeps,
|
|
|
1169
1171
|
}
|
|
1170
1172
|
// Bring an app surface's app to the foreground on its shared Android device
|
|
1171
1173
|
// session before acting on it — the active-surface switch, mirroring browser
|
|
1172
|
-
// tab focus.
|
|
1173
|
-
//
|
|
1174
|
+
// tab focus. Desktop surfaces (one driver per app) need no driver-level
|
|
1175
|
+
// foregrounding, but the ACTIVE-SURFACE pointer still moves (ADR 01081): a
|
|
1176
|
+
// step that references an app surface makes it the surface later
|
|
1177
|
+
// surface-less steps act on, uniformly across kinds. Returns an error string
|
|
1178
|
+
// if activation fails.
|
|
1174
1179
|
async function ensureAppForeground(entry, appSession) {
|
|
1175
|
-
if (!
|
|
1180
|
+
if (!appSession)
|
|
1181
|
+
return {};
|
|
1182
|
+
if (!entry.deviceName) {
|
|
1183
|
+
appSession.activeApp = entry.name;
|
|
1184
|
+
activateSurface(appSession.tracker, { kind: "app", name: entry.name });
|
|
1176
1185
|
return {};
|
|
1186
|
+
}
|
|
1177
1187
|
const session = appSession.deviceSessions?.get(entry.deviceName);
|
|
1178
1188
|
// A surface carrying a deviceName must have a live device session. A missing
|
|
1179
1189
|
// one is an internal inconsistency — fail loudly instead of skipping the
|
|
@@ -1183,18 +1193,19 @@ async function ensureAppForeground(entry, appSession) {
|
|
|
1183
1193
|
error: `Couldn't switch to app surface "${entry.name}" (${entry.appId}): no active session for device "${entry.deviceName}".`,
|
|
1184
1194
|
};
|
|
1185
1195
|
}
|
|
1186
|
-
if (session.foregroundApp
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
}
|
|
1196
|
+
if (session.foregroundApp !== entry.appId) {
|
|
1197
|
+
try {
|
|
1198
|
+
await session.driver.activateApp(entry.appId);
|
|
1199
|
+
}
|
|
1200
|
+
catch (error) {
|
|
1201
|
+
return {
|
|
1202
|
+
error: `Couldn't switch to app surface "${entry.name}" (${entry.appId}) on device "${entry.deviceName}": ${error?.message ?? error}`,
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
session.foregroundApp = entry.appId;
|
|
1195
1206
|
}
|
|
1196
|
-
session.foregroundApp = entry.appId;
|
|
1197
1207
|
appSession.activeApp = entry.name;
|
|
1208
|
+
activateSurface(appSession.tracker, { kind: "app", name: entry.name });
|
|
1198
1209
|
return {};
|
|
1199
1210
|
}
|
|
1200
1211
|
// Close a registered app surface and deregister it. On desktop, ending the
|