appium-xcuitest-driver 10.2.2 → 10.4.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/CHANGELOG.md +12 -0
- package/build/lib/commands/active-app-info.d.ts +9 -0
- package/build/lib/commands/active-app-info.d.ts.map +1 -0
- package/build/lib/commands/active-app-info.js +14 -0
- package/build/lib/commands/active-app-info.js.map +1 -0
- package/build/lib/commands/alert.d.ts +42 -45
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +66 -62
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +150 -153
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +300 -286
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +14 -17
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +23 -24
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/appearance.d.ts +19 -22
- package/build/lib/commands/appearance.d.ts.map +1 -1
- package/build/lib/commands/appearance.js +56 -56
- package/build/lib/commands/appearance.js.map +1 -1
- package/build/lib/commands/audit.d.ts +22 -17
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +17 -18
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +11 -14
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +36 -37
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/biometric.d.ts +30 -33
- package/build/lib/commands/biometric.d.ts.map +1 -1
- package/build/lib/commands/biometric.js +42 -41
- package/build/lib/commands/biometric.js.map +1 -1
- package/build/lib/commands/certificate.d.ts +48 -45
- package/build/lib/commands/certificate.d.ts.map +1 -1
- package/build/lib/commands/certificate.js +218 -205
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +19 -22
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +30 -30
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/condition.d.ts +49 -26
- package/build/lib/commands/condition.d.ts.map +1 -1
- package/build/lib/commands/condition.js +87 -86
- package/build/lib/commands/condition.js.map +1 -1
- package/build/lib/commands/content-size.d.ts +26 -29
- package/build/lib/commands/content-size.d.ts.map +1 -1
- package/build/lib/commands/content-size.js +36 -36
- package/build/lib/commands/content-size.js.map +1 -1
- package/build/lib/commands/context.d.ts +161 -108
- package/build/lib/commands/context.d.ts.map +1 -1
- package/build/lib/commands/context.js +530 -517
- package/build/lib/commands/context.js.map +1 -1
- package/build/lib/commands/deviceInfo.d.ts +9 -12
- package/build/lib/commands/deviceInfo.d.ts.map +1 -1
- package/build/lib/commands/deviceInfo.js +17 -18
- package/build/lib/commands/deviceInfo.js.map +1 -1
- package/build/lib/commands/element.d.ts +102 -105
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +337 -323
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/execute.d.ts +24 -19
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +63 -62
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts +77 -80
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +130 -124
- package/build/lib/commands/file-movement.js.map +1 -1
- package/build/lib/commands/find.d.ts +18 -21
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +158 -156
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/general.d.ts +124 -116
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +248 -232
- package/build/lib/commands/general.js.map +1 -1
- package/build/lib/commands/geolocation.d.ts +43 -46
- package/build/lib/commands/geolocation.d.ts.map +1 -1
- package/build/lib/commands/geolocation.js +10 -11
- package/build/lib/commands/geolocation.js.map +1 -1
- package/build/lib/commands/gesture.d.ts +273 -276
- package/build/lib/commands/gesture.d.ts.map +1 -1
- package/build/lib/commands/gesture.js +506 -492
- package/build/lib/commands/gesture.js.map +1 -1
- package/build/lib/commands/increase-contrast.d.ts +20 -23
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +30 -30
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/iohid.d.ts +1370 -1373
- package/build/lib/commands/iohid.d.ts.map +1 -1
- package/build/lib/commands/iohid.js +30 -31
- package/build/lib/commands/iohid.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +29 -32
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +53 -51
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +9 -12
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +13 -14
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +16 -19
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +25 -26
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/location.d.ts +36 -39
- package/build/lib/commands/location.d.ts.map +1 -1
- package/build/lib/commands/location.js +99 -98
- package/build/lib/commands/location.js.map +1 -1
- package/build/lib/commands/lock.d.ts +21 -24
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +39 -38
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/log.d.ts +43 -37
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +174 -171
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.d.ts +9 -12
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +37 -39
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +30 -33
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +92 -92
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/notifications.d.ts +26 -29
- package/build/lib/commands/notifications.d.ts.map +1 -1
- package/build/lib/commands/notifications.js +53 -53
- package/build/lib/commands/notifications.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +21 -24
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +37 -37
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/pcap.d.ts +39 -26
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +81 -81
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/commands/performance.d.ts +63 -44
- package/build/lib/commands/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +105 -105
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/permissions.d.ts +33 -36
- package/build/lib/commands/permissions.d.ts.map +1 -1
- package/build/lib/commands/permissions.js +66 -65
- package/build/lib/commands/permissions.js.map +1 -1
- package/build/lib/commands/proxy-helper.d.ts +12 -15
- package/build/lib/commands/proxy-helper.d.ts.map +1 -1
- package/build/lib/commands/proxy-helper.js +53 -54
- package/build/lib/commands/proxy-helper.js.map +1 -1
- package/build/lib/commands/record-audio.d.ts +49 -29
- package/build/lib/commands/record-audio.d.ts.map +1 -1
- package/build/lib/commands/record-audio.js +100 -104
- package/build/lib/commands/record-audio.js.map +1 -1
- package/build/lib/commands/recordscreen.d.ts +54 -18
- package/build/lib/commands/recordscreen.d.ts.map +1 -1
- package/build/lib/commands/recordscreen.js +127 -129
- package/build/lib/commands/recordscreen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +14 -17
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +108 -107
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/simctl.d.ts +11 -14
- package/build/lib/commands/simctl.d.ts.map +1 -1
- package/build/lib/commands/simctl.js +23 -26
- package/build/lib/commands/simctl.js.map +1 -1
- package/build/lib/commands/source.d.ts +14 -17
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +40 -43
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/commands/timeouts.d.ts +44 -33
- package/build/lib/commands/timeouts.d.ts.map +1 -1
- package/build/lib/commands/timeouts.js +65 -63
- package/build/lib/commands/timeouts.js.map +1 -1
- package/build/lib/commands/web.d.ts +247 -197
- package/build/lib/commands/web.d.ts.map +1 -1
- package/build/lib/commands/web.js +815 -786
- package/build/lib/commands/web.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.d.ts +63 -66
- package/build/lib/commands/xctest-record-screen.d.ts.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +103 -102
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/commands/xctest.d.ts +55 -51
- package/build/lib/commands/xctest.d.ts.map +1 -1
- package/build/lib/commands/xctest.js +116 -117
- package/build/lib/commands/xctest.js.map +1 -1
- package/build/lib/driver.d.ts +278 -1597
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +320 -236
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts.map +1 -1
- package/build/lib/execute-method-map.js +9 -0
- package/build/lib/execute-method-map.js.map +1 -1
- package/build/lib/real-device.d.ts +1 -1
- package/build/lib/real-device.d.ts.map +1 -1
- package/build/lib/real-device.js +2 -2
- package/build/lib/real-device.js.map +1 -1
- package/lib/commands/active-app-info.js +12 -0
- package/lib/commands/alert.js +68 -65
- package/lib/commands/app-management.js +308 -301
- package/lib/commands/app-strings.js +24 -26
- package/lib/commands/appearance.js +54 -56
- package/lib/commands/audit.js +18 -20
- package/lib/commands/battery.js +35 -37
- package/lib/commands/biometric.js +44 -46
- package/lib/commands/certificate.js +226 -215
- package/lib/commands/clipboard.js +30 -32
- package/lib/commands/condition.js +98 -100
- package/lib/commands/content-size.js +36 -38
- package/lib/commands/context.js +495 -490
- package/lib/commands/deviceInfo.js +19 -20
- package/lib/commands/element.js +367 -357
- package/lib/commands/execute.js +72 -72
- package/lib/commands/file-movement.js +132 -134
- package/lib/commands/find.js +160 -159
- package/lib/commands/general.js +238 -231
- package/lib/commands/geolocation.js +6 -14
- package/lib/commands/gesture.js +525 -515
- package/lib/commands/increase-contrast.js +30 -32
- package/lib/commands/iohid.js +32 -34
- package/lib/commands/keyboard.js +49 -51
- package/lib/commands/keychains.js +12 -14
- package/lib/commands/localization.js +24 -26
- package/lib/commands/location.js +102 -104
- package/lib/commands/lock.js +38 -38
- package/lib/commands/log.js +197 -198
- package/lib/commands/memory.js +40 -43
- package/lib/commands/navigation.js +96 -100
- package/lib/commands/notifications.js +57 -59
- package/lib/commands/pasteboard.js +37 -39
- package/lib/commands/pcap.js +84 -86
- package/lib/commands/performance.js +132 -133
- package/lib/commands/permissions.js +67 -69
- package/lib/commands/proxy-helper.js +60 -61
- package/lib/commands/record-audio.js +115 -120
- package/lib/commands/recordscreen.js +145 -149
- package/lib/commands/screenshots.js +116 -116
- package/lib/commands/simctl.js +25 -29
- package/lib/commands/source.js +42 -46
- package/lib/commands/timeouts.js +59 -63
- package/lib/commands/web.js +878 -858
- package/lib/commands/xctest-record-screen.js +103 -105
- package/lib/commands/xctest.js +134 -139
- package/lib/driver.js +288 -236
- package/lib/execute-method-map.ts +9 -0
- package/lib/real-device.js +2 -2
- package/npm-shrinkwrap.json +440 -76
- package/package.json +2 -1
- package/build/lib/commands/activeAppInfo.d.ts +0 -12
- package/build/lib/commands/activeAppInfo.d.ts.map +0 -1
- package/build/lib/commands/activeAppInfo.js +0 -15
- package/build/lib/commands/activeAppInfo.js.map +0 -1
- package/build/lib/commands/index.d.ts +0 -96
- package/build/lib/commands/index.d.ts.map +0 -1
- package/build/lib/commands/index.js +0 -100
- package/build/lib/commands/index.js.map +0 -1
- package/build/lib/real-device-clients/devicectl.d.ts +0 -204
- package/build/lib/real-device-clients/devicectl.d.ts.map +0 -1
- package/build/lib/real-device-clients/devicectl.js +0 -264
- package/build/lib/real-device-clients/devicectl.js.map +0 -1
- package/lib/commands/activeAppInfo.js +0 -14
- package/lib/commands/index.js +0 -95
- package/lib/real-device-clients/devicectl.js +0 -291
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordscreen.js","sourceRoot":"","sources":["../../../lib/commands/recordscreen.js"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"recordscreen.js","sourceRoot":"","sources":["../../../lib/commands/recordscreen.js"],"names":[],"mappings":";;;;;;AAmPA,oDAwGC;AAmBD,kDAoBC;AAlYD,oDAAuB;AACvB,4CAAyD;AACzD,+CAAwC;AACxC,oCAA8C;AAC9C,iEAAmD;AACnD,uCAA0C;AAC1C,8CAAsB;AAEtB;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,MAAM,0BAA0B,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,eAAe,GAAG,QAAQ,CAAC;AACjC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B,MAAM,YAAY,GAAG,gBAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACrD,MAAM,eAAe,GAAG;IACtB,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,MAAM,gCAAgC,GAAG;IACvC,4DAA4D;IAC5D,YAAY,EAAE;QACZ,OAAO,EAAE,cAAc;QACvB,mBAAmB,EAAE,kBAAkB;QACvC,kBAAkB,EAAE,UAAU;QAC9B,gBAAgB,EAAE,mBAAmB;KACtC;IACD,8DAA8D;IAC9D,IAAI,EAAE;QACJ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AqB,GAAG,cAAc,CAAC;IAE5C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAAO,GAAG,EAAE;IACpD,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QAC5E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,CAAC;QAC5D,IAAI,CAAC,CAAC,MAAM,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAC/B,yCAAyC;gBACzC,4CAA4C,SAAS,GAAG,CACzD,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,IAAA,4BAAoB,EAAC,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACpC,CAAC;AACH,CAAC;AAED;;GAEG"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function getViewportScreenshot(this: import("../driver").XCUITestDriver): Promise<string>;
|
|
16
|
-
}
|
|
17
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @this {XCUITestDriver}
|
|
3
|
+
* @returns {Promise<string>}
|
|
4
|
+
*/
|
|
5
|
+
export function getScreenshot(this: import("../driver").XCUITestDriver): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* @this {XCUITestDriver}
|
|
8
|
+
*/
|
|
9
|
+
export function getElementScreenshot(this: import("../driver").XCUITestDriver, el: any): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* @this {XCUITestDriver}
|
|
12
|
+
* @returns {Promise<string>}
|
|
13
|
+
*/
|
|
14
|
+
export function getViewportScreenshot(this: import("../driver").XCUITestDriver): Promise<string>;
|
|
18
15
|
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
19
16
|
//# sourceMappingURL=screenshots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../lib/commands/screenshots.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../lib/commands/screenshots.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,yEAFa,OAAO,CAAC,MAAM,CAAC,CAgE3B;AAED;;GAEG;AACH,yGAoBC;AAED;;;GAGG;AACH,iFAFa,OAAO,CAAC,MAAM,CAAC,CAgC3B;6BAGY,OAAO,WAAW,EAAE,cAAc"}
|
|
@@ -3,125 +3,126 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getScreenshot = getScreenshot;
|
|
7
|
+
exports.getElementScreenshot = getElementScreenshot;
|
|
8
|
+
exports.getViewportScreenshot = getViewportScreenshot;
|
|
6
9
|
const asyncbox_1 = require("asyncbox");
|
|
7
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
11
|
const driver_1 = require("appium/driver");
|
|
9
12
|
const support_1 = require("appium/support");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const getScreenshotFromWDA = async () => {
|
|
35
|
-
this.log.debug(`Taking screenshot with WDA`);
|
|
36
|
-
const data = await this.proxyCommand('/screenshot', 'GET');
|
|
37
|
-
if (!lodash_1.default.isString(data)) {
|
|
38
|
-
throw new Error(`Unable to take screenshot. WDA returned '${JSON.stringify(data)}'`);
|
|
39
|
-
}
|
|
40
|
-
return data;
|
|
41
|
-
};
|
|
42
|
-
// if we've specified an mjpeg server, use that
|
|
43
|
-
if (this.mjpegStream) {
|
|
44
|
-
this.log.info(`mjpeg video stream provided, returning latest frame as screenshot`);
|
|
45
|
-
const data = await this.mjpegStream.lastChunkPNGBase64();
|
|
46
|
-
if (data) {
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
this.log.warn('Tried to get screenshot from active MJPEG stream, but there ' +
|
|
50
|
-
'was no data yet. Falling back to regular screenshot methods.');
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
return await getScreenshotFromWDA();
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
this.log.warn(`Error getting screenshot: ${err.message}`);
|
|
57
|
-
}
|
|
58
|
-
// simulator attempt
|
|
59
|
-
if (this.isSimulator()) {
|
|
60
|
-
this.log.info(`Falling back to 'simctl io screenshot' API`);
|
|
61
|
-
const payload = await /** @type {import('../driver').Simulator} */ (this.device).simctl.getScreenshot();
|
|
62
|
-
if (!payload) {
|
|
63
|
-
throw new driver_1.errors.UnableToCaptureScreen();
|
|
64
|
-
}
|
|
65
|
-
return payload;
|
|
66
|
-
}
|
|
67
|
-
// Retry for real devices only. Fail fast on Simulator if simctl does not work as expected
|
|
68
|
-
return /** @type {string} */ (await (0, asyncbox_1.retryInterval)(2, 1000, getScreenshotFromWDA));
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* @this {XCUITestDriver}
|
|
72
|
-
*/
|
|
73
|
-
async getElementScreenshot(el) {
|
|
74
|
-
el = support_1.util.unwrapElement(el);
|
|
75
|
-
if (this.isWebContext()) {
|
|
76
|
-
const atomsElement = this.getAtomsElement(el);
|
|
77
|
-
const { width, height } = await this.executeAtom('get_size', [atomsElement]);
|
|
78
|
-
if (!width || !height) {
|
|
79
|
-
throw new driver_1.errors.UnableToCaptureScreen('Cannot take a screenshot of a zero-size element');
|
|
80
|
-
}
|
|
81
|
-
const { x, y } = await this.executeAtom('get_top_left_coordinates', [atomsElement]);
|
|
82
|
-
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote))
|
|
83
|
-
.captureScreenshot({ rect: { x, y, width, height } });
|
|
13
|
+
/**
|
|
14
|
+
* @this {XCUITestDriver}
|
|
15
|
+
* @returns {Promise<string>}
|
|
16
|
+
*/
|
|
17
|
+
async function getScreenshot() {
|
|
18
|
+
if (this.isWebContext()) {
|
|
19
|
+
const webScreenshotMode = (await this.settings.getSettings()).webScreenshotMode;
|
|
20
|
+
switch (lodash_1.default.toLower(webScreenshotMode)) {
|
|
21
|
+
case 'page':
|
|
22
|
+
case 'viewport':
|
|
23
|
+
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote)).captureScreenshot({
|
|
24
|
+
coordinateSystem: /** @type {'Viewport'|'Page'} */ (lodash_1.default.capitalize(webScreenshotMode)),
|
|
25
|
+
});
|
|
26
|
+
case 'native':
|
|
27
|
+
case undefined:
|
|
28
|
+
case null:
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
this.log.warn(`The webScreenshotMode setting value '${webScreenshotMode}' is not known. ` +
|
|
32
|
+
`Supported values are: page, viewport and native. Falling back to the native mode.`);
|
|
33
|
+
break;
|
|
84
34
|
}
|
|
85
|
-
|
|
35
|
+
}
|
|
36
|
+
const getScreenshotFromWDA = async () => {
|
|
37
|
+
this.log.debug(`Taking screenshot with WDA`);
|
|
38
|
+
const data = await this.proxyCommand('/screenshot', 'GET');
|
|
86
39
|
if (!lodash_1.default.isString(data)) {
|
|
87
|
-
throw new
|
|
40
|
+
throw new Error(`Unable to take screenshot. WDA returned '${JSON.stringify(data)}'`);
|
|
88
41
|
}
|
|
89
42
|
return data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote))
|
|
98
|
-
.captureScreenshot();
|
|
43
|
+
};
|
|
44
|
+
// if we've specified an mjpeg server, use that
|
|
45
|
+
if (this.mjpegStream) {
|
|
46
|
+
this.log.info(`mjpeg video stream provided, returning latest frame as screenshot`);
|
|
47
|
+
const data = await this.mjpegStream.lastChunkPNGBase64();
|
|
48
|
+
if (data) {
|
|
49
|
+
return data;
|
|
99
50
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
51
|
+
this.log.warn('Tried to get screenshot from active MJPEG stream, but there ' +
|
|
52
|
+
'was no data yet. Falling back to regular screenshot methods.');
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
return await getScreenshotFromWDA();
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
this.log.warn(`Error getting screenshot: ${err.message}`);
|
|
59
|
+
}
|
|
60
|
+
// simulator attempt
|
|
61
|
+
if (this.isSimulator()) {
|
|
62
|
+
this.log.info(`Falling back to 'simctl io screenshot' API`);
|
|
63
|
+
const payload = await /** @type {import('../driver').Simulator} */ (this.device).simctl.getScreenshot();
|
|
64
|
+
if (!payload) {
|
|
65
|
+
throw new driver_1.errors.UnableToCaptureScreen();
|
|
105
66
|
}
|
|
106
|
-
|
|
107
|
-
|
|
67
|
+
return payload;
|
|
68
|
+
}
|
|
69
|
+
// Retry for real devices only. Fail fast on Simulator if simctl does not work as expected
|
|
70
|
+
return /** @type {string} */ (await (0, asyncbox_1.retryInterval)(2, 1000, getScreenshotFromWDA));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @this {XCUITestDriver}
|
|
74
|
+
*/
|
|
75
|
+
async function getElementScreenshot(el) {
|
|
76
|
+
el = support_1.util.unwrapElement(el);
|
|
77
|
+
if (this.isWebContext()) {
|
|
78
|
+
const atomsElement = this.getAtomsElement(el);
|
|
79
|
+
const { width, height } = await this.executeAtom('get_size', [atomsElement]);
|
|
108
80
|
if (!width || !height) {
|
|
109
|
-
throw new driver_1.errors.UnableToCaptureScreen('
|
|
110
|
-
}
|
|
111
|
-
this.log.debug(`Screenshot dimensions: ${width}x${height}`);
|
|
112
|
-
const region = await this.getViewportRect();
|
|
113
|
-
if (region.width + region.left > width) {
|
|
114
|
-
this.log.info('Viewport region exceeds screenshot width, adjusting region to fit');
|
|
115
|
-
region.width = width - region.left;
|
|
81
|
+
throw new driver_1.errors.UnableToCaptureScreen('Cannot take a screenshot of a zero-size element');
|
|
116
82
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
83
|
+
const { x, y } = await this.executeAtom('get_top_left_coordinates', [atomsElement]);
|
|
84
|
+
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote))
|
|
85
|
+
.captureScreenshot({ rect: { x, y, width, height } });
|
|
86
|
+
}
|
|
87
|
+
const data = await this.proxyCommand(`/element/${el}/screenshot`, 'GET');
|
|
88
|
+
if (!lodash_1.default.isString(data)) {
|
|
89
|
+
throw new driver_1.errors.UnableToCaptureScreen(`Unable to take an element screenshot. WDA returned: ${JSON.stringify(data)}`);
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @this {XCUITestDriver}
|
|
95
|
+
* @returns {Promise<string>}
|
|
96
|
+
*/
|
|
97
|
+
async function getViewportScreenshot() {
|
|
98
|
+
if (this.isWebContext()) {
|
|
99
|
+
return await ( /** @type {import('appium-remote-debugger').RemoteDebugger} */(this.remote))
|
|
100
|
+
.captureScreenshot();
|
|
101
|
+
}
|
|
102
|
+
const screenshot = await this.getScreenshot();
|
|
103
|
+
// if we don't have a status bar, there's nothing to crop, so we can avoid
|
|
104
|
+
// extra calls and return straight away
|
|
105
|
+
if ((await this.getStatusBarHeight()) === 0) {
|
|
106
|
+
return screenshot;
|
|
107
|
+
}
|
|
108
|
+
const sharp = support_1.imageUtil.requireSharp();
|
|
109
|
+
const { width, height } = await sharp(Buffer.from(screenshot, 'base64')).metadata();
|
|
110
|
+
if (!width || !height) {
|
|
111
|
+
throw new driver_1.errors.UnableToCaptureScreen('The device screenshot is empty');
|
|
112
|
+
}
|
|
113
|
+
this.log.debug(`Screenshot dimensions: ${width}x${height}`);
|
|
114
|
+
const region = await this.getViewportRect();
|
|
115
|
+
if (region.width + region.left > width) {
|
|
116
|
+
this.log.info('Viewport region exceeds screenshot width, adjusting region to fit');
|
|
117
|
+
region.width = width - region.left;
|
|
118
|
+
}
|
|
119
|
+
if (region.height + region.top > height) {
|
|
120
|
+
this.log.info('Viewport region exceeds screenshot height, adjusting region to fit');
|
|
121
|
+
region.height = height - region.top;
|
|
122
|
+
}
|
|
123
|
+
this.log.debug(`Calculated viewport rect: ${JSON.stringify(region)}`);
|
|
124
|
+
return await support_1.imageUtil.cropBase64Image(screenshot, region);
|
|
125
|
+
}
|
|
125
126
|
/**
|
|
126
127
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
127
128
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshots.js","sourceRoot":"","sources":["../../../lib/commands/screenshots.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"screenshots.js","sourceRoot":"","sources":["../../../lib/commands/screenshots.js"],"names":[],"mappings":";;;;;AASA,sCA8DC;AAKD,oDAoBC;AAMD,sDA8BC;AApID,uCAAuC;AACvC,oDAAuB;AACvB,0CAAqC;AACrC,4CAA+C;AAE/C;;;GAGG;AACI,KAAK,UAAU,aAAa;IACjC,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,MAAM,iBAAiB,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,iBAAiB,CAAC;QAChF,QAAQ,gBAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACrC,KAAK,MAAM,CAAC;YACZ,KAAK,UAAU;gBACb,OAAO,MAAM,EAAC,8DAA+D,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC;oBAC5G,gBAAgB,EAAE,gCAAgC,CAAC,CAAC,gBAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;iBACrF,CAAC,CAAC;YACL,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,IAAI;gBACP,MAAM;YACR;gBACE,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,wCAAwC,iBAAiB,kBAAkB;oBAC3E,mFAAmF,CACpF,CAAC;gBACF,MAAM;QACV,CAAC;IACH,CAAC;IAED,MAAM,oBAAoB,GAAG,KAAK,IAAI,EAAE;QACtC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAC3D,IAAI,CAAC,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,CAAC,SAA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CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function mobileSimctl(this: import("./../driver").XCUITestDriver, command: string, args?: string[], timeout?: number | undefined): Promise<SimctlExecResponse>;
|
|
13
|
-
}
|
|
14
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* Run the given command with arguments as `xcrun simctl` subcommand.
|
|
3
|
+
* This method works behind the 'simctl' security flag.
|
|
4
|
+
* @this {XCUITestDriver}
|
|
5
|
+
* @param {string} command Subcommand to run with `xcrun simctl`
|
|
6
|
+
* @param {string[]} [args=[]] arguments for the subcommand. The arguments should be after <device> in the help.
|
|
7
|
+
* @param {number|undefined} timeout - The maximum number of milliseconds
|
|
8
|
+
* @returns {Promise<SimctlExecResponse>}
|
|
9
|
+
* @throws {Error} If the simctl subcommand command returns non-zero return code, or the given subcommand was invalid.
|
|
10
|
+
*/
|
|
11
|
+
export function mobileSimctl(this: import("./../driver").XCUITestDriver, command: string, args?: string[], timeout?: number | undefined): Promise<SimctlExecResponse>;
|
|
15
12
|
export type SimctlExecResponse = {
|
|
16
13
|
/**
|
|
17
14
|
* The output of standard out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simctl.d.ts","sourceRoot":"","sources":["../../../lib/commands/simctl.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simctl.d.ts","sourceRoot":"","sources":["../../../lib/commands/simctl.js"],"names":[],"mappings":"AA+BA;;;;;;;;;GASG;AACH,kFANW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GAAC,SAAS,GACd,OAAO,CAAC,kBAAkB,CAAC,CAqBvC;;;;;YAIa,MAAM;;;;YACN,MAAM;;;;UACN,MAAM;;6BAIP,OAAO,WAAW,EAAE,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mobileSimctl = mobileSimctl;
|
|
3
4
|
const driver_1 = require("appium/driver");
|
|
4
5
|
/**
|
|
5
6
|
* List of subcommands for `simctl` we provide as mobile simctl command.
|
|
@@ -29,33 +30,29 @@ const SUBCOMMANDS_HAS_DEVICE = [
|
|
|
29
30
|
'ui',
|
|
30
31
|
'uninstall'
|
|
31
32
|
];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
throw new driver_1.errors.InvalidArgumentError(`The given command '${command}' is not supported. ` +
|
|
53
|
-
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
|
|
54
|
-
}
|
|
55
|
-
return await /** @type {import('./../driver').Simulator} */ (this.device).simctl.exec(command, { args: [this.opts.udid, ...args], timeout });
|
|
33
|
+
/**
|
|
34
|
+
* Run the given command with arguments as `xcrun simctl` subcommand.
|
|
35
|
+
* This method works behind the 'simctl' security flag.
|
|
36
|
+
* @this {XCUITestDriver}
|
|
37
|
+
* @param {string} command Subcommand to run with `xcrun simctl`
|
|
38
|
+
* @param {string[]} [args=[]] arguments for the subcommand. The arguments should be after <device> in the help.
|
|
39
|
+
* @param {number|undefined} timeout - The maximum number of milliseconds
|
|
40
|
+
* @returns {Promise<SimctlExecResponse>}
|
|
41
|
+
* @throws {Error} If the simctl subcommand command returns non-zero return code, or the given subcommand was invalid.
|
|
42
|
+
*/
|
|
43
|
+
async function mobileSimctl(command, args = [], timeout = undefined) {
|
|
44
|
+
if (!this.isSimulator()) {
|
|
45
|
+
throw new driver_1.errors.UnsupportedOperationError(`Only simulator is supported.`);
|
|
46
|
+
}
|
|
47
|
+
if (!this.opts.udid) {
|
|
48
|
+
throw new driver_1.errors.InvalidArgumentError(`Unknown device or simulator UDID: '${this.opts.udid}'`);
|
|
49
|
+
}
|
|
50
|
+
if (!SUBCOMMANDS_HAS_DEVICE.includes(command)) {
|
|
51
|
+
throw new driver_1.errors.InvalidArgumentError(`The given command '${command}' is not supported. ` +
|
|
52
|
+
`Available subcommands are ${SUBCOMMANDS_HAS_DEVICE.join(',')}`);
|
|
56
53
|
}
|
|
57
|
-
};
|
|
58
|
-
|
|
54
|
+
return await /** @type {import('./../driver').Simulator} */ (this.device).simctl.exec(command, { args: [this.opts.udid, ...args], timeout });
|
|
55
|
+
}
|
|
59
56
|
/**
|
|
60
57
|
* @typedef {Object} SimctlExecResponse
|
|
61
58
|
* @property {string} stdout The output of standard out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simctl.js","sourceRoot":"","sources":["../../../lib/commands/simctl.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"simctl.js","sourceRoot":"","sources":["../../../lib/commands/simctl.js"],"names":[],"mappings":";;AAyCA,oCAkBC;AA3DD,0CAAuC;AAEvC;;;GAGG;AACH,MAAM,sBAAsB,GAAG;IAC7B,MAAM;IACN,mBAAmB;IACnB,QAAQ;IACR,aAAa;IACb,SAAS;IACT,kBAAkB;IAClB,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,MAAM;IACN,UAAU;IACV,OAAO;IACP,YAAY;IACZ,WAAW;IACX,IAAI;IACJ,WAAW;CACZ,CAAC;AAEF;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,GAAG,SAAS;IACxE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,eAAM,CAAC,yBAAyB,CAAC,8BAA8B,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,sCAAsC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IACjG,CAAC;IAED,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,sBAAsB,OAAO,sBAAsB;YACvF,6BAA6B,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,MAAM,8CAA8C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CACnF,OAAO,EACP,EAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,OAAO,EAAC,CAC3C,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AAEH;;GAEG"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function mobileGetSource(this: import("../driver").XCUITestDriver, format?: import("./types").SourceFormat, excludedAttributes?: string): Promise<string>;
|
|
16
|
-
}
|
|
17
|
-
export default _default;
|
|
1
|
+
/**
|
|
2
|
+
* @this {XCUITestDriver}
|
|
3
|
+
*/
|
|
4
|
+
export function getPageSource(this: import("../driver").XCUITestDriver): Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve the source tree of the current page in XML or JSON format.
|
|
7
|
+
*
|
|
8
|
+
* @param {import('./types').SourceFormat} format - Page tree source representation format.
|
|
9
|
+
* @param {string} [excludedAttributes] A comma-separated string of attribute names to exclude from the output. Only works if `format` is `xml`.
|
|
10
|
+
* @privateRemarks Why isn't `excludedAttributes` an array?
|
|
11
|
+
* @returns {Promise<string>} The source tree of the current page in the given format.
|
|
12
|
+
* @this {XCUITestDriver}
|
|
13
|
+
*/
|
|
14
|
+
export function mobileGetSource(this: import("../driver").XCUITestDriver, format?: import("./types").SourceFormat, excludedAttributes?: string): Promise<string>;
|
|
18
15
|
export type XCUITestDriver = import("../driver").XCUITestDriver;
|
|
19
16
|
//# sourceMappingURL=source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../lib/commands/source.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../lib/commands/source.js"],"names":[],"mappings":"AAKA;;GAEG;AACH,sFAiBC;AAED;;;;;;;;GAQG;AACH,mFANW,OAAO,SAAS,EAAE,YAAY,uBAC9B,MAAM,GAEJ,OAAO,CAAC,MAAM,CAAC,CAe3B;6BAiFY,OAAO,WAAW,EAAE,cAAc"}
|
|
@@ -3,51 +3,49 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPageSource = getPageSource;
|
|
7
|
+
exports.mobileGetSource = mobileGetSource;
|
|
6
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
9
|
const js2xmlparser2_1 = __importDefault(require("js2xmlparser2"));
|
|
8
10
|
const APPIUM_AUT_TAG = 'AppiumAUT';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.join('&');
|
|
48
|
-
return /** @type {string} */ (await this.proxyCommand(`/source?${query}`, 'GET'));
|
|
49
|
-
},
|
|
50
|
-
};
|
|
11
|
+
/**
|
|
12
|
+
* @this {XCUITestDriver}
|
|
13
|
+
*/
|
|
14
|
+
async function getPageSource() {
|
|
15
|
+
if (this.isWebContext()) {
|
|
16
|
+
const script = 'return document.documentElement.outerHTML';
|
|
17
|
+
return await this.executeAtom('execute_script', [script, []]);
|
|
18
|
+
}
|
|
19
|
+
const { pageSourceExcludedAttributes: excludedAttributes, useJSONSource } = await this.settings.getSettings();
|
|
20
|
+
const hasExcludedAttributes = lodash_1.default.isString(excludedAttributes) && !lodash_1.default.isEmpty(excludedAttributes);
|
|
21
|
+
if (useJSONSource) {
|
|
22
|
+
const srcTree = await this.mobileGetSource('json', hasExcludedAttributes ? excludedAttributes : undefined);
|
|
23
|
+
return getSourceXml(getTreeForXML(srcTree));
|
|
24
|
+
}
|
|
25
|
+
return await this.mobileGetSource('xml', hasExcludedAttributes ? excludedAttributes : undefined);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve the source tree of the current page in XML or JSON format.
|
|
29
|
+
*
|
|
30
|
+
* @param {import('./types').SourceFormat} format - Page tree source representation format.
|
|
31
|
+
* @param {string} [excludedAttributes] A comma-separated string of attribute names to exclude from the output. Only works if `format` is `xml`.
|
|
32
|
+
* @privateRemarks Why isn't `excludedAttributes` an array?
|
|
33
|
+
* @returns {Promise<string>} The source tree of the current page in the given format.
|
|
34
|
+
* @this {XCUITestDriver}
|
|
35
|
+
*/
|
|
36
|
+
async function mobileGetSource(format = 'xml', excludedAttributes) {
|
|
37
|
+
const paramsMap = {
|
|
38
|
+
format,
|
|
39
|
+
scope: APPIUM_AUT_TAG,
|
|
40
|
+
};
|
|
41
|
+
if (excludedAttributes) {
|
|
42
|
+
paramsMap.excluded_attributes = excludedAttributes;
|
|
43
|
+
}
|
|
44
|
+
const query = Object.entries(paramsMap)
|
|
45
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
46
|
+
.join('&');
|
|
47
|
+
return /** @type {string} */ (await this.proxyCommand(`/source?${query}`, 'GET'));
|
|
48
|
+
}
|
|
51
49
|
/**
|
|
52
50
|
* Will get JSON of the form:
|
|
53
51
|
*
|
|
@@ -124,7 +122,6 @@ function getSourceXml(jsonSource) {
|
|
|
124
122
|
prettyPrinting: { indentString: ' ' },
|
|
125
123
|
});
|
|
126
124
|
}
|
|
127
|
-
exports.default = { ...helpers, ...commands };
|
|
128
125
|
/**
|
|
129
126
|
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
130
127
|
*/
|