appium-uiautomator2-driver 2.6.0 → 2.7.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.
- package/README.md +238 -22
- package/build/lib/commands/actions.js.map +1 -0
- package/build/lib/commands/alert.js.map +1 -0
- package/build/lib/commands/battery.js.map +1 -0
- package/build/lib/commands/element.js.map +1 -0
- package/build/lib/commands/find.js.map +1 -0
- package/build/lib/commands/general.js.map +1 -0
- package/build/lib/commands/gestures.js.map +1 -0
- package/build/lib/commands/index.js.map +1 -0
- package/build/lib/commands/screenshot.js.map +1 -0
- package/build/lib/commands/touch.js.map +1 -0
- package/build/lib/commands/viewport.js.map +1 -0
- package/build/lib/css-converter.js.map +1 -0
- package/build/lib/desired-caps.js.map +1 -0
- package/build/lib/driver.js.map +1 -0
- package/build/lib/extensions.js.map +1 -0
- package/build/lib/helpers.js.map +1 -0
- package/build/lib/logger.js.map +1 -0
- package/build/lib/uiautomator2.js.map +1 -0
- package/npm-shrinkwrap.json +485 -1076
- package/package.json +10 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-converter.js","names":["parser","CssSelectorParser","registerSelectorPseudos","registerNestingOperators","registerAttrEqualityMods","enableSubstitutes","RESOURCE_ID","ID_LOCATOR_PATTERN","BOOLEAN_ATTRS","NUMERIC_ATTRS","STR_ATTRS","ALL_ATTRS","ATTRIBUTE_ALIASES","toSnakeCase","str","tokens","split","map","charAt","toUpperCase","slice","toLowerCase","out","join","assertGetBool","css","val","value","includes","Error","name","assertGetAttrName","attrName","officialAttr","aliasAttrs","getWordMatcherRegex","word","escapeRegExp","CssConverter","constructor","selector","pkg","formatIdLocator","locator","test","parseAttr","cssAttr","valueType","methodName","operator","parsePseudo","cssPseudo","pseudoName","parseCssRule","cssRule","nestingOperator","uiAutomatorSelector","tagName","androidClass","classNames","cssClassNames","push","id","attrs","attr","pseudos","pseudo","rule","parseCssObject","type","selectors","toUiAutomatorSelector","cssObj","parse","e","errors","InvalidSelectorError"],"sources":["../../lib/css-converter.js"],"sourcesContent":["import { CssSelectorParser } from 'css-selector-parser';\nimport { escapeRegExp } from 'lodash';\nimport { errors } from 'appium/driver';\n\nconst parser = new CssSelectorParser();\nparser.registerSelectorPseudos('has');\nparser.registerNestingOperators('>', '+', '~');\nparser.registerAttrEqualityMods('^', '$', '*', '~');\nparser.enableSubstitutes();\n\nconst RESOURCE_ID = 'resource-id';\nconst ID_LOCATOR_PATTERN = /^[a-zA-Z_][a-zA-Z0-9._]*:id\\/[\\S]+$/;\n\nconst BOOLEAN_ATTRS = [\n 'checkable', 'checked', 'clickable', 'enabled', 'focusable',\n 'focused', 'long-clickable', 'scrollable', 'selected',\n];\n\nconst NUMERIC_ATTRS = [\n 'index', 'instance',\n];\n\nconst STR_ATTRS = [\n 'description', RESOURCE_ID, 'text', 'class-name', 'package-name'\n];\n\nconst ALL_ATTRS = [\n ...BOOLEAN_ATTRS,\n ...NUMERIC_ATTRS,\n ...STR_ATTRS,\n];\n\nconst ATTRIBUTE_ALIASES = [\n [RESOURCE_ID, ['id']],\n ['description', [\n 'content-description', 'content-desc',\n 'desc', 'accessibility-id',\n ]],\n ['index', ['nth-child']],\n];\n\n/**\n * Convert hyphen separated word to snake case\n *\n * @param {string} str\n * @returns {string} The hyphen separated word translated to snake case\n */\nfunction toSnakeCase (str) {\n if (!str) {\n return '';\n }\n const tokens = str.split('-').map((str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());\n const out = tokens.join('');\n return out.charAt(0).toLowerCase() + out.slice(1);\n}\n\n/**\n * @typedef {Object} CssNameValueObject\n * @property {?name} name The name of the CSS object\n * @property {?string} value The value of the CSS object\n */\n\n/**\n * Get the boolean from a CSS object. If empty, return true. If not true/false/empty, throw exception\n *\n * @param {CssNameValueObject} css A CSS object that has 'name' and 'value'\n * @returns {string} Either 'true' or 'false'. If value is empty, return 'true'\n */\nfunction assertGetBool (css) {\n const val = css.value?.toLowerCase() || 'true'; // an omitted boolean attribute means 'true' (e.g.: input[checked] means checked is true)\n if (['true', 'false'].includes(val)) {\n return val;\n }\n throw new Error(`'${css.name}' must be true, false or empty. Found '${css.value}'`);\n}\n\n/**\n * Get the canonical form of a CSS attribute name\n *\n * Converts to lowercase and if an attribute name is an alias for something else, return\n * what it is an alias for\n *\n * @param {Object} css CSS object\n * @returns {string} The canonical attribute name\n */\nfunction assertGetAttrName (css) {\n const attrName = css.name.toLowerCase();\n\n // Check if it's supported and if it is, return it\n if (ALL_ATTRS.includes(attrName)) {\n return attrName.toLowerCase();\n }\n\n // If attrName is an alias for something else, return that\n for (const [officialAttr, aliasAttrs] of ATTRIBUTE_ALIASES) {\n if (aliasAttrs.includes(attrName)) {\n return officialAttr;\n }\n }\n throw new Error(`'${attrName}' is not a valid attribute. ` +\n `Supported attributes are '${ALL_ATTRS.join(', ')}'`);\n}\n\n/**\n * Get a regex that matches a whole word. For the ~= CSS attribute selector.\n *\n * @param {string} word\n * @returns {string} A regex \"word\" matcher\n */\nfunction getWordMatcherRegex (word) {\n return `\\\\b(\\\\w*${escapeRegExp(word)}\\\\w*)\\\\b`;\n}\n\n/**\n * @typedef {Object} CssAttr\n * @property {?string} valueType Type of attribute (must be string or empty)\n * @property {?string} value Value of the attribute\n * @property {?string} operator The operator between value and value type (=, *=, , ^=, $=)\n */\n\n/**\n * @typedef {Object} CssRule\n * @property {?string} nestingOperator The nesting operator (aka: combinator https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)\n * @property {?string} tagName The tag name (aka: type selector https://developer.mozilla.org/en-US/docs/Web/CSS/Type_selectors)\n * @property {?string[]} classNames An array of CSS class names\n * @property {?CssAttr[]} attrs An array of CSS attributes\n * @property {?CssPseudo[]} attrs An array of CSS pseudos\n * @property {?string} id CSS identifier\n * @property {?CssRule} rule A descendant of this CSS rule\n */\n\n/**\n * @typedef {Object} CssObject\n * @property {?string} type Type of CSS object. 'rule', 'ruleset' or 'selectors'\n */\n\n/**\n * @typedef {Object} CssPseudo\n * @property {?string} valueType The type of CSS pseudo selector (https://www.npmjs.com/package/css-selector-parser for reference)\n * @property {?string} name The name of the pseudo selector\n * @property {?string} value The value of the pseudo selector\n */\n\nclass CssConverter {\n\n constructor (selector, pkg) {\n this.selector = selector;\n this.pkg = pkg;\n }\n\n /**\n * Add `<pkgName>:id/` prefix to beginning of string if it's not there already\n *\n * @param {string} locator The initial locator\n * @returns {string} String with `<pkgName>:id/` prepended (if it wasn't already)\n */\n formatIdLocator (locator) {\n return ID_LOCATOR_PATTERN.test(locator)\n ? locator\n : `${this.pkg || 'android'}:id/${locator}`;\n }\n\n /**\n * Convert a CSS attribute into a UiSelector method call\n *\n * @param {CssAttr} cssAttr CSS attribute object\n * @returns {string} CSS attribute parsed as UiSelector\n */\n parseAttr (cssAttr) {\n if (cssAttr.valueType && cssAttr.valueType !== 'string') {\n throw new Error(`'${cssAttr.name}=${cssAttr.value}' is an invalid attribute. ` +\n `Only 'string' and empty attribute types are supported. Found '${cssAttr.valueType}'`);\n }\n const attrName = assertGetAttrName(cssAttr);\n const methodName = toSnakeCase(attrName);\n\n // Validate that it's a supported attribute\n if (!STR_ATTRS.includes(attrName) && !BOOLEAN_ATTRS.includes(attrName)) {\n throw new Error(`'${attrName}' is not supported. Supported attributes are ` +\n `'${[...STR_ATTRS, ...BOOLEAN_ATTRS].join(', ')}'`);\n }\n\n // Parse boolean, if it's a boolean attribute\n if (BOOLEAN_ATTRS.includes(attrName)) {\n return `.${methodName}(${assertGetBool(cssAttr)})`;\n }\n\n // Otherwise parse as string\n let value = cssAttr.value || '';\n if (attrName === RESOURCE_ID) {\n value = this.formatIdLocator(value);\n }\n if (value === '') {\n return `.${methodName}Matches(\"\")`;\n }\n\n switch (cssAttr.operator) {\n case '=':\n return `.${methodName}(\"${value}\")`;\n case '*=':\n if (['description', 'text'].includes(attrName)) {\n return `.${methodName}Contains(\"${value}\")`;\n }\n return `.${methodName}Matches(\"${escapeRegExp(value)}\")`;\n case '^=':\n if (['description', 'text'].includes(attrName)) {\n return `.${methodName}StartsWith(\"${value}\")`;\n }\n return `.${methodName}Matches(\"^${escapeRegExp(value)}\")`;\n case '$=':\n return `.${methodName}Matches(\"${escapeRegExp(value)}$\")`;\n case '~=':\n return `.${methodName}Matches(\"${getWordMatcherRegex(value)}\")`;\n default:\n // Unreachable, but adding error in case a new CSS attribute is added.\n throw new Error(`Unsupported CSS attribute operator '${cssAttr.operator}'. ` +\n ` '=', '*=', '^=', '$=' and '~=' are supported.`);\n }\n }\n\n /**\n * Convert a CSS pseudo class to a UiSelector\n *\n * @param {CssPseudo} cssPseudo CSS Pseudo class\n * @returns {string} Pseudo selector parsed as UiSelector\n */\n parsePseudo (cssPseudo) {\n if (cssPseudo.valueType && cssPseudo.valueType !== 'string') {\n throw new Error(`'${cssPseudo.name}=${cssPseudo.value}'. ` +\n `Unsupported css pseudo class value type: '${cssPseudo.valueType}'. Only 'string' type or empty is supported.`);\n }\n\n const pseudoName = assertGetAttrName(cssPseudo);\n\n if (BOOLEAN_ATTRS.includes(pseudoName)) {\n return `.${toSnakeCase(pseudoName)}(${assertGetBool(cssPseudo)})`;\n }\n\n if (NUMERIC_ATTRS.includes(pseudoName)) {\n return `.${pseudoName}(${cssPseudo.value})`;\n }\n }\n\n /**\n * Convert a CSS rule to a UiSelector\n * @param {CssRule} cssRule CSS rule definition\n */\n parseCssRule (cssRule) {\n const { nestingOperator } = cssRule;\n if (nestingOperator && nestingOperator !== ' ') {\n throw new Error(`'${nestingOperator}' is not a supported combinator. ` +\n `Only child combinator (>) and descendant combinator are supported.`);\n }\n\n let uiAutomatorSelector = 'new UiSelector()';\n if (cssRule.tagName && cssRule.tagName !== '*') {\n let androidClass = [cssRule.tagName];\n if (cssRule.classNames) {\n for (const cssClassNames of cssRule.classNames) {\n androidClass.push(cssClassNames);\n }\n uiAutomatorSelector += `.className(\"${androidClass.join('.')}\")`;\n } else {\n uiAutomatorSelector += `.classNameMatches(\"${cssRule.tagName}\")`;\n }\n } else if (cssRule.classNames) {\n uiAutomatorSelector += `.classNameMatches(\"${cssRule.classNames.join('\\\\.')}\")`;\n }\n if (cssRule.id) {\n uiAutomatorSelector += `.resourceId(\"${this.formatIdLocator(cssRule.id)}\")`;\n }\n if (cssRule.attrs) {\n for (const attr of cssRule.attrs) {\n uiAutomatorSelector += this.parseAttr(attr);\n }\n }\n if (cssRule.pseudos) {\n for (const pseudo of cssRule.pseudos) {\n uiAutomatorSelector += this.parsePseudo(pseudo);\n }\n }\n if (cssRule.rule) {\n uiAutomatorSelector += `.childSelector(${this.parseCssRule(cssRule.rule)})`;\n }\n return uiAutomatorSelector;\n }\n\n /**\n * Convert CSS object to UiAutomator2 selector\n * @param {CssObject} css CSS object\n * @returns {string} The CSS object parsed as a UiSelector\n */\n parseCssObject (css) {\n switch (css.type) {\n case 'rule':\n return this.parseCssRule(css);\n case 'ruleSet':\n return this.parseCssObject(css.rule);\n case 'selectors':\n return css.selectors.map((selector) => this.parseCssObject(selector)).join('; ');\n\n default:\n // This is never reachable, but if it ever is do this.\n throw new Error(`UiAutomator does not support '${css.type}' css. Only supports 'rule', 'ruleSet', 'selectors' `);\n }\n }\n\n /**\n * Convert a CSS selector to a UiAutomator2 selector\n *\n * @returns {string} The CSS selector converted to a UiSelector\n */\n toUiAutomatorSelector () {\n let cssObj;\n try {\n cssObj = parser.parse(this.selector);\n } catch (e) {\n throw new errors.InvalidSelectorError(`Invalid CSS selector '${this.selector}'. Reason: '${e}'`);\n }\n try {\n return this.parseCssObject(cssObj);\n } catch (e) {\n throw new errors.InvalidSelectorError(`Unsupported CSS selector '${this.selector}'. Reason: '${e}'`);\n }\n }\n}\n\nexport default CssConverter;"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,MAAMA,MAAM,GAAG,IAAIC,oCAAJ,EAAf;AACAD,MAAM,CAACE,uBAAP,CAA+B,KAA/B;AACAF,MAAM,CAACG,wBAAP,CAAgC,GAAhC,EAAqC,GAArC,EAA0C,GAA1C;AACAH,MAA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LgB;;eAwLJpC,Y"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desired-caps.js","names":["uiautomatorCapConstraints","app","presence","isString","automationName","browserName","launchTimeout","isNumber","skipUnlock","isBoolean","uiautomator2ServerLaunchTimeout","uiautomator2ServerInstallTimeout","uiautomator2ServerReadTimeout","disableWindowAnimation","systemPort","mjpegServerPort","mjpegScreenshotUrl","skipServerInstallation","androidCoverageEndIntent","userProfile","appWaitForLaunch","disableSuppressAccessibilityService","desiredCapConstraints","Object","assign","commonCapConstraints"],"sources":["../../lib/desired-caps.js"],"sourcesContent":["import { commonCapConstraints } from 'appium-android-driver';\n\nlet uiautomatorCapConstraints = {\n app: {\n presence: true,\n isString: true\n },\n automationName: {\n isString: true\n },\n browserName: {\n isString: true\n },\n launchTimeout: {\n isNumber: true\n },\n skipUnlock: {\n isBoolean: true\n },\n uiautomator2ServerLaunchTimeout: {\n isNumber: true\n },\n uiautomator2ServerInstallTimeout: {\n isNumber: true\n },\n uiautomator2ServerReadTimeout: {\n isNumber: true\n },\n disableWindowAnimation: {\n isBoolean: true\n },\n systemPort: {\n isNumber: true\n },\n mjpegServerPort: {\n isNumber: true\n },\n mjpegScreenshotUrl: {\n isString: true\n },\n skipServerInstallation: {\n isBoolean: true\n },\n androidCoverageEndIntent: {\n isString: true\n },\n userProfile: {\n isNumber: true\n },\n appWaitForLaunch: {\n isBoolean: true\n },\n disableSuppressAccessibilityService: {\n isBoolean: true\n }\n};\n\nlet desiredCapConstraints = {};\nObject.assign(\n desiredCapConstraints,\n uiautomatorCapConstraints,\n commonCapConstraints\n);\n\nexport default desiredCapConstraints;\n"],"mappings":";;;;;;;;;AAAA;;AAEA,IAAIA,yBAAyB,GAAG;EAC9BC,GAAG,EAAE;IACHC,QAAQ,EAAE,IADP;IAEHC,QAAQ,EAAE;EAFP,CADyB;EAK9BC,cAAc,EAAE;IACdD,QAAQ,EAAE;EADI,CALc;EAQ9BE,WAAW,EAAE;IACXF,QAAQ,EAAE;EADC,CARiB;EAW9BG,aAAa,EAAE;IACbC,QAAQ,EAAE;EADG,CAXe;EAc9BC,UAAU,EAAE;IACVC,SAAS,EAAE;EADD,CAdkB;EAiB9BC,+BAA+B,EAAE;IAC/BH,QAAQ,EAAE;EADqB,CAjBH;EAoB9BI,gCAAgC,EAAE;IAChCJ,QAAQ,EAAE;EADsB,CApBJ;EAuB9BK,6BAA6B,EAAE;IAC7BL,QAAQ,EAAE;EADmB,CAvBD;EA0B9BM,sBAAsB,EAAE;IACtBJ,SAAS,EAAE;EADW,CA1BM;EA6B9BK,UAAU,EAAE;IACVP,QAAQ,EAAE;EADA,CA7BkB;EAgC9BQ,eAAe,EAAE;IACfR,QAAQ,EAAE;EADK,CAhCa;EAmC9BS,kBAAkB,EAAE;IAClBb,QAAQ,EAAE;EADQ,CAnCU;EAsC9Bc,sBAAsB,EAAE;IACtBR,SAAS,EAAE;EADW,CAtCM;EAyC9BS,wBAAwB,EAAE;IACxBf,QAAQ,EAAE;EADc,CAzCI;EA4C9BgB,WAAW,EAAE;IACXZ,QAAQ,EAAE;EADC,CA5CiB;EA+C9Ba,gBAAgB,EAAE;IAChBX,SAAS,EAAE;EADK,CA/CY;EAkD9BY,mCAAmC,EAAE;IACnCZ,SAAS,EAAE;EADwB;AAlDP,CAAhC;AAuDA,IAAIa,qBAAqB,GAAG,EAA5B;AACAC,MAAM,CAACC,MAAP,CACEF,qBADF,EAEEtB,yBAFF,EAGEyB,yCAHF;eAMeH,qB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.js","names":["helpers","Object","assign","uiautomator2Helpers","androidHelpers","DEVICE_PORT_RANGE","DEVICE_PORT_ALLOCATION_GUARD","util","getLockFileGuard","path","resolve","os","tmpdir","timeout","tryRecovery","DEVICE_PORT","MJPEG_SERVER_DEVICE_PORT","LOCALHOST_IP4","NO_PROXY","RegExp","CHROME_NO_PROXY","MEMOIZED_FUNCTIONS","AndroidUiautomator2Driver","BaseDriver","constructor","opts","shouldValidateCaps","shell","locatorStrategies","desiredCapConstraints","uiautomator2","jwpProxyActive","defaultIME","jwpProxyAvoid","apkStrings","settings","DeviceSettings","ignoreUnimportantViews","allowInvisibleElements","onSettingsUpdate","bind","chromedriver","sessionChromedrivers","fn","_","memoize","validateDesiredCaps","caps","createSession","args","sessionId","serverDetails","platform","webStorageEnabled","takesScreenshot","javascriptEnabled","databaseEnabled","networkConnectionEnabled","locationContextEnabled","warnings","desired","curContext","defaultContextName","defaultOpts","fullReset","autoLaunch","adbPort","DEFAULT_ADB_PORT","androidInstallTimeout","defaults","isChromeSession","log","info","pkg","activity","getChromePkg","browserName","appPackage","appActivity","reboot","setAvdFromCapabilities","app","configureApp","APK_EXTENSION","APKS_EXTENSION","checkAppPresent","startUiAutomator2Session","fillDeviceDetails","mjpegScreenshotUrl","mjpegStream","mjpeg","MJpegStream","start","e","deleteSession","pixelRatio","getDevicePixelRatio","statBarHeight","getStatusBarHeight","viewportRect","getViewPortRect","driverData","getSession","sessionData","debug","uia2Data","jwproxy","command","isEmulator","adb","avd","deviceName","errorAndThrow","platformVersion","avdDevice","replace","allocateSystemPort","forwardPort","localPort","checkPortStatus","systemPort","_hasSystemPortInCaps","startPort","endPort","findAPortNotInUse","releaseSystemPort","removePortForward","allocateMjpegServerPort","mjpegServerPort","releaseMjpegServerPort","udid","emPort","getDeviceInfoFromCaps","createADB","apiLevel","getApiLevel","setHiddenApiPolicy","ignoreHiddenApiPolicyError","hasValue","gpsEnabled","toggleGPSLocationProvider","warn","appInfo","getLaunchInfo","curDeviceId","deviceUDID","initDevice","initUiAutomator2Server","disableWindowAnimation","isAnimationOn","setAnimationState","_wasWindowAnimationDisabled","initAUT","startSession","addDeviceInfoToCaps","skipUnlock","unlock","startChromeSession","ensureAppStarts","orientation","setOrientation","autoWebview","viewName","defaultWebviewName","autoWebviewTimeout","retryInterval","setContext","apiVersion","manufacturer","model","realDisplaySize","displayDensity","mobileGetDeviceInfo","deviceApiLevel","parseInt","deviceScreenSize","deviceScreenDensity","deviceModel","deviceManufacturer","uiautomator2Opts","host","remoteAdbHost","devicePort","apk","tmpDir","disableSuppressAccessibilityService","readTimeout","uiautomator2ServerReadTimeout","UiAutomator2Server","proxyReqRes","proxyCommand","skipServerInstallation","installServerApk","uiautomator2ServerInstallTimeout","addToDeviceIdleWhitelist","SETTINGS_HELPER_PKG_ID","SERVER_PACKAGE_ID","SERVER_TEST_PACKAGE_ID","stderr","message","uninstallOtherPackages","parseArray","otherApps","B","all","map","installOtherApks","noReset","isAppInstalled","noSign","checkApkCert","requireDefaultCert","signApp","skipUninstall","uninstallApk","installApk","fastReset","resetApp","appWaitPackage","appWaitActivity","androidCoverage","processExists","startApp","action","intentAction","category","intentCategory","flags","intentFlags","waitPkg","waitActivity","waitForLaunch","appWaitForLaunch","waitDuration","appWaitDuration","optionalIntentArguments","stopApp","dontStopAppOnReset","retry","user","userProfile","screenRecordingStopTasks","isEmpty","_screenRecordingProperties","stopRecordingScreen","mobileIsMediaProjectionRecordingRunning","mobileStopMediaProjectionRecording","_screenStreamingProps","mobileStopScreenStreaming","removeAllSessionWebSocketHandlers","server","stopChromedriverProxies","err","task","ign","unicodeKeyboard","resetKeyboard","setIME","endAndroidCoverage","androidCoverageEndIntent","broadcast","forceStop","stopLogcat","error","setDefaultHiddenApiPolicy","avdName","killEmulator","stop","fs","exists","wrapBootstrapDisconnect","wrapped","restart","proxyActive","canProxy","getProxyAvoidList","nativeWebScreenshot","isChromeBrowser","cmd","toPairs","androidCommands","prototype","commands"],"sources":["../../lib/driver.js"],"sourcesContent":["import _ from 'lodash';\nimport { BaseDriver, DeviceSettings } from 'appium/driver';\nimport {\n UiAutomator2Server, SERVER_PACKAGE_ID, SERVER_TEST_PACKAGE_ID\n} from './uiautomator2';\nimport { fs, util, mjpeg } from 'appium/support';\nimport { retryInterval } from 'asyncbox';\nimport B from 'bluebird';\nimport commands from './commands/index';\nimport { DEFAULT_ADB_PORT } from 'appium-adb';\nimport uiautomator2Helpers from './helpers';\nimport {\n androidHelpers, androidCommands, SETTINGS_HELPER_PKG_ID\n} from 'appium-android-driver';\nimport desiredCapConstraints from './desired-caps';\nimport { findAPortNotInUse, checkPortStatus } from 'portscanner';\nimport os from 'os';\nimport path from 'path';\nimport { APK_EXTENSION, APKS_EXTENSION } from './extensions';\n\n\nconst helpers = Object.assign({}, uiautomator2Helpers, androidHelpers);\n\n// The range of ports we can use on the system for communicating to the\n// UiAutomator2 HTTP server on the device\nconst DEVICE_PORT_RANGE = [8200, 8299];\n\n// The guard is needed to avoid dynamic system port allocation conflicts for\n// parallel driver sessions\nconst DEVICE_PORT_ALLOCATION_GUARD = util.getLockFileGuard(\n path.resolve(os.tmpdir(), 'uia2_device_port_guard'),\n {timeout: 25, tryRecovery: true}\n);\n\n// This is the port that UiAutomator2 listens to on the device. We will forward\n// one of the ports above on the system to this port on the device.\nconst DEVICE_PORT = 6790;\n// This is the port that the UiAutomator2 MJPEG server listens to on the device.\n// We will forward one of the ports above on the system to this port on the\n// device.\nconst MJPEG_SERVER_DEVICE_PORT = 7810;\n\nconst LOCALHOST_IP4 = '127.0.0.1';\n\n// NO_PROXY contains the paths that we never want to proxy to UiAutomator2 server.\n// TODO: Add the list of paths that we never want to proxy to UiAutomator2 server.\n// TODO: Need to segregate the paths better way using regular expressions wherever applicable.\n// (Not segregating right away because more paths to be added in the NO_PROXY list)\nconst NO_PROXY = [\n ['GET', new RegExp('^/session/(?!.*/)')],\n ['GET', new RegExp('^/session/[^/]+/alert_[^/]+')],\n ['GET', new RegExp('^/session/[^/]+/alert/[^/]+')],\n ['GET', new RegExp('^/session/[^/]+/appium/[^/]+/current_activity')],\n ['GET', new RegExp('^/session/[^/]+/appium/[^/]+/current_package')],\n ['GET', new RegExp('^/session/[^/]+/appium/app/[^/]+')],\n ['GET', new RegExp('^/session/[^/]+/appium/device/[^/]+')],\n ['GET', new RegExp('^/session/[^/]+/appium/settings')],\n ['GET', new RegExp('^/session/[^/]+/context')],\n ['GET', new RegExp('^/session/[^/]+/contexts')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/attribute')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/displayed')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/enabled')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/location_in_view')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/name')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/screenshot')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/selected')],\n ['GET', new RegExp('^/session/[^/]+/ime/[^/]+')],\n ['GET', new RegExp('^/session/[^/]+/location')],\n ['GET', new RegExp('^/session/[^/]+/network_connection')],\n ['GET', new RegExp('^/session/[^/]+/screenshot')],\n ['GET', new RegExp('^/session/[^/]+/timeouts')],\n ['GET', new RegExp('^/session/[^/]+/url')],\n ['POST', new RegExp('^/session/[^/]+/[^/]+_alert$')],\n ['POST', new RegExp('^/session/[^/]+/actions')],\n ['POST', new RegExp('^/session/[^/]+/alert/[^/]+')],\n ['POST', new RegExp('^/session/[^/]+/app/[^/]')],\n ['POST', new RegExp('^/session/[^/]+/appium/[^/]+/start_activity')],\n ['POST', new RegExp('^/session/[^/]+/appium/app/[^/]+')],\n ['POST', new RegExp('^/session/[^/]+/appium/compare_images')],\n ['POST', new RegExp('^/session/[^/]+/appium/device/(?!set_clipboard)[^/]+')],\n ['POST', new RegExp('^/session/[^/]+/appium/element/[^/]+/replace_value')],\n ['POST', new RegExp('^/session/[^/]+/appium/element/[^/]+/value')],\n ['POST', new RegExp('^/session/[^/]+/appium/getPerformanceData')],\n ['POST', new RegExp('^/session/[^/]+/appium/performanceData/types')],\n ['POST', new RegExp('^/session/[^/]+/appium/settings')],\n ['POST', new RegExp('^/session/[^/]+/appium/execute_driver')],\n ['POST', new RegExp('^/session/[^/]+/appium/start_recording_screen')],\n ['POST', new RegExp('^/session/[^/]+/appium/stop_recording_screen')],\n ['POST', new RegExp('^/session/[^/]+/appium/.*event')],\n ['POST', new RegExp('^/session/[^/]+/context')],\n ['POST', new RegExp('^/session/[^/]+/element')],\n ['POST', new RegExp('^/session/[^/]+/ime/[^/]+')],\n ['POST', new RegExp('^/session/[^/]+/keys')],\n ['POST', new RegExp('^/session/[^/]+/location')],\n ['POST', new RegExp('^/session/[^/]+/network_connection')],\n ['POST', new RegExp('^/session/[^/]+/timeouts')],\n ['POST', new RegExp('^/session/[^/]+/touch/multi/perform')],\n ['POST', new RegExp('^/session/[^/]+/touch/perform')],\n ['POST', new RegExp('^/session/[^/]+/url')],\n\n // MJSONWP commands\n ['GET', new RegExp('^/session/[^/]+/log/types')],\n ['POST', new RegExp('^/session/[^/]+/execute')],\n ['POST', new RegExp('^/session/[^/]+/execute_async')],\n ['POST', new RegExp('^/session/[^/]+/log')],\n // W3C commands\n // For Selenium v4 (W3C does not have this route)\n ['GET', new RegExp('^/session/[^/]+/se/log/types')],\n ['GET', new RegExp('^/session/[^/]+/window/rect')],\n ['POST', new RegExp('^/session/[^/]+/execute/async')],\n ['POST', new RegExp('^/session/[^/]+/execute/sync')],\n // For Selenium v4 (W3C does not have this route)\n ['POST', new RegExp('^/session/[^/]+/se/log')],\n];\n\n// This is a set of methods and paths that we never want to proxy to Chromedriver.\nconst CHROME_NO_PROXY = [\n ['GET', new RegExp('^/session/[^/]+/appium')],\n ['GET', new RegExp('^/session/[^/]+/context')],\n ['GET', new RegExp('^/session/[^/]+/element/[^/]+/rect')],\n ['GET', new RegExp('^/session/[^/]+/orientation')],\n ['POST', new RegExp('^/session/[^/]+/appium')],\n ['POST', new RegExp('^/session/[^/]+/context')],\n ['POST', new RegExp('^/session/[^/]+/orientation')],\n ['POST', new RegExp('^/session/[^/]+/touch/multi/perform')],\n ['POST', new RegExp('^/session/[^/]+/touch/perform')],\n\n // this is needed to make the mobile: commands working in web context\n ['POST', new RegExp('^/session/[^/]+/execute$')],\n ['POST', new RegExp('^/session/[^/]+/execute/sync')],\n\n // MJSONWP commands\n ['GET', new RegExp('^/session/[^/]+/log/types$')],\n ['POST', new RegExp('^/session/[^/]+/log$')],\n // W3C commands\n // For Selenium v4 (W3C does not have this route)\n ['GET', new RegExp('^/session/[^/]+/se/log/types$')],\n // For Selenium v4 (W3C does not have this route)\n ['POST', new RegExp('^/session/[^/]+/se/log$')],\n];\n\nconst MEMOIZED_FUNCTIONS = [\n 'getStatusBarHeight',\n 'getDevicePixelRatio',\n];\n\nclass AndroidUiautomator2Driver extends BaseDriver {\n constructor (opts = {}, shouldValidateCaps = true) {\n // `shell` overwrites adb.shell, so remove\n delete opts.shell;\n\n super(opts, shouldValidateCaps);\n this.locatorStrategies = [\n 'xpath',\n 'id',\n 'class name',\n 'accessibility id',\n 'css selector',\n '-android uiautomator'\n ];\n this.desiredCapConstraints = desiredCapConstraints;\n this.uiautomator2 = null;\n this.jwpProxyActive = false;\n this.defaultIME = null;\n this.jwpProxyAvoid = NO_PROXY;\n this.apkStrings = {}; // map of language -> strings obj\n\n this.settings = new DeviceSettings({ignoreUnimportantViews: false, allowInvisibleElements: false},\n this.onSettingsUpdate.bind(this));\n // handle webview mechanics from AndroidDriver\n this.chromedriver = null;\n this.sessionChromedrivers = {};\n\n // memoize functions here, so that they are done on a per-instance basis\n for (const fn of MEMOIZED_FUNCTIONS) {\n this[fn] = _.memoize(this[fn]);\n }\n }\n\n validateDesiredCaps (caps) {\n return super.validateDesiredCaps(caps) && androidHelpers.validateDesiredCaps(caps);\n }\n\n async createSession (...args) {\n try {\n // TODO handle otherSessionData for multiple sessions\n let [sessionId, caps] = await super.createSession(...args);\n\n let serverDetails = {\n platform: 'LINUX',\n webStorageEnabled: false,\n takesScreenshot: true,\n javascriptEnabled: true,\n databaseEnabled: false,\n networkConnectionEnabled: true,\n locationContextEnabled: false,\n warnings: {},\n desired: this.caps,\n };\n\n this.caps = Object.assign(serverDetails, this.caps);\n\n this.curContext = this.defaultContextName();\n\n let defaultOpts = {\n fullReset: false,\n autoLaunch: true,\n adbPort: DEFAULT_ADB_PORT,\n androidInstallTimeout: 90000\n };\n _.defaults(this.opts, defaultOpts);\n\n if (this.isChromeSession) {\n this.log.info(\"We're going to run a Chrome-based session\");\n let {pkg, activity} = helpers.getChromePkg(this.opts.browserName);\n this.opts.appPackage = this.caps.appPackage = pkg;\n this.opts.appActivity = this.caps.appActivity = activity;\n this.log.info(`Chrome-type package and activity are ${pkg} and ${activity}`);\n }\n\n if (this.opts.reboot) {\n this.setAvdFromCapabilities(caps);\n }\n\n if (this.opts.app) {\n // find and copy, or download and unzip an app url or path\n this.opts.app = await this.helpers.configureApp(this.opts.app, [APK_EXTENSION, APKS_EXTENSION]);\n await this.checkAppPresent();\n } else if (this.opts.appPackage) {\n // the app isn't an actual app file but rather something we want to\n // assume is on the device and just launch via the appPackage\n this.log.info(`Starting '${this.opts.appPackage}' directly on the device`);\n } else {\n this.log.info(`Neither 'app' nor 'appPackage' was set. Starting UiAutomator2 ` +\n 'without the target application');\n }\n this.opts.adbPort = this.opts.adbPort || DEFAULT_ADB_PORT;\n\n await this.startUiAutomator2Session();\n await this.fillDeviceDetails();\n if (this.opts.mjpegScreenshotUrl) {\n this.log.info(`Starting MJPEG stream reading URL: '${this.opts.mjpegScreenshotUrl}'`);\n this.mjpegStream = new mjpeg.MJpegStream(this.opts.mjpegScreenshotUrl);\n await this.mjpegStream.start();\n }\n return [sessionId, this.caps];\n } catch (e) {\n await this.deleteSession();\n throw e;\n }\n }\n\n async fillDeviceDetails () {\n this.caps.pixelRatio = await this.getDevicePixelRatio();\n this.caps.statBarHeight = await this.getStatusBarHeight();\n this.caps.viewportRect = await this.getViewPortRect();\n }\n\n get driverData () {\n // TODO fill out resource info here\n return {};\n }\n\n async getSession () {\n let sessionData = await super.getSession();\n this.log.debug('Getting session details from server to mix in');\n let uia2Data = await this.uiautomator2.jwproxy.command('/', 'GET', {});\n return Object.assign({}, sessionData, uia2Data);\n }\n\n isEmulator () {\n return helpers.isEmulator(this.adb, this.opts);\n }\n\n setAvdFromCapabilities (caps) {\n if (this.opts.avd) {\n this.log.info('avd name defined, ignoring device name and platform version');\n } else {\n if (!caps.deviceName) {\n this.log.errorAndThrow('avd or deviceName should be specified when reboot option is enables');\n }\n if (!caps.platformVersion) {\n this.log.errorAndThrow('avd or platformVersion should be specified when reboot option is enabled');\n }\n let avdDevice = caps.deviceName.replace(/[^a-zA-Z0-9_.]/g, '-');\n this.opts.avd = `${avdDevice}__${caps.platformVersion}`;\n }\n }\n\n async allocateSystemPort () {\n const forwardPort = async (localPort) => {\n this.log.debug(`Forwarding UiAutomator2 Server port ${DEVICE_PORT} to local port ${localPort}`);\n if ((await checkPortStatus(localPort, LOCALHOST_IP4)) === 'open') {\n this.log.errorAndThrow(`UiAutomator2 Server cannot start because the local port #${localPort} is busy. ` +\n `Make sure the port you provide via 'systemPort' capability is not occupied. ` +\n `This situation might often be a result of an inaccurate sessions management, e.g. ` +\n `old automation sessions on the same device must always be closed before starting new ones.`);\n }\n await this.adb.forwardPort(localPort, DEVICE_PORT);\n };\n\n if (this.opts.systemPort) {\n this._hasSystemPortInCaps = true;\n return await forwardPort(this.opts.systemPort);\n }\n\n await DEVICE_PORT_ALLOCATION_GUARD(async () => {\n const [startPort, endPort] = DEVICE_PORT_RANGE;\n try {\n this.opts.systemPort = await findAPortNotInUse(startPort, endPort);\n } catch (e) {\n this.log.errorAndThrow(\n `Cannot find any free port in range ${startPort}..${endPort}}. ` +\n `Please set the available port number by providing the systemPort capability or ` +\n `double check the processes that are locking ports within this range and terminate ` +\n `these which are not needed anymore`);\n }\n await forwardPort(this.opts.systemPort);\n });\n }\n\n async releaseSystemPort () {\n if (!this.opts.systemPort || !this.adb) {\n return;\n }\n\n if (this._hasSystemPortInCaps) {\n await this.adb.removePortForward(this.opts.systemPort);\n } else {\n await DEVICE_PORT_ALLOCATION_GUARD(async () => await this.adb.removePortForward(this.opts.systemPort));\n }\n }\n\n async allocateMjpegServerPort () {\n if (this.opts.mjpegServerPort) {\n await this.adb.forwardPort(this.opts.mjpegServerPort, MJPEG_SERVER_DEVICE_PORT);\n }\n }\n\n async releaseMjpegServerPort () {\n if (this.opts.mjpegServerPort) {\n await this.adb.removePortForward(this.opts.mjpegServerPort);\n }\n }\n\n async startUiAutomator2Session () {\n // get device udid for this session\n let {udid, emPort} = await helpers.getDeviceInfoFromCaps(this.opts);\n this.opts.udid = udid;\n this.opts.emPort = emPort;\n\n // now that we know our java version and device info, we can create our\n // ADB instance\n this.adb = await androidHelpers.createADB(this.opts);\n\n const apiLevel = await this.adb.getApiLevel();\n\n if (apiLevel < 21) {\n this.log.errorAndThrow('UIAutomator2 is only supported since Android 5.0 (Lollipop). ' +\n 'You could still use other supported backends in order to automate older Android versions.');\n }\n\n if (apiLevel >= 28) { // Android P\n this.log.info('Relaxing hidden api policy');\n await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);\n }\n\n // check if we have to enable/disable gps before running the application\n if (util.hasValue(this.opts.gpsEnabled)) {\n if (this.isEmulator()) {\n this.log.info(`Trying to ${this.opts.gpsEnabled ? 'enable' : 'disable'} gps location provider`);\n await this.adb.toggleGPSLocationProvider(this.opts.gpsEnabled);\n } else {\n this.log.warn(`Sorry! 'gpsEnabled' capability is only available for emulators`);\n }\n }\n\n // get appPackage et al from manifest if necessary\n const appInfo = await helpers.getLaunchInfo(this.adb, this.opts);\n // and get it onto our 'opts' object so we use it from now on\n Object.assign(this.opts, appInfo || {});\n\n // set actual device name, udid, platform version, screen size, screen density, model and manufacturer details\n this.caps.deviceName = this.adb.curDeviceId;\n this.caps.deviceUDID = this.opts.udid;\n\n // start an avd, set the language/locale, pick an emulator, etc...\n // TODO with multiple devices we'll need to parameterize this\n this.defaultIME = await helpers.initDevice(this.adb, this.opts);\n\n // Prepare the device by forwarding the UiAutomator2 port\n // This call mutates this.opts.systemPort if it is not set explicitly\n await this.allocateSystemPort();\n\n // Prepare the device by forwarding the UiAutomator2 MJPEG server port (if\n // applicable)\n await this.allocateMjpegServerPort();\n\n // set up the modified UiAutomator2 server etc\n await this.initUiAutomator2Server();\n\n // Should be after installing io.appium.settings in helpers.initDevice\n if (this.opts.disableWindowAnimation && (await this.adb.getApiLevel() < 26)) { // API level 26 is Android 8.0.\n // Granting android.permission.SET_ANIMATION_SCALE is necessary to handle animations under API level 26\n // Read https://github.com/appium/appium/pull/11640#issuecomment-438260477\n // `--no-window-animation` works over Android 8 to disable all of animations\n if (await this.adb.isAnimationOn()) {\n this.log.info('Disabling animation via io.appium.settings');\n await this.adb.setAnimationState(false);\n this._wasWindowAnimationDisabled = true;\n } else {\n this.log.info('Window animation is already disabled');\n }\n }\n\n // set up app under test\n // prepare our actual AUT, get it on the device, etc...\n await this.initAUT();\n\n // Adding AUT package name in the capabilities if package name not exist in caps\n if (!this.caps.appPackage && appInfo) {\n this.caps.appPackage = appInfo.appPackage;\n }\n\n // launch UiAutomator2 and wait till its online and we have a session\n await this.uiautomator2.startSession(this.caps);\n\n await this.addDeviceInfoToCaps();\n\n // Unlock the device after the session is started.\n if (!this.opts.skipUnlock) {\n // unlock the device to prepare it for testing\n await helpers.unlock(this, this.adb, this.caps);\n } else {\n this.log.debug(`'skipUnlock' capability set, so skipping device unlock`);\n }\n\n if (this.isChromeSession) { // start a chromedriver session\n await this.startChromeSession(this);\n } else if (this.opts.autoLaunch && this.opts.appPackage) {\n await this.ensureAppStarts();\n }\n\n // if the initial orientation is requested, set it\n if (util.hasValue(this.opts.orientation)) {\n this.log.debug(`Setting initial orientation to '${this.opts.orientation}'`);\n await this.setOrientation(this.opts.orientation);\n }\n\n // if we want to immediately get into a webview, set our context\n // appropriately\n if (this.opts.autoWebview) {\n const viewName = this.defaultWebviewName();\n const timeout = this.opts.autoWebviewTimeout || 2000;\n this.log.info(`Setting auto webview to context '${viewName}' with timeout ${timeout}ms`);\n await retryInterval(timeout / 500, 500, this.setContext.bind(this), viewName);\n }\n\n // now that everything has started successfully, turn on proxying so all\n // subsequent session requests go straight to/from uiautomator2\n this.jwpProxyActive = true;\n }\n\n async addDeviceInfoToCaps () {\n const {\n apiVersion,\n platformVersion,\n manufacturer,\n model,\n realDisplaySize,\n displayDensity,\n } = await this.mobileGetDeviceInfo();\n this.caps.deviceApiLevel = parseInt(apiVersion, 10);\n this.caps.platformVersion = platformVersion;\n this.caps.deviceScreenSize = realDisplaySize;\n this.caps.deviceScreenDensity = displayDensity;\n this.caps.deviceModel = model;\n this.caps.deviceManufacturer = manufacturer;\n }\n\n async initUiAutomator2Server () {\n // broken out for readability\n const uiautomator2Opts = {\n host: this.opts.remoteAdbHost || this.opts.host || LOCALHOST_IP4,\n systemPort: this.opts.systemPort,\n devicePort: DEVICE_PORT,\n adb: this.adb,\n apk: this.opts.app,\n tmpDir: this.opts.tmpDir,\n appPackage: this.opts.appPackage,\n appActivity: this.opts.appActivity,\n disableWindowAnimation: !!this.opts.disableWindowAnimation,\n disableSuppressAccessibilityService: this.opts.disableSuppressAccessibilityService,\n readTimeout: this.opts.uiautomator2ServerReadTimeout,\n };\n // now that we have package and activity, we can create an instance of\n // uiautomator2 with the appropriate options\n this.uiautomator2 = new UiAutomator2Server(this.log, uiautomator2Opts);\n this.proxyReqRes = this.uiautomator2.proxyReqRes.bind(this.uiautomator2);\n this.proxyCommand = this.uiautomator2.proxyCommand.bind(this.uiautomator2);\n\n if (this.opts.skipServerInstallation) {\n this.log.info(`'skipServerInstallation' is set. Skipping UIAutomator2 server installation.`);\n } else {\n await this.uiautomator2.installServerApk(this.opts.uiautomator2ServerInstallTimeout);\n try {\n await this.adb.addToDeviceIdleWhitelist(\n SETTINGS_HELPER_PKG_ID, SERVER_PACKAGE_ID, SERVER_TEST_PACKAGE_ID,\n );\n } catch (e) {\n this.log.warn(`Cannot add server packages to the Doze whitelist. Original error: ` +\n (e.stderr || e.message));\n }\n }\n }\n\n async initAUT () {\n // Uninstall any uninstallOtherPackages which were specified in caps\n if (this.opts.uninstallOtherPackages) {\n await helpers.uninstallOtherPackages(\n this.adb,\n helpers.parseArray(this.opts.uninstallOtherPackages),\n [SETTINGS_HELPER_PKG_ID, SERVER_PACKAGE_ID, SERVER_TEST_PACKAGE_ID]\n );\n }\n\n // Install any \"otherApps\" that were specified in caps\n if (this.opts.otherApps) {\n let otherApps;\n try {\n otherApps = helpers.parseArray(this.opts.otherApps);\n } catch (e) {\n this.log.errorAndThrow(`Could not parse \"otherApps\" capability: ${e.message}`);\n }\n otherApps = await B.all(otherApps\n .map((app) => this.helpers.configureApp(app, [APK_EXTENSION, APKS_EXTENSION])));\n await helpers.installOtherApks(otherApps, this.adb, this.opts);\n }\n\n if (this.opts.app) {\n if (this.opts.noReset && !(await this.adb.isAppInstalled(this.opts.appPackage))\n || !this.opts.noReset) {\n if (!this.opts.noSign && !await this.adb.checkApkCert(this.opts.app, this.opts.appPackage, {\n requireDefaultCert: false,\n })) {\n await helpers.signApp(this.adb, this.opts.app);\n }\n if (!this.opts.skipUninstall) {\n await this.adb.uninstallApk(this.opts.appPackage);\n }\n await helpers.installApk(this.adb, this.opts);\n } else {\n this.log.debug('noReset has been requested and the app is already installed. Doing nothing');\n }\n } else {\n if (this.opts.fullReset) {\n this.log.errorAndThrow('Full reset requires an app capability, use fastReset if app is not provided');\n }\n this.log.debug('No app capability. Assuming it is already on the device');\n if (this.opts.fastReset && this.opts.appPackage) {\n await helpers.resetApp(this.adb, this.opts);\n }\n }\n }\n\n async ensureAppStarts () {\n // make sure we have an activity and package to wait for\n const appWaitPackage = this.opts.appWaitPackage || this.opts.appPackage;\n const appWaitActivity = this.opts.appWaitActivity || this.opts.appActivity;\n\n this.log.info(`Starting '${this.opts.appPackage}/${this.opts.appActivity} ` +\n `and waiting for '${appWaitPackage}/${appWaitActivity}'`);\n\n if (this.caps.androidCoverage) {\n this.log.info(`androidCoverage is configured. ` +\n ` Starting instrumentation of '${this.caps.androidCoverage}'...`);\n await this.adb.androidCoverage(this.caps.androidCoverage, appWaitPackage, appWaitActivity);\n } else {\n if (this.opts.noReset && await this.adb.processExists(this.opts.appPackage)) {\n this.log.info(`'${this.opts.appPackage}' is already running`);\n return;\n }\n await this.adb.startApp({\n pkg: this.opts.appPackage,\n activity: this.opts.appActivity,\n action: this.opts.intentAction || 'android.intent.action.MAIN',\n category: this.opts.intentCategory || 'android.intent.category.LAUNCHER',\n flags: this.opts.intentFlags || '0x10200000', // FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED\n waitPkg: this.opts.appWaitPackage,\n waitActivity: this.opts.appWaitActivity,\n waitForLaunch: this.opts.appWaitForLaunch,\n waitDuration: this.opts.appWaitDuration,\n optionalIntentArguments: this.opts.optionalIntentArguments,\n stopApp: !this.opts.dontStopAppOnReset,\n retry: true,\n user: this.opts.userProfile,\n });\n }\n\n }\n\n async deleteSession () {\n this.log.debug('Deleting UiAutomator2 session');\n\n const screenRecordingStopTasks = [async () => {\n if (!_.isEmpty(this._screenRecordingProperties)) {\n await this.stopRecordingScreen();\n }\n }, async () => {\n if (await this.mobileIsMediaProjectionRecordingRunning()) {\n await this.mobileStopMediaProjectionRecording();\n }\n }, async () => {\n if (!_.isEmpty(this._screenStreamingProps)) {\n await this.mobileStopScreenStreaming();\n }\n }];\n\n await androidHelpers.removeAllSessionWebSocketHandlers(this.server, this.sessionId);\n\n if (this.uiautomator2) {\n try {\n await this.stopChromedriverProxies();\n } catch (err) {\n this.log.warn(`Unable to stop ChromeDriver proxies: ${err.message}`);\n }\n if (this.jwpProxyActive) {\n try {\n await this.uiautomator2.deleteSession();\n } catch (err) {\n this.log.warn(`Unable to proxy deleteSession to UiAutomator2: ${err.message}`);\n }\n }\n this.uiautomator2 = null;\n }\n this.jwpProxyActive = false;\n\n if (this.adb) {\n await B.all(screenRecordingStopTasks.map((task) => {\n (async () => {\n try {\n await task();\n } catch (ign) {}\n })();\n }));\n\n if (this.opts.unicodeKeyboard && this.opts.resetKeyboard && this.defaultIME) {\n this.log.debug(`Resetting IME to '${this.defaultIME}'`);\n try {\n await this.adb.setIME(this.defaultIME);\n } catch (err) {\n this.log.warn(`Unable to reset IME: ${err.message}`);\n }\n }\n if (this.caps.androidCoverage) {\n this.log.info('Shutting down the adb process of instrumentation...');\n await this.adb.endAndroidCoverage();\n // Use this broadcast intent to notify it's time to dump coverage to file\n if (this.caps.androidCoverageEndIntent) {\n this.log.info(`Sending intent broadcast '${this.caps.androidCoverageEndIntent}' at the end of instrumenting.`);\n await this.adb.broadcast(this.caps.androidCoverageEndIntent);\n } else {\n this.log.warn('No androidCoverageEndIntent is configured in caps. Possibly you cannot get coverage file.');\n }\n }\n if (this.opts.appPackage) {\n if (!this.isChromeSession\n && !this.opts.dontStopAppOnReset\n && !this.opts.noReset) {\n try {\n await this.adb.forceStop(this.opts.appPackage);\n } catch (err) {\n this.log.warn(`Unable to force stop app: ${err.message}`);\n }\n }\n if (this.opts.fullReset && !this.opts.skipUninstall) {\n this.log.debug(`Capability 'fullReset' set to 'true', Uninstalling '${this.opts.appPackage}'`);\n try {\n await this.adb.uninstallApk(this.opts.appPackage);\n } catch (err) {\n this.log.warn(`Unable to uninstall app: ${err.message}`);\n }\n }\n }\n // This value can be true if test target device is <= 26\n if (this._wasWindowAnimationDisabled) {\n this.log.info('Restoring window animation state');\n await this.adb.setAnimationState(true);\n }\n await this.adb.stopLogcat();\n try {\n await this.releaseSystemPort();\n } catch (error) {\n this.log.warn(`Unable to remove system port forward: ${error.message}`);\n // Ignore, this block will also be called when we fall in catch block\n // and before even port forward.\n }\n try {\n await this.releaseMjpegServerPort();\n } catch (error) {\n this.log.warn(`Unable to remove MJPEG server port forward: ${error.message}`);\n // Ignore, this block will also be called when we fall in catch block\n // and before even port forward.\n }\n\n if (await this.adb.getApiLevel() >= 28) { // Android P\n this.log.info('Restoring hidden api policy to the device default configuration');\n await this.adb.setDefaultHiddenApiPolicy(!!this.opts.ignoreHiddenApiPolicyError);\n }\n\n if (this.opts.reboot) {\n let avdName = this.opts.avd.replace('@', '');\n this.log.debug(`Closing emulator '${avdName}'`);\n try {\n await this.adb.killEmulator(avdName);\n } catch (err) {\n this.log.warn(`Unable to close emulator: ${err.message}`);\n }\n }\n }\n if (this.mjpegStream) {\n this.log.info('Closing MJPEG stream');\n this.mjpegStream.stop();\n }\n await super.deleteSession();\n }\n\n async checkAppPresent () {\n this.log.debug('Checking whether app is actually present');\n if (!(await fs.exists(this.opts.app))) {\n this.log.errorAndThrow(`Could not find app apk at '${this.opts.app}'`);\n }\n }\n\n async onSettingsUpdate () {\n // intentionally do nothing here, since commands.updateSettings proxies\n // settings to the uiauto2 server already\n }\n\n // Need to override android-driver's version of this since we don't actually\n // have a bootstrap; instead we just restart adb and re-forward the UiAutomator2\n // port\n async wrapBootstrapDisconnect (wrapped) {\n await wrapped();\n await this.adb.restart();\n await this.allocateSystemPort();\n await this.allocateMjpegServerPort();\n }\n\n proxyActive (sessionId) {\n super.proxyActive(sessionId);\n\n // we always have an active proxy to the UiAutomator2 server\n return true;\n }\n\n canProxy (sessionId) {\n super.canProxy(sessionId);\n\n // we can always proxy to the uiautomator2 server\n return true;\n }\n\n getProxyAvoidList (sessionId) {\n super.getProxyAvoidList(sessionId);\n // we are maintaining two sets of NO_PROXY lists, one for chromedriver(CHROME_NO_PROXY)\n // and one for uiautomator2(NO_PROXY), based on current context will return related NO_PROXY list\n if (util.hasValue(this.chromedriver)) {\n // if the current context is webview(chromedriver), then return CHROME_NO_PROXY list\n this.jwpProxyAvoid = CHROME_NO_PROXY;\n } else {\n this.jwpProxyAvoid = NO_PROXY;\n }\n if (this.opts.nativeWebScreenshot) {\n this.jwpProxyAvoid = [...this.jwpProxyAvoid, ['GET', new RegExp('^/session/[^/]+/screenshot')]];\n }\n\n return this.jwpProxyAvoid;\n }\n\n get isChromeSession () {\n return helpers.isChromeBrowser(this.opts.browserName);\n }\n}\n\n// first add the android-driver commands which we will fall back to\nfor (let [cmd, fn] of _.toPairs(androidCommands)) {\n AndroidUiautomator2Driver.prototype[cmd] = fn;\n}\n\n// then overwrite with any uiautomator2-specific commands\nfor (let [cmd, fn] of _.toPairs(commands)) {\n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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","names":["APK_EXTENSION","APKS_EXTENSION"],"sources":["../../lib/extensions.js"],"sourcesContent":["const APK_EXTENSION = '.apk';\nconst APKS_EXTENSION = '.apks';\n\nexport { APK_EXTENSION, APKS_EXTENSION };\n"],"mappings":";;;;;;;;;AAAA,MAAMA,aAAa,GAAG,MAAtB;;AACA,MAAMC,cAAc,GAAG,OAAvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["helpers","ensureInternetPermissionForApp","adb","app","has","hasInternetPermissionFromManifest","msg","Error","isWriteable","filePath","fs","access","W_OK","system","isWindows","close","open","ign","signApp","appPath","path","dirname","sign"],"sources":["../../lib/helpers.js"],"sourcesContent":["import path from 'path';\nimport { fs, system } from 'appium/support';\n\n\nlet helpers = {};\n\nhelpers.ensureInternetPermissionForApp = async function (adb, app) {\n let has = await adb.hasInternetPermissionFromManifest(app);\n if (has) {\n return;\n }\n let msg = 'Your apk does not have INTERNET permissions. Uiautomator2 needs ' +\n 'the internet permission to proceed. Please check if you have ' +\n '<uses-permission android:name=\"android.**permission.INTERNET\"/>' +\n 'in your AndroidManifest.xml';\n throw new Error(msg);\n};\n\nhelpers.isWriteable = async function isWriteable (filePath) {\n try {\n await fs.access(filePath, fs.W_OK);\n if (system.isWindows()) {\n // On operating systems, where access-control policies may\n // limit access to the file system, `fs.access` does not work\n // as expected. See https://groups.google.com/forum/#!topic/nodejs/qmZtIwDRSYo\n // for more details\n await fs.close(await fs.open(filePath, 'r+'));\n }\n return true;\n } catch (ign) {\n return false;\n }\n};\n\nhelpers.signApp = async function (adb, appPath) {\n if (!await this.isWriteable(appPath)) {\n throw new Error(`The application at '${appPath}' is not writeable. ` +\n `Please grant write permissions to this file or to its parent folder '${path.dirname(appPath)}' ` +\n `for the Appium process, so it could sign the application`);\n }\n await adb.sign(appPath);\n};\n\nexport default helpers;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAGA,IAAIA,OAAO,GAAG,EAAd;;AAEAA,OAAO,CAACC,8BAAR,GAAyC,gBAAgBC,GAAhB,EAAqBC,GAArB,EAA0B;EACjE,IAAIC,GAAG,GAAG,MAAMF,GAAG,CAACG,iCAAJ,CAAsCF,GAAtC,CAAhB;;EACA,IAAIC,GAAJ,EAAS;IACP;EACD;;EACD,IAAIE,GAAG,GAAG,qEACA,+DADA,GAEA,iEAFA,GAGA,6BAHV;EAIA,MAAM,IAAIC,KAAJ,CAAUD,GAAV,CAAN;AACD,CAVD;;AAYAN,OAAO,CAACQ,WAAR,GAAsB,eAAeA,WAAf,CAA4BC,QAA5B,EAAsC;EAC1D,IAAI;IACF,MAAMC,WAAA,CAAGC,MAAH,CAAUF,QAAV,EAAoBC,WAAA,CAAGE,IAAvB,CAAN;;IACA,IAAIC,eAAA,CAAOC,SAAP,EAAJ,EAAwB;MAKtB,MAAMJ,WAAA,CAAGK,KAAH,CAAS,MAAML,WAAA,CAAGM,IAAH,CAAQP,QAAR,EAAkB,IAAlB,CAAf,CAAN;IACD;;IACD,OAAO,IAAP;EACD,CAVD,CAUE,OAAOQ,GAAP,EAAY;IACZ,OAAO,KAAP;EACD;AACF,CAdD;;AAgBAjB,OAAO,CAACkB,OAAR,GAAkB,gBAAgBhB,GAAhB,EAAqBiB,OAArB,EAA8B;EAC9C,IAAI,EAAC,MAAM,KAAKX,WAAL,CAAiBW,OAAjB,CAAP,CAAJ,EAAsC;IACpC,MAAM,IAAIZ,KAAJ,CAAW,uBAAsBY,OAAQ,sBAA/B,GACb,wEAAuEC,aAAA,CAAKC,OAAL,CAAaF,OAAb,CAAsB,IADhF,GAEb,0DAFG,CAAN;EAGD;;EACD,MAAMjB,GAAG,CAACoB,IAAJ,CAASH,OAAT,CAAN;AACD,CAPD;;eASenB,O"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","names":["log","logger","getLogger"],"sources":["../../lib/logger.js"],"sourcesContent":["import { logger } from 'appium/support';\n\n\nconst log = logger.getLogger('UiAutomator2');\n\nexport default log;\n"],"mappings":";;;;;;;;;AAAA;;AAGA,MAAMA,GAAG,GAAGC,eAAA,CAAOC,SAAP,CAAiB,cAAjB,CAAZ;;eAEeF,G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiautomator2.js","names":["REQD_PARAMS","SERVER_LAUNCH_TIMEOUT","SERVER_INSTALL_RETRIES","SERVICES_LAUNCH_TIMEOUT","SERVER_PACKAGE_ID","SERVER_TEST_PACKAGE_ID","INSTRUMENTATION_TARGET","instrumentationLogger","logger","getLogger","UIA2Proxy","JWProxy","proxyCommand","url","method","body","didInstrumentationExit","errors","InvalidContextError","UiAutomator2Server","constructor","log","opts","req","util","hasValue","Error","disableSuppressAccessibilityService","proxyOpts","server","host","port","systemPort","keepAlive","readTimeout","timeout","jwproxy","proxyReqRes","bind","command","installServerApk","installTimeout","tmpRoot","tempDir","openDir","packageInfosMapper","appPath","appId","helpers","isWriteable","info","dstPath","path","resolve","basename","fs","copyFile","packagesInfo","B","all","map","apkPath","testApkPath","shouldUninstallServerPackages","shouldInstallServerPackages","isAppInstalled","adb","checkApkCert","signApp","appState","getApplicationInstallState","debug","APP_INSTALL_STATE","OLDER_VERSION_INSTALLED","NEWER_VERSION_INSTALLED","includes","NOT_INSTALLED","uninstallApk","err","warn","message","install","noIncremental","replace","timeoutCapName","rimraf","verifyServicesAvailability","isPmServiceAvailable","pmOutput","pmError","waitForCondition","shell","e","waitMs","intervalMs","error","line","split","startSession","caps","cleanupAutomationLeftovers","skipServerInstallation","serverVersion","uiautomator2ServerLaunchTimeout","timer","timing","Timer","start","retries","maxRetries","delayBetweenRetries","startInstrumentationProcess","errorAndThrow","delay","getDuration","asMilliSeconds","toFixed","capabilities","firstMatch","alwaysMatch","cmd","disableWindowAnimation","push","_","isBoolean","instrumentationProcess","createSubProcess","on","stdout","stderr","output","trim","code","deleteSession","strictCleanup","value","axios","data","activeSessionIds","id","filter","Boolean","length","JSON","stringify","pluralize","delete","forceStop","ignore","killProcessesByName"],"sources":["../../lib/uiautomator2.js"],"sourcesContent":["import _ from 'lodash';\nimport { JWProxy, errors } from 'appium/driver';\nimport { waitForCondition } from 'asyncbox';\nimport {\n SERVER_APK_PATH as apkPath,\n TEST_APK_PATH as testApkPath,\n version as serverVersion\n} from 'appium-uiautomator2-server';\nimport {\n util, logger, tempDir, fs, timing\n} from 'appium/support';\nimport B from 'bluebird';\nimport helpers from './helpers';\nimport axios from 'axios';\nimport path from 'path';\n\nconst REQD_PARAMS = ['adb', 'tmpDir', 'host', 'systemPort', 'devicePort', 'disableWindowAnimation'];\nconst SERVER_LAUNCH_TIMEOUT = 30000;\nconst SERVER_INSTALL_RETRIES = 20;\nconst SERVICES_LAUNCH_TIMEOUT = 30000;\nconst SERVER_PACKAGE_ID = 'io.appium.uiautomator2.server';\nconst SERVER_TEST_PACKAGE_ID = `${SERVER_PACKAGE_ID}.test`;\nconst INSTRUMENTATION_TARGET = `${SERVER_TEST_PACKAGE_ID}/androidx.test.runner.AndroidJUnitRunner`;\nconst instrumentationLogger = logger.getLogger('Instrumentation');\n\nclass UIA2Proxy extends JWProxy {\n async proxyCommand (url, method, body = null) {\n if (this.didInstrumentationExit) {\n throw new errors.InvalidContextError(\n `'${method} ${url}' cannot be proxied to UiAutomator2 server because ` +\n 'the instrumentation process is not running (probably crashed). ' +\n 'Check the server log and/or the logcat output for more details');\n }\n return await super.proxyCommand(url, method, body);\n }\n}\n\nclass UiAutomator2Server {\n constructor (log, opts = {}) {\n for (let req of REQD_PARAMS) {\n if (!opts || !util.hasValue(opts[req])) {\n throw new Error(`Option '${req}' is required!`);\n }\n this[req] = opts[req];\n }\n this.log = log;\n this.disableSuppressAccessibilityService = opts.disableSuppressAccessibilityService;\n const proxyOpts = {\n log,\n server: this.host,\n port: this.systemPort,\n keepAlive: true,\n };\n if (opts.readTimeout && opts.readTimeout > 0) {\n proxyOpts.timeout = opts.readTimeout;\n }\n this.jwproxy = new UIA2Proxy(proxyOpts);\n this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);\n this.proxyCommand = this.jwproxy.command.bind(this.jwproxy);\n this.jwproxy.didInstrumentationExit = false;\n }\n\n /**\n * Installs the apks on to the device or emulator.\n *\n * @param {number} installTimeout - Installation timeout\n */\n async installServerApk (installTimeout = SERVER_INSTALL_RETRIES * 1000) {\n const tmpRoot = await tempDir.openDir();\n const packageInfosMapper = async ({appPath, appId}) => {\n if (await helpers.isWriteable(appPath)) {\n return { appPath, appId };\n }\n\n this.log.info(`Server package at '${appPath}' is not writeable. ` +\n `Will copy it into the temporary location at '${tmpRoot}' as a workaround. ` +\n `Consider making this file writeable manually in order to improve the performance of session startup.`);\n const dstPath = path.resolve(tmpRoot, path.basename(appPath));\n await fs.copyFile(appPath, dstPath);\n return {\n appPath: dstPath,\n appId,\n };\n };\n\n try {\n const packagesInfo = await B.all(B.map([\n {\n appPath: apkPath,\n appId: SERVER_PACKAGE_ID,\n }, {\n appPath: testApkPath,\n appId: SERVER_TEST_PACKAGE_ID,\n },\n ], packageInfosMapper));\n\n let shouldUninstallServerPackages = false;\n let shouldInstallServerPackages = false;\n for (const {appId, appPath} of packagesInfo) {\n if (appId === SERVER_TEST_PACKAGE_ID) {\n const isAppInstalled = await this.adb.isAppInstalled(appId);\n\n // There is no point in getting the state for test server,\n // since it does not contain version info\n if (!await this.adb.checkApkCert(appPath, appId)) {\n await helpers.signApp(this.adb, appPath);\n shouldUninstallServerPackages = shouldUninstallServerPackages || isAppInstalled;\n shouldInstallServerPackages = true;\n }\n\n if (!isAppInstalled) {\n shouldInstallServerPackages = true;\n }\n continue;\n }\n\n const appState = await this.adb.getApplicationInstallState(appPath, appId);\n this.log.debug(`${appId} installation state: ${appState}`);\n if (await this.adb.checkApkCert(appPath, appId)) {\n shouldUninstallServerPackages = shouldUninstallServerPackages || [\n this.adb.APP_INSTALL_STATE.OLDER_VERSION_INSTALLED,\n this.adb.APP_INSTALL_STATE.NEWER_VERSION_INSTALLED,\n ].includes(appState);\n } else {\n await helpers.signApp(this.adb, appPath);\n shouldUninstallServerPackages = shouldUninstallServerPackages || ![\n this.adb.APP_INSTALL_STATE.NOT_INSTALLED,\n ].includes(appState);\n }\n shouldInstallServerPackages = shouldInstallServerPackages || shouldUninstallServerPackages || [\n this.adb.APP_INSTALL_STATE.NOT_INSTALLED,\n ].includes(appState);\n }\n this.log.info(`Server packages are ${shouldInstallServerPackages ? '' : 'not '}going to be (re)installed`);\n if (shouldInstallServerPackages && shouldUninstallServerPackages) {\n this.log.info('Full packages reinstall is going to be performed');\n }\n for (const {appId, appPath} of packagesInfo) {\n if (shouldUninstallServerPackages) {\n try {\n await this.adb.uninstallApk(appId);\n } catch (err) {\n this.log.warn(`Error uninstalling '${appId}': ${err.message}`);\n }\n }\n if (shouldInstallServerPackages) {\n await this.adb.install(appPath, {\n noIncremental: true,\n replace: true,\n timeout: installTimeout,\n timeoutCapName: 'uiautomator2ServerInstallTimeout'\n });\n }\n }\n } finally {\n await fs.rimraf(tmpRoot);\n }\n\n await this.verifyServicesAvailability();\n }\n\n async verifyServicesAvailability () {\n this.log.debug(`Waiting up to ${SERVICES_LAUNCH_TIMEOUT}ms for services to be available`);\n let isPmServiceAvailable = false;\n let pmOutput = '';\n let pmError = null;\n try {\n await waitForCondition(async () => {\n if (!isPmServiceAvailable) {\n pmError = null;\n pmOutput = '';\n try {\n pmOutput = await this.adb.shell(['pm', 'list', 'instrumentation']);\n } catch (e) {\n pmError = e;\n }\n if (pmOutput.includes('Could not access the Package Manager')) {\n pmError = new Error(`Problem running Package Manager: ${pmOutput}`);\n pmOutput = ''; // remove output, so it is not printed below\n } else if (pmOutput.includes(INSTRUMENTATION_TARGET)) {\n pmOutput = ''; // remove output, so it is not printed below\n this.log.debug(`Instrumentation target '${INSTRUMENTATION_TARGET}' is available`);\n // eslint-disable-next-line require-atomic-updates\n isPmServiceAvailable = true;\n } else if (!pmError) {\n pmError = new Error('The instrumentation target is not listed by Package Manager');\n }\n }\n return isPmServiceAvailable;\n }, {\n waitMs: SERVICES_LAUNCH_TIMEOUT,\n intervalMs: 1000,\n });\n } catch (err) {\n this.log.error(`Unable to find instrumentation target '${INSTRUMENTATION_TARGET}': ${(pmError || {}).message}`);\n if (pmOutput) {\n this.log.debug('Available targets:');\n for (const line of pmOutput.split('\\n')) {\n this.log.debug(` ${line.replace('instrumentation:', '')}`);\n }\n }\n }\n }\n\n async startSession (caps) {\n await this.cleanupAutomationLeftovers();\n if (caps.skipServerInstallation) {\n this.log.info(`'skipServerInstallation' is set. Attempting to use UIAutomator2 server from the device`);\n } else {\n this.log.info(`Starting UIAutomator2 server ${serverVersion}`);\n this.log.info(`Using UIAutomator2 server from '${apkPath}' and test from '${testApkPath}'`);\n }\n\n const timeout = caps.uiautomator2ServerLaunchTimeout || SERVER_LAUNCH_TIMEOUT;\n const timer = new timing.Timer().start();\n let retries = 0;\n const maxRetries = 2;\n const delayBetweenRetries = 3000;\n while (retries < maxRetries) {\n this.log.info(`Waiting up to ${timeout}ms for UiAutomator2 to be online...`);\n this.jwproxy.didInstrumentationExit = false;\n await this.startInstrumentationProcess();\n if (!this.jwproxy.didInstrumentationExit) {\n try {\n await waitForCondition(async () => {\n try {\n await this.jwproxy.command('/status', 'GET');\n return true;\n } catch (err) {\n // short circuit to retry or fail fast\n return this.jwproxy.didInstrumentationExit;\n }\n }, {\n waitMs: timeout,\n intervalMs: 1000,\n });\n } catch (err) {\n this.log.errorAndThrow(`The instrumentation process cannot be initialized within ${timeout}ms timeout. `\n + 'Make sure the application under test does not crash and investigate the logcat output. '\n + `You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability`);\n }\n }\n if (!this.jwproxy.didInstrumentationExit) {\n break;\n }\n\n retries++;\n if (retries >= maxRetries) {\n this.log.errorAndThrow('The instrumentation process cannot be initialized. '\n + 'Make sure the application under test does not crash and investigate the logcat output.');\n }\n this.log.warn(`The instrumentation process has been unexpectedly terminated. `\n + `Retrying UiAutomator2 startup (#${retries} of ${maxRetries - 1})`);\n await this.cleanupAutomationLeftovers(true);\n await B.delay(delayBetweenRetries);\n }\n\n this.log.debug(`The initialization of the instrumentation process took `\n + `${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);\n await this.jwproxy.command('/session', 'POST', {\n capabilities: {\n firstMatch: [caps],\n alwaysMatch: {},\n }\n });\n }\n\n async startInstrumentationProcess () {\n const cmd = ['am', 'instrument', '-w'];\n if (this.disableWindowAnimation) {\n cmd.push('--no-window-animation');\n }\n if (_.isBoolean(this.disableSuppressAccessibilityService)) {\n cmd.push('-e', 'DISABLE_SUPPRESS_ACCESSIBILITY_SERVICES', this.disableSuppressAccessibilityService);\n }\n // Disable Google analytics to prevent possible fatal exception\n cmd.push('-e', 'disableAnalytics', true);\n cmd.push(INSTRUMENTATION_TARGET);\n const instrumentationProcess = this.adb.createSubProcess(['shell', ...cmd]);\n instrumentationProcess.on('output', (stdout, stderr) => {\n const output = _.trim(stdout || stderr);\n if (output) {\n instrumentationLogger.debug(output);\n }\n });\n instrumentationProcess.on('exit', (code) => {\n instrumentationLogger.debug(`The process has exited with code ${code}`);\n this.jwproxy.didInstrumentationExit = true;\n });\n await instrumentationProcess.start(0);\n }\n\n async deleteSession () {\n this.log.debug('Deleting UiAutomator2 server session');\n // rely on jwproxy's intelligence to know what we're talking about and\n // delete the current session\n try {\n await this.jwproxy.command('/', 'DELETE');\n } catch (err) {\n this.log.warn(`Did not get confirmation UiAutomator2 deleteSession worked; ` +\n `Error was: ${err}`);\n }\n }\n\n async cleanupAutomationLeftovers (strictCleanup = false) {\n this.log.debug(`Performing ${strictCleanup ? 'strict' : 'shallow'} cleanup of automation leftovers`);\n\n try {\n const {value} = (await axios({\n url: `http://${this.host}:${this.systemPort}/sessions`,\n timeout: 500,\n })).data;\n const activeSessionIds = value.map(({id}) => id).filter(Boolean);\n if (activeSessionIds.length) {\n this.log.debug(`The following obsolete sessions are still running: ${JSON.stringify(activeSessionIds)}`);\n this.log.debug(`Cleaning up ${util.pluralize('obsolete session', activeSessionIds.length, true)}`);\n await B.all(activeSessionIds\n .map((id) => axios.delete(`http://${this.host}:${this.systemPort}/session/${id}`))\n );\n // Let all sessions to be properly terminated before continuing\n await B.delay(1000);\n } else {\n this.log.debug('No obsolete sessions have been detected');\n }\n } catch (e) {\n this.log.debug(`No obsolete sessions have been detected (${e.message})`);\n }\n\n try {\n await this.adb.forceStop(SERVER_TEST_PACKAGE_ID);\n } catch (ignore) {}\n if (!strictCleanup) {\n return;\n }\n // https://github.com/appium/appium/issues/10749\n try {\n await this.adb.killProcessesByName('uiautomator');\n } catch (ignore) {}\n }\n}\n\nexport { UiAutomator2Server, INSTRUMENTATION_TARGET, SERVER_PACKAGE_ID, SERVER_TEST_PACKAGE_ID };\nexport default UiAutomator2Server;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAKA;;AAGA;;AACA;;AACA;;AACA;;AAEA,MAAMA,WAAW,GAAG,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,YAA1B,EAAwC,YAAxC,EAAsD,wBAAtD,CAApB;AACA,MAAMC,qBAAqB,GAAG,KAA9B;AACA,MAAMC,sBAAsB,GAAG,EAA/B;AACA,MAAMC,uBAAuB,GAAG,KAAhC;AACA,MAAMC,iBAAiB,GAAG,+BAA1B;;AACA,MAAMC,sBAAsB,GAAI,GAAED,iBAAkB,OAApD;;AACA,MAAME,sBAAsB,GAAI,GAAED,sBAAuB,0CAAzD;;;AACA,MAAME,qBAAqB,GAAGC,eAAA,CAAOC,SAAP,CAAiB,iBAAjB,CAA9B;;AAEA,MAAMC,SAAN,SAAwBC,eAAxB,CAAgC;EACZ,MAAZC,YAAY,CAAEC,GAAF,EAAOC,MAAP,EAAeC,IAAI,GAAG,IAAtB,EAA4B;IAC5C,IAAI,KAAKC,sBAAT,EAAiC;MAC/B,MAAM,IAAIC,cAAA,CAAOC,mBAAX,CACH,IAAGJ,MAAO,IAAGD,GAAI,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