appium-espresso-driver 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/LICENSE +201 -0
- package/README.md +864 -0
- package/build/index.js +48 -0
- package/build/lib/commands/execute.js +67 -0
- package/build/lib/commands/general.js +337 -0
- package/build/lib/commands/idling-resources.js +31 -0
- package/build/lib/commands/index.js +26 -0
- package/build/lib/commands/services.js +27 -0
- package/build/lib/desired-caps.js +65 -0
- package/build/lib/driver.js +475 -0
- package/build/lib/espresso-runner.js +381 -0
- package/build/lib/logger.js +18 -0
- package/build/lib/server-builder.js +213 -0
- package/build/lib/server.js +39 -0
- package/build/lib/utils.js +85 -0
- package/espresso-server/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +0 -0
- package/espresso-server/app/build/outputs/apk/androidTest/debug/output-metadata.json +18 -0
- package/espresso-server/app/build.gradle.kts +153 -0
- package/espresso-server/app/proguard-rules.pro +25 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/EspressoServerRunnerTest.kt +93 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/drivers/AppDriver.kt +29 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/drivers/ComposeDriver.kt +73 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/drivers/DriverContext.kt +35 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/drivers/EspressoDriver.kt +70 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/AcceptAlert.kt +32 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Back.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Clear.kt +40 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Click.kt +27 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/CreateSession.kt +58 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/DeleteSession.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/DismissAlert.kt +32 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/DrawerActionHandler.kt +45 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ElementEquals.kt +19 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ElementScreenshot.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ElementValue.kt +85 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/FindActive.kt +32 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/FindElement.kt +29 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/FindElements.kt +43 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetAlertText.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetAttribute.kt +101 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetClipboard.kt +65 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetDeviceInfo.kt +44 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetDisplayed.kt +28 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetEnabled.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetLocation.kt +32 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetLocationInView.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetName.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetOrientation.kt +44 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetRect.kt +38 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetRotation.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetSelected.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetSession.kt +34 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetSessions.kt +41 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetSettings.kt +25 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetSize.kt +32 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetToastVisibility.kt +34 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetWindowRect.kt +43 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/GetWindowSize.kt +42 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/HideKeyboard.kt +29 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Keys.kt +82 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ListIdlingResources.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/MobileBackdoor.kt +42 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/MobileClickAction.kt +49 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/MobileSwipe.kt +71 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/MobileViewFlash.kt +50 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/MoveTo.kt +50 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/MultiTouchAction.kt +50 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/NavigateTo.kt +42 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/NoSessionCommandHandler.kt +4 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/NotYetImplemented.kt +28 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/OpenNotifications.kt +28 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/PerformAction.kt +42 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/PerformAutofillDismissal.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/PerformEditorAction.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/PointerEventHandler.kt +281 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/PressKeyCode.kt +90 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/RegisterIdlingResources.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ReleaseActions.kt +41 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/RequestHandler.kt +43 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ScreenshotHandler.kt +29 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/ScrollToPage.kt +60 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/SetClipboard.kt +64 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/SetDate.kt +41 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/SetOrientation.kt +61 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/SetRotation.kt +46 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/SetTime.kt +41 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Source.kt +29 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/StartActivity.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/StartService.kt +40 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Status.kt +26 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/StopService.kt +37 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Text.kt +28 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/TouchAction.kt +49 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/Uiautomator.kt +68 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/UiautomatorPageSource.kt +35 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/UnregisterIdlingResources.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/UpdateSettings.kt +35 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/WebAtoms.kt +69 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/AppiumException.kt +40 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/DuplicateRouteException.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/ElementNotVisibleException.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/InvalidArgumentException.kt +35 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/InvalidElementStateException.kt +41 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/InvalidSelectorException.kt +35 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/MoveTargetOutOfBoundsException.kt +39 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/NoAlertOpenException.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/NoSuchDriverException.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/NoSuchElementException.kt +34 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/NotYetImplementedException.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/ScreenCaptureException.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/SessionNotCreatedException.kt +34 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/StaleElementException.kt +30 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/exceptions/XPathLookupException.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/AccessibilityServiceState.kt +15 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ActivityHelpers.kt +125 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ActivityOptionsHelpers.kt +60 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/AlertHelpers.kt +170 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/AndroidLogger.kt +45 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/AssertHelpers.kt +17 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/AutofillHelpers.kt +44 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/BackdoorUtils.java +49 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ClipboardHelper.kt +51 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ComposeNodeFinder.kt +59 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/DeviceInfoHelper.kt +148 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/EspressoViewsCache.kt +57 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/GsonParserHelpers.kt +72 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/IMEHelpers.kt +88 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/IntentHelpers.kt +336 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/InteractionHelper.kt +40 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/InvocationOperation.java +80 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/LocaleHelpers.kt +46 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/Logger.kt +25 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/NotificationListener.kt +87 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/Rect.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ReflectionUtils.kt +64 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ScreenshotsHelper.kt +59 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/StringHelpers.kt +42 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ThreadHelpers.kt +15 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/UiAutomationWrapper.kt +48 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/ViewFinder.kt +316 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/XMLHelpers.kt +56 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/extensions/Semaphore.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/reflection/ArrayUtils.java +110 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/reflection/ClassUtils.java +180 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/reflection/MethodUtils.java +155 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/reflection/Validate.java +34 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/BaseW3CActionAdapter.kt +71 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/DummyW3CActionAdapter.kt +133 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/W3CActionAdapter.kt +71 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/AndroidKeyEvent.kt +271 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/AndroidMotionEvent.kt +90 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/EspressoW3CActionAdapter.kt +147 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/Helpers.kt +71 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/MotionEventBuilder.kt +153 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/MultiTouchState.kt +132 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/adapter/espresso/TouchState.kt +7 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/caps/CapsUtils.kt +96 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/BaseDispatchResult.kt +14 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/DispatchPointerMoveResult.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/KeyDispatch.kt +151 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/PointerDispatch.kt +286 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/W3CKeyEvent.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/constants/KeyCodeMapper.kt +169 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/constants/KeyLocationMapper.kt +50 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/constants/KeyNormalizer.kt +84 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/dispatcher/constants/NormalizedKeys.kt +60 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/ActionObject.kt +138 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/ActionSequence.kt +112 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/Actions.kt +89 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/InputSource.kt +173 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/Origin.kt +24 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/OriginDeserializer.kt +25 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/models/Tick.kt +62 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/processor/ActionsProcessor.kt +93 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/processor/KeyProcessor.kt +57 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/processor/PauseProcessor.kt +59 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/processor/PointerProcessor.kt +115 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/processor/ProcessorHelpers.kt +35 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/state/ActiveInputSources.kt +62 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/state/InputState.kt +6 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/state/InputStateTable.kt +95 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/state/KeyInputState.kt +82 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/helpers/w3c/state/PointerInputState.kt +45 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/RouteDefinition.kt +67 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/RouteMap.kt +51 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/Router.kt +250 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/Server.kt +109 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/response/AppiumResponse.kt +61 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/http/response/BaseResponse.kt +25 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/AlertParams.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/AppiumParams.kt +55 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/BackdoorMethodArg.kt +3 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ClipboardDataType.kt +18 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/DrawerActionParams.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/EditorActionParams.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/Element.kt +169 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/GetClipboardParams.kt +27 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/GlobalSession.kt +64 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/HamcrestMatcher.kt +144 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/IdlingResourcesParams.kt +66 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/KeyEventParams.kt +23 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/LocaleParams.kt +34 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/Location.kt +19 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/Locator.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MatcherJson.kt +37 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MobileBackdoorMethod.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MobileBackdoorParams.kt +20 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MobileClickActionParams.kt +81 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MobileSwipeParams.kt +106 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MotionEventParams.kt +37 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MoveToParams.kt +26 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/MultiTouchActionsParams.kt +5 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/NavigateToParams.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/OrientationParams.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/OrientationType.kt +6 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/Rect.kt +24 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/RotationParams.kt +38 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ScrollToPageParams.kt +36 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/SessionParams.kt +23 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/SetClipboardParams.kt +29 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/SetDateParams.kt +23 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/SetTimeParams.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/SettingsParams.kt +19 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/Size.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/SourceDocument.kt +286 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/StartActivityParams.kt +9 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/StartServiceParams.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/StopServiceParams.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/Strategy.kt +49 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/TextValueParams.kt +6 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ToastLookupParams.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/TouchAction.kt +178 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/TouchActionsParams.kt +5 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/UiautomatorParams.kt +123 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ViewAttributesEnum.kt +51 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ViewElement.kt +204 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ViewFlashParams.kt +9 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/ViewText.kt +12 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/WindowRect.kt +24 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/WindowSize.kt +22 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/settings/AbstractSetting.kt +23 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/settings/DriverSetting.kt +40 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/settings/SettingType.kt +21 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/web/WebAtom.kt +26 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/web/WebAtomDeserializer.kt +99 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/web/WebAtomsMethods.kt +4 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/model/web/WebAtomsParams.kt +9 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewaction/OrientationChange.kt +47 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewaction/ScrollTo.kt +48 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewaction/UiControllerPerformer.kt +67 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewaction/UiControllerRunnable.kt +25 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewaction/ViewGetter.kt +79 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewaction/ViewTextGetter.kt +31 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewmatcher/RegexpTextMatcher.kt +38 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewmatcher/WithView.kt +33 -0
- package/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/viewmatcher/WithXPath.kt +55 -0
- package/espresso-server/app/src/main/AndroidManifest.xml +7 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/assets/Helpers.kt +20 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/assets/backdoor-methods.json +51 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/assets/key-actions.json +15 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/assets/multi-touch-actions.json +28 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/GsonParserHelpersTest.kt +41 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/IntentCreationTests.kt +115 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/InvocationOperationTest.java +97 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/KReflectionUtilsTest.kt +108 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/XpathQueryParserTests.kt +42 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/ActionSequenceTest.kt +220 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/ActionsTest.kt +76 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/CapsUtilsTest.kt +76 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/Helpers.kt +7 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/InputSourceTest.kt +153 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/InputStateTableTest.kt +72 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/KeyDispatchTest.kt +133 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/KeyInputStateTest.kt +74 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/PointerDispatchTest.kt +370 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/ProcessorTest.kt +320 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/TickTest.kt +265 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/adapter/AndroidKeyEventTest.kt +114 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/helpers/w3c/adapter/HelpersTest.kt +31 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/http/RouteDefinitionTest.kt +74 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/HamcrestMatcherTest.kt +112 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/MatcherJsonTest.kt +20 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/MobileBackdoorMethodTest.java +110 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/MobileClickTest.kt +46 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/MobileSwipeTest.kt +68 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/TouchActionTest.kt +56 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/web/WebAtomTest.kt +68 -0
- package/espresso-server/app/src/test/java/io/appium/espressoserver/test/model/web/WebAtomsTest.kt +96 -0
- package/espresso-server/build.gradle.kts +33 -0
- package/espresso-server/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/espresso-server/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/espresso-server/gradle.properties +26 -0
- package/espresso-server/gradlew +185 -0
- package/espresso-server/gradlew.bat +89 -0
- package/espresso-server/lint.xml +4 -0
- package/espresso-server/settings.gradle.kts +1 -0
- package/index.js +29 -0
- package/lib/commands/execute.js +72 -0
- package/lib/commands/general.js +321 -0
- package/lib/commands/idling-resources.js +52 -0
- package/lib/commands/index.js +16 -0
- package/lib/commands/services.js +50 -0
- package/lib/desired-caps.js +55 -0
- package/lib/driver.js +566 -0
- package/lib/espresso-runner.js +340 -0
- package/lib/logger.js +6 -0
- package/lib/server-builder.js +194 -0
- package/lib/server.js +18 -0
- package/lib/utils.js +74 -0
- package/package.json +105 -0
package/lib/driver.js
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { BaseDriver, errors, isErrorType, DeviceSettings} from 'appium-base-driver';
|
|
3
|
+
import { EspressoRunner, TEST_APK_PKG } from './espresso-runner';
|
|
4
|
+
import { fs } from 'appium-support';
|
|
5
|
+
import logger from './logger';
|
|
6
|
+
import commands from './commands';
|
|
7
|
+
import { DEFAULT_ADB_PORT } from 'appium-adb';
|
|
8
|
+
import { androidHelpers, androidCommands, SETTINGS_HELPER_PKG_ID } from 'appium-android-driver';
|
|
9
|
+
import desiredCapConstraints from './desired-caps';
|
|
10
|
+
import { version } from '../../package.json'; // eslint-disable-line import/no-unresolved
|
|
11
|
+
import { findAPortNotInUse } from 'portscanner';
|
|
12
|
+
import { retryInterval } from 'asyncbox';
|
|
13
|
+
import { qualifyActivityName } from './utils';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// TODO merge our own helpers onto this later
|
|
17
|
+
const helpers = androidHelpers;
|
|
18
|
+
|
|
19
|
+
// The range of ports we can use on the system for communicating to the
|
|
20
|
+
// Espresso HTTP server on the device
|
|
21
|
+
const SYSTEM_PORT_RANGE = [8300, 8399];
|
|
22
|
+
|
|
23
|
+
// This is the port that the espresso server listens to on the device. We will
|
|
24
|
+
// forward one of the ports above on the system to this port on the device.
|
|
25
|
+
const DEVICE_PORT = 6791;
|
|
26
|
+
|
|
27
|
+
// NO_PROXY contains the paths that we never want to proxy to espresso server.
|
|
28
|
+
// TODO: Add the list of paths that we never want to proxy to espresso server.
|
|
29
|
+
// TODO: Need to segregate the paths better way using regular expressions wherever applicable.
|
|
30
|
+
// (Not segregating right away because more paths to be added in the NO_PROXY list)
|
|
31
|
+
const NO_PROXY = [
|
|
32
|
+
['GET', new RegExp('^/session/(?!.*/)')],
|
|
33
|
+
['GET', new RegExp('^/session/[^/]+/appium/device/current_activity')],
|
|
34
|
+
['GET', new RegExp('^/session/[^/]+/appium/device/current_package')],
|
|
35
|
+
['GET', new RegExp('^/session/[^/]+/appium/device/display_density')],
|
|
36
|
+
['GET', new RegExp('^/session/[^/]+/appium/device/is_keyboard_shown')],
|
|
37
|
+
['GET', new RegExp('^/session/[^/]+/appium/device/system_bars')],
|
|
38
|
+
['GET', new RegExp('^/session/[^/]+/appium/device/system_time')],
|
|
39
|
+
['GET', new RegExp('^/session/[^/]+/appium/settings')],
|
|
40
|
+
['GET', new RegExp('^/session/[^/]+/context')],
|
|
41
|
+
['GET', new RegExp('^/session/[^/]+/contexts')],
|
|
42
|
+
['GET', new RegExp('^/session/[^/]+/ime/[^/]+')],
|
|
43
|
+
['GET', new RegExp('^/session/[^/]+/log/types')],
|
|
44
|
+
['GET', new RegExp('^/session/[^/]+/network_connection')],
|
|
45
|
+
['GET', new RegExp('^/session/[^/]+/timeouts')],
|
|
46
|
+
['GET', new RegExp('^/session/[^/]+/url')],
|
|
47
|
+
['POST', new RegExp('^/session/[^/]+/appium/app/background')],
|
|
48
|
+
['POST', new RegExp('^/session/[^/]+/appium/app/close')],
|
|
49
|
+
['POST', new RegExp('^/session/[^/]+/appium/app/launch')],
|
|
50
|
+
['POST', new RegExp('^/session/[^/]+/appium/app/reset')],
|
|
51
|
+
['POST', new RegExp('^/session/[^/]+/appium/app/strings')],
|
|
52
|
+
['POST', new RegExp('^/session/[^/]+/appium/compare_images')],
|
|
53
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/activate_app')],
|
|
54
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/app_installed')],
|
|
55
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/app_state')],
|
|
56
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/get_clipboard')],
|
|
57
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/install_app')],
|
|
58
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/is_locked')],
|
|
59
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/lock')],
|
|
60
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/pull_file')],
|
|
61
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/pull_folder')],
|
|
62
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/push_file')],
|
|
63
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/remove_app')],
|
|
64
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/start_activity')],
|
|
65
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/terminate_app')],
|
|
66
|
+
['POST', new RegExp('^/session/[^/]+/appium/device/unlock')],
|
|
67
|
+
['POST', new RegExp('^/session/[^/]+/appium/getPerformanceData')],
|
|
68
|
+
['POST', new RegExp('^/session/[^/]+/appium/performanceData/types')],
|
|
69
|
+
['POST', new RegExp('^/session/[^/]+/appium/settings')],
|
|
70
|
+
['POST', new RegExp('^/session/[^/]+/appium/execute_driver')],
|
|
71
|
+
['POST', new RegExp('^/session/[^/]+/appium/start_recording_screen')],
|
|
72
|
+
['POST', new RegExp('^/session/[^/]+/appium/stop_recording_screen')],
|
|
73
|
+
['POST', new RegExp('^/session/[^/]+/context')],
|
|
74
|
+
['POST', new RegExp('^/session/[^/]+/execute')],
|
|
75
|
+
['POST', new RegExp('^/session/[^/]+/execute/async')],
|
|
76
|
+
['POST', new RegExp('^/session/[^/]+/execute/sync')],
|
|
77
|
+
['POST', new RegExp('^/session/[^/]+/execute_async')],
|
|
78
|
+
['POST', new RegExp('^/session/[^/]+/ime/[^/]+')],
|
|
79
|
+
['POST', new RegExp('^/session/[^/]+/location')],
|
|
80
|
+
['POST', new RegExp('^/session/[^/]+/log')],
|
|
81
|
+
['POST', new RegExp('^/session/[^/]+/network_connection')],
|
|
82
|
+
['POST', new RegExp('^/session/[^/]+/timeouts')],
|
|
83
|
+
['POST', new RegExp('^/session/[^/]+/url')],
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
// This is a set of methods and paths that we never want to proxy to Chromedriver.
|
|
87
|
+
const CHROME_NO_PROXY = [
|
|
88
|
+
['GET', new RegExp('^/session/[^/]+/appium')],
|
|
89
|
+
['GET', new RegExp('^/session/[^/]+/context')],
|
|
90
|
+
['GET', new RegExp('^/session/[^/]+/element/[^/]+/rect')],
|
|
91
|
+
['GET', new RegExp('^/session/[^/]+/orientation')],
|
|
92
|
+
['POST', new RegExp('^/session/[^/]+/appium')],
|
|
93
|
+
['POST', new RegExp('^/session/[^/]+/context')],
|
|
94
|
+
['POST', new RegExp('^/session/[^/]+/orientation')],
|
|
95
|
+
['POST', new RegExp('^/session/[^/]+/touch/multi/perform')],
|
|
96
|
+
['POST', new RegExp('^/session/[^/]+/touch/perform')],
|
|
97
|
+
|
|
98
|
+
// this is needed to make the mobile: commands working in web context
|
|
99
|
+
['POST', new RegExp('^/session/[^/]+/execute$')],
|
|
100
|
+
['POST', new RegExp('^/session/[^/]+/execute/sync')],
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
const APP_EXTENSION = '.apk';
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class EspressoDriver extends BaseDriver {
|
|
107
|
+
constructor (opts = {}, shouldValidateCaps = true) {
|
|
108
|
+
// `shell` overwrites adb.shell, so remove
|
|
109
|
+
delete opts.shell;
|
|
110
|
+
|
|
111
|
+
super(opts, shouldValidateCaps);
|
|
112
|
+
this.locatorStrategies = [
|
|
113
|
+
'id',
|
|
114
|
+
'class name',
|
|
115
|
+
'accessibility id',
|
|
116
|
+
];
|
|
117
|
+
this.desiredCapConstraints = desiredCapConstraints;
|
|
118
|
+
this.espresso = null;
|
|
119
|
+
this.jwpProxyActive = false;
|
|
120
|
+
this.defaultIME = null;
|
|
121
|
+
this.jwpProxyAvoid = NO_PROXY;
|
|
122
|
+
|
|
123
|
+
this.apkStrings = {}; // map of language -> strings obj
|
|
124
|
+
this.settings = new DeviceSettings({}, this.onSettingsUpdate.bind(this));
|
|
125
|
+
|
|
126
|
+
this.chromedriver = null;
|
|
127
|
+
this.sessionChromedrivers = {};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async createSession (...args) {
|
|
131
|
+
try {
|
|
132
|
+
// TODO handle otherSessionData for multiple sessions
|
|
133
|
+
let [sessionId, caps] = await super.createSession(...args);
|
|
134
|
+
|
|
135
|
+
let serverDetails = {
|
|
136
|
+
platform: 'LINUX',
|
|
137
|
+
webStorageEnabled: false,
|
|
138
|
+
takesScreenshot: true,
|
|
139
|
+
javascriptEnabled: true,
|
|
140
|
+
databaseEnabled: false,
|
|
141
|
+
networkConnectionEnabled: true,
|
|
142
|
+
locationContextEnabled: false,
|
|
143
|
+
warnings: {},
|
|
144
|
+
desired: Object.assign({}, this.caps)
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
this.caps = Object.assign(serverDetails, this.caps);
|
|
148
|
+
|
|
149
|
+
this.curContext = this.defaultContextName();
|
|
150
|
+
|
|
151
|
+
let defaultOpts = {
|
|
152
|
+
fullReset: false,
|
|
153
|
+
autoLaunch: true,
|
|
154
|
+
adbPort: DEFAULT_ADB_PORT,
|
|
155
|
+
androidInstallTimeout: 90000
|
|
156
|
+
};
|
|
157
|
+
_.defaults(this.opts, defaultOpts);
|
|
158
|
+
|
|
159
|
+
if (this.isChromeSession) {
|
|
160
|
+
if (this.opts.app) {
|
|
161
|
+
logger.warn(`
|
|
162
|
+
'browserName' capability will be ignored.
|
|
163
|
+
Chrome browser cannot be run in Espresso sessions because Espresso automation doesn't have permission to access Chrome.
|
|
164
|
+
`);
|
|
165
|
+
} else {
|
|
166
|
+
logger.errorAndThrow(`Chrome browser sessions cannot be run in Espresso because Espresso automation doesn't have permission to access Chrome`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (this.opts.reboot) {
|
|
171
|
+
this.setAvdFromCapabilities(caps);
|
|
172
|
+
this.addWipeDataToAvdArgs();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (this.opts.app) {
|
|
176
|
+
// find and copy, or download and unzip an app url or path
|
|
177
|
+
this.opts.app = await this.helpers.configureApp(this.opts.app, APP_EXTENSION);
|
|
178
|
+
await this.checkAppPresent();
|
|
179
|
+
} else if (this.appOnDevice) {
|
|
180
|
+
// the app isn't an actual app file but rather something we want to
|
|
181
|
+
// assume is on the device and just launch via the appPackage
|
|
182
|
+
logger.info(`App file was not listed, instead we're going to run ` +
|
|
183
|
+
`${this.opts.appPackage} directly on the device`);
|
|
184
|
+
await this.checkPackagePresent();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
this.opts.systemPort = this.opts.systemPort || await findAPortNotInUse(SYSTEM_PORT_RANGE[0], SYSTEM_PORT_RANGE[1]);
|
|
188
|
+
this.opts.adbPort = this.opts.adbPort || DEFAULT_ADB_PORT;
|
|
189
|
+
await this.startEspressoSession();
|
|
190
|
+
return [sessionId, caps];
|
|
191
|
+
} catch (e) {
|
|
192
|
+
await this.deleteSession();
|
|
193
|
+
e.message += '. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.';
|
|
194
|
+
if (isErrorType(e, errors.SessionNotCreatedError)) {
|
|
195
|
+
throw e;
|
|
196
|
+
}
|
|
197
|
+
const err = new errors.SessionNotCreatedError(e.message);
|
|
198
|
+
err.stack = e.stack;
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
get driverData () {
|
|
204
|
+
// TODO fille out resource info here
|
|
205
|
+
return {};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
isEmulator () {
|
|
209
|
+
return helpers.isEmulator(this.adb, this.opts);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// TODO this method is duplicated from uiautomator2-driver; consolidate
|
|
213
|
+
setAvdFromCapabilities (caps) {
|
|
214
|
+
if (this.opts.avd) {
|
|
215
|
+
logger.info('avd name defined, ignoring device name and platform version');
|
|
216
|
+
} else {
|
|
217
|
+
if (!caps.deviceName) {
|
|
218
|
+
logger.errorAndThrow('avd or deviceName should be specified when reboot option is enables');
|
|
219
|
+
}
|
|
220
|
+
if (!caps.platformVersion) {
|
|
221
|
+
logger.errorAndThrow('avd or platformVersion should be specified when reboot option is enabled');
|
|
222
|
+
}
|
|
223
|
+
let avdDevice = caps.deviceName.replace(/[^a-zA-Z0-9_.]/g, '-');
|
|
224
|
+
this.opts.avd = `${avdDevice}__${caps.platformVersion}`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// TODO this method is duplicated from uiautomator2-driver; consolidate
|
|
229
|
+
addWipeDataToAvdArgs () {
|
|
230
|
+
if (!this.opts.avdArgs) {
|
|
231
|
+
this.opts.avdArgs = '-wipe-data';
|
|
232
|
+
} else if (!this.opts.avdArgs.toLowerCase().includes('-wipe-data')) {
|
|
233
|
+
this.opts.avdArgs += ' -wipe-data';
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// TODO much of this logic is duplicated from uiautomator2
|
|
238
|
+
async startEspressoSession () {
|
|
239
|
+
logger.info(`EspressoDriver version: ${version}`);
|
|
240
|
+
|
|
241
|
+
// get device udid for this session
|
|
242
|
+
let {udid, emPort} = await helpers.getDeviceInfoFromCaps(this.opts);
|
|
243
|
+
this.opts.udid = udid;
|
|
244
|
+
this.opts.emPort = emPort;
|
|
245
|
+
|
|
246
|
+
// now that we know our java version and device info, we can create our
|
|
247
|
+
// ADB instance
|
|
248
|
+
this.adb = await androidHelpers.createADB(this.opts);
|
|
249
|
+
|
|
250
|
+
// Read https://github.com/appium/appium-android-driver/pull/461 what happens if ther is no setHiddenApiPolicy for Android P+
|
|
251
|
+
if (await this.adb.getApiLevel() >= 28) { // Android P
|
|
252
|
+
logger.warn('Relaxing hidden api policy');
|
|
253
|
+
await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// get appPackage et al from manifest if necessary
|
|
257
|
+
let appInfo = await helpers.getLaunchInfo(this.adb, this.opts);
|
|
258
|
+
if (appInfo) {
|
|
259
|
+
// and get it onto our 'opts' object so we use it from now on
|
|
260
|
+
Object.assign(this.opts, appInfo);
|
|
261
|
+
} else {
|
|
262
|
+
appInfo = this.opts;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// start an avd, set the language/locale, pick an emulator, etc...
|
|
266
|
+
// TODO with multiple devices we'll need to parameterize this
|
|
267
|
+
await helpers.initDevice(this.adb, this.opts);
|
|
268
|
+
// https://github.com/appium/appium-espresso-driver/issues/72
|
|
269
|
+
if (await this.adb.isAnimationOn()) {
|
|
270
|
+
try {
|
|
271
|
+
await this.adb.setAnimationState(false);
|
|
272
|
+
this.wasAnimationEnabled = true;
|
|
273
|
+
} catch (err) {
|
|
274
|
+
logger.warn(`Unable to turn off animations: ${err.message}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// set actual device name, udid
|
|
279
|
+
this.caps.deviceName = this.adb.curDeviceId;
|
|
280
|
+
this.caps.deviceUDID = this.opts.udid;
|
|
281
|
+
|
|
282
|
+
// set up the modified espresso server etc
|
|
283
|
+
this.initEspressoServer();
|
|
284
|
+
// Further prepare the device by forwarding the espresso port
|
|
285
|
+
logger.debug(`Forwarding Espresso Server port ${DEVICE_PORT} to ${this.opts.systemPort}`);
|
|
286
|
+
await this.adb.forwardPort(this.opts.systemPort, DEVICE_PORT);
|
|
287
|
+
|
|
288
|
+
if (!this.opts.skipUnlock) {
|
|
289
|
+
// unlock the device to prepare it for testing
|
|
290
|
+
await helpers.unlock(this, this.adb, this.caps);
|
|
291
|
+
} else {
|
|
292
|
+
logger.debug(`'skipUnlock' capability set, so skipping device unlock`);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// set up app under test
|
|
296
|
+
// prepare our actual AUT, get it on the device, etc...
|
|
297
|
+
await this.initAUT();
|
|
298
|
+
|
|
299
|
+
//Adding AUT package name in the capabilities if package name not exist in caps
|
|
300
|
+
if (!this.caps.appPackage) {
|
|
301
|
+
this.caps.appPackage = appInfo.appPackage;
|
|
302
|
+
}
|
|
303
|
+
if (!this.caps.appWaitPackage) {
|
|
304
|
+
this.caps.appWaitPackage = appInfo.appWaitPackage || appInfo.appPackage || this.caps.appPackage;
|
|
305
|
+
}
|
|
306
|
+
if (this.caps.appActivity) {
|
|
307
|
+
this.caps.appActivity = qualifyActivityName(this.caps.appActivity, this.caps.appPackage);
|
|
308
|
+
} else {
|
|
309
|
+
this.caps.appActivity = qualifyActivityName(appInfo.appActivity, this.caps.appPackage);
|
|
310
|
+
}
|
|
311
|
+
if (this.caps.appWaitActivity) {
|
|
312
|
+
this.caps.appWaitActivity = qualifyActivityName(this.caps.appWaitActivity, this.caps.appWaitPackage);
|
|
313
|
+
} else {
|
|
314
|
+
this.caps.appWaitActivity = qualifyActivityName(appInfo.appWaitActivity || appInfo.appActivity || this.caps.appActivity,
|
|
315
|
+
this.caps.appWaitPackage);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// launch espresso and wait till its online and we have a session
|
|
319
|
+
await this.espresso.startSession(this.caps);
|
|
320
|
+
if (this.caps.autoLaunch === false) {
|
|
321
|
+
logger.info(`Not waiting for the application activity to start because 'autoLaunch' is disabled`);
|
|
322
|
+
} else {
|
|
323
|
+
await this.adb.waitForActivity(this.caps.appWaitPackage, this.caps.appWaitActivity, this.opts.appWaitDuration);
|
|
324
|
+
}
|
|
325
|
+
// if we want to immediately get into a webview, set our context
|
|
326
|
+
// appropriately
|
|
327
|
+
if (this.opts.autoWebview) {
|
|
328
|
+
await this.initWebview();
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// now that everything has started successfully, turn on proxying so all
|
|
332
|
+
// subsequent session requests go straight to/from espresso
|
|
333
|
+
this.jwpProxyActive = true;
|
|
334
|
+
|
|
335
|
+
await this.addDeviceInfoToCaps();
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async initWebview () {
|
|
339
|
+
const viewName = androidCommands.defaultWebviewName.call(this);
|
|
340
|
+
const timeout = this.opts.autoWebviewTimeout || 2000;
|
|
341
|
+
logger.info(`Setting webview to context '${viewName}' with timeout ${timeout}ms`);
|
|
342
|
+
await retryInterval(timeout / 500, 500, this.setContext.bind(this), viewName);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
async addDeviceInfoToCaps () {
|
|
346
|
+
const {
|
|
347
|
+
apiVersion,
|
|
348
|
+
platformVersion,
|
|
349
|
+
manufacturer,
|
|
350
|
+
model,
|
|
351
|
+
realDisplaySize,
|
|
352
|
+
displayDensity,
|
|
353
|
+
} = await this.mobileGetDeviceInfo();
|
|
354
|
+
this.caps.deviceApiLevel = parseInt(apiVersion, 10);
|
|
355
|
+
this.caps.platformVersion = platformVersion;
|
|
356
|
+
this.caps.deviceScreenSize = realDisplaySize;
|
|
357
|
+
this.caps.deviceScreenDensity = displayDensity;
|
|
358
|
+
this.caps.deviceModel = model;
|
|
359
|
+
this.caps.deviceManufacturer = manufacturer;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
initEspressoServer () {
|
|
363
|
+
// now that we have package and activity, we can create an instance of
|
|
364
|
+
// espresso with the appropriate data
|
|
365
|
+
this.espresso = new EspressoRunner({
|
|
366
|
+
host: this.opts.remoteAdbHost || this.opts.host || 'localhost',
|
|
367
|
+
systemPort: this.opts.systemPort,
|
|
368
|
+
devicePort: DEVICE_PORT,
|
|
369
|
+
adb: this.adb,
|
|
370
|
+
apk: this.opts.app,
|
|
371
|
+
tmpDir: this.opts.tmpDir,
|
|
372
|
+
appPackage: this.opts.appPackage,
|
|
373
|
+
appActivity: this.opts.appActivity,
|
|
374
|
+
forceEspressoRebuild: !!this.opts.forceEspressoRebuild,
|
|
375
|
+
espressoBuildConfig: this.opts.espressoBuildConfig,
|
|
376
|
+
showGradleLog: !!this.opts.showGradleLog,
|
|
377
|
+
serverLaunchTimeout: this.opts.espressoServerLaunchTimeout,
|
|
378
|
+
androidInstallTimeout: this.opts.androidInstallTimeout,
|
|
379
|
+
skipServerInstallation: this.opts.skipServerInstallation,
|
|
380
|
+
useKeystore: this.opts.useKeystore,
|
|
381
|
+
keystorePath: this.opts.keystorePath,
|
|
382
|
+
keystorePassword: this.opts.keystorePassword,
|
|
383
|
+
keyAlias: this.opts.keyAlias,
|
|
384
|
+
keyPassword: this.opts.keyPassword,
|
|
385
|
+
disableSuppressAccessibilityService: this.opts.disableSuppressAccessibilityService,
|
|
386
|
+
});
|
|
387
|
+
this.proxyReqRes = this.espresso.proxyReqRes.bind(this.espresso);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// TODO this method is mostly duplicated from uiautomator2
|
|
391
|
+
async initAUT () {
|
|
392
|
+
// set the localized strings for the current language from the apk
|
|
393
|
+
// TODO: incorporate changes from appium#5308 which fix a race cond-
|
|
394
|
+
// ition bug in old appium and need to be replicated here
|
|
395
|
+
// this.apkStrings[this.opts.language] = await androidHelpers.pushStrings(
|
|
396
|
+
// this.opts.language, this.adb, this.opts);
|
|
397
|
+
|
|
398
|
+
// Uninstall any uninstallOtherPackages which were specified in caps
|
|
399
|
+
if (this.opts.uninstallOtherPackages) {
|
|
400
|
+
await helpers.uninstallOtherPackages(
|
|
401
|
+
this.adb,
|
|
402
|
+
helpers.parseArray(this.opts.uninstallOtherPackages),
|
|
403
|
+
[SETTINGS_HELPER_PKG_ID, TEST_APK_PKG]
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (!this.opts.app) {
|
|
408
|
+
if (this.opts.fullReset) {
|
|
409
|
+
logger.errorAndThrow('Full reset requires an app capability, use fastReset if app is not provided');
|
|
410
|
+
}
|
|
411
|
+
logger.debug('No app capability. Assuming it is already on the device');
|
|
412
|
+
if (this.opts.fastReset) {
|
|
413
|
+
await helpers.resetApp(this.adb, this.opts);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (!this.opts.skipUninstall) {
|
|
418
|
+
await this.adb.uninstallApk(this.opts.appPackage);
|
|
419
|
+
}
|
|
420
|
+
if (this.opts.app) {
|
|
421
|
+
if (this.opts.noSign) {
|
|
422
|
+
logger.info('Skipping application signing because noSign capability is set to true. ' +
|
|
423
|
+
'Having the application under test with improper signature/non-signed will cause ' +
|
|
424
|
+
'Espresso automation startup failure.');
|
|
425
|
+
} else if (!await this.adb.checkApkCert(this.opts.app, this.opts.appPackage)) {
|
|
426
|
+
await this.adb.sign(this.opts.app, this.opts.appPackage);
|
|
427
|
+
}
|
|
428
|
+
await helpers.installApk(this.adb, this.opts);
|
|
429
|
+
}
|
|
430
|
+
if (this.opts.skipServerInstallation) {
|
|
431
|
+
logger.debug('skipServerInstallation capability is set. Not installig espresso-server ');
|
|
432
|
+
} else {
|
|
433
|
+
await this.espresso.installTestApk();
|
|
434
|
+
try {
|
|
435
|
+
await this.adb.addToDeviceIdleWhitelist(SETTINGS_HELPER_PKG_ID, TEST_APK_PKG);
|
|
436
|
+
} catch (e) {
|
|
437
|
+
logger.warn(`Cannot add server packages to the Doze whitelist. Original error: ` +
|
|
438
|
+
(e.stderr || e.message));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
async deleteSession () {
|
|
444
|
+
logger.debug('Deleting espresso session');
|
|
445
|
+
|
|
446
|
+
try {
|
|
447
|
+
if (!_.isEmpty(this._screenRecordingProperties)) {
|
|
448
|
+
await this.stopRecordingScreen();
|
|
449
|
+
}
|
|
450
|
+
} catch (ign) {}
|
|
451
|
+
|
|
452
|
+
await androidHelpers.removeAllSessionWebSocketHandlers(this.server, this.sessionId);
|
|
453
|
+
|
|
454
|
+
await this.mobileStopScreenStreaming();
|
|
455
|
+
|
|
456
|
+
if (this.espresso) {
|
|
457
|
+
if (this.jwpProxyActive) {
|
|
458
|
+
await this.espresso.deleteSession();
|
|
459
|
+
}
|
|
460
|
+
this.espresso = null;
|
|
461
|
+
}
|
|
462
|
+
this.jwpProxyActive = false;
|
|
463
|
+
|
|
464
|
+
// TODO below logic is duplicated from uiautomator2
|
|
465
|
+
if (this.adb) {
|
|
466
|
+
if (this.wasAnimationEnabled) {
|
|
467
|
+
try {
|
|
468
|
+
await this.adb.setAnimationState(true);
|
|
469
|
+
} catch (err) {
|
|
470
|
+
logger.warn(`Unable to reset animation: ${err.message}`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (this.opts.unicodeKeyboard && this.opts.resetKeyboard &&
|
|
474
|
+
this.defaultIME) {
|
|
475
|
+
logger.debug(`Resetting IME to '${this.defaultIME}'`);
|
|
476
|
+
await this.adb.setIME(this.defaultIME);
|
|
477
|
+
}
|
|
478
|
+
if (!this.isChromeSession && this.opts.appPackage && !this.opts.dontStopAppOnReset) {
|
|
479
|
+
await this.adb.forceStop(this.opts.appPackage);
|
|
480
|
+
}
|
|
481
|
+
if (this.opts.fullReset && !this.opts.skipUninstall && !this.appOnDevice) {
|
|
482
|
+
logger.debug(`FULL_RESET set to 'true', Uninstalling '${this.opts.appPackage}'`);
|
|
483
|
+
await this.adb.uninstallApk(this.opts.appPackage);
|
|
484
|
+
}
|
|
485
|
+
await this.adb.stopLogcat();
|
|
486
|
+
if (this.opts.reboot) {
|
|
487
|
+
let avdName = this.opts.avd.replace('@', '');
|
|
488
|
+
logger.debug(`closing emulator '${avdName}'`);
|
|
489
|
+
await this.adb.killEmulator(avdName);
|
|
490
|
+
}
|
|
491
|
+
if (await this.adb.getApiLevel() >= 28) { // Android P
|
|
492
|
+
logger.info('Restoring hidden api policy to the device default configuration');
|
|
493
|
+
await this.adb.setDefaultHiddenApiPolicy(!!this.opts.ignoreHiddenApiPolicyError);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
await super.deleteSession();
|
|
497
|
+
if (this.opts.systemPort !== undefined) {
|
|
498
|
+
try {
|
|
499
|
+
await this.adb.removePortForward(this.opts.systemPort);
|
|
500
|
+
} catch (error) {
|
|
501
|
+
logger.warn(`Unable to remove port forward '${error.message}'`);
|
|
502
|
+
//Ignore, this block will also be called when we fall in catch block
|
|
503
|
+
// and before even port forward.
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// TODO method is duplicated from uiautomator2
|
|
509
|
+
async checkAppPresent () {
|
|
510
|
+
logger.debug('Checking whether app is actually present');
|
|
511
|
+
if (!(await fs.exists(this.opts.app))) {
|
|
512
|
+
logger.errorAndThrow(`Could not find app apk at '${this.opts.app}'`);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
async onSettingsUpdate () {
|
|
517
|
+
// intentionally do nothing here, since commands.updateSettings proxies
|
|
518
|
+
// settings to the espresso server already
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
proxyActive (sessionId) {
|
|
522
|
+
super.proxyActive(sessionId);
|
|
523
|
+
|
|
524
|
+
// we always have an active proxy to the espresso server
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
canProxy (sessionId) {
|
|
529
|
+
super.canProxy(sessionId);
|
|
530
|
+
|
|
531
|
+
// we can always proxy to the espresso server
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
getProxyAvoidList (sessionId) {
|
|
536
|
+
super.getProxyAvoidList(sessionId);
|
|
537
|
+
// we are maintaining two sets of NO_PROXY lists, one for chromedriver(CHROME_NO_PROXY)
|
|
538
|
+
// and one for Espresso(NO_PROXY), based on current context will return related NO_PROXY list
|
|
539
|
+
this.jwpProxyAvoid = _.isNil(this.chromedriver) ? NO_PROXY : CHROME_NO_PROXY;
|
|
540
|
+
if (this.opts.nativeWebScreenshot) {
|
|
541
|
+
this.jwpProxyAvoid = [...this.jwpProxyAvoid, ['GET', new RegExp('^/session/[^/]+/screenshot')]];
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return this.jwpProxyAvoid;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
get isChromeSession () {
|
|
548
|
+
return helpers.isChromeBrowser(this.opts.browserName);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// first add the android-driver commands which we will fall back to
|
|
553
|
+
for (let [cmd, fn] of _.toPairs(androidCommands)) {
|
|
554
|
+
// we do some different/special things with these methods
|
|
555
|
+
if (!_.includes(['defaultWebviewName'], cmd)) {
|
|
556
|
+
EspressoDriver.prototype[cmd] = fn;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// then overwrite with any espresso-specific commands
|
|
561
|
+
for (let [cmd, fn] of _.toPairs(commands)) {
|
|
562
|
+
EspressoDriver.prototype[cmd] = fn;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export { EspressoDriver };
|
|
566
|
+
export default EspressoDriver;
|