appium-xcuitest-driver 4.11.1 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +55 -11
  2. package/build/lib/app-utils.js.map +1 -0
  3. package/build/lib/build-wda.js.map +1 -0
  4. package/build/lib/cert-utils.js.map +1 -0
  5. package/build/lib/commands/activeAppInfo.js.map +1 -0
  6. package/build/lib/commands/alert.js.map +1 -0
  7. package/build/lib/commands/app-management.js.map +1 -0
  8. package/build/lib/commands/appearance.js.map +1 -0
  9. package/build/lib/commands/battery.js.map +1 -0
  10. package/build/lib/commands/biometric.js.map +1 -0
  11. package/build/lib/commands/certificate.js.map +1 -0
  12. package/build/lib/commands/clipboard.js.map +1 -0
  13. package/build/lib/commands/condition.js.map +1 -0
  14. package/build/lib/commands/context.js.map +1 -0
  15. package/build/lib/commands/cookies.js.map +1 -0
  16. package/build/lib/commands/deviceInfo.js.map +1 -0
  17. package/build/lib/commands/element.js.map +1 -0
  18. package/build/lib/commands/execute.js +2 -1
  19. package/build/lib/commands/execute.js.map +1 -0
  20. package/build/lib/commands/file-movement.js.map +1 -0
  21. package/build/lib/commands/find.js.map +1 -0
  22. package/build/lib/commands/general.js.map +1 -0
  23. package/build/lib/commands/gesture.js +27 -1
  24. package/build/lib/commands/gesture.js.map +1 -0
  25. package/build/lib/commands/index.js.map +1 -0
  26. package/build/lib/commands/iohid.js.map +1 -0
  27. package/build/lib/commands/keychains.js.map +1 -0
  28. package/build/lib/commands/localization.js.map +1 -0
  29. package/build/lib/commands/location.js.map +1 -0
  30. package/build/lib/commands/lock.js.map +1 -0
  31. package/build/lib/commands/log.js.map +1 -0
  32. package/build/lib/commands/navigation.js.map +1 -0
  33. package/build/lib/commands/notifications.js.map +1 -0
  34. package/build/lib/commands/pasteboard.js.map +1 -0
  35. package/build/lib/commands/pcap.js.map +1 -0
  36. package/build/lib/commands/performance.js.map +1 -0
  37. package/build/lib/commands/permissions.js.map +1 -0
  38. package/build/lib/commands/proxy-helper.js.map +1 -0
  39. package/build/lib/commands/record-audio.js.map +1 -0
  40. package/build/lib/commands/recordscreen.js.map +1 -0
  41. package/build/lib/commands/screenshots.js.map +1 -0
  42. package/build/lib/commands/source.js.map +1 -0
  43. package/build/lib/commands/timeouts.js.map +1 -0
  44. package/build/lib/commands/web.js.map +1 -0
  45. package/build/lib/commands/xctest.js.map +1 -0
  46. package/build/lib/cookies.js.map +1 -0
  47. package/build/lib/css-converter.js.map +1 -0
  48. package/build/lib/desired-caps.js.map +1 -0
  49. package/build/lib/device-connections-factory.js.map +1 -0
  50. package/build/lib/device-log/ios-crash-log.js.map +1 -0
  51. package/build/lib/device-log/ios-device-log.js.map +1 -0
  52. package/build/lib/device-log/ios-log.js.map +1 -0
  53. package/build/lib/device-log/ios-performance-log.js.map +1 -0
  54. package/build/lib/device-log/ios-simulator-log.js.map +1 -0
  55. package/build/lib/device-log/rotating-log.js.map +1 -0
  56. package/build/lib/device-log/safari-console-log.js.map +1 -0
  57. package/build/lib/device-log/safari-network-log.js.map +1 -0
  58. package/build/lib/driver.js.map +1 -0
  59. package/build/lib/ios-deploy.js.map +1 -0
  60. package/build/lib/ios-fs-helpers.js.map +1 -0
  61. package/build/lib/ios-generic-simulators.js.map +1 -0
  62. package/build/lib/logger.js.map +1 -0
  63. package/build/lib/py-ios-device-client.js.map +1 -0
  64. package/build/lib/real-device-management.js.map +1 -0
  65. package/build/lib/simulator-management.js.map +1 -0
  66. package/build/lib/utils.js.map +1 -0
  67. package/lib/commands/execute.js +2 -0
  68. package/lib/commands/gesture.js +22 -0
  69. package/npm-shrinkwrap.json +324 -247
  70. package/package.json +3 -3
package/README.md CHANGED
@@ -5,14 +5,17 @@
5
5
 
