detox 21.0.0-breaking.new-global-lifecycle.0 → 21.0.1-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +2 -7
- package/Detox-android/com/wix/detox/{21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar → 21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar → 21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom → 21.0.1-rc.0/detox-21.0.1-rc.0.pom} +22 -10
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-framework.tbz +0 -0
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios-xcuitest.tbz +0 -0
- package/README.md +1 -1
- package/android/build.gradle +13 -8
- package/android/detox/build.gradle +24 -13
- package/android/detox/proguard-rules-app.pro +6 -0
- package/android/detox/proguard-rules.pro +3 -0
- package/android/detox/publish-pom.gradle +5 -1
- package/android/detox/publishing.gradle +35 -33
- package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +4 -4
- package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
- package/android/detox/src/full/java/com/wix/detox/adapters/server/WebSocketClient.java +3 -1
- package/android/detox/src/full/java/com/wix/detox/common/UIExtensions.kt +28 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +37 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxMatcher.java +11 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +1 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +22 -0
- package/android/detox/src/{main → full}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +17 -4
- package/android/detox/src/full/java/com/wix/detox/espresso/action/RNDetoxAccessibilityAction.kt +46 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +75 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +24 -28
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/WithAccessibilityLabelMatcher.kt +23 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResourceDescription.kt +26 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +54 -8
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +3 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +43 -34
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +2 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/RN66Workaround.kt +13 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/ui/UIExtensions.kt +37 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/utils/RNUtils.kt +6 -0
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +4 -1
- package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +2 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +10 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/UTHelpers.kt +12 -0
- package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
- package/android/detox/src/testFull/java/com/wix/detox/common/UIExtensionsTest.kt +107 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +22 -9
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +39 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/matcher/ViewAtIndexMatcherSpec.kt +1 -2
- package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
- package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
- package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/android/gradlew +181 -107
- package/index.d.ts +239 -83
- package/index.js +12 -1
- package/internals.d.ts +219 -45
- package/internals.js +10 -3
- package/local-cli/build-framework-cache.js +1 -1
- package/local-cli/build-xcuitest-cache.js +16 -0
- package/local-cli/build.js +2 -2
- package/local-cli/clean-framework-cache.js +1 -1
- package/local-cli/clean-xcuitest-cache.js +19 -0
- package/local-cli/cli.js +13 -7
- package/local-cli/init.js +61 -21
- package/local-cli/rebuild-framework-cache.js +4 -4
- package/local-cli/rebuild-xcuitest-cache.js +21 -0
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/run-server.js +12 -1
- package/local-cli/start.js +49 -0
- package/local-cli/startCommand/AppStartCommand.js +65 -0
- package/local-cli/templates/jest.js +13 -10
- package/local-cli/test.js +14 -8
- package/local-cli/testCommand/TestRunnerCommand.js +126 -77
- package/local-cli/testCommand/TestRunnerError.js +13 -0
- package/local-cli/testCommand/builder.js +5 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/local-cli/utils/cliErrorHandling.js +15 -0
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +46 -26
- package/runners/deprecation.js +42 -44
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- package/runners/jest/index.d.ts +61 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/reporters/DetoxReporter.js +33 -2
- package/runners/jest/testEnvironment/index.js +119 -68
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +97 -51
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +15 -17
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +3 -7
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/scripts/build_framework.ios.sh +26 -60
- package/scripts/build_local_framework.ios.sh +62 -0
- package/scripts/build_local_xcuitest.ios.sh +53 -0
- package/scripts/build_xcuitest.ios.sh +23 -0
- package/scripts/pack_ios.sh +14 -5
- package/scripts/postinstall.js +10 -4
- package/src/DetoxWorker.js +112 -64
- package/src/android/actions/native.js +16 -0
- package/src/android/core/NativeElement.js +72 -20
- package/src/android/core/NativeExpect.js +28 -9
- package/src/android/core/NativeMatcher.js +31 -10
- package/src/android/core/NativeWaitFor.js +8 -0
- package/src/android/espressoapi/DetoxAction.js +37 -0
- package/src/android/espressoapi/DetoxMatcher.js +24 -0
- package/src/android/espressoapi/EspressoDetox.js +1 -1
- package/src/android/espressoapi/web/WebElement.js +1 -1
- package/src/android/interactions/native.js +25 -18
- package/src/android/matchers/index.js +2 -2
- package/src/android/matchers/native.js +10 -3
- package/src/artifacts/ArtifactsManager.js +14 -47
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +2 -2
- package/src/artifacts/templates/plugin/TwoSnapshotsPerTestPlugin.js +2 -1
- package/src/artifacts/templates/plugin/WholeTestRecorderPlugin.js +3 -2
- package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
- package/src/artifacts/utils/temporaryPath.js +47 -8
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +11 -19
- package/src/client/Client.js +35 -3
- package/src/client/actions/SyncStatusSchema.json +21 -0
- package/src/client/actions/actions.js +38 -0
- package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
- package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
- package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
- package/src/configuration/collectCliConfig.js +3 -13
- package/src/configuration/composeAppsConfig.js +5 -1
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +20 -10
- package/src/configuration/composeRunnerConfig.js +62 -9
- package/src/configuration/index.js +14 -9
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +15 -2
- package/src/devices/allocation/drivers/AllocationDriverBase.js +10 -2
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +10 -1
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +28 -29
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +6 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +4 -17
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +27 -18
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +12 -7
- package/src/devices/allocation/factories/base.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +9 -0
- package/src/devices/common/drivers/android/genycloud/exec/GenyCloudExec.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
- package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/AppInstallHelper.js +4 -4
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/{FileXfer.js → FileTransfer.js} +2 -2
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
- package/src/devices/common/drivers/android/tools/TempFileTransfer.js +14 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +21 -4
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +24 -12
- package/src/devices/runtime/drivers/DeviceDriverBase.js +2 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +17 -8
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +42 -2
- package/src/devices/runtime/drivers/ios/XCUITestUtils.js +209 -0
- package/src/devices/runtime/drivers/ios/allowNetworkPermissionsXCUITest.scpt +14 -0
- package/src/devices/runtime/factories/android.js +6 -5
- package/src/devices/runtime/factories/base.js +3 -2
- package/src/errors/DetoxConfigErrorComposer.js +18 -3
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +199 -78
- package/src/ipc/IPCClient.js +36 -27
- package/src/ipc/IPCServer.js +40 -21
- package/src/ipc/SessionState.js +60 -0
- package/src/logger/DetoxLogger.js +287 -154
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +105 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +37 -0
- package/src/logger/utils/DetoxLogFinalizer.js +166 -0
- package/src/logger/utils/MessageStack.js +35 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +23 -6
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxContext.js +83 -66
- package/src/realms/DetoxInternalsFacade.js +9 -13
- package/src/realms/DetoxPrimaryContext.js +117 -74
- package/src/realms/DetoxSecondaryContext.js +32 -35
- package/src/{symbols.js → realms/symbols.js} +16 -22
- package/src/server/DetoxConnection.js +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +9 -6
- package/src/server/DetoxSessionManager.js +2 -1
- package/src/server/handlers/AnonymousConnectionHandler.js +1 -0
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/servicelocator/android/index.js +2 -2
- package/src/utils/ExclusiveLockfile.js +1 -0
- package/src/utils/Timer.js +59 -36
- package/src/utils/argparse.js +11 -27
- package/src/utils/childProcess/exec.js +4 -2
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/dateUtils.js +5 -0
- package/src/utils/environment.js +55 -16
- package/src/utils/errorUtils.js +24 -3
- package/src/utils/invocationTraceDescriptions.js +44 -0
- package/src/utils/isPromise.js +8 -1
- package/src/utils/logger.js +2 -2
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/src/validation/ios/IosSimulatorEnvValidator.js +7 -4
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
- package/Detox-ios.tbz +0 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +0 -20
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
- package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -36
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +0 -59
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
- package/local-cli/build.test.js +0 -104
- package/local-cli/run-server.test.js +0 -23
- package/local-cli/test.test.js +0 -515
- package/runners/jest/deprecation.js +0 -25
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
- package/scripts/build_universal_framework.sh +0 -14
- package/scripts/build_universal_framework_legacy.sh +0 -76
- package/scripts/build_universal_framework_modern.sh +0 -28
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/common/drivers/android/tools/TempFileXfer.js +0 -16
- package/src/ipc/state.js +0 -76
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/logger/TraceThreadDispatcher.js +0 -52
- package/src/realms/index.js +0 -10
- package/src/utils/ChromeTracingExporter.js +0 -53
- package/src/utils/streamUtils.js +0 -214
- package/src/utils/trace.js +0 -19
package/src/DetoxWorker.js
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
+
const CAF = require('caf');
|
1
2
|
const _ = require('lodash');
|
2
3
|
|
3
4
|
const Client = require('./client/Client');
|
4
5
|
const environmentFactory = require('./environmentFactory');
|
5
6
|
const { DetoxRuntimeErrorComposer } = require('./errors');
|
6
7
|
const { InvocationManager } = require('./invoke');
|
7
|
-
const symbols = require('./symbols');
|
8
|
+
const symbols = require('./realms/symbols');
|
8
9
|
const AsyncEmitter = require('./utils/AsyncEmitter');
|
9
10
|
const uuid = require('./utils/uuid');
|
10
11
|
|
11
12
|
class DetoxWorker {
|
12
13
|
constructor(context) {
|
13
14
|
this._context = context;
|
14
|
-
this.
|
15
|
+
this._injectedGlobalProperties = [];
|
15
16
|
this._config = context[symbols.config];
|
16
17
|
this._runtimeErrorComposer = new DetoxRuntimeErrorComposer(this._config);
|
17
18
|
this._client = null;
|
@@ -32,6 +33,20 @@ class DetoxWorker {
|
|
32
33
|
onError: this._onEmitError.bind(this),
|
33
34
|
});
|
34
35
|
|
36
|
+
|
37
|
+
/** @type {DetoxInternals.RuntimeConfig['apps']} */
|
38
|
+
this._appsConfig = null;
|
39
|
+
/** @type {DetoxInternals.RuntimeConfig['artifacts']} */
|
40
|
+
this._artifactsConfig = null;
|
41
|
+
/** @type {DetoxInternals.RuntimeConfig['behavior']} */
|
42
|
+
this._behaviorConfig = null;
|
43
|
+
/** @type {DetoxInternals.RuntimeConfig['device']} */
|
44
|
+
this._deviceConfig = null;
|
45
|
+
/** @type {DetoxInternals.RuntimeConfig['session']} */
|
46
|
+
this._sessionConfig = null;
|
47
|
+
|
48
|
+
/** @type {string} */
|
49
|
+
this.id = 'worker';
|
35
50
|
/** @type {Detox.Device} */
|
36
51
|
this.device = null;
|
37
52
|
/** @type {Detox.ElementFacade} */
|
@@ -51,20 +66,40 @@ class DetoxWorker {
|
|
51
66
|
this.trace = this._context.trace;
|
52
67
|
/** @deprecated */
|
53
68
|
this.traceCall = this._context.traceCall;
|
69
|
+
|
70
|
+
this._reinstallAppsOnDevice = CAF(this._reinstallAppsOnDevice.bind(this));
|
71
|
+
this._initToken = new CAF.cancelToken();
|
72
|
+
|
73
|
+
this._cafWrap([
|
74
|
+
'init',
|
75
|
+
'onRunDescribeStart',
|
76
|
+
'onTestStart',
|
77
|
+
'onHookFailure',
|
78
|
+
'onTestFnFailure',
|
79
|
+
'onTestDone',
|
80
|
+
'onRunDescribeFinish',
|
81
|
+
]);
|
54
82
|
}
|
55
83
|
|
56
|
-
|
57
|
-
|
84
|
+
/** @this {DetoxWorker} */
|
85
|
+
init = function* (signal) {
|
86
|
+
const {
|
87
|
+
apps: appsConfig,
|
88
|
+
artifacts: artifactsConfig,
|
89
|
+
behavior: behaviorConfig,
|
90
|
+
device: deviceConfig,
|
91
|
+
session: sessionConfig
|
92
|
+
} = this._config;
|
58
93
|
|
59
|
-
const { appsConfig, artifactsConfig, behaviorConfig, deviceConfig, sessionConfig } = this._config;
|
60
94
|
this._appsConfig = appsConfig;
|
61
95
|
this._artifactsConfig = artifactsConfig;
|
62
96
|
this._behaviorConfig = behaviorConfig;
|
63
97
|
this._deviceConfig = deviceConfig;
|
64
98
|
this._sessionConfig = sessionConfig;
|
99
|
+
// @ts-ignore
|
100
|
+
this._sessionConfig.sessionId = sessionConfig.sessionId || uuid.UUID();
|
65
101
|
this._runtimeErrorComposer.appsConfig = this._appsConfig;
|
66
102
|
|
67
|
-
sessionConfig.sessionId = sessionConfig.sessionId || uuid.UUID();
|
68
103
|
this._client = new Client(sessionConfig);
|
69
104
|
this._client.terminateApp = async () => {
|
70
105
|
// @ts-ignore
|
@@ -73,8 +108,7 @@ class DetoxWorker {
|
|
73
108
|
}
|
74
109
|
};
|
75
110
|
|
76
|
-
|
77
|
-
if (this._isCleaningUp) return;
|
111
|
+
yield this._client.connect();
|
78
112
|
|
79
113
|
const invocationManager = new InvocationManager(this._client);
|
80
114
|
|
@@ -91,8 +125,7 @@ class DetoxWorker {
|
|
91
125
|
} = environmentFactory.createFactories(this._deviceConfig);
|
92
126
|
|
93
127
|
const envValidator = envValidatorFactory.createValidator();
|
94
|
-
|
95
|
-
if (this._isCleaningUp) return;
|
128
|
+
yield envValidator.validate();
|
96
129
|
|
97
130
|
const commonDeps = {
|
98
131
|
invocationManager,
|
@@ -103,8 +136,9 @@ class DetoxWorker {
|
|
103
136
|
|
104
137
|
this._artifactsManager = artifactsManagerFactory.createArtifactsManager(this._artifactsConfig, commonDeps);
|
105
138
|
this._deviceAllocator = deviceAllocatorFactory.createDeviceAllocator(commonDeps);
|
106
|
-
this._deviceCookie =
|
107
|
-
|
139
|
+
this._deviceCookie = yield this._deviceAllocator.allocate(this._deviceConfig);
|
140
|
+
|
141
|
+
yield this._deviceAllocator.postAllocate(this._deviceCookie);
|
108
142
|
|
109
143
|
this.device = runtimeDeviceFactory.createRuntimeDevice(
|
110
144
|
this._deviceCookie,
|
@@ -115,7 +149,6 @@ class DetoxWorker {
|
|
115
149
|
deviceConfig: this._deviceConfig,
|
116
150
|
sessionConfig,
|
117
151
|
});
|
118
|
-
if (this._isCleaningUp) return;
|
119
152
|
|
120
153
|
const matchers = matchersFactory.createMatchers({
|
121
154
|
invocationManager,
|
@@ -125,34 +158,37 @@ class DetoxWorker {
|
|
125
158
|
Object.assign(this, matchers);
|
126
159
|
|
127
160
|
if (behaviorConfig.init.exposeGlobals) {
|
128
|
-
|
161
|
+
const injectedGlobals = {
|
129
162
|
...matchers,
|
130
163
|
device: this.device,
|
131
164
|
detox: this,
|
132
|
-
}
|
165
|
+
};
|
166
|
+
|
167
|
+
this._injectedGlobalProperties = Object.keys(injectedGlobals);
|
168
|
+
Object.assign(DetoxWorker.global, injectedGlobals);
|
133
169
|
}
|
134
170
|
|
135
171
|
// @ts-ignore
|
136
|
-
|
137
|
-
if (this._isCleaningUp) return;
|
172
|
+
yield this.device.installUtilBinaries();
|
138
173
|
|
139
174
|
if (behaviorConfig.init.reinstallApp) {
|
140
|
-
|
141
|
-
if (this._isCleaningUp) return;
|
175
|
+
yield this._reinstallAppsOnDevice(signal);
|
142
176
|
}
|
143
177
|
|
144
178
|
const appAliases = Object.keys(this._appsConfig);
|
145
179
|
if (appAliases.length === 1) {
|
146
|
-
|
180
|
+
yield this.device.selectApp(appAliases[0]);
|
147
181
|
} else {
|
148
|
-
|
182
|
+
yield this.device.selectApp(null);
|
149
183
|
}
|
150
|
-
|
151
|
-
return this;
|
152
|
-
}
|
184
|
+
};
|
153
185
|
|
154
186
|
async cleanup() {
|
155
|
-
this.
|
187
|
+
this._initToken.abort('CLEANUP');
|
188
|
+
|
189
|
+
for (const key of this._injectedGlobalProperties) {
|
190
|
+
delete DetoxWorker.global[key];
|
191
|
+
}
|
156
192
|
|
157
193
|
if (this._artifactsManager) {
|
158
194
|
await this._artifactsManager.onBeforeCleanup();
|
@@ -166,9 +202,12 @@ class DetoxWorker {
|
|
166
202
|
}
|
167
203
|
|
168
204
|
if (this.device) {
|
169
|
-
const shutdown = this._behaviorConfig ? this._behaviorConfig.cleanup.shutdownDevice : false;
|
170
205
|
// @ts-ignore
|
171
206
|
await this.device._cleanup();
|
207
|
+
}
|
208
|
+
|
209
|
+
if (this._deviceCookie) {
|
210
|
+
const shutdown = this._behaviorConfig ? this._behaviorConfig.cleanup.shutdownDevice : false;
|
172
211
|
await this._deviceAllocator.free(this._deviceCookie, { shutdown });
|
173
212
|
}
|
174
213
|
|
@@ -181,46 +220,45 @@ class DetoxWorker {
|
|
181
220
|
return this._context.log;
|
182
221
|
}
|
183
222
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
223
|
+
onRunDescribeStart = function* (_signal, ...args) {
|
224
|
+
yield this._artifactsManager.onRunDescribeStart(...args);
|
225
|
+
};
|
226
|
+
|
227
|
+
onTestStart = function* (_signal, testSummary) {
|
188
228
|
this._validateTestSummary('beforeEach', testSummary);
|
189
|
-
this._logTestRunCheckpoint('DETOX_BEFORE_EACH', testSummary);
|
190
229
|
|
191
|
-
|
192
|
-
await this._dumpUnhandledErrorsIfAny({
|
230
|
+
yield this._dumpUnhandledErrorsIfAny({
|
193
231
|
pendingRequests: false,
|
194
232
|
testName: testSummary.fullName,
|
195
233
|
});
|
196
234
|
|
197
|
-
|
198
|
-
|
235
|
+
yield this._artifactsManager.onTestStart(testSummary);
|
236
|
+
};
|
237
|
+
|
238
|
+
onHookFailure = function* (_signal, ...args) {
|
239
|
+
yield this._artifactsManager.onHookFailure(...args);
|
240
|
+
};
|
241
|
+
|
242
|
+
onTestFnFailure = function* (_signal, ...args) {
|
243
|
+
yield this._artifactsManager.onTestFnFailure(...args);
|
199
244
|
};
|
200
|
-
|
201
|
-
|
202
|
-
onHookSuccess = async (...args) => this._artifactsManager.onHookSuccess(...args);
|
203
|
-
onTestFnStart = async (...args) => this._artifactsManager.onTestFnStart(...args);
|
204
|
-
onTestFnFailure = async (...args) => this._artifactsManager.onTestFnFailure(...args);
|
205
|
-
onTestFnSuccess = async (...args) => this._artifactsManager.onTestFnSuccess(...args);
|
206
|
-
onTestDone = async (testSummary) => {
|
207
|
-
if (this._isCleaningUp) return;
|
245
|
+
|
246
|
+
onTestDone = function* (_signal, testSummary) {
|
208
247
|
this._validateTestSummary('afterEach', testSummary);
|
209
|
-
this._logTestRunCheckpoint('DETOX_AFTER_EACH', testSummary);
|
210
248
|
|
211
|
-
|
212
|
-
await this._artifactsManager.onTestDone(testSummary);
|
249
|
+
yield this._artifactsManager.onTestDone(testSummary);
|
213
250
|
|
214
|
-
|
215
|
-
await this._dumpUnhandledErrorsIfAny({
|
251
|
+
yield this._dumpUnhandledErrorsIfAny({
|
216
252
|
pendingRequests: testSummary.timedOut,
|
217
253
|
testName: testSummary.fullName,
|
218
254
|
});
|
219
255
|
};
|
220
|
-
onRunDescribeFinish = async (...args) => this._artifactsManager.onRunDescribeFinish(...args);
|
221
|
-
onRunFinish = async (...args) => this._artifactsManager.onRunFinish(...args);
|
222
256
|
|
223
|
-
|
257
|
+
onRunDescribeFinish = function* (_signal, ...args) {
|
258
|
+
yield this._artifactsManager.onRunDescribeFinish(...args);
|
259
|
+
};
|
260
|
+
|
261
|
+
*_reinstallAppsOnDevice(_signal) {
|
224
262
|
const appNames = _(this._appsConfig)
|
225
263
|
.map((config, key) => [key, `${config.binaryPath}:${config.testBinaryPath}`])
|
226
264
|
.uniqBy(1)
|
@@ -228,24 +266,16 @@ class DetoxWorker {
|
|
228
266
|
.value();
|
229
267
|
|
230
268
|
for (const appName of appNames) {
|
231
|
-
|
232
|
-
|
233
|
-
await this.device.uninstallApp();
|
234
|
-
if (this._isCleaningUp) return;
|
269
|
+
yield this.device.selectApp(appName);
|
270
|
+
yield this.device.uninstallApp();
|
235
271
|
}
|
236
272
|
|
237
273
|
for (const appName of appNames) {
|
238
|
-
|
239
|
-
|
240
|
-
await this.device.installApp();
|
241
|
-
if (this._isCleaningUp) return;
|
274
|
+
yield this.device.selectApp(appName);
|
275
|
+
yield this.device.installApp();
|
242
276
|
}
|
243
277
|
}
|
244
278
|
|
245
|
-
_logTestRunCheckpoint(event, { status, fullName }) {
|
246
|
-
this.log.trace({ event, status }, `${status} test: ${JSON.stringify(fullName)}`);
|
247
|
-
}
|
248
|
-
|
249
279
|
_validateTestSummary(methodName, testSummary) {
|
250
280
|
if (!_.isPlainObject(testSummary)) {
|
251
281
|
throw this._runtimeErrorComposer.invalidTestSummary(methodName, testSummary);
|
@@ -274,10 +304,28 @@ class DetoxWorker {
|
|
274
304
|
error
|
275
305
|
);
|
276
306
|
}
|
307
|
+
|
308
|
+
_cafWrap(methodNames) {
|
309
|
+
for (const methodName of methodNames) {
|
310
|
+
const cafMethod = CAF(this[methodName].bind(this));
|
311
|
+
this[methodName] = async (...args) => {
|
312
|
+
try {
|
313
|
+
await cafMethod(this._initToken.signal, ...args);
|
314
|
+
} catch (e) {
|
315
|
+
if (e !== 'CLEANUP') {
|
316
|
+
throw e;
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
return this;
|
321
|
+
};
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
277
325
|
}
|
278
326
|
|
279
327
|
/**
|
280
|
-
* @type {NodeJS.Global}
|
328
|
+
* @type {NodeJS.Global | {}}
|
281
329
|
*/
|
282
330
|
DetoxWorker.global = global;
|
283
331
|
|
@@ -124,6 +124,13 @@ class ScrollToIndex extends Action {
|
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
+
class SetDatePickerDateAction extends Action {
|
128
|
+
constructor(dateString, formatString) {
|
129
|
+
super();
|
130
|
+
this._call = invoke.callDirectly(DetoxActionApi.setDatePickerDate(dateString, formatString));
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
127
134
|
class AdjustSliderToPosition extends Action {
|
128
135
|
constructor(newPosition) {
|
129
136
|
super();
|
@@ -138,6 +145,13 @@ class TakeElementScreenshot extends Action {
|
|
138
145
|
}
|
139
146
|
}
|
140
147
|
|
148
|
+
class AccessibilityActionAction extends Action {
|
149
|
+
constructor(actionName) {
|
150
|
+
super();
|
151
|
+
this._call = invoke.callDirectly(DetoxActionApi.accessibilityAction(actionName));
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
141
155
|
module.exports = {
|
142
156
|
Action,
|
143
157
|
TapAction,
|
@@ -155,5 +169,7 @@ module.exports = {
|
|
155
169
|
SwipeAction,
|
156
170
|
TakeElementScreenshot,
|
157
171
|
ScrollToIndex,
|
172
|
+
SetDatePickerDateAction,
|
158
173
|
AdjustSliderToPosition,
|
174
|
+
AccessibilityActionAction
|
159
175
|
};
|
@@ -5,6 +5,8 @@ const tempfile = require('tempfile');
|
|
5
5
|
|
6
6
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
7
7
|
const invoke = require('../../invoke');
|
8
|
+
const { removeMilliseconds } = require('../../utils/dateUtils');
|
9
|
+
const { actionDescription } = require('../../utils/invocationTraceDescriptions');
|
8
10
|
const actions = require('../actions/native');
|
9
11
|
const DetoxMatcherApi = require('../espressoapi/DetoxMatcher');
|
10
12
|
const { ActionInteraction } = require('../interactions/native');
|
@@ -18,12 +20,11 @@ class NativeElement {
|
|
18
20
|
}
|
19
21
|
|
20
22
|
_selectElementWithMatcher(matcher) {
|
21
|
-
// if (!(matcher instanceof NativeMatcher)) throw new DetoxRuntimeError(`Element _selectElementWithMatcher argument must be a valid NativeMatcher, got ${typeof matcher}`);
|
22
23
|
this._call = invoke.call(invoke.Espresso, 'onView', matcher._call);
|
23
24
|
}
|
24
25
|
|
25
26
|
atIndex(index) {
|
26
|
-
if (typeof index !== 'number') throw new DetoxRuntimeError(`Element atIndex argument must be a number, got ${typeof index}`);
|
27
|
+
if (typeof index !== 'number') throw new DetoxRuntimeError({ message: `Element atIndex argument must be a number, got ${typeof index}` });
|
27
28
|
const matcher = this._originalMatcher;
|
28
29
|
this._originalMatcher._call = invoke.callDirectly(DetoxMatcherApi.matcherForAtIndex(index, matcher._call.value));
|
29
30
|
|
@@ -32,56 +33,94 @@ class NativeElement {
|
|
32
33
|
}
|
33
34
|
|
34
35
|
async tap(value) {
|
35
|
-
|
36
|
+
const action = new actions.TapAction(value);
|
37
|
+
const traceDescription = actionDescription.tapAtPoint(value);
|
38
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
36
39
|
}
|
37
40
|
|
38
41
|
async tapAtPoint(value) {
|
39
|
-
|
42
|
+
const action = new actions.TapAtPointAction(value);
|
43
|
+
const traceDescription = actionDescription.tapAtPoint(value);
|
44
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
40
45
|
}
|
41
46
|
|
42
47
|
async longPress() {
|
43
|
-
|
48
|
+
const action = new actions.LongPressAction();
|
49
|
+
const traceDescription = actionDescription.longPress();
|
50
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
44
51
|
}
|
45
52
|
|
46
53
|
async multiTap(times) {
|
47
|
-
|
54
|
+
if (typeof times !== 'number') throw new Error('times should be a number, but got ' + (times + (' (' + (typeof times + ')'))));
|
55
|
+
if (times < 1) throw new Error('times should be greater than 0, but got ' + times);
|
56
|
+
|
57
|
+
const action = new actions.MultiClickAction(times);
|
58
|
+
const traceDescription = actionDescription.multiTap(times);
|
59
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
48
60
|
}
|
49
61
|
|
50
62
|
async tapBackspaceKey() {
|
51
|
-
|
63
|
+
const action = new actions.PressKeyAction(67);
|
64
|
+
const traceDescription = actionDescription.tapBackspaceKey();
|
65
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
52
66
|
}
|
53
67
|
|
54
68
|
async tapReturnKey() {
|
55
|
-
|
69
|
+
const action = new actions.TypeTextAction('\n');
|
70
|
+
const traceDescription = actionDescription.tapReturnKey();
|
71
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
56
72
|
}
|
57
73
|
|
58
74
|
async typeText(value) {
|
59
|
-
|
75
|
+
const action = new actions.TypeTextAction(value);
|
76
|
+
const traceDescription = actionDescription.typeText(value);
|
77
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
60
78
|
}
|
61
79
|
|
62
80
|
async replaceText(value) {
|
63
|
-
|
81
|
+
const action = new actions.ReplaceTextAction(value);
|
82
|
+
const traceDescription = actionDescription.replaceText(value);
|
83
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
64
84
|
}
|
65
85
|
|
66
86
|
async clearText() {
|
67
|
-
|
87
|
+
const action = new actions.ClearTextAction();
|
88
|
+
const traceDescription = actionDescription.clearText();
|
89
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
68
90
|
}
|
69
91
|
|
70
92
|
async scroll(amount, direction = 'down', startPositionX, startPositionY) {
|
71
|
-
|
72
|
-
|
73
|
-
return await new ActionInteraction(this._invocationManager, this,
|
93
|
+
const action = new actions.ScrollAmountAction(direction, amount, startPositionX, startPositionY);
|
94
|
+
const traceDescription = actionDescription.scroll(amount, direction, startPositionX, startPositionY);
|
95
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
74
96
|
}
|
75
97
|
|
76
98
|
async scrollTo(edge) {
|
77
99
|
// override the user's element selection with an extended matcher that looks for UIScrollView children
|
78
100
|
this._selectElementWithMatcher(this._originalMatcher._extendToDescendantScrollViews());
|
79
|
-
|
101
|
+
|
102
|
+
const action = new actions.ScrollEdgeAction(edge);
|
103
|
+
const traceDescription = actionDescription.scrollTo(edge);
|
104
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
80
105
|
}
|
81
106
|
|
82
107
|
async scrollToIndex(index) {
|
108
|
+
// override the user's element selection with an extended matcher that looks for UIScrollView children
|
83
109
|
this._selectElementWithMatcher(this._originalMatcher._extendToDescendantScrollViews());
|
84
|
-
|
110
|
+
|
111
|
+
const action = new actions.ScrollToIndex(index);
|
112
|
+
const traceDescription = actionDescription.scrollToIndex(index);
|
113
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
114
|
+
}
|
115
|
+
|
116
|
+
async setDatePickerDate(rawDateString, formatString) {
|
117
|
+
const dateString = formatString === 'ISO8601'
|
118
|
+
? removeMilliseconds(rawDateString)
|
119
|
+
: rawDateString;
|
120
|
+
|
121
|
+
const action = new actions.SetDatePickerDateAction(dateString, formatString);
|
122
|
+
const traceDescription = actionDescription.setDatePickerDate(dateString, formatString);
|
123
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
85
124
|
}
|
86
125
|
|
87
126
|
/**
|
@@ -96,13 +135,17 @@ class NativeElement {
|
|
96
135
|
|
97
136
|
// override the user's element selection with an extended matcher that avoids RN issues with RCTScrollView
|
98
137
|
this._selectElementWithMatcher(this._originalMatcher._avoidProblematicReactNativeElements());
|
138
|
+
|
99
139
|
const action = new actions.SwipeAction(direction, speed, normalizedSwipeOffset, normalizedStartingPointX, normalizedStartingPointY);
|
100
|
-
|
140
|
+
const traceDescription = actionDescription.swipe(direction, speed, normalizedSwipeOffset, normalizedStartingPointX, normalizedStartingPointY);
|
141
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
101
142
|
}
|
102
143
|
|
103
144
|
async takeScreenshot(screenshotName) {
|
104
145
|
// TODO this should be moved to a lower-layer handler of this use-case
|
105
|
-
const
|
146
|
+
const action = new actions.TakeElementScreenshot();
|
147
|
+
const traceDescription = actionDescription.takeScreenshot(screenshotName);
|
148
|
+
const resultBase64 = await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
106
149
|
const filePath = tempfile('detox.element-screenshot.png');
|
107
150
|
await fs.writeFile(filePath, resultBase64, 'base64');
|
108
151
|
|
@@ -115,12 +158,21 @@ class NativeElement {
|
|
115
158
|
}
|
116
159
|
|
117
160
|
async getAttributes() {
|
118
|
-
const
|
161
|
+
const action = new actions.GetAttributes();
|
162
|
+
const traceDescription = actionDescription.getAttributes();
|
163
|
+
const result = await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
119
164
|
return JSON.parse(result);
|
120
165
|
}
|
121
166
|
|
122
167
|
async adjustSliderToPosition(newPosition) {
|
123
|
-
|
168
|
+
const action = new actions.AdjustSliderToPosition(newPosition);
|
169
|
+
const traceDescription = actionDescription.adjustSliderToPosition(newPosition);
|
170
|
+
return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
|
171
|
+
}
|
172
|
+
|
173
|
+
async performAccessibilityAction(actionName) {
|
174
|
+
const traceDescription = actionDescription.performAccessibilityAction(actionName);
|
175
|
+
return await new ActionInteraction(this._invocationManager, this, new actions.AccessibilityActionAction(actionName), traceDescription).execute();
|
124
176
|
}
|
125
177
|
}
|
126
178
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
const { expectDescription } = require('../../utils/invocationTraceDescriptions');
|
1
2
|
const { MatcherAssertionInteraction } = require('../interactions/native');
|
2
3
|
const matchers = require('../matchers/native');
|
3
4
|
|
@@ -19,7 +20,9 @@ class NativeExpectElement extends NativeExpect {
|
|
19
20
|
}
|
20
21
|
|
21
22
|
async toBeVisible(pct) {
|
22
|
-
|
23
|
+
const matcher = new matchers.VisibleMatcher(pct);
|
24
|
+
const traceDescription = expectDescription.toBeVisible(pct);
|
25
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
23
26
|
}
|
24
27
|
|
25
28
|
async toBeNotVisible() {
|
@@ -27,7 +30,9 @@ class NativeExpectElement extends NativeExpect {
|
|
27
30
|
}
|
28
31
|
|
29
32
|
async toExist() {
|
30
|
-
|
33
|
+
const matcher = new matchers.ExistsMatcher();
|
34
|
+
const traceDescription = expectDescription.toExist();
|
35
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
31
36
|
}
|
32
37
|
|
33
38
|
async toNotExist() {
|
@@ -35,7 +40,9 @@ class NativeExpectElement extends NativeExpect {
|
|
35
40
|
}
|
36
41
|
|
37
42
|
async toHaveText(text) {
|
38
|
-
|
43
|
+
const matcher = new matchers.TextMatcher(text);
|
44
|
+
const traceDescription = expectDescription.toHaveText(text);
|
45
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
39
46
|
}
|
40
47
|
|
41
48
|
async toNotHaveText(text) {
|
@@ -43,7 +50,9 @@ class NativeExpectElement extends NativeExpect {
|
|
43
50
|
}
|
44
51
|
|
45
52
|
async toHaveLabel(value) {
|
46
|
-
|
53
|
+
const matcher = new matchers.LabelMatcher(value);
|
54
|
+
const traceDescription = expectDescription.toHaveLabel(value);
|
55
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
47
56
|
}
|
48
57
|
|
49
58
|
async toNotHaveLabel(value) {
|
@@ -51,7 +60,9 @@ class NativeExpectElement extends NativeExpect {
|
|
51
60
|
}
|
52
61
|
|
53
62
|
async toHaveId(value) {
|
54
|
-
|
63
|
+
const matcher = new matchers.IdMatcher(value);
|
64
|
+
const traceDescription = expectDescription.toHaveId(value);
|
65
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
55
66
|
}
|
56
67
|
|
57
68
|
async toNotHaveId(value) {
|
@@ -59,7 +70,9 @@ class NativeExpectElement extends NativeExpect {
|
|
59
70
|
}
|
60
71
|
|
61
72
|
async toHaveValue(value) {
|
62
|
-
|
73
|
+
const matcher = new matchers.ValueMatcher(value);
|
74
|
+
const traceDescription = expectDescription.toHaveValue(value);
|
75
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
63
76
|
}
|
64
77
|
|
65
78
|
async toNotHaveValue(value) {
|
@@ -67,15 +80,21 @@ class NativeExpectElement extends NativeExpect {
|
|
67
80
|
}
|
68
81
|
|
69
82
|
async toHaveToggleValue(value) {
|
70
|
-
|
83
|
+
const matcher = new matchers.ToggleMatcher(value);
|
84
|
+
const traceDescription = expectDescription.toHaveToggleValue(value);
|
85
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
71
86
|
}
|
72
87
|
|
73
88
|
async toHaveSliderPosition(value, tolerance = 0) {
|
74
|
-
|
89
|
+
const matcher = new matchers.SliderPositionMatcher(value, tolerance);
|
90
|
+
const traceDescription = expectDescription.toHaveSliderPosition(value, tolerance);
|
91
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
75
92
|
}
|
76
93
|
|
77
94
|
async toBeFocused() {
|
78
|
-
|
95
|
+
const matcher = new matchers.FocusMatcher();
|
96
|
+
const traceDescription = expectDescription.toBeFocused();
|
97
|
+
return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
|
79
98
|
}
|
80
99
|
|
81
100
|
async toBeNotFocused() {
|