@qapilot/appium-module 1.1.2 → 1.2.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/README.md +1 -0
- package/dist/commands/command.registry.d.ts.map +1 -1
- package/dist/commands/command.registry.js +3 -1
- package/dist/commands/command.registry.js.map +1 -1
- package/dist/commands/window/get-window-rect.command.d.ts +39 -0
- package/dist/commands/window/get-window-rect.command.d.ts.map +1 -0
- package/dist/commands/window/get-window-rect.command.js +45 -0
- package/dist/commands/window/get-window-rect.command.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ All commands are invoked via `invokeCommand({ commandName, provider, credentials
|
|
|
111
111
|
| | `getContexts` | `sessionId` |
|
|
112
112
|
| **Window** | `getWindow` | `sessionId` |
|
|
113
113
|
| | `getWindowHandles` | `sessionId` |
|
|
114
|
+
| | `getWindowRect` | `sessionId` |
|
|
114
115
|
| | `switchWindow` | `sessionId`, `handle` |
|
|
115
116
|
| **Device** | `hideKeyboard` | `sessionId` |
|
|
116
117
|
| | `isKeyboardShown` | `sessionId` |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.registry.d.ts","sourceRoot":"","sources":["../../src/commands/command.registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"command.registry.d.ts","sourceRoot":"","sources":["../../src/commands/command.registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuDhD,KAAK,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;AA4D5D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAUnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAEzD"}
|
|
@@ -30,6 +30,7 @@ import { GetContextsCommand } from './context/get-contexts.command.js';
|
|
|
30
30
|
// Window
|
|
31
31
|
import { GetWindowHandlesCommand } from './window/get-window-handles.command.js';
|
|
32
32
|
import { GetWindowCommand } from './window/get-window.command.js';
|
|
33
|
+
import { GetWindowRectCommand } from './window/get-window-rect.command.js';
|
|
33
34
|
import { SwitchWindowCommand } from './window/switch-window.command.js';
|
|
34
35
|
// Device
|
|
35
36
|
import { HideKeyboardCommand } from './device/hide-keyboard.command.js';
|
|
@@ -71,9 +72,10 @@ const commands = [
|
|
|
71
72
|
new GetContextCommand(),
|
|
72
73
|
new SetContextCommand(),
|
|
73
74
|
new GetContextsCommand(),
|
|
74
|
-
// Window (
|
|
75
|
+
// Window (4)
|
|
75
76
|
new GetWindowHandlesCommand(),
|
|
76
77
|
new GetWindowCommand(),
|
|
78
|
+
new GetWindowRectCommand(),
|
|
77
79
|
new SwitchWindowCommand(),
|
|
78
80
|
// Device (7)
|
|
79
81
|
new HideKeyboardCommand(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.registry.js","sourceRoot":"","sources":["../../src/commands/command.registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGvE,UAAU;AACV,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,UAAU;AACV,OAAO,EAAE,kBAAkB,EAAE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IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAmB;IACjD,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { WebDriverRect } from '../../types/webdriver.types.js';
|
|
2
|
+
import { BaseCommand } from '../base.command.js';
|
|
3
|
+
interface GetWindowRectParams extends Record<string, unknown> {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* W3C `GET /session/{sessionId}/window/rect` — the size of the window under
|
|
8
|
+
* automation. This is what WebdriverIO's `client.getWindowSize()` calls.
|
|
9
|
+
*
|
|
10
|
+
* Distinct from the other window commands: `getWindow` returns the window
|
|
11
|
+
* HANDLE (an opaque string), not its geometry. There was previously no way
|
|
12
|
+
* to ask this module for screen dimensions at all.
|
|
13
|
+
*
|
|
14
|
+
* Why it matters: any gesture expressed as a fraction of the screen
|
|
15
|
+
* (swipe 25% of the height, tap at the horizontal centre) needs the same
|
|
16
|
+
* dimensions the rest of the toolchain uses, and the alternatives disagree
|
|
17
|
+
* on a real device. Measured on a Samsung A33 / Android 15, 1080x2400:
|
|
18
|
+
*
|
|
19
|
+
* GET /window/rect 1080x2400 full window
|
|
20
|
+
* mobile: viewportRect 1080x2335 excludes the 65px status bar
|
|
21
|
+
* mobile: deviceInfo no dimensions in the response at all
|
|
22
|
+
*
|
|
23
|
+
* Callers that computed geometry from `mobile: deviceInfo` were silently
|
|
24
|
+
* falling back to hardcoded defaults, because its response carries no
|
|
25
|
+
* display size on UiAutomator2.
|
|
26
|
+
*
|
|
27
|
+
* Note for iOS/XCUITest: this endpoint reports POINTS, not pixels, so on a
|
|
28
|
+
* Retina device the numbers are the logical size and will not match a
|
|
29
|
+
* screenshot's pixel dimensions. Android/UiAutomator2 reports pixels.
|
|
30
|
+
*/
|
|
31
|
+
export declare class GetWindowRectCommand extends BaseCommand<GetWindowRectParams, WebDriverRect> {
|
|
32
|
+
readonly name = "getWindowRect";
|
|
33
|
+
readonly method: "GET";
|
|
34
|
+
readonly pathTemplate = "/session/{sessionId}/window/rect";
|
|
35
|
+
buildBody(_params: GetWindowRectParams): undefined;
|
|
36
|
+
parseResponse(raw: unknown): WebDriverRect;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=get-window-rect.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-window-rect.command.d.ts","sourceRoot":"","sources":["../../../src/commands/window/get-window-rect.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,UAAU,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,oBAAqB,SAAQ,WAAW,CAAC,mBAAmB,EAAE,aAAa,CAAC;IACvF,QAAQ,CAAC,IAAI,mBAAmB;IAChC,QAAQ,CAAC,MAAM,EAAG,KAAK,CAAU;IACjC,QAAQ,CAAC,YAAY,sCAAsC;IAE3D,SAAS,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS;IAIlD,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa;CAU3C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BaseCommand } from '../base.command.js';
|
|
2
|
+
/**
|
|
3
|
+
* W3C `GET /session/{sessionId}/window/rect` — the size of the window under
|
|
4
|
+
* automation. This is what WebdriverIO's `client.getWindowSize()` calls.
|
|
5
|
+
*
|
|
6
|
+
* Distinct from the other window commands: `getWindow` returns the window
|
|
7
|
+
* HANDLE (an opaque string), not its geometry. There was previously no way
|
|
8
|
+
* to ask this module for screen dimensions at all.
|
|
9
|
+
*
|
|
10
|
+
* Why it matters: any gesture expressed as a fraction of the screen
|
|
11
|
+
* (swipe 25% of the height, tap at the horizontal centre) needs the same
|
|
12
|
+
* dimensions the rest of the toolchain uses, and the alternatives disagree
|
|
13
|
+
* on a real device. Measured on a Samsung A33 / Android 15, 1080x2400:
|
|
14
|
+
*
|
|
15
|
+
* GET /window/rect 1080x2400 full window
|
|
16
|
+
* mobile: viewportRect 1080x2335 excludes the 65px status bar
|
|
17
|
+
* mobile: deviceInfo no dimensions in the response at all
|
|
18
|
+
*
|
|
19
|
+
* Callers that computed geometry from `mobile: deviceInfo` were silently
|
|
20
|
+
* falling back to hardcoded defaults, because its response carries no
|
|
21
|
+
* display size on UiAutomator2.
|
|
22
|
+
*
|
|
23
|
+
* Note for iOS/XCUITest: this endpoint reports POINTS, not pixels, so on a
|
|
24
|
+
* Retina device the numbers are the logical size and will not match a
|
|
25
|
+
* screenshot's pixel dimensions. Android/UiAutomator2 reports pixels.
|
|
26
|
+
*/
|
|
27
|
+
export class GetWindowRectCommand extends BaseCommand {
|
|
28
|
+
name = 'getWindowRect';
|
|
29
|
+
method = 'GET';
|
|
30
|
+
pathTemplate = '/session/{sessionId}/window/rect';
|
|
31
|
+
buildBody(_params) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
parseResponse(raw) {
|
|
35
|
+
const body = raw;
|
|
36
|
+
const value = body['value'];
|
|
37
|
+
return {
|
|
38
|
+
x: Number(value['x'] ?? 0),
|
|
39
|
+
y: Number(value['y'] ?? 0),
|
|
40
|
+
width: Number(value['width'] ?? 0),
|
|
41
|
+
height: Number(value['height'] ?? 0),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=get-window-rect.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-window-rect.command.js","sourceRoot":"","sources":["../../../src/commands/window/get-window-rect.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,oBAAqB,SAAQ,WAA+C;IAC9E,IAAI,GAAG,eAAe,CAAC;IACvB,MAAM,GAAG,KAAc,CAAC;IACxB,YAAY,GAAG,kCAAkC,CAAC;IAE3D,SAAS,CAAC,OAA4B;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,aAAa,CAAC,GAAY;QACxB,MAAM,IAAI,GAAG,GAA8B,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAA4B,CAAC;QACvD,OAAO;YACL,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SACrC,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
CHANGED