6
6
  [![Release](https://github.com/appium/appium-xcuitest-driver/actions/workflows/publish.js.yml/badge.svg)](https://github.com/appium/appium-xcuitest-driver/actions/workflows/publish.js.yml)
7
7
 
8
- Appium XCUITest Driver is a combined solution, which allows to perform automated black-box testing of iOS and tvOS native applications and WebKit web views.
8
+ Appium XCUITest Driver is a combined solution, which allows performing automated black-box testing of iOS and tvOS native applications and WebKit web views.
9
9
  The native testing is based on Apple's [XCTest](https://developer.apple.com/documentation/xctest) framework and the fork of Facebook's [WebDriverAgent](https://github.com/appium/WebDriverAgent) server (the [original](https://github.com/facebookarchive/WebDriverAgent) project is not supported anymore).
10
10
  Web views communication is done via [Webkit remote debugger protocol](https://github.com/appium/appium-remote-debugger). Real devices communication is ensured by [appium-ios-device](https://github.com/appium/appium-ios-device) library.
11
11
  Simulators communication is ensured by [appium-ios-simulator](https://github.com/appium/appium-ios-simulator) library.
12
12
 
13
13
  In the native mode the driver operates in scope of [WebDriver W3C protocol](https://w3c.github.io/webdriver) with several platform-specific extensions. Web views communication only supports the obsolete [JWP protocol](https://webdriver.io/docs/api/jsonwp.html).
14
14
 
15
- *Note*: Issue tracking for this repo has been disabled. Please use the [main Appium issue tracker](https://github.com/appium/appium/issues) instead.
15
+ > **Note**
16
+ >
17
+ > Since version 4.0.0 XCUITest driver has dropped the support of Appium 1, and is only compatible to Appium 2.
18
+ > Use the `appium driver install xcuitest` command to add it to your Appium 2 dist.
16
19
 
17
20
 
18
21
  ## Requirements
@@ -20,27 +23,45 @@ In the native mode the driver operates in scope of [WebDriver W3C protocol](http
20
23
  On top of standard Appium requirements XCUITest driver also expects the following prerequisites:
21
24
 
22
25
  - Only macOS is supported as the host platform
23
- - Xcode and developer tools must be installed. Note, that usually some time is needed for the Appium team to pick up with the support of the most recent Xcode versions, especially beta ones.
26
+ - Xcode and developer tools must be installed. Note, that usually some time is needed for the Appium team to pick up with the support of the most recent Xcode versions, especially beta ones (check [Xcode version support](#xcode-version-support) section below).
24
27
  - Connected real devices must be trusted, added to your developer profile and configured properly along with WebDriverAgent signing. Read [Real devices](#real-devices) section _carefully_ to set them up properly before running your tests.
25
28
  - Starting from iOS/iPadOS version iOS/iPadOS 16 real devices require enabling of _Developer Mode_ option in _Settings -> Privacy & Security_
26
- - The minimum supported Xcode SDK version for the current driver snapshot is *10.2 (iOS 12.2)*. Consider using earlier releases of the driver (see [Xcode version support](#xcode-version-support) section below) if it is necessary to test older iOS versions on real devices. Also, it is highly recommended to always use the same major version of Xcode SDK, which was used to build the particular iOS/tvOS version on your real device under test (for example Xcode 11 for iOS 13, Xcode 12 for iOS 14, etc).
29
+ - Consider using earlier releases of the driver (check [Xcode version support](#xcode-version-support) section below) if it is necessary to test iOS versions older than the current iOS major version minus one on real devices. Also, it is highly recommended to always use the same major version of Xcode SDK, which was used to build the particular iOS/tvOS version on your real device under test (for example Xcode 11 for iOS 13, Xcode 12 for iOS 14, etc).
27
30
  - Web views must be debuggable in order to test them. If it is not possible to connect to your web view(s) using [Safari remote debugger](https://appletoolbox.com/use-web-inspector-debug-mobile-safari/) then XCUITest won't be able to connect to them as well.
28
31
  - Since version 3.33.0 (included into Appium 1.20.0+) of XCUITest driver the [Carthage](https://github.com/Carthage/Carthage) dependency *is not needed anymore*. Prior to that version it was required and could be installed using [brew](https://brew.sh/): `brew install carthage`.
29
32
 
33
+
30
34
  ## Optional dependencies
31
35
 
32
36
  - [xcpretty](https://github.com/supermarin/xcpretty) tool could be used to make Xcode output easier to read. It could be installed using `gem install xcpretty` command.
33
37
  - For test video recording we use [ffmpeg](https://ffmpeg.org/). It could be installed using [brew](https://brew.sh/): `brew install ffmpeg`
34
38
  - [IDB](https://github.com/facebook/idb), [go-ios](https://github.com/danielpaulus/go-ios) and [tidevice](https://github.com/alibaba/taobao-iphone-device) could be used to improve some real device/Simulator interactions
35
39
  - [WIX AppleSimulatorUtils](https://github.com/wix/AppleSimulatorUtils) could be used to improve some Simulator interactions
40
+ - [py-ios-device](https://github.com/YueChen-C/py-ios-device) is required in several `mobile:` extensions and to improve the general testing experience for _real_ iOS devices
36
41
 
37
42
 
38
43
  ## Xcode version support
39
44
 
40
- * module versions below `2.96.0` only supports XCode 8 and newer
41
- * module version `2.96.0` and above only supports XCode 9 and newer
42
- * module version `3.0.0` and above only supports Xcode 10 and newer
43
- * module version `3.32.0` and above only supports Xcode 10.2 and newer
45
+ Apple constantly works on various updates/improvements to XCTest framework. Thus, some major and even minor iOS releases might partially break the backward compatibility, so we need to implement multiple branches to support the legacy and the current implementations in [WebDriverAgent](https://github.com/appium/WebDriverAgent). Eventually we just drop the support of legacy XCTest implementations in order to simplify the client code and to have access to the recent platform features. The general aim is to support the _current major_ platform version and the _previous major_ one.
46
+
47
+ Minimum XCUITest driver version | Minimum required Xcode version
48
+ --- | ---
49
+ 2.96.0 | Xcode 9
50
+ 3.0.0 | Xcode 10
51
+ 3.32.0 | Xcode 10.2
52
+ 3.56.0 | Xcode 11
53
+ 4.2.0 | Xcode 12
54
+
55
+ It could be that after a new Xcode SDK is released we figure out a part or even the whole functionality that [WebDriverAgent](https://github.com/appium/WebDriverAgent) currently provides does not work anymore and needs to be updated. The below table contains the driver versions mapping for the cases where we had known compatibility issues with newly released SDKs and addressed them. Basically, version numbers in this table mean that all XCUITest driver versions _below_ the one in the first column _won't support_ Xcode SDK equal or above the version in the second column and the only way to make your test working after Xcode update would be to also *bump the driver version*.
56
+
57
+ Minimum XCUITest driver version | Tested for compatibility with Xcode version
58
+ --- | ---
59
+ 4.7.4 | Xcode 14-beta.3
60
+
61
+
62
+ ## tvOS Support
63
+
64
+ Read the [tvOS support](docs/ios/ios-tvos.md) article to get more details on how to automate testing for this platform.
44
65
 
45
66
 
46
67
  ## Real devices
@@ -54,7 +75,7 @@ See [real device configuration documentation](docs/real-device-config.md).
54
75
  - After many failures on real devices it could transition to a state where connections are no longer being accepted. To possibly remedy this issue reboot the device. Read https://github.com/facebook/WebDriverAgent/issues/507 for more details.
55
76
  - iPhone/iPad real devices show overlay, which has `Automation Running Hold both volume buttons to stop` text, since iOS/iPadOS 15. This is a known limitation of XCTest framework. This limitation does not affect screenshooting APIs though (e.g. the overlay is not visible on taken screenshots).
56
77
  - iPhone/iPad real devices [require passcode or touch id](https://github.com/appium/appium/issues/15898#issuecomment-927340411) when they start a XCTest session since iOS/iPadOS 15. Disabling passcode/touch id in the device preference allows to workaround the behaviour above.
57
- - OpenSSL v3 breaks secured communication with real devices. It can cause a [Failed to receive any data within the timeout](https://github.com/appium/appium/issues/16399) error in [appium-ios-device](https://github.com/appium/appium-ios-device). Please read [this issue](https://github.com/appium/appium-ios-device/pull/88#discussion_r825315862) for more details.
78
+ - OpenSSL v3 breaks secure communication with real devices. It can cause a [Failed to receive any data within the timeout](https://github.com/appium/appium/issues/16399) error in [appium-ios-device](https://github.com/appium/appium-ios-device). Please read [this issue](https://github.com/appium/appium-ios-device/pull/88#discussion_r825315862) for more details.
58
79
  - Please make sure your environment has Open SSL v1 for NodeJS environment, or prepare an OpenSSL v3 build by patching `OPENSSL_TLS_SECURITY_LEVEL=1`. (e.g. [an article](https://www.feistyduck.com/library/openssl-cookbook/online/ch-openssl.html))
59
80
  - This configuration is only necessary for XCUITest driver v4.3.0 or lower.
60
81
 
@@ -98,7 +119,7 @@ Usage: `appium --driver-args='{"xcuitest": {[argName]: [argValue]}}'`
98
119
 
99
120
  |Argument|Default|Description|Example|
100
121
  |----|-------|-----------|-------|
101
- |`"wdaLocalPort"`|8100| Local port used for communication with ios-web-driver-agent|`--driver-args='{"xcuitest": {"wdaLocalPort": 8100}}'`|
122
+ | wdaLocalPort | 8100 | Local port used for communication with ios-web-driver-agent | `--driver-args='{"xcuitest": {"wdaLocalPort": 8100}}'` |
102
123
 
103
124
  ## Capabilities
104
125
 
@@ -248,7 +269,7 @@ XCUITest driver supports the following element attributes:
248
269
  Name | Description | Example
249
270
  --- | --- | ---
250
271
  name | Could contain either element's [identifier](https://developer.apple.com/documentation/xctest/xcuielementattributes/1500981-identifier?language=objc) or its [label](https://developer.apple.com/documentation/xctest/xcuielementattributes/1500692-label?language=objc), depending on which one is available first. Could also be `null`. It is recommended to prefer the usage of [accessibilityIdentifier](https://developer.apple.com/documentation/uikit/uiaccessibilityidentification/1623132-accessibilityidentifier) over [accessibilityLabel](https://developer.apple.com/documentation/objectivec/nsobject/1615181-accessibilitylabel) for automation purposes, since the `identifier` property is supposed to stay constant under different locales and does not affect accessibility services such as VoiceOver. | 'hello'
251
- label | Element's [label](https://developer.apple.com/documentation/xctest/xcuielementattributes/1500692-label?language=objc) value. Could be `null` | 'hello'
272
+ label | Element's [label](https://developer.apple.com/documentation/xctest/xcuielementattributes/1500692-label?language=objc) value. Could be `null`. Since XCUITest driver 4.7.3 (WebDriverAgent 4.8.0), the behavior of this value was better aligned with XCTest, so it could include line breaks (`\n`). Before this version, line breaks were replaced by spaces. | 'hello', 'hello\nworld'
252
273
  type | Element's [type](https://developer.apple.com/documentation/xctest/xcuielementattributes/1500614-elementtype?language=objc) name | 'XCUIElementTypeButton'
253
274
  visible | Whether the element is visible. This value is not available in the "vanilla" XCTest and is read directly from the accessibility layer | 'false'
254
275
  focused | Whether the element is [focused](https://developer.apple.com/documentation/xctest/xcuielementattributes/1627636-hasfocus?language=objc). *Only available for tvOS* | 'true'
@@ -1290,6 +1311,29 @@ js.executeScript("mobile: dragFromToForDuration", params);
1290
1311
 
1291
1312
  [clickForDuration:thenDragToElement:](https://developer.apple.com/documentation/xctest/xcuielement/1500989-clickforduration?language=objc)
1292
1313
 
1314
+ ### mobile: dragFromToWithVelocity
1315
+
1316
+ Initiates a press-and-hold gesture, drags to another coordinate or an element with a velocity you specify, and holds for a duration you specify.
1317
+
1318
+ #### Arguments
1319
+
1320
+ Name | Type | Required | Description | Example
1321
+ --- | --- | --- | --- | ---
1322
+ fromElementId | string | no | The internal element identifier (as hexadecimal hash string) to start the drag gesture from. Absolute screen coordinates are expected if this argument is not set | fe50b60b-916d-420b-8728-ee2072ec53eb
1323
+ toElementId | string | no | The internal element identifier (as hexadecimal hash string) to end the drag gesture on. This parameter is mandatory if `fromElementId` is provided | fe50b60b-916d-420b-8728-ee2072ec53eb
1324
+ pressDuration | number | yes | Float number of seconds in range [0, 60]. How long the tap gesture at starting drag point should be before to start dragging | 0.5
1325
+ holdDuration | number | yes | Float number of seconds in range [0, 60]. The duration for which to hold over the other coordinate or the given element after dragging | 0.1
1326
+ velocity | number | yes | The speed at which to move from the initial press position to the other element or coordinate, expressed in pixels per second | 400
1327
+ fromX | number | no | The x coordinate of starting drag point. Must be provided if `fromElementId` is not defined | 100
1328
+ fromY | number | no | The y coordinate of starting drag point. Must be provided if `fromElementId` is not defined | 100
1329
+ toX | number | no | The x coordinate of ending drag point. Must be provided if `fromElementId` is not defined | 200
1330
+ toY | number | no | The y coordinate of ending drag point. Must be provided if `fromElementId` is not defined | 200
1331
+
1332
+ #### References
1333
+
1334
+ [pressForDuration:thenDragToElement:withVelocity:thenHoldForDuration:](https://developer.apple.com/documentation/xctest/xcuielement/3551693-pressforduration?language=objc)
1335
+ [pressForDuration:thenDragToCoordinate:withVelocity:thenHoldForDuration:](https://developer.apple.com/documentation/xctest/xcuicoordinate/3551692-pressforduration?language=objc)
1336
+
1293
1337
  ### mobile: selectPickerWheelValue
1294
1338
 
1295
1339
  Performs selection of the next or previous picker wheel value. This might
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-utils.js","names":["STRINGSDICT_RESOURCE","STRINGS_RESOURCE","SAFARI_BUNDLE_ID","APP_EXT","IPA_EXT","extractPlistEntry","app","entryName","plistPath","path","resolve","plist","parsePlistFile","err","Error","basename","message","extractBundleId","bundleId","log","debug","fetchSupportedAppPlatforms","result","_","isArray","warn","verifyApplicationPlatform","expectedPlatform","supportedPlatforms","JSON","stringify","isSimulator","isTvOS","prefix","suffix","dstPlatform","includes","readResource","resourcePath","data","key","value","toPairs","isString","parseLocalizableStrings","opts","language","localizableStringsDir","stringFile","strictMode","info","lprojRoot","subfolder","fs","exists","resourcePaths","dstPath","push","isEmpty","resourceFiles","readdir","filter","name","some","x","endsWith","map","length","resultStrings","toAbsolutePath","p","isAbsolute","process","cwd","util","isSubPath","keys","merge","e","isAppBundle","appPath","toLower","stat","isDirectory","join","findApps","archivePath","appExtensions","useSystemUnzipEnv","env","APPIUM_PREFER_SYSTEM_UNZIP","useSystemUnzip","tmpRoot","tempDir","openDir","zip","extractAllTo","globPattern","ext","replace","sortedBundleItems","glob","strict","sort","a","b","split","sep","isolateAppBundle","appRoot","dstRoot","mv","mkdirp"],"sources":["../../lib/app-utils.js"],"sourcesContent":["import _ from 'lodash';\nimport path from 'path';\nimport { plist, fs, util, tempDir, zip } from 'appium/support';\nimport log from './logger.js';\n\nconst STRINGSDICT_RESOURCE = '.stringsdict';\nconst STRINGS_RESOURCE = '.strings';\nconst SAFARI_BUNDLE_ID = 'com.apple.mobilesafari';\nconst APP_EXT = '.app';\nconst IPA_EXT = '.ipa';\n\nasync function extractPlistEntry (app, entryName) {\n const plistPath = path.resolve(app, 'Info.plist');\n try {\n return (await plist.parsePlistFile(plistPath))[entryName];\n } catch (err) {\n throw new Error(`Could not extract Info.plist from '${path.basename(app)}': ${err.message}`);\n }\n}\n\nasync function extractBundleId (app) {\n const bundleId = await extractPlistEntry(app, 'CFBundleIdentifier');\n log.debug(`Getting bundle ID from app '${app}': '${bundleId}'`);\n return bundleId;\n}\n\nasync function fetchSupportedAppPlatforms (app) {\n try {\n const result = await extractPlistEntry(app, 'CFBundleSupportedPlatforms');\n if (!_.isArray(result)) {\n log.warn(`${path.basename(app)}': CFBundleSupportedPlatforms is not a valid list`);\n return [];\n }\n return result;\n } catch (err) {\n log.warn(\n `Cannot extract the list of supported platforms from '${path.basename(app)}': ${err.message}`\n );\n return [];\n }\n}\n\n/**\n * @typedef {Object} PlatformOpts\n *\n * @property {boolean} isSimulator - Whether the destination platform is a Simulator\n * @property {boolean} isTvOS - Whether the destination platform is a Simulator\n */\n\n/**\n * Verify whether the given application is compatible to the\n * platform where it is going to be installed and tested.\n *\n * @param {string} app - The actual path to the application bundle\n * @param {PlatformOpts} expectedPlatform\n * @throws {Error} If bundle architecture does not match the expected device architecture.\n */\nasync function verifyApplicationPlatform (app, expectedPlatform) {\n log.debug('Verifying application platform');\n\n const supportedPlatforms = await fetchSupportedAppPlatforms(app);\n log.debug(`CFBundleSupportedPlatforms: ${JSON.stringify(supportedPlatforms)}`);\n\n const {\n isSimulator,\n isTvOS,\n } = expectedPlatform;\n const prefix = isTvOS ? 'AppleTV' : 'iPhone';\n const suffix = isSimulator ? 'Simulator' : 'OS';\n const dstPlatform = `${prefix}${suffix}`;\n if (!supportedPlatforms.includes(dstPlatform)) {\n throw new Error(`${isSimulator ? 'Simulator' : 'Real device'} architecture is unsupported by the '${app}' application. ` +\n `Make sure the correct deployment target has been selected for its compilation in Xcode.`);\n }\n}\n\nasync function readResource (resourcePath) {\n const data = await plist.parsePlistFile(resourcePath);\n const result = {};\n for (const [key, value] of _.toPairs(data)) {\n result[key] = _.isString(value) ? value : JSON.stringify(value);\n }\n return result;\n}\n\nasync function parseLocalizableStrings (opts) {\n const {\n app,\n language = 'en',\n localizableStringsDir,\n stringFile,\n strictMode,\n } = opts;\n\n if (!app) {\n const message = `Strings extraction is not supported if 'app' capability is not set`;\n if (strictMode) {\n throw new Error(message);\n }\n log.info(message);\n return {};\n }\n\n let lprojRoot;\n for (const subfolder of [`${language}.lproj`, localizableStringsDir, '']) {\n lprojRoot = path.resolve(app, subfolder);\n if (await fs.exists(lprojRoot)) {\n break;\n }\n const message = `No '${lprojRoot}' resources folder has been found`;\n if (strictMode) {\n throw new Error(message);\n }\n log.debug(message);\n }\n log.info(`Will extract resource strings from '${lprojRoot}'`);\n\n const resourcePaths = [];\n if (stringFile) {\n const dstPath = path.resolve(lprojRoot, stringFile);\n if (await fs.exists(dstPath)) {\n resourcePaths.push(dstPath);\n } else {\n const message = `No '${dstPath}' resource file has been found for '${app}'`;\n if (strictMode) {\n throw new Error(message);\n }\n log.info(message);\n log.info(`Getting all the available strings from '${lprojRoot}'`);\n }\n }\n\n if (_.isEmpty(resourcePaths) && await fs.exists(lprojRoot)) {\n const resourceFiles = (await fs.readdir(lprojRoot))\n .filter((name) => _.some([STRINGS_RESOURCE, STRINGSDICT_RESOURCE], (x) => name.endsWith(x)))\n .map((name) => path.resolve(lprojRoot, name));\n resourcePaths.push(...resourceFiles);\n }\n log.info(`Got ${resourcePaths.length} resource file(s) in '${lprojRoot}'`);\n\n if (_.isEmpty(resourcePaths)) {\n return {};\n }\n\n const resultStrings = {};\n const toAbsolutePath = function (p) {\n return path.isAbsolute(p) ? p : path.resolve(process.cwd(), p);\n };\n for (const resourcePath of resourcePaths) {\n if (!util.isSubPath(toAbsolutePath(resourcePath), toAbsolutePath(app))) {\n // security precaution\n throw new Error(`'${resourcePath}' is expected to be located under '${app}'`);\n }\n try {\n const data = await readResource(resourcePath);\n log.debug(`Parsed ${_.keys(data).length} string(s) from '${resourcePath}'`);\n _.merge(resultStrings, data);\n } catch (e) {\n log.warn(`Cannot parse '${resourcePath}' resource. Original error: ${e.message}`);\n }\n }\n\n log.info(`Got ${_.keys(resultStrings).length} string(s) from '${lprojRoot}'`);\n return resultStrings;\n}\n\n/**\n * Check whether the given path on the file system points to the .app bundle root\n *\n * @param {string} appPath Possible .app bundle root\n * @returns {boolean} Whether the given path points to an .app bundle\n */\nasync function isAppBundle (appPath) {\n return _.endsWith(_.toLower(appPath), APP_EXT)\n && (await fs.stat(appPath)).isDirectory()\n && await fs.exists(path.join(appPath, 'Info.plist'));\n}\n\n/**\n * Extract the given archive and looks for items with given extensions in it\n *\n * @param {string} archivePath Full path to a .zip archive\n * @param {Array<string>} appExtensions List of matching item extensions\n * @returns {[string, Array<String>]} Tuple, where the first element points to\n * a temporary folder root where the archive has been extracted and the second item\n * contains a list of relative paths to matched items\n */\nasync function findApps (archivePath, appExtensions) {\n const useSystemUnzipEnv = process.env.APPIUM_PREFER_SYSTEM_UNZIP;\n const useSystemUnzip = _.isEmpty(useSystemUnzipEnv)\n || !['0', 'false'].includes(_.toLower(useSystemUnzipEnv));\n const tmpRoot = await tempDir.openDir();\n await zip.extractAllTo(archivePath, tmpRoot, {useSystemUnzip});\n const globPattern = `**/*.+(${appExtensions.map((ext) => ext.replace(/^\\./, '')).join('|')})`;\n const sortedBundleItems = (await fs.glob(globPattern, {\n cwd: tmpRoot,\n strict: false,\n })).sort((a, b) => a.split(path.sep).length - b.split(path.sep).length);\n return [tmpRoot, sortedBundleItems];\n}\n\n/**\n * Moves the application bundle to a newly created temporary folder\n *\n * @param {string} appRoot Full path to the .app bundle\n * @returns {string} The new path to the app bundle.\n * The name of the app bundle remains though\n */\nasync function isolateAppBundle (appRoot) {\n const tmpRoot = await tempDir.openDir();\n const dstRoot = path.join(tmpRoot, path.basename(appRoot));\n await fs.mv(appRoot, dstRoot, {mkdirp: true});\n return dstRoot;\n}\n\nexport {\n extractBundleId, verifyApplicationPlatform, parseLocalizableStrings,\n SAFARI_BUNDLE_ID, fetchSupportedAppPlatforms, APP_EXT, IPA_EXT,\n isAppBundle, findApps, isolateAppBundle,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,MAAMA,oBAAoB,GAAG,cAA7B;AACA,MAAMC,gBAAgB,GAAG,UAAzB;AACA,MAAMC,gBAAgB,GAAG,wBAAzB;;AACA,MAAMC,OAAO,GAAG,MAAhB;;AACA,MAAMC,OAAO,GAAG,MAAhB;;;AAEA,eAAeC,iBAAf,CAAkCC,GAAlC,EAAuCC,SAAvC,EAAkD;EAChD,MAAMC,SAAS,GAAGC,aAAA,CAAKC,OAAL,CAAaJ,GAAb,EAAkB,YAAlB,CAAlB;;EACA,IAAI;IACF,OAAO,CAAC,MAAMK,cAAA,CAAMC,cAAN,CAAqBJ,SAArB,CAAP,EAAwCD,SAAxC,CAAP;EACD,CAFD,CAEE,OAAOM,GAAP,EAAY;IACZ,MAAM,IAAIC,KAAJ,CAAW,sCAAqCL,aAAA,CAAKM,QAAL,CAAcT,GAAd,CAAmB,MAAKO,GAAG,CAACG,OAAQ,EAApF,CAAN;EACD;AACF;;AAED,eAAeC,eAAf,CAAgCX,GAAhC,EAAqC;EACnC,MAAMY,QAAQ,GAAG,MAAMb,iBAAiB,CAACC,GAAD,E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D,EAAUQ,iBAAV,CAAP;AACD;;AASD,eAAeQ,gBAAf,CAAiCC,OAAjC,EAA0C;EACxC,MAAMjB,OAAO,GAAG,MAAMC,gBAAA,CAAQC,OAAR,EAAtB;;EACA,MAAMgB,OAAO,GAAGrG,aAAA,CAAK2E,IAAL,CAAUQ,OAAV,EAAmBnF,aAAA,CAAKM,QAAL,CAAc8F,OAAd,CAAnB,CAAhB;;EACA,MAAMxD,WAAA,CAAG0D,EAAH,CAAMF,OAAN,EAAeC,OAAf,EAAwB;IAACE,MAAM,EAAE;EAAT,CAAxB,CAAN;EACA,OAAOF,OAAP;AACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-wda.js","names":["DEFAULT_SIM_NAME","build","xcodeVersion","getAndCheckXcodeVersion","iosVersion","getAndCheckIosSdkVersion","deviceName","translateDeviceName","device","getExistingSim","platformVersion","wda","WebDriverAgent","iosSdkVersion","showXcodeLog","xcodebuild","start","require","main","module","asyncify"],"sources":["../../lib/build-wda.js"],"sourcesContent":["import { WebDriverAgent } from 'appium-webdriveragent';\nimport { translateDeviceName, getAndCheckXcodeVersion, getAndCheckIosSdkVersion } from './utils';\nimport { getExistingSim } from './simulator-management';\nimport { asyncify } from 'asyncbox';\n\nconst DEFAULT_SIM_NAME = 'iPhone 12';\n\n// TODO: allow passing in all the various build params as CLI args\nasync function build () {\n const xcodeVersion = await getAndCheckXcodeVersion();\n const iosVersion = await getAndCheckIosSdkVersion();\n const deviceName = translateDeviceName(iosVersion, DEFAULT_SIM_NAME);\n const device = await getExistingSim({\n platformVersion: iosVersion,\n deviceName\n });\n const wda = new WebDriverAgent(xcodeVersion, {\n iosSdkVersion: iosVersion,\n platformVersion: iosVersion,\n showXcodeLog: true,\n device,\n });\n await wda.xcodebuild.start(true);\n}\n\nif (require.main === module) {\n asyncify(build);\n}\n\nexport default build;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,MAAMA,gBAAgB,GAAG,WAAzB;;AAGA,eAAeC,KAAf,GAAwB;EACtB,MAAMC,YAAY,GAAG,MAAM,IAAAC,8BAAA,GAA3B;EACA,MAAMC,UAAU,GAAG,MAAM,IAAAC,+BAAA,GAAzB;EACA,MAAMC,UAAU,GAAG,IAAAC,0BAAA,EAAoBH,UAApB,EAAgCJ,gBAAhC,CAAnB;EACA,MAAMQ,MAAM,GAAG,MAAM,IAAAC,mCAAA,EAAe;IAClCC,eAAe,EAAEN,UADiB;IAElCE;EAFkC,CAAf,CAArB;EAIA,MAAMK,GAAG,GAAG,IAAIC,oCAAJ,CAAmBV,YAAnB,EAAiC;IAC3CW,aAAa,EAAET,UAD4B;IAE3CM,eAAe,EAAEN,UAF0B;IAG3CU,YAAY,EAAE,IAH6B;IAI3CN;EAJ2C,CAAjC,CAAZ;EAMA,MAAMG,GAAG,CAACI,UAAJ,CAAeC,KAAf,CAAqB,IAArB,CAAN;AACD;;AAED,IAAIC,OAAO,CAACC,IAAR,KAAiBC,MAArB,EAA6B;EAC3B,IAAAC,kBAAA,EAASnB,KAAT;AACD;;eAEcA,K"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cert-utils.js","names":["doesSupportKeychainApi","_","memoize","device","simctl","exec","args","e","installCertificate","payload","addRootCertificate","raw","hasCertificateLegacy","hasSSLCert","udid","installCertificateLegacy","installSSLCert"],"sources":["../../lib/cert-utils.js"],"sourcesContent":["import _ from 'lodash';\nimport { installSSLCert, hasSSLCert } from 'appium-ios-simulator';\n\n/**\n * Check whether the given Simulator device supports simctl keychain API.\n *\n * @param {object} device Simulator instance created by appium-ios-simulator module\n * @returns {boolean} `true` if the current Simulator SDK supports keychain commands.\n */\nconst doesSupportKeychainApi = _.memoize(async function doesSupportKeychainApi (device) {\n try {\n await device.simctl.exec('help', {\n args: ['keychain']\n });\n return true;\n } catch (e) {\n return false;\n }\n});\n\n/**\n * Adds a certificate to the trusted root store.\n * Simulator must be in BOOTED state for this API to work.\n *\n * @param {object} device Simulator instance created by appium-ios-simulator module\n * @param {string} payload Certificate payload\n */\nasync function installCertificate (device, payload) {\n await device.simctl.addRootCertificate(payload, {raw: true});\n}\n\n/**\n * Check whether the given certificate is already installed.\n * The function is using hacky calls to make certificate stuff working for older SDKs.\n * Simulator must be in SHUTDOWN state for this API to work.\n *\n * @param {object} device Simulator instance created by appium-ios-simulator module\n * @param {string} payload Certificate payload\n * @returns {boolean} `true` if the certificate is already present in the root store.\n */\nasync function hasCertificateLegacy (device, payload) {\n return await hasSSLCert(payload, device.udid);\n}\n\n/**\n * Adds a certificate to the trusted root store.\n * The function is using hacky calls to make certificate stuff working for older SDKs.\n * Simulator must be in SHUTDOWN state for this API to work.\n *\n * @param {object} device Simulator instance created by appium-ios-simulator module\n * @param {string} payload Certificate payload\n */\nasync function installCertificateLegacy (device, payload) {\n await installSSLCert(payload, device.udid);\n}\n\n\nexport {\n doesSupportKeychainApi, installCertificate, installCertificateLegacy,\n hasCertificateLegacy\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;;AACA;;AAQA,MAAMA,sBAAsB,GAAGC,eAAA,CAAEC,OAAF,CAAU,eAAeF,sBAAf,CAAuCG,MAAvC,EAA+C;EACtF,IAAI;IACF,MAAMA,MAAM,CAACC,MAAP,CAAcC,IAAd,CAAmB,MAAnB,EAA2B;MAC/BC,IAAI,EAAE,CAAC,UAAD;IADyB,CAA3B,CAAN;IAGA,OAAO,IAAP;EACD,CALD,CAKE,OAAOC,CAAP,EAAU;IACV,OAAO,KAAP;EACD;AACF,CAT8B,CAA/B;;;;AAkBA,eAAeC,kBAAf,CAAmCL,MAAnC,EAA2CM,OAA3C,EAAoD;EAClD,MAAMN,MAAM,CAACC,MAAP,CAAcM,kBAAd,CAAiCD,OAAjC,EAA0C;IAACE,GAAG,EAAE;EAAN,CAA1C,CAAN;AACD;;AAWD,eAAeC,oBAAf,CAAqCT,MAArC,EAA6CM,OAA7C,EAAsD;EACpD,OAAO,MAAM,IAAAI,8BAAA,EAAWJ,OAAX,EAAoBN,MAAM,CAACW,IAA3B,CAAb;AACD;;AAUD,eAAeC,wBAAf,CAAyCZ,MAAzC,EAAiDM,OAAjD,EAA0D;EACxD,MAAM,IAAAO,kCAAA,EAAeP,OAAf,EAAwBN,MAAM,CAACW,IAA/B,CAAN;AACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activeAppInfo.js","names":["extensions","commands","mobileGetActiveAppInfo","proxyCommand","Object","assign"],"sources":["../../../lib/commands/activeAppInfo.js"],"sourcesContent":["const extensions = {}, commands = {};\n\n/**\n * Returns ActiveApp info.\n *\n * @returns {Object} The response of `/wda/activeAppInfo'`\n * @throws {Error} if an error raised by command\n */\ncommands.mobileGetActiveAppInfo = async function mobileGetActiveAppInfo () {\n return await this.proxyCommand('/wda/activeAppInfo', 'GET');\n};\n\nObject.assign(extensions, commands);\nexport { commands };\nexport default extensions;\n"],"mappings":";;;;;;;;;AAAA,MAAMA,UAAU,GAAG,EAAnB;AAAA,MAAuBC,QAAQ,GAAG,EAAlC;;;AAQAA,QAAQ,CAACC,sBAAT,GAAkC,eAAeA,sBAAf,GAAyC;EACzE,OAAO,MAAM,KAAKC,YAAL,CAAkB,oBAAlB,EAAwC,KAAxC,CAAb;AACD,CAFD;;AAIAC,MAAM,CAACC,MAAP,CAAcL,UAAd,EAA0BC,QAA1B;eAEeD,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.js","names":["commands","toAlertParams","opts","params","buttonLabel","name","getAlertText","proxyCommand","setAlertText","value","postAcceptAlert","postDismissAlert","getAlertButtons","mobileHandleAlert","action","Error"],"sources":["../../../lib/commands/alert.js"],"sourcesContent":["const commands = {};\n\nfunction toAlertParams (opts = {}) {\n const params = {};\n if (opts.buttonLabel) {\n params.name = opts.buttonLabel;\n }\n return params;\n}\n\ncommands.getAlertText = async function getAlertText () {\n return await this.proxyCommand('/alert/text', 'GET');\n};\n\ncommands.setAlertText = async function setAlertText (value) {\n return await this.proxyCommand('/alert/text', 'POST', {value});\n};\n\ncommands.postAcceptAlert = async function postAcceptAlert (opts = {}) {\n return await this.proxyCommand('/alert/accept', 'POST', toAlertParams(opts));\n};\n\ncommands.postDismissAlert = async function postDismissAlert (opts = {}) {\n return await this.proxyCommand('/alert/dismiss', 'POST', toAlertParams(opts));\n};\n\ncommands.getAlertButtons = async function getAlertButtons () {\n return await this.proxyCommand('/wda/alert/buttons', 'GET');\n};\n\ncommands.mobileHandleAlert = async function mobileHandleAlert (opts = {}) {\n switch (opts.action) {\n case 'accept':\n return await this.postAcceptAlert(opts);\n case 'dismiss':\n return await this.postDismissAlert(opts);\n case 'getButtons':\n return await this.getAlertButtons();\n default:\n throw new Error(`The 'action' value should be either 'accept', 'dismiss' or 'getButtons'. ` +\n `'${opts.action}' is provided instead.`);\n }\n};\n\nexport { commands };\nexport default commands;\n"],"mappings":";;;;;;;;;AAAA,MAAMA,QAAQ,GAAG,EAAjB;;;AAEA,SAASC,aAAT,CAAwBC,IAAI,GAAG,EAA/B,EAAmC;EACjC,MAAMC,MAAM,GAAG,EAAf;;EACA,IAAID,IAAI,CAACE,WAAT,EAAsB;IACpBD,MAAM,CAACE,IAAP,GAAcH,IAAI,CAACE,WAAnB;EACD;;EACD,OAAOD,MAAP;AACD;;AAEDH,QAAQ,CAACM,YAAT,GAAwB,eAAeA,YAAf,GAA+B;EACrD,OAAO,MAAM,KAAKC,YAAL,CAAkB,aAAlB,EAAiC,KAAjC,CAAb;AACD,CAFD;;AAIAP,QAAQ,CAACQ,YAAT,GAAwB,eAAeA,YAAf,CAA6BC,KAA7B,EAAoC;EAC1D,OAAO,MAAM,KAAKF,YAAL,CAAkB,aAAlB,EAAiC,MAAjC,EAAyC;IAACE;EAAD,CAAzC,CAAb;AACD,CAFD;;AAIAT,QAAQ,CAACU,eAAT,GAA2B,eAAeA,eAAf,CAAgCR,IAAI,GAAG,EAAvC,EAA2C;EACpE,OAAO,MAAM,KAAKK,YAAL,CAAkB,eAAlB,EAAmC,MAAnC,EAA2CN,aAAa,CAACC,IAAD,CAAxD,CAAb;AACD,CAFD;;AAIAF,QAAQ,CAACW,gBAAT,GAA4B,eAAeA,gBAAf,CAAiCT,IAAI,GAAG,EAAxC,EAA4C;EACtE,OAAO,MAAM,KAAKK,YAAL,CAAkB,gBAAlB,EAAoC,MAApC,EAA4CN,aAAa,CAACC,IAAD,CAAzD,CAAb;AACD,CAFD;;AAIAF,QAAQ,CAACY,eAAT,GAA2B,eAAeA,eAAf,GAAkC;EAC3D,OAAO,MAAM,KAAKL,YAAL,CAAkB,oBAAlB,EAAwC,KAAxC,CAAb;AACD,CAFD;;AAIAP,QAAQ,CAACa,iBAAT,GAA6B,eAAeA,iBAAf,CAAkCX,IAAI,GAAG,EAAzC,EAA6C;EACxE,QAAQA,IAAI,CAACY,MAAb;IACE,KAAK,QAAL;MACE,OAAO,MAAM,KAAKJ,eAAL,CAAqBR,IAArB,CAAb;;IACF,KAAK,SAAL;MACE,OAAO,MAAM,KAAKS,gBAAL,CAAsBT,IAAtB,CAAb;;IACF,KAAK,YAAL;MACE,OAAO,MAAM,KAAKU,eAAL,EAAb;;IACF;MACE,MAAM,IAAIG,KAAJ,CAAW,2EAAD,GACC,IAAGb,IAAI,CAACY,MAAO,wBAD1B,CAAN;EARJ;AAWD,CAZD;;eAeed,Q"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-management.js","names":["commands","requireOptions","opts","reqKeys","key","_","isString","isEmpty","errors","InvalidArgumentError","mobileInstallApp","app","timeoutMs","strategy","srcAppPath","helpers","configureApp","log","info","isRealDevice","device","udid","fs","exists","errorAndThrow","installApp","appPushTimeout","appInstallStrategy","mobileIsAppInstalled","bundleId","installed","isAppInstalled","mobileRemoveApp","removeApp","err","warn","message","mobileLaunchApp","launchOptions","arguments","isArray","environment","proxyCommand","mobileTerminateApp","mobileActivateApp","mobileKillApp","UnsupportedOperationError","terminateApp","mobileQueryAppState","appPath","isPlainObject","activateApp","Object","assign","queryAppState","mobileListApps","NotImplementedError","applicationType","service","services","startInstallationProxyService","listApplications","close"],"sources":["../../../lib/commands/app-management.js"],"sourcesContent":["import _ from 'lodash';\nimport { fs } from 'appium/support';\nimport { errors } from 'appium/driver';\nimport { services } from 'appium-ios-device';\n\nconst commands = {};\n\nfunction requireOptions (opts = {}, reqKeys = []) {\n for (const key of reqKeys) {\n if (!_.isString(opts[key]) || _.isEmpty(opts[key])) {\n throw new errors.InvalidArgumentError(\n `'${key}' is expected to be a valid string. '${opts[key]}' is given instead`\n );\n }\n }\n return opts;\n}\n\ncommands.mobileInstallApp = async function mobileInstallApp (opts = {}) {\n const { app, timeoutMs, strategy } = requireOptions(opts, ['app']);\n const srcAppPath = await this.helpers.configureApp(app, '.app');\n this.log.info(`Installing '${srcAppPath}' to the ${this.isRealDevice() ? 'real device' : 'Simulator'} ` +\n `with UDID '${this.opts.device.udid}'`);\n if (!await fs.exists(srcAppPath)) {\n this.log.errorAndThrow(`The application at '${srcAppPath}' does not exist or is not accessible`);\n }\n await this.opts.device.installApp(\n srcAppPath, timeoutMs ?? this.opts.appPushTimeout, strategy ?? this.opts.appInstallStrategy\n );\n this.log.info(`Installation of '${srcAppPath}' succeeded`);\n};\n\ncommands.mobileIsAppInstalled = async function mobileIsAppInstalled (opts = {}) {\n const {bundleId} = requireOptions(opts, ['bundleId']);\n const installed = await this.opts.device.isAppInstalled(bundleId);\n this.log.info(`App '${bundleId}' is${installed ? '' : ' not'} installed`);\n return installed;\n};\n\ncommands.mobileRemoveApp = async function mobileRemoveApp (opts = {}) {\n const {bundleId} = requireOptions(opts, ['bundleId']);\n this.log.info(`Uninstalling the application with bundle identifier '${bundleId}' ` +\n `from the ${this.isRealDevice() ? 'real device' : 'Simulator'} with UDID '${this.opts.device.udid}'`);\n try {\n await this.opts.device.removeApp(bundleId);\n this.log.info(`Removal of '${bundleId}' succeeded`);\n return true;\n } catch (err) {\n this.log.warn(`Cannot remove '${bundleId}'. Original error: ${err.message}`);\n return false;\n }\n};\n\ncommands.mobileLaunchApp = async function mobileLaunchApp (opts = {}) {\n const launchOptions = requireOptions(opts, ['bundleId']);\n if (opts.arguments) {\n launchOptions.arguments = _.isArray(opts.arguments) ? opts.arguments : [opts.arguments];\n }\n if (opts.environment) {\n launchOptions.environment = opts.environment;\n }\n return await this.proxyCommand('/wda/apps/launch', 'POST', launchOptions);\n};\n\ncommands.mobileTerminateApp = async function mobileTerminateApp (opts = {}) {\n return await this.proxyCommand('/wda/apps/terminate', 'POST', requireOptions(opts, ['bundleId']));\n};\n\ncommands.mobileActivateApp = async function mobileActivateApp (opts = {}) {\n return await this.proxyCommand('/wda/apps/activate', 'POST', requireOptions(opts, ['bundleId']));\n};\n\n/**\n * Kill the given bundle id process via instruments service.\n * https://github.com/YueChen-C/py-ios-device/blob/51f4683c5c3c385a015858ada07a5f1c62d3cf57/ios_device/cli/base.py#L220\n *\n * @param {Object} opts - Options set, which must contain `bundleId` property\n * @returns {boolean} Returns true if the bundle id process was killed. Otherwise false.\n */\ncommands.mobileKillApp = async function mobileKillApp (opts = {}) {\n if (!this.isRealDevice()) {\n throw new errors.UnsupportedOperationError('A real device is required');\n }\n\n const {bundleId} = requireOptions(opts, ['bundleId']);\n return await this.opts.device.terminateApp(bundleId);\n};\n\n/**\n * Returns the current application state\n *\n * @param {Object} opts - Options set, which must contain `bundleId` property\n * @returns {number} The actual application state code. See\n * https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc\n * to get the list of possible values.\n */\ncommands.mobileQueryAppState = async function mobileQueryAppState (opts = {}) {\n return await this.proxyCommand('/wda/apps/state', 'POST', requireOptions(opts, ['bundleId']));\n};\n\ncommands.installApp = async function installApp (appPath, opts = {}) {\n await this.mobileInstallApp({\n ...(_.isPlainObject(opts) ? opts : {}),\n app: appPath,\n });\n};\n\ncommands.activateApp = async function activateApp (bundleId, opts = {}) {\n return await this.mobileLaunchApp(Object.assign({}, opts, {bundleId}));\n};\n\ncommands.isAppInstalled = async function isAppInstalled (bundleId) {\n return await this.mobileIsAppInstalled({bundleId});\n};\n\ncommands.terminateApp = async function terminateApp (bundleId) {\n return await this.mobileTerminateApp({bundleId});\n};\n\ncommands.queryAppState = async function queryAppState (bundleId) {\n return await this.mobileQueryAppState({bundleId});\n};\n\n/**\n * @typedef {Object} ListAppsOptions\n * @property {'System'|'User'} applicationType [User] The type of applications to list\n */\n\n/**\n * List applications installed on the real device under test\n *\n * @param {ListAppsOptions} opts\n * @returns {Array<Object>} A list of apps, where each item is a map where keys are\n * bundle identifiers and values are maps of platform-specific app properties.\n */\ncommands.mobileListApps = async function mobileListApps (opts = {}) {\n if (!this.isRealDevice()) {\n throw new errors.NotImplementedError(`This extension is only supported on real devices`);\n }\n\n const {\n applicationType = 'User',\n } = opts;\n const service = await services.startInstallationProxyService(this.opts.device.udid);\n try {\n return await service.listApplications({applicationType});\n } finally {\n service.close();\n }\n};\n\nexport default commands;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,MAAMA,QAAQ,GAAG,EAAjB;;AAEA,SAASC,cAAT,CAAyBC,IAAI,GAAG,EAAhC,EAAoCC,OAAO,GAAG,EAA9C,EAAkD;EAChD,KAAK,MAAMC,GAAX,IAAkBD,OAAlB,EAA2B;IACzB,IAAI,CAACE,eAAA,CAAEC,QAAF,CAAWJ,IAAI,CAACE,GAAD,CAAf,CAAD,IAA0BC,eAAA,CAAEE,OAAF,CAAUL,IAAI,CAACE,GAAD,CAAd,CAA9B,EAAoD;MAClD,MAAM,IAAII,cAAA,CAAOC,oBAAX,CACH,IAAGL,GAAI,wCAAuCF,IAAI,CAACE,GAAD,CAAM,oBADrD,CAAN;IAGD;EACF;;EACD,OAAOF,IAAP;AACD;;AAEDF,QAAQ,CAACU,gBAAT,GAA4B,eAAeA,gBAAf,CAAiCR,IAAI,GAAG,EAAxC,EAA4C;EACtE,MAAM;IAAES,GAAF;IAAOC,SAAP;IAAkBC;EAAlB,IAA+BZ,cAAc,CAACC,IAAD,EAAO,CAAC,KAAD,CAAP,CAAnD;EACA,MAAMY,UAAU,GAAG,MAAM,KA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AAKmC,eAAL,CAAqBe,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBnD,IAAlB,EAAwB;IAAC2B;EAAD,CAAxB,CAArB,CAAb;AACD,CAFD;;AAIA7B,QAAQ,CAAC+B,cAAT,GAA0B,eAAeA,cAAf,CAA+BF,QAA/B,EAAyC;EACjE,OAAO,MAAM,KAAKD,oBAAL,CAA0B;IAACC;EAAD,CAA1B,CAAb;AACD,CAFD;;AAIA7B,QAAQ,CAAC+C,YAAT,GAAwB,eAAeA,YAAf,CAA6BlB,QAA7B,EAAuC;EAC7D,OAAO,MAAM,KAAKc,kBAAL,CAAwB;IAACd;EAAD,CAAxB,CAAb;AACD,CAFD;;AAIA7B,QAAQ,CAACsD,aAAT,GAAyB,eAAeA,aAAf,CAA8BzB,QAA9B,EAAwC;EAC/D,OAAO,MAAM,KAAKmB,mBAAL,CAAyB;IAACnB;EAAD,CAAzB,CAAb;AACD,CAFD;;AAgBA7B,QAAQ,CAACuD,cAAT,GAA0B,eAAeA,cAAf,CAA+BrD,IAAI,GAAG,EAAtC,EAA0C;EAClE,IAAI,CAAC,KAAKiB,YAAL,EAAL,EAA0B;IACxB,MAAM,IAAIX,cAAA,CAAOgD,mBAAX,CAAgC,kDAAhC,CAAN;EACD;;EAED,MAAM;IACJC,eAAe,GAAG;EADd,IAEFvD,IAFJ;EAGA,MAAMwD,OAAO,GAAG,MAAMC,yBAAA,CAASC,6BAAT,CAAuC,KAAK1D,IAAL,CAAUkB,MAAV,CAAiBC,IAAxD,CAAtB;;EACA,IAAI;IACF,OAAO,MAAMqC,OAAO,CAACG,gBAAR,CAAyB;MAACJ;IAAD,CAAzB,CAAb;EACD,CAFD,SAEU;IACRC,OAAO,CAACI,KAAR;EACD;AACF,CAdD;;eAgBe9D,Q"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appearance.js","names":["commands","mobileSetAppearance","opts","style","includes","_","toLower","Error","util","compareVersions","platformVersion","isSimulator","device","setAppearance","e","log","debug","stack","proxyCommand","name","mobileSiriCommand","text","mobileGetAppearance","getAppearance","ign","userInterfaceStyle"],"sources":["../../../lib/commands/appearance.js"],"sourcesContent":["import _ from 'lodash';\nimport { util } from 'appium/support';\n\n\nconst commands = {};\n\n/**\n * @typedef {Object} SetAppearanceOptions\n *\n * @property {string} style - Currently two styles are supported:\n * - dark\n * - light\n */\n\n/**\n * Set the device's UI appearance style\n *\n * @since iOS 12.0\n * @param {SetAppearanceOptions} opts\n * @throws {Error} if the current platform does not support UI\n * appearance changes\n */\ncommands.mobileSetAppearance = async function mobileSetAppearance (opts = {}) {\n const {\n style,\n } = opts;\n if (!['light', 'dark'].includes(_.toLower(style))) {\n throw new Error(`The 'style' value is expected to equal either 'light' or 'dark'`);\n }\n if (util.compareVersions(this.opts.platformVersion, '<', '12.0')) {\n throw new Error('Changing appearance is only supported since iOS 12');\n }\n\n if (this.isSimulator()) {\n try {\n return void (await this.opts.device.setAppearance(style));\n } catch (e) {\n this.log.debug(e.stack);\n }\n }\n try {\n return void (await this.proxyCommand('/wda/device/appearance', 'POST', {name: style}));\n } catch (e) {\n this.log.debug(e.stack);\n }\n // Fall back to the ugly Siri workaround if the current SDK is too old\n await this.mobileSiriCommand({\n text: `Turn ${_.toLower(style) === 'dark' ? 'on' : 'off'} dark mode`,\n });\n};\n\n/**\n * @typedef {Object} Appearance\n * @property {string} style - The device's UI appearance value.\n * This could be one of:\n * - `light`\n * - `dark`\n * - `unknown`\n * - `unsupported`\n */\n\n/**\n * Get the device's UI appearance style.\n *\n * @since Xcode SDK 11\n * @returns {Appearance}\n */\ncommands.mobileGetAppearance = async function mobileGetAppearance () {\n if (util.compareVersions(this.opts.platformVersion, '<', '12.0')) {\n return 'unsupported';\n }\n\n let style;\n if (this.isSimulator()) {\n try {\n style = await this.opts.device.getAppearance();\n } catch (ign) {}\n }\n if (!style) {\n style = (await this.proxyCommand('/wda/device/info', 'GET')).userInterfaceStyle || 'unknown';\n }\n return {\n style,\n };\n};\n\n\nexport { commands };\nexport default comm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AsC;EACnE,IAAId,aAAA,CAAKC,eAAL,CAAqB,KAAKP,IAAL,CAAUQ,eAA/B,EAAgD,GAAhD,EAAqD,MAArD,CAAJ,EAAkE;IAChE,OAAO,aAAP;EACD;;EAED,IAAIP,KAAJ;;EACA,IAAI,KAAKQ,WAAL,EAAJ,EAAwB;IACtB,IAAI;MACFR,KAAK,GAAG,MAAM,KAAKD,IAAL,CAAUU,MAAV,CAAiBW,aAAjB,EAAd;IACD,CAFD,CAEE,OAAOC,GAAP,EAAY,CAAE;EACjB;;EACD,IAAI,CAACrB,KAAL,EAAY;IACVA,KAAK,GAAG,CAAC,MAAM,KAAKe,YAAL,CAAkB,kBAAlB,EAAsC,KAAtC,CAAP,EAAqDO,kBAArD,IAA2E,SAAnF;EACD;;EACD,OAAO;IACLtB;EADK,CAAP;AAGD,CAjBD;;eAqBeH,Q"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"battery.js","names":["extensions","commands","mobileGetBatteryInfo","proxyCommand","Object","assign"],"sources":["../../../lib/commands/battery.js"],"sourcesContent":["let extensions = {}, commands = {};\n\n/**\n * @typedef {Object} BatteryInfo\n *\n * @property {number} level - Battery level in range [0.0, 1.0], where\n * 1.0 means 100% charge.\n * @property {number} state - Battery state. The following values are possible:\n * UIDeviceBatteryStateUnknown = 0\n * UIDeviceBatteryStateUnplugged = 1 // on battery, discharging\n * UIDeviceBatteryStateCharging = 2 // plugged in, less than 100%\n * UIDeviceBatteryStateFull = 3 // plugged in, at 100%\n */\n\n/**\n * Reads the battery information from the device under test.\n * This endpoint only returns reliable result on real devices.\n *\n * @returns {BatteryInfo} The actual battery info\n */\ncommands.mobileGetBatteryInfo = async function mobileGetBatteryInfo () {\n return await this.proxyCommand('/wda/batteryInfo', 'GET');\n};\n\nObject.assign(extensions, commands);\nexport { commands };\nexport default extensions;\n"],"mappings":";;;;;;;;;AAAA,IAAIA,UAAU,GAAG,EAAjB;AAAA,IAAqBC,QAAQ,GAAG,EAAhC;;;AAoBAA,QAAQ,CAACC,oBAAT,GAAgC,eAAeA,oBAAf,GAAuC;EACrE,OAAO,MAAM,KAAKC,YAAL,CAAkB,kBAAlB,EAAsC,KAAtC,CAAb;AACD,CAFD;;AAIAC,MAAM,CAACC,MAAP,CAAcL,UAAd,EAA0BC,QAA1B;eAEeD,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biometric.js","names":["commands","helpers","extensions","assertIsSimulator","driver","isSimulator","Error","mobileEnrollBiometric","opts","isEnabled","device","enrollBiometric","mobileSendBiometricMatch","match","type","sendBiometricMatch","mobileIsBiometricEnrolled","isBiometricEnrolled","Object","assign"],"sources":["../../../lib/commands/biometric.js"],"sourcesContent":["let commands = {}, helpers = {}, extensions = {};\n\nfunction assertIsSimulator (driver) {\n if (!driver.isSimulator()) {\n throw new Error('Biometric enrollment can only be performed on Simulator');\n }\n}\n\n/**\n * @typedef {Object} EnrollOptions\n *\n * @property {?boolean} isEnabled [true] - Whether to enable/disable biometric enrollment.\n */\n\n/**\n * Enrolls biometric authentication on Simulator.\n *\n * @param {EnrollOptions} opts - Enrollment options.\n * @throws {Error} If enrollment fails or the device is not a Simulator.\n */\ncommands.mobileEnrollBiometric = async function mobileEnrollBiometric (opts = {}) {\n const {\n isEnabled = true,\n } = opts;\n\n assertIsSimulator(this);\n\n await this.opts.device.enrollBiometric(isEnabled);\n};\n\n/**\n * @typedef {Object} BiometricMatchOptions\n *\n * @property {?string} type [touchId] - The biometric feature name.\n * @property {?boolean} match [true] - Whether to simulate biometric match or non-match.\n */\n\n/**\n * Emulates biometric match/non-match event on Simulator.\n * The biometric feature is expected to be already enrolled before executing that.\n *\n * @param {BiometricMatchOptions} opts - Matching options.\n * @throws {Error} If matching fails or the device is not a Simulator.\n */\ncommands.mobileSendBiometricMatch = async function mobileSendBiometricMatch (opts = {}) {\n const {\n match = true,\n type = 'touchId',\n } = opts;\n\n assertIsSimulator(this);\n\n await this.opts.device.sendBiometricMatch(match, type);\n};\n\n/**\n * Checks whether biometric is currently enrolled or not.\n *\n * @return {boolean} True if biometric is enrolled.\n * @throws {Error} If the detection fails or the device is not a Simulator.\n */\ncommands.mobileIsBiometricEnrolled = async function mobileIsBiometricEnrolled () {\n assertIsSimulator(this);\n\n return await this.opts.device.isBiometricEnrolled();\n};\n\nObject.assign(extensions, commands, helpers);\nexport { commands, helpers };\nexport default extensions;\n"],"mappings":";;;;;;;;;AAAA,IAAIA,QAAQ,GAAG,EAAf;AAAA,IAAmBC,OAAO,GAAG,EAA7B;AAAA,IAAiCC,UAAU,GAAG,EAA9C;;;;AAEA,SAASC,iBAAT,CAA4BC,MAA5B,EAAoC;EAClC,IAAI,CAACA,MAAM,CAACC,WAAP,EAAL,EAA2B;IACzB,MAAM,IAAIC,KAAJ,CAAU,yDAAV,CAAN;EACD;AACF;;AAcDN,QAAQ,CAACO,qBAAT,GAAiC,eAAeA,qBAAf,CAAsCC,IAAI,GAAG,EAA7C,EAAiD;EAChF,MAAM;IACJC,SAAS,GAAG;EADR,IAEFD,IAFJ;EAIAL,iBAAiB,CAAC,IAAD,CAAjB;EAEA,MAAM,KAAKK,IAAL,CAAUE,MAAV,CAAiBC,eAAjB,CAAiCF,SAAjC,CAAN;AACD,CARD;;AAwBAT,QAAQ,CAACY,wBAAT,GAAoC,eAAeA,wBAAf,CAAyCJ,IAAI,GAAG,EAAhD,EAAoD;EACtF,MAAM;IACJK,KAAK,GAAG,IADJ;IAEJC,IAAI,GAAG;EAFH,IAGFN,IAHJ;EAKAL,iBAAiB,CAAC,IAAD,CAAjB;EAEA,MAAM,KAAKK,IAAL,CAAUE,MAAV,CAAiBK,kBAAjB,CAAoCF,KAApC,EAA2CC,IAA3C,CAAN;AACD,CATD;;AAiBAd,QAAQ,CAACgB,yBAAT,GAAqC,eAAeA,yBAAf,GAA4C;EAC/Eb,iBAAiB,CAAC,IAAD,CAAjB;EAEA,OAAO,MAAM,KAAKK,IAAL,CAAUE,MAAV,CAAiBO,mBAAjB,EAAb;AACD,CAJD;;AAMAC,MAAM,CAACC,MAAP,CAAcjB,UAAd,EAA0BF,QAA1B,EAAoCC,OAApC;eAEeC,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certificate.js","names":["extensions","commands","CONFIG_EXTENSION","HOST_PORT_RANGE","TMPSERVER_STARTUP_TIMEOUT","Settings","General","type","value","Profile","About","Certificate_Trust_Settings","Button","Install","Allow","Done","Return_to_Settings","Alert","extractCommonName","certBuffer","tempCert","tempDir","open","prefix","suffix","fs","writeFile","path","stdout","exec","parseCommonName","err","Error","message","rimraf","LIBRE_SSL_PATTERN","OPEN_SSL_PATTERN","stringCertificate","result","reduce","acc","r","match","toMobileConfig","commonName","getUUID","util","uuidV4","toUpperCase","contentUuid","PayloadContent","PayloadCertificateFileName","PayloadDescription","PayloadDisplayName","PayloadIdentifier","PayloadType","PayloadUUID","PayloadVersion","os","hostname","split","PayloadRemovalDisallowed","clickElement","driver","locator","options","element","timeout","skipIfInvisible","lookupDelay","retryInterval","findNativeElementOrElements","JSON","stringify","nativeClick","installPre122Certificate","B","delay","trustCertificateInPreferences","name","switchLocator","retry","mobileSwipe","direction","postAcceptAlert","installPost122Certificate","activateApp","isCertFound","swipeNum","mobileInstallCertificate","opts","content","isRoot","_","isEmpty","isSimulator","methodName","device","simctl","Buffer","from","toString","raw","e","log","debug","info","client","Pyidevice","udid","assertExists","installProfile","payload","tmpRoot","openDir","tmpPort","findAPortNotInUse","configName","configPath","resolve","tmpServer","http","createServer","res","configFile","readFile","end","cn","mobileConfig","plist","updatePlistFile","host","certUrl","listen","waitForCondition","checkPortStatus","ign","waitMs","intervalMs","isRealDevice","proxyCommand","url","isWebContext","setUrl","openUrl","isCertAlreadyInstalled","compareVersions","platformVersion","bundleId","warn","toInMemoryBase64","close","mobileListCertificates","errors","NotImplementedError","listProfiles","Object","assign"],"sources":["../../../lib/commands/certificate.js"],"sourcesContent":["import _ from 'lodash';\nimport { fs, plist, tempDir, util } from 'appium/support';\nimport { retryInterval, retry, waitForCondition } from 'asyncbox';\nimport B from 'bluebird';\nimport os from 'os';\nimport path from 'path';\nimport http from 'http';\nimport { exec } from 'teen_process';\nimport { findAPortNotInUse, checkPortStatus } from 'portscanner';\nimport Pyidevice from '../py-ios-device-client';\nimport { errors } from 'appium/driver';\n\nlet extensions = {}, commands = {};\n\nconst CONFIG_EXTENSION = 'mobileconfig';\nconst HOST_PORT_RANGE = [38200, 38299];\nconst TMPSERVER_STARTUP_TIMEOUT = 5000;\nconst Settings = {\n General: {\n type: 'accessibility id',\n value: 'General',\n },\n Profile: {\n type: '-ios predicate string',\n value: `name BEGINSWITH 'Profile'`,\n },\n About: {\n type: 'accessibility id',\n value: 'About',\n },\n Certificate_Trust_Settings: {\n type: 'accessibility id',\n value: 'Certificate Trust Settings',\n },\n};\nconst Button = {\n Install: {\n type: 'accessibility id',\n value: 'Install',\n },\n Allow: {\n type: 'accessibility id',\n value: 'Allow',\n },\n Done: {\n type: 'accessibility id',\n value: 'Done',\n },\n Return_to_Settings: {\n type: 'accessibility id',\n value: 'Return to Settings',\n },\n};\nconst Alert = {\n Install: {\n type: '-ios class chain',\n value: '**/XCUIElementTypeAny[`type == \\'XCUIElementTypeAlert\\' OR type == \\'XCUIElementTypeSheet\\'`]/**/XCUIElementTypeButton[`label == \\'Install\\'`]',\n },\n};\n\n\nasync function extractCommonName (certBuffer) {\n const tempCert = await tempDir.open({\n prefix: 'cert',\n suffix: '.cer'\n });\n try {\n await fs.writeFile(tempCert.path, certBuffer);\n const {stdout} = await exec('openssl', ['x509', '-noout', '-subject', '-in', tempCert.path]);\n return parseCommonName(stdout);\n } catch (err) {\n throw new Error(`Cannot parse common name value from the certificate. Is it valid and base64-encoded? ` +\n `Original error: ${err.message}`);\n } finally {\n await fs.rimraf(tempCert.path);\n }\n}\n\nconst LIBRE_SSL_PATTERN = /\\/CN=([^\\/]+)/; // eslint-disable-line no-useless-escape\nconst OPEN_SSL_PATTERN = /,\\sCN\\s=\\s([^,]+)/;\n\nfunction parseCommonName (stringCertificate) {\n const result = [LIBRE_SSL_PATTERN, OPEN_SSL_PATTERN].reduce((acc, r) => {\n if (acc) {\n return acc;\n }\n const match = r.exec(stringCertificate);\n return match && match[1];\n }, null);\n if (!result) {\n throw new Error(`There is no common name value in '${stringCertificate}' output`);\n }\n return result;\n}\n\n/**\n * Generates Apple's over-the-air configuration profile\n * for certificate deployment based on the given PEM certificate content.\n * Read https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/Introduction/Introduction.html\n * for more details on such profiles.\n *\n * @param {Buffer} certBuffer - The actual content of PEM certificate encoded into NodeJS buffer\n * @param {string} commonName - Certificate's common name\n * @returns {Object} The encoded structure of the given certificate, which is ready to be passed\n * as an argument to plist builder\n * @throws {Error} If the given certificate cannot be parsed\n */\nfunction toMobileConfig (certBuffer, commonName) {\n const getUUID = () => util.uuidV4().toUpperCase();\n const contentUuid = getUUID();\n return {\n PayloadContent: [{\n PayloadCertificateFileName: `${commonName}.cer`,\n PayloadContent: certBuffer,\n PayloadDescription: 'Adds a CA root certificate',\n PayloadDisplayName: commonName,\n PayloadIdentifier: `com.apple.security.root.${contentUuid}`,\n PayloadType: 'com.apple.security.root',\n PayloadUUID: contentUuid,\n PayloadVersion: 1\n }],\n PayloadDisplayName: commonName,\n PayloadIdentifier: `${os.hostname().split('.')[0]}.${getUUID()}`,\n PayloadRemovalDisallowed: false,\n PayloadType: 'Configuration',\n PayloadUUID: getUUID(),\n PayloadVersion: 1\n };\n}\n\nasync function clickElement (driver, locator, options = {}) {\n let element = null;\n const {\n timeout = 5000,\n skipIfInvisible = false\n } = options;\n const lookupDelay = 500;\n try {\n element = await retryInterval(timeout < lookupDelay ? 1 : timeout / lookupDelay, lookupDelay,\n () => driver.findNativeElementOrElements(locator.type, locator.value, false)\n );\n } catch (err) {\n if (skipIfInvisible) {\n return false;\n }\n throw new Error(`Cannot find ${JSON.stringify(locator)} within ${timeout}ms timeout`);\n }\n await driver.nativeClick(element);\n return true;\n}\n\nasync function installPre122Certificate (driver) {\n // Accept Safari alert\n await clickElement(driver, Button.Allow, {\n // certificate load might take some time on slow machines\n timeout: 15000,\n });\n // Wait until Preferences are opened\n await B.delay(2000);\n\n // Go through Preferences wizard\n if (!await clickElement(driver, Button.Install, {\n skipIfInvisible: true,\n })) {\n return false;\n }\n // We need to click Install button on two different tabs\n // The second one confirms the previous\n await B.delay(1500);\n await clickElement(driver, Button.Install);\n // Accept alert\n await clickElement(driver, Alert.Install);\n // Finish adding certificate\n await clickElement(driver, Button.Done);\n return true;\n}\n\nasync function trustCertificateInPreferences (driver, name) {\n await clickElement(driver, Settings.General);\n await clickElement(driver, Settings.About);\n const switchLocator = {\n type: '-ios class chain',\n value: `**/XCUIElementTypeCell[\\`label == '${name}'\\`]/**/XCUIElementTypeSwitch`,\n };\n await retry(5, async () => {\n await driver.mobileSwipe({\n element: await driver.findNativeElementOrElements('class name', 'XCUIElementTypeTable', false),\n direction: 'up'\n });\n await clickElement(driver, Settings.Certificate_Trust_Settings, {\n timeout: 500,\n });\n\n await driver.findNativeElementOrElements(switchLocator.type, switchLocator.value, false);\n });\n // Only click the switch if it is set to Off\n if (await clickElement(driver, {\n type: switchLocator.type,\n value: `${switchLocator.value}[\\`value == '0'\\`]`\n }, {\n timeout: 1000,\n skipIfInvisible: true,\n })) {\n await driver.postAcceptAlert();\n }\n}\n\nasync function installPost122Certificate (driver, name) {\n // Accept Safari alert\n await clickElement(driver, Button.Allow, {\n // certificate load might take some time on slow machines\n timeout: 15000,\n });\n // Wait for the second alert\n await B.delay(2000);\n\n await driver.postAcceptAlert();\n await driver.activateApp('com.apple.Preferences');\n await clickElement(driver, Settings.General);\n await clickElement(driver, Settings.Profile);\n // Select the target cert\n let isCertFound = false;\n for (let swipeNum = 0; swipeNum < 5; ++swipeNum) {\n if (await clickElement(driver, {\n type: '-ios class chain',\n value: `**/XCUIElementTypeCell[\\`label == '${name}'\\`]`,\n }, {\n timeout: 500,\n skipIfInvisible: true,\n })) {\n isCertFound = true;\n break;\n }\n\n await driver.mobileSwipe({\n element: await driver.findNativeElementOrElements('class name', 'XCUIElementTypeTable', false),\n direction: 'up'\n });\n }\n if (!isCertFound) {\n throw new Error(`'${name}' cannot be found in the certificates list`);\n }\n\n // Install option is only visible if the cert is not installed yet\n if (!await clickElement(driver, Button.Install, {\n skipIfInvisible: true,\n })) {\n return false;\n }\n await B.delay(1500);\n // Confirm untrusted cert install\n await clickElement(driver, Button.Install);\n // Accept alert\n await clickElement(driver, Alert.Install);\n // Finish adding certificate\n await clickElement(driver, Button.Done);\n\n return true;\n}\n\n/**\n * @typedef {Object} CertificateInstallationOptions\n *\n * @property {!string} content - Base64-encoded content of the public certificate\n * @property {?string} commonName - Common name of the certificate. If this is not set\n * then the script will try to parse it from the given certificate content.\n * @property {?boolean} isRoot [true] - This option defines where the certificate should be\n * installed to: either Trusted Root Store (`true`, the default option) or\n * the Keychain (`false`). On environments other than Xcode 11.4+ Simulator this\n * option is ignored.\n */\n\n/**\n * Installs a custom certificate onto the device.\n * Since Xcode SDK 11.4 Apple has added a dedicated simctl subcommand to quickly handle\n * certificates on Simulator over CLI.\n * On real devices or simulators before Xcode 11.4 SDK\n * Apple provides no official way to do it via the command line.\n * In such case (and also as a fallback if CLI setup fails)\n * this method tries to wrap the certificate into .mobileconfig format\n * and then deploys the wrapped file to the internal HTTP server,\n * so one can open it via mobile Safari.\n * Then the algorithm goes through the profile installation procedure by\n * clicking the necessary buttons using WebDriverAgent.\n *\n * @param {CertificateInstallationOptions} opts\n * @returns {?string} The content of the generated .mobileconfig file as\n * base64-encoded string. This config might be useful for debugging purposes.\n * If the certificate has been successfully set via CLI then nothing is returned.\n */\ncommands.mobileInstallCertificate = async function mobileInstallCertificate (opts = {}) {\n const {\n content,\n commonName,\n isRoot = true,\n } = opts;\n if (_.isEmpty(content)) {\n throw new Error('Certificate content should not be empty');\n }\n\n if (this.isSimulator()) {\n try {\n const methodName = isRoot ? 'addRootCertificate' : 'addCertificate';\n await this.opts.device.simctl[methodName](\n Buffer.from(content, 'base64').toString(), {raw: true}\n );\n return;\n } catch (e) {\n this.log.debug(e);\n this.log.info(`The certificate cannot be installed via CLI. ` +\n `Falling back to UI-based deployment`);\n }\n } else {\n const client = new Pyidevice(this.opts.udid);\n if (await client.assertExists(false)) {\n await client.installProfile({payload: Buffer.from(content, 'base64')});\n return;\n } else {\n this.log.info('pyidevice is not installed on your system. ' +\n 'Falling back to the (slow) UI-based installation');\n }\n }\n\n const tmpRoot = await tempDir.openDir();\n const tmpPort = await findAPortNotInUse(HOST_PORT_RANGE[0], HOST_PORT_RANGE[1]);\n const configName = `appium.${CONFIG_EXTENSION}`;\n const configPath = path.resolve(tmpRoot, configName);\n const tmpServer = http.createServer(async function (_, res) {\n const configFile = await fs.readFile(configPath);\n res.end(configFile);\n });\n try {\n const certBuffer = Buffer.from(content, 'base64');\n const cn = commonName || await extractCommonName(certBuffer);\n const mobileConfig = toMobileConfig(certBuffer, cn);\n try {\n await plist.updatePlistFile(configPath, mobileConfig, false, false);\n } catch (err) {\n throw new Error(`Cannot store the generated config as '${configPath}'. ` +\n `Original error: ${err.message}`);\n }\n\n try {\n const host = os.hostname();\n const certUrl = `http://${host}:${tmpPort}/${configName}`;\n await tmpServer.listen(tmpPort);\n try {\n await waitForCondition(async () => {\n try {\n return (await checkPortStatus(tmpPort, host)) === 'open';\n } catch (ign) {\n return false;\n }\n }, {\n waitMs: TMPSERVER_STARTUP_TIMEOUT,\n intervalMs: 300,\n });\n this.log.debug(`The temporary web server is running at http://${host}:${tmpPort}`);\n } catch (e) {\n throw new Error(`The temporary web server cannot be started at http://${host}:${tmpPort}.`);\n }\n if (this.isRealDevice()) {\n try {\n await this.proxyCommand('/url', 'POST', {url: certUrl});\n } catch (err) {\n if (this.isWebContext()) {\n // The command above does not always work on real devices\n await this.setUrl(certUrl);\n } else {\n throw err;\n }\n }\n } else {\n await this.opts.device.openUrl(certUrl);\n }\n\n let isCertAlreadyInstalled = false;\n if (util.compareVersions(this.opts.platformVersion, '>=', '12.2')) {\n if (await installPost122Certificate(this, cn)) {\n await clickElement(this, Settings.Profile);\n await trustCertificateInPreferences(this, cn);\n } else {\n isCertAlreadyInstalled = true;\n }\n } else {\n if (await installPre122Certificate(this)) {\n await clickElement(this, Button.Return_to_Settings);\n await trustCertificateInPreferences(this, cn);\n } else {\n isCertAlreadyInstalled = true;\n }\n }\n if (isCertAlreadyInstalled) {\n this.log.info(`It looks like the '${cn}' certificate has been already added to the CA root`);\n }\n } finally {\n if (this.opts.bundleId) {\n try {\n await this.activateApp(this.opts.bundleId);\n } catch (e) {\n this.log.warn(`Cannot restore the application '${this.opts.bundleId}'. Original error: ${e.message}`);\n }\n }\n }\n\n return (await util.toInMemoryBase64(configPath)).toString();\n } finally {\n await tmpServer.close();\n await fs.rimraf(tmpRoot);\n }\n};\n\n/**\n * Lists installed certificates for real devices only\n * if [py-ios-device](https://github.com/YueChen-C/py-ios-device) tool\n * is available on the server machine.\n *\n * @returns {Object} Returns map of certificates installed on the real device\n * @throws {Error} If attempting to list certificates for simulated device or if py-ios-device\n * is not installed\n */\ncommands.mobileListCertificates = async function mobileListCertificates () {\n if (!this.isRealDevice()) {\n throw new errors.NotImplementedError('This extension is only supported on real devices');\n }\n const client = new Pyidevice(this.opts.udid);\n if (await client.assertExists(false)) {\n return await client.listProfiles();\n }\n throw new Error('pyidevice is not installed on your system, command cannot be executed.');\n};\n\nObject.assign(extensions, commands);\nexport { commands, parseCommonName };\nexport default extensions;\n"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAIA,UAAU,GAAG,EAAjB;AAAA,IAAqBC,QAAQ,GAAG,EAAhC;;AAEA,MAAMC,gBAAgB,GAAG,cAAzB;AACA,MAAMC,eAAe,GAAG,CAAC,KAAD,EAAQ,KAAR,CAAxB;AACA,MAAMC,yBAAyB,GAAG,IAAlC;AACA,MAAMC,QAAQ,GAAG;EACfC,OAAO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,CAAC+B,KAAV,EAAN;IACA,MAAM9H,WAAA,CAAGS,MAAH,CAAU+E,OAAV,CAAN;EACD;AACF,CAxHD;;AAmIAhH,QAAQ,CAACuJ,sBAAT,GAAkC,eAAeA,sBAAf,GAAyC;EACzE,IAAI,CAAC,KAAKb,YAAL,EAAL,EAA0B;IACxB,MAAM,IAAIc,cAAA,CAAOC,mBAAX,CAA+B,kDAA/B,CAAN;EACD;;EACD,MAAM/C,MAAM,GAAG,IAAIC,0BAAJ,CAAc,KAAKlB,IAAL,CAAUmB,IAAxB,CAAf;;EACA,IAAI,MAAMF,MAAM,CAACG,YAAP,CAAoB,KAApB,CAAV,EAAsC;IACpC,OAAO,MAAMH,MAAM,CAACgD,YAAP,EAAb;EACD;;EACD,MAAM,IAAI3H,KAAJ,CAAU,wEAAV,CAAN;AACD,CATD;;AAWA4H,MAAM,CAACC,MAAP,CAAc7J,UAAd,EAA0BC,QAA1B;eAEeD,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","names":["extensions","commands","setClipboard","content","contentType","proxyCommand","getClipboard","Object","assign"],"sources":["../../../lib/commands/clipboard.js"],"sourcesContent":["let extensions = {}, commands = {};\n\n\n/**\n * Sets the primary clipboard's content on the device under test.\n *\n * @param {!string} content - The content to be set as base64 encoded string.\n * @param {?string} contentType [plaintext] - The type of the content to set.\n * Only `plaintext`, 'image and 'url' are supported.\n */\ncommands.setClipboard = async function setClipboard (content, contentType) {\n await this.proxyCommand('/wda/setPasteboard', 'POST', {\n content,\n contentType,\n });\n};\n\n/**\n * Gets the content of the primary clipboard on the device under test.\n *\n * @param {?string} contentType [plaintext] - The type of the content to get.\n * Only `plaintext`, 'image and 'url' are supported.\n * @returns {string} The actual clipboard content encoded into base64 string.\n * An empty string is returned if the clipboard contains no data.\n */\ncommands.getClipboard = async function getClipboard (contentType) {\n return await this.proxyCommand('/wda/getPasteboard', 'POST', {\n contentType,\n });\n};\n\n\nObject.assign(extensions, commands);\nexport { commands };\nexport default extensions;\n"],"mappings":";;;;;;;;;AAAA,IAAIA,UAAU,GAAG,EAAjB;AAAA,IAAqBC,QAAQ,GAAG,EAAhC;;;AAUAA,QAAQ,CAACC,YAAT,GAAwB,eAAeA,YAAf,CAA6BC,OAA7B,EAAsCC,WAAtC,EAAmD;EACzE,MAAM,KAAKC,YAAL,CAAkB,oBAAlB,EAAwC,MAAxC,EAAgD;IACpDF,OADoD;IAEpDC;EAFoD,CAAhD,CAAN;AAID,CALD;;AAeAH,QAAQ,CAACK,YAAT,GAAwB,eAAeA,YAAf,CAA6BF,WAA7B,EAA0C;EAChE,OAAO,MAAM,KAAKC,YAAL,CAAkB,oBAAlB,EAAwC,MAAxC,EAAgD;IAC3DD;EAD2D,CAAhD,CAAb;AAGD,CAJD;;AAOAG,MAAM,CAACC,MAAP,CAAcR,UAAd,EAA0BC,QAA1B;eAEeD,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition.js","names":["commands","requireConditionInducerCompatibleDevice","driver","isSimulator","log","errorAndThrow","util","compareVersions","opts","platformVersion","mobileListConditionInducers","listConditionInducers","conditionInducerService","services","startInstrumentService","device","udid","ret","callChannel","INSTRUMENT_CHANNEL","CONDITION_INDUCER","selector","close","mobileEnableConditionInducer","enableConditionInducer","options","_conditionInducerService","_socketClient","destroyed","conditionID","profileID","_","isBoolean","JSON","stringify","mobileDisableConditionInducer","disableConditionInducer","warn"],"sources":["../../../lib/commands/condition.js"],"sourcesContent":["import { INSTRUMENT_CHANNEL, services } from 'appium-ios-device';\nimport _ from 'lodash';\nimport { util } from 'appium/support';\n\nconst commands = {};\n\nfunction requireConditionInducerCompatibleDevice (driver) {\n if (driver.isSimulator()) {\n driver.log.errorAndThrow('Condition inducer only works on real devices');\n }\n if (util.compareVersions(driver.opts.platformVersion, '<', '13.0')) {\n driver.log.errorAndThrow('Condition inducer is only supported since iOS 13+');\n }\n }\n\n/**\n * @typedef {Object} Profile\n * @property {String} name\n * @property {String} identifier the property is profileID used in MobileEnableConditionInducer\n * @property {String} description Configuration details\n */\n\n/**\n * We can use the returned data to determine whether the Condition is enabled and the currently enabled configuration information\n * @typedef {Object} Condition\n * @property {Array<Profile>} profiles\n * @property {String} identifier the property is conditionID used in MobileEnableConditionInducer\n * @property {boolean} profilesSorted\n * @property {boolean} isDestructive\n * @property {boolean} isInternal\n * @property {boolean} isActive `true` if this condition identifier is enabled\n * @property {String} activeProfile enabled profiles identifier\n */\n\n/**\n * Get all ConditionInducer configuration information\n * We will use conditionID and profileID in the mobileEnableConditionInducer\n * @returns {Array<Condition>}\n * [{\n * \"profiles\": [\n * {\n * \"name\": \"100% packet loss\",\n * \"identifier\": \"SlowNetwork100PctLoss\", // MobileEnableConditionInducer profileID\n * \"description\": \"Name: 100% Loss Scenario\\n\n * Downlink Bandwidth: 0 Mbps\\n\n * Downlink Latency:0 ms\\n\n * Downlink Packet Loss Ratio: 100%\\n\n * Uplink Bandwidth: 0 Mbps\\n\n * Uplink Latency: 0 ms\\n\n * Uplink Packet Loss Ratio: 100%\"\n * }\n * ],\n * \"profilesSorted\": true,\n * \"identifier\": \"SlowNetworkCondition\", // MobileEnableConditionInducer conditionID\n * \"isDestructive\": false,\n * \"isInternal\": false,\n * \"activeProfile\": \"\",\n * \"name\": \"Network Link\",\n * \"isActive\": false\n * }]\n */\ncommands.mobileListConditionInducers = async function listConditionInducers () {\n requireConditionInducerCompatibleDevice(this);\n const conditionInducerService = await services.startInstrumentService(this.opts.device.udid);\n try {\n const ret = await conditionInducerService.callChannel(INSTRUMENT_CHANNEL.CONDITION_INDUCER, 'availableConditionInducers');\n return ret.selector;\n } finally {\n conditionInducerService.close();\n }\n};\n\n/**\n * Enable condition inducer. The socket needs to remain connected during operation\n * conditionID Condition[0].identifier\n * profileID Condition[0].profiles[0].identifier\n * @param {{conditionID,profileID}} options\n * @returns {boolean} `true` if enable the condition succeeded\n * @throws {Error} If try to start another Condition and the previous Condition has not stopped, it will throw an error\n */\ncommands.mobileEnableConditionInducer = async function enableConditionInducer (options = {}) {\n requireConditionInducerCompatibleDevice(this);\n if (this._conditionInducerService && !this._conditionInducerService._socketClient.destroyed) {\n this.log.errorAndThrow(`Condition inducer has been started. A condition is already active.`);\n }\n const {\n conditionID,\n profileID,\n } = options;\n this._conditionInducerService = await services.startInstrumentService(this.opts.device.udid);\n const ret = await this._conditionInducerService.callChannel(INSTRUMENT_CHANNEL.CONDITION_INDUCER,\n 'enableConditionWithIdentifier:profileIdentifier:', conditionID, profileID);\n if (!_.isBoolean(ret.selector)) {\n this._conditionInducerService.close();\n this._conditionInducerService = null;\n this.log.errorAndThrow(`Enable condition inducer error: '${JSON.stringify(ret.selector)}'`);\n }\n return ret.selector;\n};\n\n/**\n * Disable condition inducer\n * this call upon driver deletion\n * @returns {boolean} `true` if disable the condition succeeded\n */\ncommands.mobileDisableConditionInducer = async function disableConditionInducer () {\n if (!this._conditionInducerService) {\n this.log.warn('Condition inducer server is not started');\n return false;\n }\n try {\n const ret = await this._conditionInducerService.callChannel(INSTRUMENT_CHANNEL.CONDITION_INDUCER, 'disableActiveCondition');\n if (!_.isBoolean(ret.selector)) {\n this.log.warn(`Disable condition inducer error: '${JSON.stringify(ret.selector)}'`);\n return false;\n }\n return ret.selector;\n } finally {\n if (this._conditionInducerService) {\n this._conditionInducerService.close();\n this._conditionInducerService = null;\n }\n }\n};\n\nexport {commands};\nexport default commands;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,QAAQ,GAAG,EAAjB;;;AAEA,SAASC,uCAAT,CAAkDC,MAAlD,EAA0D;EACtD,IAAIA,MAAM,CAACC,WAAP,EAAJ,EAA0B;IACxBD,MAAM,CAACE,GAAP,CAAWC,aAAX,CAAyB,8CAAzB;EACD;;EACD,IAAIC,aAAA,CAAKC,eAAL,CAAqBL,MAAM,CAACM,IAAP,CAAYC,eAAjC,EAAkD,GAAlD,EAAuD,MAAvD,CAAJ,EAAoE;IAClEP,MAAM,CAACE,GAAP,CAAWC,aAAX,CAAyB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AejB,GAAG,CAACI,QAAnB,CAA6B,GAAxF;EACD;;EACD,OAAOJ,GAAG,CAACI,QAAX;AACD,CAlBD;;AAyBArB,QAAQ,CAACmC,6BAAT,GAAyC,eAAeC,uBAAf,GAA0C;EACjF,IAAI,CAAC,KAAKV,wBAAV,EAAoC;IAClC,KAAKtB,GAAL,CAASiC,IAAT,CAAc,yCAAd;IACA,OAAO,KAAP;EACD;;EACD,IAAI;IACF,MAAMpB,GAAG,GAAG,MAAM,KAAKS,wBAAL,CAA8BR,WAA9B,CAA0CC,mCAAA,CAAmBC,iBAA7D,EAAgF,wBAAhF,CAAlB;;IACA,IAAI,CAACW,eAAA,CAAEC,SAAF,CAAYf,GAAG,CAACI,QAAhB,CAAL,EAAgC;MAC9B,KAAKjB,GAAL,CAASiC,IAAT,CAAe,qCAAoCJ,IAAI,CAACC,SAAL,CAAejB,GAAG,CAACI,QAAnB,CAA6B,GAAhF;MACA,OAAO,KAAP;IACD;;IACD,OAAOJ,GAAG,CAACI,QAAX;EACD,CAPD,SAOU;IACR,IAAI,KAAKK,wBAAT,EAAmC;MACjC,KAAKA,wBAAL,CAA8BJ,KAA9B;;MACA,KAAKI,wBAAL,GAAgC,IAAhC;IACD;EACF;AACF,CAlBD;;eAqBe1B,Q"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","names":["NATIVE_WIN","WEBVIEW_WIN","WEBVIEW_BASE","RECENT_WEBVIEW_DETECTION_TIMEOUT_MS","commands","helpers","extensions","getCurrentContext","curContext","getContextsAndViews","useUrl","log","debug","webviews","listWebFrames","ctxs","id","view","contexts","push","toString","useNewSafari","isRealDevice","opts","safari","activateRecentWebview","timer","timing","Timer","start","spinTimeMs","spinHandles","contextId","getRecentWebviewContextId","err","message","includes","error","Error","stack","setContext","remote","cancelPageLoad","getDuration","asMilliSeconds","warn","B","delay","element","findUIElementOrElements","nativeClick","stopRemote","closeWindowBeforeDisconnecting","errorAndThrow","closeWindow","disconnect","curWebFrames","curWebCoords","setCurrentUrl","url","_currentUrl","getCurrentUrl","titleRegExp","urlRegExp","_","isRegExp","errors","InvalidArgumentError","currentUrl","filter","ctx","find","title","test","isWebContext","isWebview","getNewRemoteDebugger","socketPath","device","getWebInspectorSocket","createRemoteDebugger","bundleId","additionalBundleIds","additionalWebviewBundleIds","isSafari","includeSafari","includeSafariInWebviews","pageLoadMs","platformVersion","remoteDebugProxy","garbageCollectOnExecute","util","hasValue","safariGarbageCollect","udid","logAllCommunication","safariLogAllCommunication","logAllCommunicationHexDump","safariLogAllCommunicationHexDump","socketChunkSize","safariSocketChunkSize","webInspectorMaxFrameLength","safariWebInspectorMaxFrameLength","name","callback","skipReadyCheck","alreadyInContext","desired","current","isNativeContext","context","replace","isUndefined","getContexts","NoSuchContextError","oldContext","curWindowHandle","appIdKey","pageIdKey","map","split","parseInt","selectingNewPage","selectPage","enablePerformanceLogging","logs","performance","IOSPerformanceLog","startCapture","safariConsole","startConsole","addLogLine","bind","safariNetwork","startNetwork","connectToRemoteDebugger","on","RemoteDebugger","EVENT_PAGE_CHANGE","onPageChange","EVENT_FRAMES_DETACHED","isEmpty","pluralize","length","join","connect","webviewConnectTimeout","setConnectionKey","getWebviewPages","selectApp","undefined","webviewConnectRetries","ignoreAboutBlankUrl","pageArray","mapFn","fullContextList","mobileGetContexts","waitForWebviewMs","isNumber","isNaN","curOpt","toFixed","setWindow","noop","isErrorType","NoSuchWindowError","getWindowHandle","NotImplementedError","getWindowHandles","pageChangeNotification","JSON","stringify","isConnected","newIds","newPages","keyId","isUrlIgnored","safariIgnoreWebHostnames","ignoredHosts","b","trim","ignoredHost","hostname","URL","ign","page","isKey","info","curAppIdKey","curPageIdKey","newPage","last","needsPageLoad","contextArray","isEqual","pageLoad","currentPageId","p","catch","windowHandleCache","Object","assign"],"sources":["../../../lib/commands/context.js"],"sourcesContent":["import { createRemoteDebugger, RemoteDebugger } from 'appium-remote-debugger';\nimport { errors, isErrorType } from 'appium/driver';\nimport { util, timing } from 'appium/support';\nimport B from 'bluebird';\nimport IOSPerformanceLog from '../device-log/ios-performance-log';\nimport _ from 'lodash';\n\nconst NATIVE_WIN = 'NATIVE_APP';\nconst WEBVIEW_WIN = 'WEBVIEW';\nconst WEBVIEW_BASE = `${WEBVIEW_WIN}_`;\nconst RECENT_WEBVIEW_DETECTION_TIMEOUT_MS = 90000;\n\nconst commands = {}, helpers = {}, extensions = {};\n\n\ncommands.getCurrentContext = async function getCurrentContext () { // eslint-disable-line require-await\n if (this.curContext && this.curContext !== NATIVE_WIN) {\n return `${WEBVIEW_BASE}${this.curContext}`;\n }\n return NATIVE_WIN;\n};\n\nextensions.getContextsAndViews = async function getContextsAndViews (useUrl = true) {\n this.log.debug('Retrieving contexts and views');\n let webviews = await this.listWebFrames(useUrl);\n\n let ctxs = [{id: NATIVE_WIN, view: {}}];\n this.contexts = [NATIVE_WIN];\n for (let view of webviews) {\n ctxs.push({id: `${WEBVIEW_BASE}${view.id}`, view});\n this.contexts.push(view.id.toString());\n }\n return ctxs;\n};\n\n// Right now we don't necessarily wait for webview\n// and frame to load, which leads to race conditions and flakiness,\n// let's see if we can transition to something better\nextensions.useNewSafari = function useNewSafari () {\n return !this.isRealDevice() && this.opts.safari;\n};\n\nextensions.activateRecentWebview = async function activateRecentWebview () {\n this.log.debug('Activating a recent webview');\n const timer = new timing.Timer().start();\n const spinTimeMs = 500;\n const spinHandles = async () => {\n let contextId;\n try {\n contextId = await this.getRecentWebviewContextId(/.*/, /.*/);\n } catch (err) {\n if (!err.message.includes('Could not connect to a valid app after')) {\n const error = new Error(`Could not navigate to webview! Err: ${err.message}`);\n error.stack += `\\nCaused by: ${err.stack}`;\n throw error;\n }\n this.log.debug('Could not navigate to webview. Retrying if possible.');\n }\n if (contextId) {\n this.log.debug(`Picking webview '${contextId}'`);\n await this.setContext(contextId);\n await this.remote.cancelPageLoad();\n return;\n }\n\n // no webview was found\n if (timer.getDuration().asMilliSeconds >= RECENT_WEBVIEW_DETECTION_TIMEOUT_MS) {\n // too slow, get out\n throw new Error('Could not navigate to webview; there are none!');\n }\n\n this.log.warn('Could not find any webviews yet, refreshing/retrying');\n if (this.isRealDevice() || !this.opts.safari) {\n // on a real device, when not using Safari, we just want to try again\n await B.delay(spinTimeMs);\n return await spinHandles();\n }\n\n // find the reload button and tap it, if possible\n let element;\n try {\n this.log.debug('Finding and tapping reload button');\n element = await this.findUIElementOrElements('accessibility id', 'ReloadButton', '', false);\n await this.nativeClick(element);\n } catch (err) {\n this.log.warn(`Error finding and tapping reload button: ${err.message}`);\n this.log.warn('Retrying.');\n await B.delay(spinTimeMs);\n }\n\n // try it all again\n return await spinHandles();\n };\n await spinHandles();\n};\n\nhelpers.stopRemote = async function stopRemote (closeWindowBeforeDisconnecting = false) {\n if (!this.remote) {\n this.log.errorAndThrow('Tried to leave a web frame but were not in one');\n }\n\n if (closeWindowBeforeDisconnecting) {\n await this.closeWindow();\n }\n await this.remote.disconnect();\n this.curContext = null;\n this.curWebFrames = [];\n this.curWebCoords = null;\n this.remote = null;\n};\n\nhelpers.setCurrentUrl = function setCurrentUrl (url) {\n this._currentUrl = url;\n};\n\nhelpers.getCurrentUrl = function getCurrentUrl () {\n return this._currentUrl;\n};\n\nextensions.getRecentWebviewContextId = async function getRecentWebviewContextId (titleRegExp, urlRegExp) {\n if (!_.isRegExp(titleRegExp) && !_.isRegExp(urlRegExp)) {\n throw new errors.InvalidArgumentError(\n 'A regular expression for either web view title or url must be provided'\n );\n }\n\n const currentUrl = this.getCurrentUrl();\n const contexts = _.filter(await this.getContextsAndViews(false), 'view');\n // first try to match by current url\n if (currentUrl) {\n const ctx = contexts.find(({view}) => (view.url || '') === currentUrl);\n if (ctx) {\n return ctx.id;\n }\n }\n // if not, try to match by regular expression\n return (contexts.find(({view}) =>\n view.title && titleRegExp?.test(view.title) || view.url && urlRegExp?.test(view.url)\n ))?.id;\n};\n\nextensions.isWebContext = function isWebContext () {\n return !!this.curContext && this.curContext !== NATIVE_WIN;\n};\n\nextensions.isWebview = function isWebview () {\n return this.isWebContext();\n};\n\nextensions.getNewRemoteDebugger = async function getNewRemoteDebugger () {\n let socketPath;\n if (!this.isRealDevice()) {\n socketPath = await this.opts.device.getWebInspectorSocket();\n }\n return createRemoteDebugger({\n bundleId: this.opts.bundleId,\n additionalBundleIds: this.opts.additionalWebviewBundleIds,\n isSafari: this.isSafari(),\n includeSafari: this.opts.includeSafariInWebviews,\n useNewSafari: this.useNewSafari(),\n pageLoadMs: this.pageLoadMs,\n platformVersion: this.opts.platformVersion,\n socketPath,\n remoteDebugProxy: this.opts.remoteDebugProxy,\n garbageCollectOnExecute: util.hasValue(this.opts.safariGarbageCollect)\n ? !!this.opts.safariGarbageCollect\n : false,\n udid: this.opts.udid,\n logAllCommunication: this.opts.safariLogAllCommunication,\n logAllCommunicationHexDump: this.opts.safariLogAllCommunicationHexDump,\n socketChunkSize: this.opts.safariSocketChunkSize,\n webInspectorMaxFrameLength: this.opts.safariWebInspectorMaxFrameLength\n }, this.isRealDevice());\n};\n\n/**\n * Set context\n *\n * @param {?string} name - The name of context to set. It could be 'null' as NATIVE_WIN.\n * @param {callback} callback The callback. (It is not called in this method)\n * @param {boolean} skipReadyCheck - Whether it waits for the new context is ready\n */\ncommands.setContext = async function setContext (name, callback, skipReadyCheck) {\n function alreadyInContext (desired, current) {\n return (desired === current ||\n (desired === null && current === NATIVE_WIN) ||\n (desired === NATIVE_WIN && current === null));\n }\n function isNativeContext (context) {\n return context === NATIVE_WIN || context === null;\n }\n\n // allow the full context list to be passed in\n if (name && name.id) {\n name = name.id;\n }\n\n this.log.debug(`Attempting to set context to '${name || NATIVE_WIN}' from '${this.curContext ? this.curContext : NATIVE_WIN}'`);\n\n if (alreadyInContext(name, this.curContext) || alreadyInContext(_.replace(name, WEBVIEW_BASE, ''), this.curContext)) {\n // already in the named context, no need to do anything\n this.log.debug(`Already in '${name || NATIVE_WIN}' context. Doing nothing.`);\n return;\n }\n if (isNativeContext(name)) {\n // switching into the native context\n this.curContext = null;\n return;\n }\n\n // switching into a webview context\n\n // if contexts have not already been retrieved, get them\n if (_.isUndefined(this.contexts)) {\n await this.getContexts();\n }\n\n let contextId = _.replace(name, WEBVIEW_BASE, '');\n if (contextId === '') {\n // allow user to pass in \"WEBVIEW\" without an index\n // the second context will be the first webview as\n // the first is always NATIVE_APP\n contextId = this.contexts[1];\n }\n if (!_.includes(this.contexts, contextId)) {\n throw new errors.NoSuchContextError();\n }\n\n const oldContext = this.curContext;\n this.curContext = this.curWindowHandle = contextId;\n\n // `contextId` will be in the form of `appId.pageId` in this case\n const [appIdKey, pageIdKey] = _.map(contextId.split('.'), (id) => parseInt(id, 10));\n try {\n this.selectingNewPage = true;\n await this.remote.selectPage(appIdKey, pageIdKey, skipReadyCheck);\n } catch (err) {\n this.curContext = this.curWindowHandle = oldContext;\n throw err;\n } finally {\n this.selectingNewPage = false;\n }\n\n // attempt to start performance logging, if requested\n if (this.opts.enablePerformanceLogging && this.remote) {\n this.log.debug(`Starting performance log on '${this.curContext}'`);\n this.logs.performance = new IOSPerformanceLog(this.remote);\n await this.logs.performance.startCapture();\n }\n\n // start safari logging if the logs handlers are active\n if (name && name !== NATIVE_WIN && this.logs) {\n if (this.logs.safariConsole) {\n await this.remote.startConsole(this.logs.safariConsole.addLogLine.bind(this.logs.safariConsole));\n }\n if (this.logs.safariNetwork) {\n await this.remote.startNetwork(this.logs.safariNetwork.addLogLine.bind(this.logs.safariNetwork));\n }\n }\n};\n\nextensions.connectToRemoteDebugger = async function connectToRemoteDebugger () {\n this.remote = await this.getNewRemoteDebugger();\n\n this.remote.on(RemoteDebugger.EVENT_PAGE_CHANGE, this.onPageChange.bind(this));\n this.remote.on(RemoteDebugger.EVENT_FRAMES_DETACHED, () => {\n if (!_.isEmpty(this.curWebFrames)) {\n this.log.debug(`Clearing ${util.pluralize('frame', this.curWebFrames.length, true)}: ${this.curWebFrames.join(', ')}`);\n }\n this.curWebFrames = [];\n });\n\n await this.remote.connect(this.opts.webviewConnectTimeout);\n};\n\nextensions.listWebFrames = async function listWebFrames (useUrl = true) {\n useUrl = useUrl && !this.isRealDevice() && !!this.getCurrentUrl();\n this.log.debug(`Selecting by url: ${useUrl}${useUrl ? ` (expected url: '${this.getCurrentUrl()}')` : ''}`);\n\n if (!this.remote) {\n await this.connectToRemoteDebugger();\n if (!this.remote.appIdKey) {\n await this.remote.setConnectionKey();\n }\n }\n const getWebviewPages = async () => {\n try {\n return await this.remote.selectApp(\n useUrl ? this.getCurrentUrl() : undefined,\n this.opts.webviewConnectRetries,\n this.opts.ignoreAboutBlankUrl\n );\n } catch (err) {\n this.log.debug(`No available web pages: ${err.message}`);\n return [];\n }\n };\n const pageArray = await getWebviewPages();\n if (_.isEmpty(pageArray)) {\n // we have no web frames, but continue anyway\n this.log.debug('No web frames found.');\n }\n return pageArray;\n};\n\ncommands.getContexts = async function getContexts () {\n this.log.debug('Getting list of available contexts');\n const contexts = await this.getContextsAndViews(false);\n\n const mapFn = this.opts.fullContextList\n ? function (context) {\n return {\n id: context.id.toString(),\n title: context.view.title,\n url: context.view.url,\n bundleId: context.view.bundleId,\n };\n }\n : (context) => context.id.toString();\n return contexts.map(mapFn);\n};\n\n/**\n * @typedef {Object} Context\n *\n * @property {string} id - The identifier of the context. The native context\n * will be 'NATIVE_APP' and the webviews will be\n * 'WEBVIEW_xxx'\n * @property {?string} title - The title associated with the webview content\n * @property {?string} url - The url associated with the webview content\n */\n\n/**\n * Get the contexts available, with information about the url and title of each\n * webview\n *\n * @param {Object} opts - Options set, which can include `waitForWebviewMs` to\n * specify the period to poll for available webviews\n * @returns {Array} List of Context objects\n */\nextensions.mobileGetContexts = async function mobileGetContexts (opts = {}) {\n let {\n waitForWebviewMs = 0,\n } = opts;\n\n // make sure it is a number, so the duration check works properly\n if (!_.isNumber(waitForWebviewMs)) {\n waitForWebviewMs = parseInt(waitForWebviewMs, 10);\n if (isNaN(waitForWebviewMs)) {\n waitForWebviewMs = 0;\n }\n }\n\n const curOpt = this.opts.fullContextList;\n this.opts.fullContextList = true;\n\n const timer = new timing.Timer().start();\n try {\n let contexts;\n do {\n contexts = await this.getContexts();\n\n if (contexts.length >= 2) {\n this.log.debug(`Found webview context after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);\n return contexts;\n }\n this.log.debug(`No webviews found in ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);\n } while (timer.getDuration().asMilliSeconds < waitForWebviewMs);\n return contexts;\n } finally {\n // reset the option so there are no side effects\n this.opts.fullContextList = curOpt;\n }\n};\n\ncommands.setWindow = async function setWindow (name, skipReadyCheck) {\n try {\n await this.setContext(name, _.noop, skipReadyCheck);\n } catch (err) {\n // translate the error in terms of windows\n throw isErrorType(err, errors.NoSuchContextError)\n ? new errors.NoSuchWindowError()\n : err;\n }\n};\n\ncommands.getWindowHandle = async function getWindowHandle () { // eslint-disable-line require-await\n if (!this.isWebContext()) {\n throw new errors.NotImplementedError();\n }\n this.log.debug(`Getting current window handle`);\n return this.curContext;\n};\n\ncommands.getWindowHandles = async function getWindowHandles () {\n if (!this.isWebContext()) {\n throw new errors.NotImplementedError();\n }\n this.log.debug('Getting list of available window handles');\n const contexts = await this.getContextsAndViews(false);\n return contexts\n // get rid of the native app context\n .filter((context) => context.id !== NATIVE_WIN)\n // get the `app.id` format expected\n .map((context) => context.view.id.toString());\n};\n\nextensions.onPageChange = async function onPageChange (pageChangeNotification) {\n this.log.debug(`Remote debugger notified us of a new page listing: ${JSON.stringify(pageChangeNotification)}`);\n if (this.selectingNewPage) {\n this.log.debug('We are in the middle of selecting a page, ignoring');\n return;\n }\n if (!this.remote || !this.remote.isConnected) {\n this.log.debug('We have not yet connected, ignoring');\n return;\n }\n\n const {appIdKey, pageArray} = pageChangeNotification;\n\n let newIds = [];\n let newPages = [];\n let keyId = null;\n\n // Checks if a URL is blacklisted in the 'safariIgnoreWebHostnames' capability\n function isUrlIgnored (url, safariIgnoreWebHostnames) {\n const ignoredHosts = (safariIgnoreWebHostnames || '')\n .split(',')\n .map((b) => b.trim())\n .filter((b) => !_.isEmpty(b));\n for (const ignoredHost of ignoredHosts) {\n if (ignoredHost === 'about:blank' && url === 'about:blank') {\n return true;\n } else {\n try {\n const hostname = new URL(url).hostname;\n if (hostname === ignoredHost) {\n return true;\n }\n } catch (ign) {\n // do nothing if invalid URL\n }\n }\n }\n return false;\n }\n\n for (const page of pageArray) {\n const id = page.id.toString();\n newIds.push(id);\n if (page.isKey) {\n keyId = id;\n }\n const contextId = `${appIdKey}.${id}`;\n\n // add if this is a new page\n if (!_.includes(this.contexts, contextId)) {\n if (isUrlIgnored(page.url, this.opts.safariIgnoreWebHostnames)) {\n this.log.info(`Not tracking '${page.url}' page because it is blacklisted. ` +\n `'safariIgnoreWebHostnames'=${this.opts.safariIgnoreWebHostnames}`);\n } else {\n newPages.push(id);\n this.contexts.push(contextId);\n }\n }\n }\n\n if (!keyId) {\n // if there is no key id, pull the first id from the page array and use that\n // as a stand in\n this.log.debug('No key id found. Choosing first id from page array');\n keyId = newIds[0] || null;\n }\n\n if (!util.hasValue(this.curContext)) {\n this.log.debug('We do not appear to have window set yet, ignoring');\n return;\n }\n\n const [curAppIdKey, curPageIdKey] = this.curContext.split('.');\n\n if (curAppIdKey !== appIdKey) {\n this.log.debug('Page change not referring to currently selected app, ignoring.');\n return;\n }\n\n let newPage = null;\n if (newPages.length) {\n newPage = _.last(newPages);\n this.log.debug(`We have new pages, selecting page '${newPage}'`);\n } else if (!_.includes(newIds, curPageIdKey)) {\n this.log.debug('New page listing from remote debugger does not contain ' +\n 'current window; assuming it is closed');\n if (!util.hasValue(keyId)) {\n this.log.error('Do not have our current window anymore, and there ' +\n 'are not any more to load! Doing nothing...');\n this.setCurrentUrl(undefined);\n return;\n }\n\n this.log.debug(`Debugger already selected page '${keyId}', ` +\n `confirming that choice.`);\n this.curContext = `${appIdKey}.${keyId}`;\n newPage = keyId;\n } else {\n // at this point, there are no new pages, and the current page still exists\n this.log.debug('Checking if page needs to load');\n // If a window navigates to an anchor it doesn't always fire a page\n // callback event. Let's check if we wound up in such a situation.\n const needsPageLoad = (() => {\n // need to map the page ids to context ids\n const contextArray = _.map(pageArray, (page) => `${appIdKey}.${page.id}`);\n // check if the current context exists in both our recorded contexts,\n // and the page array\n return !_.isEqual(_.find(this.contexts, this.curContext), _.find(contextArray, this.curContext));\n })();\n\n if (needsPageLoad) {\n this.log.debug('Page load needed. Loading...');\n await this.remote.pageLoad();\n }\n\n this.log.debug('New page listing is same as old, doing nothing');\n }\n\n // make sure that the page listing isn't indicating a redirect\n if (util.hasValue(this.curContext)) {\n let currentPageId = parseInt(_.last(this.curContext.split('.')), 10);\n let page = _.find(pageArray, (p) => parseInt(p.id, 10) === currentPageId);\n if (page && page.url !== this.getCurrentUrl()) {\n this.log.debug(`Redirected from '${this.getCurrentUrl()}' to '${page.url}'`);\n this.setCurrentUrl(page.url);\n }\n }\n\n if (util.hasValue(newPage)) {\n this.selectingNewPage = true;\n const oldContext = this.curContext;\n this.curContext = `${appIdKey}.${newPage}`;\n // do not wait, as this can take a long time, and the response is not necessary\n // eslint-disable-next-line promise/prefer-await-to-callbacks, promise/prefer-await-to-then\n this.remote.selectPage(appIdKey, parseInt(newPage, 10)).catch((err) => {\n this.log.warn(`Failed to select page: ${err.message}`);\n this.curContext = oldContext;\n });\n this.selectingNewPage = false;\n }\n this.windowHandleCache = pageArray;\n};\n\n\nObject.assign(commands, extensions, helpers);\nexport default commands;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,MAAMA,UAAU,GAAG,YAAnB;AACA,MAAMC,WAAW,GAAG,SAApB;AACA,MAAMC,YAAY,GAAI,GAAED,WAAY,GAApC;AACA,MAAME,mCAAmC,GAAG,KAA5C;AAEA,MAAMC,QAAQ,GAAG,EAAjB;AAAA,MAAqBC,OAAO,GAAG,EAA/B;AAAA,MAAmCC,UAAU,GAAG,EAAhD;;AAGAF,QAAQ,CAACG,iBAAT,GAA6B,eAAeA,iBAAf,GAAoC;EAC/D,IAAI,KA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EO,IAAF,CAAOkF,SAAP,EAAmB4C,CAAD,IAAO5E,QAAQ,CAAC4E,CAAC,CAACrL,EAAH,EAAO,EAAP,CAAR,KAAuBoL,aAAhD,CAAX;;IACA,IAAIX,IAAI,IAAIA,IAAI,CAAC9H,GAAL,KAAa,KAAKE,aAAL,EAAzB,EAA+C;MAC7C,KAAKlD,GAAL,CAASC,KAAT,CAAgB,oBAAmB,KAAKiD,aAAL,EAAqB,SAAQ4H,IAAI,CAAC9H,GAAI,GAAzE;MACA,KAAKD,aAAL,CAAmB+H,IAAI,CAAC9H,GAAxB;IACD;EACF;;EAED,IAAIgC,aAAA,CAAKC,QAAL,CAAckG,OAAd,CAAJ,EAA4B;IAC1B,KAAKpE,gBAAL,GAAwB,IAAxB;IACA,MAAMP,UAAU,GAAG,KAAK3G,UAAxB;IACA,KAAKA,UAAL,GAAmB,GAAE6G,QAAS,IAAGyE,OAAQ,EAAzC;IAGA,KAAKrJ,MAAL,CAAYkF,UAAZ,CAAuBN,QAAvB,EAAiCI,QAAQ,CAACqE,OAAD,EAAU,EAAV,CAAzC,EAAwDQ,KAAxD,CAA+DpK,GAAD,IAAS;MACrE,KAAKvB,GAAL,CAASkC,IAAT,CAAe,0BAAyBX,GAAG,CAACC,OAAQ,EAApD;MACA,KAAK3B,UAAL,GAAkB2G,UAAlB;IACD,CAHD;IAIA,KAAKO,gBAAL,GAAwB,KAAxB;EACD;;EACD,KAAK6E,iBAAL,GAAyB9C,SAAzB;AACD,CA7ID;;AAgJA+C,MAAM,CAACC,MAAP,CAAcrM,QAAd,EAAwBE,UAAxB,EAAoCD,OAApC;eACeD,Q"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookies.js","names":["commands","helpers","extensions","getCookies","isWebContext","errors","NotImplementedError","cookies","remote","decodedCookieValues","map","cookie","decodeURI","value","error","log","debug","name","warn","undefined","_","zip","filter","isUndefined","Object","assign","deleteCookie","cookieName","find","_deleteCookie","deleteCookies","url","secure","domain","path"],"sources":["../../../lib/commands/cookies.js"],"sourcesContent":["import _ from 'lodash';\nimport { errors } from 'appium/driver';\n\n\nlet commands = {}, helpers = {}, extensions = {};\n\ncommands.getCookies = async function getCookies () {\n if (!this.isWebContext()) {\n throw new errors.NotImplementedError();\n }\n\n // get the cookies from the remote debugger, or an empty object\n const cookies = await this.remote.getCookies() || {cookies: []};\n\n // the value is URI encoded, so decode it safely\n const decodedCookieValues = cookies.cookies.map((cookie) => {\n try {\n return decodeURI(cookie.value);\n } catch (error) {\n this.log.debug(`Cookie ${cookie.name} was not decoded successfully. Cookie value: ${cookie.value}`);\n this.log.warn(error);\n return undefined;\n }\n });\n\n // zip cookes with decoded value, removing undefined cookie values\n return _.zip(cookies.cookies, decodedCookieValues)\n .filter(([, value]) => !_.isUndefined(value))\n .map(([cookie, value]) => Object.assign({}, cookie, {value}));\n};\n\ncommands.deleteCookie = async function deleteCookie (cookieName) {\n if (!this.isWebContext()) {\n throw new errors.NotImplementedError();\n }\n\n const cookies = await this.getCookies();\n const cookie = cookies.find((cookie) => cookie.name === cookieName);\n if (!cookie) {\n this.log.debug(`Cookie '${cookieName}' not found. Ignoring.`);\n return true;\n }\n\n await this._deleteCookie(cookie);\n return true;\n};\n\ncommands.deleteCookies = async function deleteCookies () {\n if (!this.isWebContext()) {\n throw new errors.NotImplementedError();\n }\n\n const cookies = await this.getCookies();\n for (const cookie of cookies) {\n await this._deleteCookie(cookie);\n }\n return true;\n};\n\nhelpers._deleteCookie = async function _deleteCookie (cookie) {\n const url = `http${cookie.secure ? 's' : ''}://${cookie.domain}${cookie.path}`;\n return await this.remote.deleteCookie(cookie.name, url);\n};\n\nObject.assign(extensions, commands, helpers);\nexport { commands, helpers };\nexport default extensions;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAGA,IAAIA,QAAQ,GAAG,EAAf;AAAA,IAAmBC,OAAO,GAAG,EAA7B;AAAA,IAAiCC,UAAU,GAAG,EAA9C;;;;AAEAF,QAAQ,CAACG,UAAT,GAAsB,eA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AzC,CAAf;;EACA,IAAI,CAAChB,MAAL,EAAa;IACX,KAAKI,GAAL,CAASC,KAAT,CAAgB,WAAUW,UAAW,wBAArC;IACA,OAAO,IAAP;EACD;;EAED,MAAM,KAAKE,aAAL,CAAmBlB,MAAnB,CAAN;EACA,OAAO,IAAP;AACD,CAdD;;AAgBAX,QAAQ,CAAC8B,aAAT,GAAyB,eAAeA,aAAf,GAAgC;EACvD,IAAI,CAAC,KAAK1B,YAAL,EAAL,EAA0B;IACxB,MAAM,IAAIC,cAAA,CAAOC,mBAAX,EAAN;EACD;;EAED,MAAMC,OAAO,GAAG,MAAM,KAAKJ,UAAL,EAAtB;;EACA,KAAK,MAAMQ,MAAX,IAAqBJ,OAArB,EAA8B;IAC5B,MAAM,KAAKsB,aAAL,CAAmBlB,MAAnB,CAAN;EACD;;EACD,OAAO,IAAP;AACD,CAVD;;AAYAV,OAAO,CAAC4B,aAAR,GAAwB,eAAeA,aAAf,CAA8BlB,MAA9B,EAAsC;EAC5D,MAAMoB,GAAG,GAAI,OAAMpB,MAAM,CAACqB,MAAP,GAAgB,GAAhB,GAAsB,EAAG,MAAKrB,MAAM,CAACsB,MAAO,GAAEtB,MAAM,CAACuB,IAAK,EAA7E;EACA,OAAO,MAAM,KAAK1B,MAAL,CAAYkB,YAAZ,CAAyBf,MAAM,CAACM,IAAhC,EAAsCc,GAAtC,CAAb;AACD,CAHD;;AAKAP,MAAM,CAACC,MAAP,CAAcvB,UAAd,EAA0BF,QAA1B,EAAoCC,OAApC;eAEeC,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceInfo.js","names":["extensions","commands","mobileGetDeviceInfo","infoByWda","proxyCommand","isRealDevice","lockdownInfo","utilities","getDeviceInfo","opts","device","udid","Object","assign"],"sources":["../../../lib/commands/deviceInfo.js"],"sourcesContent":["import { utilities } from 'appium-ios-device';\n\nconst extensions = {}, commands = {};\n\n/**\n * Returns device info.\n *\n * @returns {Object} The response of `/wda/device/info'`\n * @throws {Error} if an error raised by command\n */\ncommands.mobileGetDeviceInfo = async function mobileGetDeviceInfo () {\n const infoByWda = await this.proxyCommand('/wda/device/info', 'GET');\n\n if (this.isRealDevice()) {\n const lockdownInfo = await utilities.getDeviceInfo(this.opts.device.udid);\n return {...infoByWda, ...{lockdownInfo}};\n }\n\n return infoByWda;\n};\n\nObject.assign(extensions, commands);\nexport { commands };\nexport default extensions;\n"],"mappings":";;;;;;;;;AAAA;;AAEA,MAAMA,UAAU,GAAG,EAAnB;AAAA,MAAuBC,QAAQ,GAAG,EAAlC;;;AAQAA,QAAQ,CAACC,mBAAT,GAA+B,eAAeA,mBAAf,GAAsC;EACnE,MAAMC,SAAS,GAAG,MAAM,KAAKC,YAAL,CAAkB,kBAAlB,EAAsC,KAAtC,CAAxB;;EAEA,IAAI,KAAKC,YAAL,EAAJ,EAAyB;IACvB,MAAMC,YAAY,GAAG,MAAMC,0BAAA,CAAUC,aAAV,CAAwB,KAAKC,IAAL,CAAUC,MAAV,CAAiBC,IAAzC,CAA3B;IACA,OAAO,EAAC,GAAGR,SAAJ;MAAe,GAAG;QAACG;MAAD;IAAlB,CAAP;EACD;;EAED,OAAOH,SAAP;AACD,CATD;;AAWAS,MAAM,CAACC,MAAP,CAAcb,UAAd,EAA0BC,QAA1B;eAEeD,U"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.js","names":["commands","extensions","elementDisplayed","el","util","unwrapElement","isWebContext","atomsElement","getAtomsElement","executeAtom","proxyCommand","elementEnabled","elementSelected","getName","script","getNativeAttribute","attribute","getContentSize","value","includes","_","isNull","isString","JSON","stringify","getAttribute","getProperty","property","getText","getElementRect","x","y","getLocation","width","height","getSize","getNativeRect","loc","opts","absoluteWebLocations","xOffset","yOffset","execute","rect","getLocationInView","prepareInputValue","inp","isArray","isFinite","some","f","Error","join","map","k","setValueImmediate","log","info","setValue","keys","clear","errors","NotYetImplementedError","type","locator","contentHeight","children","findElOrEls","length","head","firstRect","lastRect","last","elsInRow","initialRects","i","push","spaceBetweenEls","numRows","Math","ceil","size","origin","top","left","scrollableOffset","isKeyboardShown","findNativeElementOrElements","ign","Object","assign"],"sources":["../../../lib/commands/element.js"],"sourcesContent":["import _ from 'lodash';\nimport { errors } from 'appium/driver';\nimport { util } from 'appium/support';\n\n\nconst commands = {}, extensions = {};\n\ncommands.elementDisplayed = async function elementDisplayed (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n const atomsElement = this.getAtomsElement(el);\n return await this.executeAtom('is_displayed', [atomsElement]);\n }\n\n return await this.proxyCommand(`/element/${el}/displayed`, 'GET');\n};\n\ncommands.elementEnabled = async function elementEnabled (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n const atomsElement = this.getAtomsElement(el);\n return await this.executeAtom('is_enabled', [atomsElement]);\n }\n\n return await this.proxyCommand(`/element/${el}/enabled`, 'GET');\n};\n\ncommands.elementSelected = async function elementSelected (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n const atomsElement = this.getAtomsElement(el);\n return await this.executeAtom('is_selected', [atomsElement]);\n }\n\n return await this.proxyCommand(`/element/${el}/selected`, 'GET');\n};\n\ncommands.getName = async function getName (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n const atomsElement = this.getAtomsElement(el);\n const script = 'return arguments[0].tagName.toLowerCase()';\n return await this.executeAtom('execute_script', [script, [atomsElement]]);\n }\n\n return await this.proxyCommand(`/element/${el}/name`, 'GET');\n};\n\ncommands.getNativeAttribute = async function getNativeAttribute (attribute, el) {\n if (attribute === 'contentSize') {\n // don't proxy requests for the content size of a scrollable element\n return await this.getContentSize(el);\n }\n\n el = util.unwrapElement(el);\n\n // otherwise let WDA handle attribute requests\n let value = await this.proxyCommand(`/element/${el}/attribute/${attribute}`, 'GET');\n // Transform the result for the case when WDA returns an integer representation for a boolean value\n if ([0, 1].includes(value)) {\n value = !!value;\n }\n // The returned value must be of type string according to https://www.w3.org/TR/webdriver/#get-element-attribute\n return (_.isNull(value) || _.isString(value)) ? value : JSON.stringify(value);\n};\n\ncommands.getAttribute = async function getAttribute (attribute, el) {\n el = util.unwrapElement(el);\n if (!this.isWebContext()) {\n return await this.getNativeAttribute(attribute, el);\n }\n const atomsElement = this.getAtomsElement(el);\n return await this.executeAtom('get_attribute_value', [atomsElement, attribute]);\n};\n\ncommands.getProperty = async function getProperty (property, el) {\n el = util.unwrapElement(el);\n if (!this.isWebContext()) {\n return await this.getNativeAttribute(property, el);\n }\n const atomsElement = this.getAtomsElement(el);\n return await this.executeAtom('get_attribute_value', [atomsElement, property]);\n};\n\ncommands.getText = async function getText (el) {\n el = util.unwrapElement(el);\n if (!this.isWebContext()) {\n return await this.proxyCommand(`/element/${el}/text`, 'GET');\n }\n let atomsElement = this.getAtomsElement(el);\n return await this.executeAtom('get_text', [atomsElement]);\n};\n\ncommands.getElementRect = async function getElementRect (el) {\n if (this.isWebContext()) {\n // Mobile safari doesn't support rect\n const {x, y} = await this.getLocation(el);\n const {width, height} = await this.getSize(el);\n return {x, y, width, height};\n }\n\n el = util.unwrapElement(el);\n return await this.getNativeRect(el);\n};\n\nextensions.getNativeRect = async function getNativeRect (el) {\n return await this.proxyCommand(`/element/${el}/rect`, 'GET');\n};\n\ncommands.getLocation = async function getLocation (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n const atomsElement = await this.getAtomsElement(el);\n let loc = await this.executeAtom('get_top_left_coordinates', [atomsElement]);\n if (this.opts.absoluteWebLocations) {\n const script = 'return [' +\n 'Math.max(window.pageXOffset,document.documentElement.scrollLeft,document.body.scrollLeft),' +\n 'Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop)];';\n const [xOffset, yOffset] = await this.execute(script);\n loc.x += xOffset;\n loc.y += yOffset;\n }\n return loc;\n }\n\n const rect = await this.getElementRect(el);\n return {x: rect.x, y: rect.y};\n};\n\ncommands.getLocationInView = async function getLocationInView (el) {\n return await this.getLocation(el);\n};\n\ncommands.getSize = async function getSize (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n return await this.executeAtom('get_size', [this.getAtomsElement(el)]);\n }\n\n const rect = await this.getElementRect(el);\n return {width: rect.width, height: rect.height};\n};\n\n/**\n * Prepares the input value to be passed as an argument to WDA.\n *\n * @param {string|Array<string>|number} inp The actual text to type.\n * Acceptable values of `inp`:\n * ['some text']\n * ['s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't']\n * 'some text'\n * 1234\n * @throws {Error} If the value is not acceptable for input\n * @returns {Array<string>} The preprocessed value\n */\nfunction prepareInputValue (inp) {\n if (![_.isArray, _.isString, _.isFinite].some((f) => f(inp))) {\n throw new Error(`Only strings, numbers and arrays are supported as input arguments. ` +\n `Received: ${JSON.stringify(inp)}`);\n }\n\n // make it into a string, so then we assure\n // the array items are single characters\n if (_.isArray(inp)) {\n inp = inp.join('');\n } else if (_.isFinite(inp)) {\n inp = `${inp}`;\n }\n // The `split` method must not be used on the string\n // to properly handle all Unicode code points\n return [...inp].map((k) => {\n if (['\\uE006', '\\uE007'].includes(k)) { // RETURN or ENTER\n return '\\n';\n }\n if (['\\uE003', '\\ue017'].includes(k)) { // BACKSPACE or DELETE\n return '\\b';\n }\n return k;\n });\n}\n\ncommands.setValueImmediate = async function setValueImmediate (value, el) {\n // WDA does not provide no way to set the value directly\n this.log.info('There is currently no way to bypass typing using XCUITest. Setting value through keyboard');\n await this.setValue(value, el);\n};\n\ncommands.setValue = async function setValue (value, el) {\n el = util.unwrapElement(el);\n if (!this.isWebContext()) {\n await this.proxyCommand(`/element/${el}/value`, 'POST', {\n value: prepareInputValue(value),\n });\n return;\n }\n\n const atomsElement = this.getAtomsElement(el);\n await this.executeAtom('click', [atomsElement]);\n await this.executeAtom('type', [atomsElement, value]);\n};\n\ncommands.keys = async function keys (value) {\n await this.proxyCommand('/wda/keys', 'POST', {\n value: prepareInputValue(value),\n });\n};\n\ncommands.clear = async function clear (el) {\n el = util.unwrapElement(el);\n if (this.isWebContext()) {\n const atomsElement = this.getAtomsElement(el);\n await this.executeAtom('clear', [atomsElement]);\n return;\n }\n await this.proxyCommand(`/element/${el}/clear`, 'POST');\n};\n\ncommands.getContentSize = async function getContentSize (el) {\n if (this.isWebContext()) {\n throw new errors.NotYetImplementedError('Support for getContentSize for web context is not yet implemented. Please contact an Appium dev');\n }\n\n const type = await this.getAttribute('type', el);\n\n if (type !== 'XCUIElementTypeTable' &&\n type !== 'XCUIElementTypeCollectionView') {\n throw new Error(`Can't get content size for type '${type}', only for ` +\n `tables and collection views`);\n }\n let locator = '*';\n if (type === 'XCUIElementTypeTable') {\n // only find table cells, not just any children\n locator = 'XCUIElementTypeCell';\n }\n\n let contentHeight = 0;\n const children = await this.findElOrEls(`class chain`, locator, true, el);\n if (children.length === 1) {\n // if we know there's only one element, we can optimize to make just one\n // call to WDA\n const rect = await this.getElementRect(_.head(children));\n contentHeight = rect.height;\n } else if (children.length) {\n // otherwise if we have multiple elements, logic differs based on element\n // type\n switch (type) {\n case 'XCUIElementTypeTable': {\n const firstRect = await this.getElementRect(_.head(children));\n const lastRect = await this.getElementRect(_.last(children));\n contentHeight = lastRect.y + lastRect.height - firstRect.y;\n break;\n }\n case 'XCUIElementTypeCollectionView': {\n let elsInRow = 1; // we know there must be at least one element in the row\n let firstRect = await this.getElementRect(_.head(children));\n let initialRects = [firstRect];\n for (let i = 1; i < children.length; i++) {\n const rect = await this.getElementRect(children[i]);\n initialRects.push(rect);\n if (rect.y !== firstRect.y) {\n elsInRow = i;\n break;\n }\n }\n const spaceBetweenEls = initialRects[elsInRow].y - initialRects[elsInRow - 1].y - initialRects[elsInRow - 1].height;\n const numRows = Math.ceil(children.length / elsInRow);\n\n // assume all cells are the same height\n contentHeight = (numRows * firstRect.height) + (spaceBetweenEls * (numRows - 1));\n break;\n }\n default: throw new Error(`Programming error: type '${type}' was not ` +\n `valid but should have already been rejected`);\n }\n }\n const size = await this.getSize(el);\n const origin = await this.getLocationInView(el);\n // attributes have to be strings, so stringify this up\n return JSON.stringify({\n width: size.width,\n height: size.height,\n top: origin.y,\n left: origin.x,\n scrollableOffset: contentHeight\n });\n};\n\ncommands.isKeyboardShown = async function isKeyboardShown () {\n try {\n await this.findNativeElementOrElements('class name', 'XCUIElementTypeKeyboard', false);\n return true;\n } catch (ign) {\n return false;\n }\n};\n\nObject.assign(extensions, commands);\nexport { commands };\nexport default extensions;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAGA,MAAMA,QAAQ,GAAG,EAAjB;AAAA,MAAqBC,UAAU,GAAG,EAAlC;;;AAEAD,QAAQ,CAACE,gBAAT,GAA4B,eAAeA,gBAAf,CAAiCC,EAAjC,EAAqC;EAC/DA,EAAE,GAAGC,aAAA,CAAKC,aAAL,CAAmBF,EAAnB,CAAL;;EACA,IAAI,KAAKG,YAAL,EAAJ,EAAyB;IACvB,MAAMC,YAAY,GAAG,KAAKC,eAAL,CAAqBL,EAArB,CAArB;IACA,OAAO,MAAM,KAAKM,WAAL,CAAiB,cAAjB,EAAiC,CAACF,YAAD,CAAjC,CAAb;EACD;;EAED,OAAO,MAAM,KAAKG,YAAL,CAAmB,YAAWP,EAAG,YAAjC,EAA8C,KAA9C,CAAb;AACD,CARD;;AAUAH,QAAQ,CAACW,cAAT,GAA0B,eAAeA,cAAf,CAA+BR,EAA/B,EAAmC;EAC3DA,EAAE,GAAGC,aAAA,CAAKC,aAAL,CAAmBF,EAAnB,CAAL;;EACA,IAAI,KAAKG,YAAL,EAAJ,EAAyB;IACvB,MAAMC,YAAY,GAAG,KAAKC,eAAL,CAAqBL,EAArB,CAArB;IACA,OAAO,MAAM,KAAKM,WAAL,CAAiB,YAAjB,EAA+B,CAACF,YAAD,CAA/B,CAAb;EACD;;EAED,OAAO,MAAM,KAAKG,YAAL,CAAmB,YAAWP,EAAG,UAAjC,EAA4C,KAA5C,CAAb;AACD,CARD;;AAUAH,QAAQ,CAACY,eAAT,GAA2B,eAAeA,eAAf,CAAgCT,EAAhC,EAAoC;EAC7DA,EAAE,GAAGC,aAAA,CAAKC,aA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