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
@@ -409,7 +409,7 @@ Please check your Detox config${this._atPath()}`,
|
|
409
409
|
case 'gpuMode':
|
410
410
|
return this._unsupportedPropertyByDeviceType('gpuMode', ['android.emulator'], deviceAlias);
|
411
411
|
case 'headless':
|
412
|
-
return this._unsupportedPropertyByDeviceType('headless', ['android.emulator'], deviceAlias);
|
412
|
+
return this._unsupportedPropertyByDeviceType('headless', ['ios.simulator', 'android.emulator'], deviceAlias);
|
413
413
|
case 'readonly':
|
414
414
|
return this._unsupportedPropertyByDeviceType('readonly', ['android.emulator'], deviceAlias);
|
415
415
|
case 'utilBinaryPaths':
|
@@ -507,6 +507,14 @@ Examine your Detox config${this._atPath()}`,
|
|
507
507
|
});
|
508
508
|
}
|
509
509
|
|
510
|
+
unsupportedReversePorts(appPath) {
|
511
|
+
return new DetoxConfigError({
|
512
|
+
message: `Non-Android app configs cannot have "reversePorts" property:`,
|
513
|
+
debugInfo: this._focusOnAppConfig(appPath),
|
514
|
+
inspectOptions: { depth: 4 },
|
515
|
+
});
|
516
|
+
}
|
517
|
+
|
510
518
|
missingAppBinaryPath(appPath) {
|
511
519
|
return new DetoxConfigError({
|
512
520
|
message: `Missing "binaryPath" property in the app config.\nExpected a string:`,
|
@@ -656,12 +664,19 @@ Examine your Detox config${this._atPath()}`,
|
|
656
664
|
}
|
657
665
|
|
658
666
|
invalidTestRunnerProperty(isGlobal) {
|
667
|
+
const testRunner = _.get(
|
668
|
+
isGlobal
|
669
|
+
? this.contents
|
670
|
+
: this._getSelectedConfiguration(),
|
671
|
+
['testRunner']
|
672
|
+
);
|
673
|
+
|
659
674
|
return new DetoxConfigError({
|
660
|
-
message: `testRunner should be an object, not a
|
675
|
+
message: `testRunner should be an object, not a ${typeof testRunner}`,
|
661
676
|
hint: `Check that in your Detox config${this._atPath()}`,
|
662
677
|
inspectOptions: { depth: isGlobal ? 0 : 3 },
|
663
678
|
debugInfo: isGlobal ? {
|
664
|
-
testRunner
|
679
|
+
testRunner,
|
665
680
|
...this.contents,
|
666
681
|
} : {
|
667
682
|
...this._focusOnConfiguration(c => _.pick(c, ['testRunner'])),
|
package/src/errors/DetoxError.js
CHANGED
@@ -8,6 +8,10 @@ class DetoxError extends Error {
|
|
8
8
|
this.name = 'DetoxError';
|
9
9
|
}
|
10
10
|
|
11
|
+
format() {
|
12
|
+
return this.message;
|
13
|
+
}
|
14
|
+
|
11
15
|
static get reportIssue() {
|
12
16
|
return 'Please report this issue on our GitHub tracker:\nhttps://github.com/wix/Detox/issues';
|
13
17
|
}
|
@@ -32,7 +36,7 @@ class DetoxError extends Error {
|
|
32
36
|
*/
|
33
37
|
static format(err, inspectOptions = { depth: 1 }) {
|
34
38
|
if (err instanceof DetoxError) {
|
35
|
-
return err.
|
39
|
+
return err.format();
|
36
40
|
}
|
37
41
|
|
38
42
|
if (_.isError(err) && /^Command failed:/.test(err.message)) {
|
package/src/ios/expectTwo.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
+
const assert = require('assert');
|
2
3
|
const path = require('path');
|
3
4
|
|
4
5
|
const fs = require('fs-extra');
|
@@ -6,6 +7,10 @@ const _ = require('lodash');
|
|
6
7
|
const tempfile = require('tempfile');
|
7
8
|
|
8
9
|
const { assertEnum, assertNormalized } = require('../utils/assertArgument');
|
10
|
+
const { removeMilliseconds } = require('../utils/dateUtils');
|
11
|
+
const { actionDescription, expectDescription } = require('../utils/invocationTraceDescriptions');
|
12
|
+
const log = require('../utils/logger').child({ cat: 'ws-client, ws' });
|
13
|
+
const traceInvocationCall = require('../utils/traceInvocationCall').bind(null, log);
|
9
14
|
|
10
15
|
const assertDirection = assertEnum(['left', 'right', 'up', 'down']);
|
11
16
|
const assertSpeed = assertEnum(['fast', 'slow']);
|
@@ -23,7 +28,8 @@ class Expect {
|
|
23
28
|
+ (percent + (' (' + (typeof percent + ')'))));
|
24
29
|
}
|
25
30
|
|
26
|
-
|
31
|
+
const traceDescription = expectDescription.toBeVisible(percent);
|
32
|
+
return this.expect('toBeVisible', traceDescription, percent);
|
27
33
|
}
|
28
34
|
|
29
35
|
toBeNotVisible() {
|
@@ -31,7 +37,8 @@ class Expect {
|
|
31
37
|
}
|
32
38
|
|
33
39
|
toBeFocused() {
|
34
|
-
|
40
|
+
const traceDescription = expectDescription.toBeFocused();
|
41
|
+
return this.expect('toBeFocused', traceDescription);
|
35
42
|
}
|
36
43
|
|
37
44
|
toBeNotFocused() {
|
@@ -39,7 +46,8 @@ class Expect {
|
|
39
46
|
}
|
40
47
|
|
41
48
|
toExist() {
|
42
|
-
|
49
|
+
const traceDescription = expectDescription.toExist();
|
50
|
+
return this.expect('toExist', traceDescription);
|
43
51
|
}
|
44
52
|
|
45
53
|
toNotExist() {
|
@@ -47,7 +55,8 @@ class Expect {
|
|
47
55
|
}
|
48
56
|
|
49
57
|
toHaveText(text) {
|
50
|
-
|
58
|
+
const traceDescription = expectDescription.toHaveText(text);
|
59
|
+
return this.expect('toHaveText', traceDescription, text);
|
51
60
|
}
|
52
61
|
|
53
62
|
toNotHaveText(text) {
|
@@ -55,7 +64,8 @@ class Expect {
|
|
55
64
|
}
|
56
65
|
|
57
66
|
toHaveLabel(label) {
|
58
|
-
|
67
|
+
const traceDescription = expectDescription.toHaveLabel(label);
|
68
|
+
return this.expect('toHaveLabel', traceDescription, label);
|
59
69
|
}
|
60
70
|
|
61
71
|
toNotHaveLabel(label) {
|
@@ -63,7 +73,8 @@ class Expect {
|
|
63
73
|
}
|
64
74
|
|
65
75
|
toHaveId(id) {
|
66
|
-
|
76
|
+
const traceDescription = expectDescription.toHaveId(id);
|
77
|
+
return this.expect('toHaveId', traceDescription, id);
|
67
78
|
}
|
68
79
|
|
69
80
|
toNotHaveId(id) {
|
@@ -71,7 +82,8 @@ class Expect {
|
|
71
82
|
}
|
72
83
|
|
73
84
|
toHaveValue(value) {
|
74
|
-
|
85
|
+
const traceDescription = expectDescription.toHaveValue(value);
|
86
|
+
return this.expect('toHaveValue', traceDescription, value);
|
75
87
|
}
|
76
88
|
|
77
89
|
toNotHaveValue(value) {
|
@@ -79,7 +91,8 @@ class Expect {
|
|
79
91
|
}
|
80
92
|
|
81
93
|
toHaveSliderPosition(position, tolerance = 0) {
|
82
|
-
|
94
|
+
const traceDescription = expectDescription.toHaveSliderPosition(position, tolerance);
|
95
|
+
return this.expect('toHaveSliderPosition', traceDescription, position, tolerance);
|
83
96
|
}
|
84
97
|
|
85
98
|
toHaveToggleValue(value) {
|
@@ -103,16 +116,18 @@ class Expect {
|
|
103
116
|
};
|
104
117
|
}
|
105
118
|
|
106
|
-
expect(expectation, ...params) {
|
119
|
+
expect(expectation, traceDescription, ...params) {
|
120
|
+
assert(traceDescription, `must provide trace description for expectation: \n ${JSON.stringify(expectation)}`);
|
121
|
+
|
107
122
|
const invocation = this.createInvocation(expectation, ...params);
|
108
|
-
|
123
|
+
traceDescription = expectDescription.full(traceDescription, this.modifiers.includes('not'));
|
124
|
+
return _executeInvocation(this._invocationManager, invocation, traceDescription);
|
109
125
|
}
|
110
126
|
}
|
111
127
|
|
112
128
|
class InternalExpect extends Expect {
|
113
|
-
expect(expectation, ...params) {
|
114
|
-
|
115
|
-
return invocation;
|
129
|
+
expect(expectation, _traceDescription, ...params) {
|
130
|
+
return this.createInvocation(expectation, ...params);
|
116
131
|
}
|
117
132
|
}
|
118
133
|
|
@@ -131,7 +146,8 @@ class Element {
|
|
131
146
|
}
|
132
147
|
|
133
148
|
getAttributes() {
|
134
|
-
|
149
|
+
const traceDescription = actionDescription.getAttributes();
|
150
|
+
return this.withAction('getAttributes', traceDescription);
|
135
151
|
}
|
136
152
|
|
137
153
|
tap(point) {
|
@@ -140,12 +156,16 @@ class Element {
|
|
140
156
|
if (typeof point.x !== 'number') throw new Error('point.x should be a number, but got ' + (point.x + (' (' + (typeof point.x + ')'))));
|
141
157
|
if (typeof point.y !== 'number') throw new Error('point.y should be a number, but got ' + (point.y + (' (' + (typeof point.y + ')'))));
|
142
158
|
}
|
143
|
-
|
159
|
+
|
160
|
+
const traceDescription = actionDescription.tapAtPoint(point);
|
161
|
+
return this.withAction('tap', traceDescription, point);
|
144
162
|
}
|
145
163
|
|
146
164
|
longPress(duration = 1000) {
|
147
165
|
if (typeof duration !== 'number') throw new Error('duration should be a number, but got ' + (duration + (' (' + (typeof duration + ')'))));
|
148
|
-
|
166
|
+
|
167
|
+
const traceDescription = actionDescription.longPress(duration);
|
168
|
+
return this.withAction('longPress', traceDescription, duration);
|
149
169
|
}
|
150
170
|
|
151
171
|
longPressAndDrag(duration, normalizedPositionX, normalizedPositionY, targetElement,
|
@@ -162,13 +182,18 @@ class Element {
|
|
162
182
|
assertNormalized({ normalizedTargetPositionX });
|
163
183
|
assertNormalized({ normalizedTargetPositionY });
|
164
184
|
|
165
|
-
|
185
|
+
const traceDescription = actionDescription.longPressAndDrag(duration, normalizedPositionX, normalizedPositionY, targetElement,
|
186
|
+
normalizedTargetPositionX, normalizedTargetPositionY, speed, holdDuration);
|
187
|
+
return this.withActionAndTargetElement('longPress', targetElement, traceDescription, duration, normalizedPositionX, normalizedPositionY,
|
166
188
|
normalizedTargetPositionX, normalizedTargetPositionY, speed, holdDuration);
|
167
189
|
}
|
168
190
|
|
169
191
|
multiTap(times) {
|
170
192
|
if (typeof times !== 'number') throw new Error('times should be a number, but got ' + (times + (' (' + (typeof times + ')'))));
|
171
|
-
|
193
|
+
if (times < 1) throw new Error('times should be greater than 0, but got ' + times);
|
194
|
+
|
195
|
+
const traceDescription = actionDescription.multiTap(times);
|
196
|
+
return this.withAction('multiTap', traceDescription, times);
|
172
197
|
}
|
173
198
|
|
174
199
|
tapAtPoint(point) {
|
@@ -176,25 +201,39 @@ class Element {
|
|
176
201
|
}
|
177
202
|
|
178
203
|
tapBackspaceKey() {
|
179
|
-
|
204
|
+
const traceDescription = actionDescription.tapBackspaceKey();
|
205
|
+
return this.withAction('tapBackspaceKey', traceDescription);
|
180
206
|
}
|
181
207
|
|
182
208
|
tapReturnKey() {
|
183
|
-
|
209
|
+
const traceDescription = actionDescription.tapReturnKey();
|
210
|
+
return this.withAction('tapReturnKey', traceDescription);
|
184
211
|
}
|
185
212
|
|
186
213
|
typeText(text) {
|
187
214
|
if (typeof text !== 'string') throw new Error('text should be a string, but got ' + (text + (' (' + (typeof text + ')'))));
|
188
|
-
|
215
|
+
|
216
|
+
const traceDescription = actionDescription.typeText(text);
|
217
|
+
return this.withAction('typeText', traceDescription, text);
|
189
218
|
}
|
190
219
|
|
191
220
|
replaceText(text) {
|
192
221
|
if (typeof text !== 'string') throw new Error('text should be a string, but got ' + (text + (' (' + (typeof text + ')'))));
|
193
|
-
|
222
|
+
|
223
|
+
const traceDescription = actionDescription.replaceText(text);
|
224
|
+
return this.withAction('replaceText', traceDescription, text);
|
194
225
|
}
|
195
226
|
|
196
227
|
clearText() {
|
197
|
-
|
228
|
+
const traceDescription = actionDescription.clearText();
|
229
|
+
return this.withAction('clearText', traceDescription);
|
230
|
+
}
|
231
|
+
|
232
|
+
performAccessibilityAction(actionName) {
|
233
|
+
if (typeof actionName !== 'string') throw new Error('actionName should be a string, but got ' + (actionName + (' (' + (typeof actionName + ')'))));
|
234
|
+
|
235
|
+
const traceDescription = actionDescription.performAccessibilityAction(actionName);
|
236
|
+
return this.withAction('accessibilityAction', traceDescription, actionName);
|
198
237
|
}
|
199
238
|
|
200
239
|
scroll(pixels, direction = 'down', startPositionX = NaN, startPositionY = NaN) {
|
@@ -202,12 +241,15 @@ class Element {
|
|
202
241
|
if (typeof pixels !== 'number') throw new Error('amount of pixels should be a number, but got ' + (pixels + (' (' + (typeof pixels + ')'))));
|
203
242
|
if (typeof startPositionX !== 'number') throw new Error('startPositionX should be a number, but got ' + (startPositionX + (' (' + (typeof startPositionX + ')'))));
|
204
243
|
if (typeof startPositionY !== 'number') throw new Error('startPositionY should be a number, but got ' + (startPositionY + (' (' + (typeof startPositionY + ')'))));
|
205
|
-
|
244
|
+
|
245
|
+
const traceDescription = actionDescription.scroll(pixels, direction, startPositionX, startPositionY);
|
246
|
+
return this.withAction('scroll', traceDescription, pixels, direction, startPositionX, startPositionY);
|
206
247
|
}
|
207
248
|
|
208
249
|
scrollTo(edge) {
|
209
250
|
if (!['left', 'right', 'top', 'bottom'].some(option => option === edge)) throw new Error('edge should be one of [left, right, top, bottom], but got ' + edge);
|
210
|
-
|
251
|
+
const traceDescription = actionDescription.scrollTo(edge);
|
252
|
+
return this.withAction('scrollTo', traceDescription, edge);
|
211
253
|
}
|
212
254
|
|
213
255
|
swipe(direction, speed = 'fast', normalizedSwipeOffset = NaN, normalizedStartingPointX = NaN, normalizedStartingPointY = NaN) {
|
@@ -218,42 +260,65 @@ class Element {
|
|
218
260
|
assertNormalized({ normalizedStartingPointY });
|
219
261
|
|
220
262
|
normalizedSwipeOffset = Number.isNaN(normalizedSwipeOffset) ? 0.75 : normalizedSwipeOffset;
|
221
|
-
|
263
|
+
const traceDescription = actionDescription.swipe(direction, speed, normalizedSwipeOffset, normalizedStartingPointX, normalizedStartingPointY);
|
264
|
+
return this.withAction(
|
265
|
+
'swipe',
|
266
|
+
traceDescription,
|
267
|
+
direction,
|
268
|
+
speed,
|
269
|
+
normalizedSwipeOffset,
|
270
|
+
normalizedStartingPointX,
|
271
|
+
normalizedStartingPointY
|
272
|
+
);
|
222
273
|
}
|
223
274
|
|
224
275
|
setColumnToValue(column, value) {
|
225
276
|
if (typeof column !== 'number') throw new Error('column should be a number, but got ' + (column + (' (' + (typeof column + ')'))));
|
226
277
|
if (typeof value !== 'string') throw new Error('value should be a string, but got ' + (value + (' (' + (typeof value + ')'))));
|
227
|
-
|
278
|
+
|
279
|
+
const traceDescription = actionDescription.setColumnToValue(column, value);
|
280
|
+
return this.withAction('setColumnToValue', traceDescription, column, value);
|
228
281
|
}
|
229
282
|
|
230
283
|
setDatePickerDate(dateString, dateFormat) {
|
231
284
|
if (typeof dateString !== 'string') throw new Error('dateString should be a string, but got ' + (dateString + (' (' + (typeof dateString + ')'))));
|
232
285
|
if (typeof dateFormat !== 'string') throw new Error('dateFormat should be a string, but got ' + (dateFormat + (' (' + (typeof dateFormat + ')'))));
|
233
|
-
|
286
|
+
if (dateFormat === 'ISO8601') {
|
287
|
+
dateString = removeMilliseconds(dateString);
|
288
|
+
}
|
289
|
+
|
290
|
+
const traceDescription = actionDescription.setDatePickerDate(dateString, dateFormat);
|
291
|
+
return this.withAction('setDatePickerDate', traceDescription, dateString, dateFormat);
|
234
292
|
}
|
235
293
|
|
236
294
|
pinch(scale, speed = 'fast', angle = 0) {
|
237
295
|
if (typeof scale !== 'number' || !Number.isFinite(scale) || scale < 0) throw new Error(`pinch scale must be a finite number larger than zero`);
|
238
296
|
if (!['slow', 'fast'].includes(speed)) throw new Error(`pinch speed is either 'slow' or 'fast'`);
|
239
297
|
if (typeof angle !== 'number' || !Number.isFinite(angle)) throw new Error(`pinch angle must be a finite number (radian)`);
|
240
|
-
|
298
|
+
|
299
|
+
const traceDescription = actionDescription.pinch(scale, speed, angle);
|
300
|
+
return this.withAction('pinch', traceDescription, scale, speed, angle);
|
241
301
|
}
|
242
302
|
|
243
303
|
pinchWithAngle(direction, speed = 'slow', angle = 0) {
|
244
304
|
if (!['inward', 'outward'].includes(direction)) throw new Error(`pinchWithAngle direction is either 'inward' or 'outward'`);
|
245
305
|
if (!['slow', 'fast'].includes(speed)) throw new Error(`pinchWithAngle speed is either 'slow' or 'fast'`);
|
246
306
|
if (typeof angle !== 'number') throw new Error(`pinchWithAngle angle must be a number (radiant), got ${typeof angle}`);
|
247
|
-
|
307
|
+
|
308
|
+
const traceDescription = actionDescription.pinchWithAngle(direction, speed, angle);
|
309
|
+
return this.withAction('pinchWithAngle', traceDescription, direction, speed, angle);
|
248
310
|
}
|
249
311
|
|
250
312
|
adjustSliderToPosition(position) {
|
251
313
|
if (!(typeof position === 'number' && position >= 0 && position <= 1)) throw new Error('position should be a number [0.0, 1.0], but got ' + (position + (' (' + (typeof position + ')'))));
|
252
|
-
|
314
|
+
|
315
|
+
const traceDescription = actionDescription.adjustSliderToPosition(position);
|
316
|
+
return this.withAction('adjustSliderToPosition', traceDescription, position);
|
253
317
|
}
|
254
318
|
|
255
319
|
async takeScreenshot(fileName) {
|
256
|
-
const
|
320
|
+
const traceDescription = actionDescription.takeScreenshot(fileName);
|
321
|
+
const { screenshotPath } = await this.withAction('takeScreenshot', traceDescription, fileName);
|
257
322
|
|
258
323
|
const filePath = tempfile('.detox.element-screenshot.png');
|
259
324
|
await fs.move(screenshotPath, filePath);
|
@@ -287,22 +352,20 @@ class Element {
|
|
287
352
|
return invocation;
|
288
353
|
}
|
289
354
|
|
290
|
-
withAction(action, ...params) {
|
355
|
+
withAction(action, traceDescription, ...params) {
|
291
356
|
const invocation = this.createInvocation(action, null, ...params);
|
292
|
-
return this._invocationManager
|
357
|
+
return _executeInvocation(this._invocationManager, invocation, traceDescription);
|
293
358
|
}
|
294
359
|
|
295
|
-
withActionAndTargetElement(action, targetElement, ...params) {
|
360
|
+
withActionAndTargetElement(action, targetElement, traceDescription, ...params) {
|
296
361
|
const invocation = this.createInvocation(action, targetElement, ...params);
|
297
|
-
return this._invocationManager
|
362
|
+
return _executeInvocation(this._invocationManager, invocation, traceDescription);
|
298
363
|
}
|
299
364
|
}
|
300
365
|
|
301
366
|
class InternalElement extends Element {
|
302
|
-
|
303
|
-
|
304
|
-
const invocation = this.createInvocation(action, null, ...params);
|
305
|
-
return invocation;
|
367
|
+
withAction(action, _traceDescription, ...params) {
|
368
|
+
return this.createInvocation(action, null, ...params);
|
306
369
|
}
|
307
370
|
}
|
308
371
|
|
@@ -341,7 +404,6 @@ class By {
|
|
341
404
|
}
|
342
405
|
|
343
406
|
class Matcher {
|
344
|
-
|
345
407
|
accessibilityLabel(label) {
|
346
408
|
return this.label(label);
|
347
409
|
}
|
@@ -387,32 +449,38 @@ class Matcher {
|
|
387
449
|
throwMatcherError(matcher);
|
388
450
|
}
|
389
451
|
|
390
|
-
this.and({ predicate: { type: 'ancestor', predicate: matcher.predicate } });
|
391
|
-
return this;
|
452
|
+
return this.and({ predicate: { type: 'ancestor', predicate: matcher.predicate } });
|
392
453
|
}
|
393
454
|
|
394
455
|
withDescendant(matcher) {
|
395
456
|
if (!(matcher instanceof Matcher)) {
|
396
457
|
throwMatcherError(matcher);
|
397
458
|
}
|
398
|
-
|
399
|
-
return this;
|
459
|
+
|
460
|
+
return this.and({ predicate: { type: 'descendant', predicate: matcher.predicate } });
|
400
461
|
}
|
401
462
|
|
402
463
|
and(matcher) {
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
464
|
+
const result = new Matcher();
|
465
|
+
|
466
|
+
result.predicate = {
|
467
|
+
type: 'and',
|
468
|
+
predicates: [
|
469
|
+
...Matcher.predicates(this),
|
470
|
+
...Matcher.predicates(matcher),
|
471
|
+
].map(x => _.cloneDeep(x))
|
472
|
+
};
|
473
|
+
|
474
|
+
return result;
|
475
|
+
}
|
476
|
+
|
477
|
+
/** @private */
|
478
|
+
static *predicates(matcher) {
|
410
479
|
if (matcher.predicate.type === 'and') {
|
411
|
-
|
480
|
+
yield* matcher.predicate.predicates;
|
412
481
|
} else {
|
413
|
-
|
482
|
+
yield matcher.predicate;
|
414
483
|
}
|
415
|
-
return this;
|
416
484
|
}
|
417
485
|
}
|
418
486
|
|
@@ -484,6 +552,16 @@ class WaitFor {
|
|
484
552
|
return this;
|
485
553
|
}
|
486
554
|
|
555
|
+
toBeFocused() {
|
556
|
+
this.expectation = this.expectation.toBeFocused();
|
557
|
+
return this;
|
558
|
+
}
|
559
|
+
|
560
|
+
toBeNotFocused() {
|
561
|
+
this.expectation = this.expectation.toBeNotFocused();
|
562
|
+
return this;
|
563
|
+
}
|
564
|
+
|
487
565
|
get not() {
|
488
566
|
this.expectation.not;
|
489
567
|
return this;
|
@@ -493,7 +571,9 @@ class WaitFor {
|
|
493
571
|
if (typeof timeout !== 'number') throw new Error('text should be a number, but got ' + (timeout + (' (' + (typeof timeout + ')'))));
|
494
572
|
if (timeout < 0) throw new Error('timeout must be larger than 0');
|
495
573
|
this.timeout = timeout;
|
496
|
-
|
574
|
+
|
575
|
+
const traceDescription = expectDescription.withTimeout(timeout);
|
576
|
+
return this.waitForWithTimeout(traceDescription);
|
497
577
|
}
|
498
578
|
|
499
579
|
whileElement(matcher) {
|
@@ -504,106 +584,143 @@ class WaitFor {
|
|
504
584
|
|
505
585
|
tap(point) {
|
506
586
|
this.action = this.actionableElement.tap(point);
|
507
|
-
|
587
|
+
const traceDescription = actionDescription.tapAtPoint(point);
|
588
|
+
return this.waitForWithAction(traceDescription);
|
508
589
|
}
|
509
590
|
|
510
591
|
longPress(duration) {
|
511
592
|
this.action = this.actionableElement.longPress(duration);
|
512
|
-
|
593
|
+
const traceDescription = actionDescription.longPress(duration);
|
594
|
+
return this.waitForWithAction(traceDescription);
|
513
595
|
}
|
514
596
|
|
515
597
|
multiTap(times) {
|
516
598
|
this.action = this.actionableElement.multiTap(times);
|
517
|
-
|
599
|
+
const traceDescription = actionDescription.multiTap(times);
|
600
|
+
return this.waitForWithAction(traceDescription);
|
518
601
|
}
|
519
602
|
|
520
603
|
tapAtPoint(point) {
|
521
604
|
this.action = this.actionableElement.tap(point);
|
522
|
-
|
605
|
+
const traceDescription = actionDescription.tapAtPoint(point);
|
606
|
+
return this.waitForWithAction(traceDescription);
|
523
607
|
}
|
524
608
|
|
525
609
|
tapBackspaceKey() {
|
526
610
|
this.action = this.actionableElement.tapBackspaceKey();
|
527
|
-
|
611
|
+
const traceDescription = actionDescription.tapBackspaceKey();
|
612
|
+
return this.waitForWithAction(traceDescription);
|
528
613
|
}
|
529
614
|
|
530
615
|
tapReturnKey() {
|
531
616
|
this.action = this.actionableElement.tapReturnKey();
|
532
|
-
|
617
|
+
const traceDescription = actionDescription.tapReturnKey();
|
618
|
+
return this.waitForWithAction(traceDescription);
|
533
619
|
}
|
534
620
|
|
535
621
|
typeText(text) {
|
536
622
|
this.action = this.actionableElement.typeText(text);
|
537
|
-
|
623
|
+
const traceDescription = actionDescription.typeText(text);
|
624
|
+
return this.waitForWithAction(traceDescription);
|
538
625
|
}
|
539
626
|
|
540
627
|
replaceText(text) {
|
541
628
|
this.action = this.actionableElement.replaceText(text);
|
542
|
-
|
629
|
+
const traceDescription = actionDescription.replaceText(text);
|
630
|
+
return this.waitForWithAction(traceDescription);
|
543
631
|
}
|
544
632
|
|
545
633
|
clearText() {
|
546
634
|
this.action = this.actionableElement.clearText();
|
547
|
-
|
635
|
+
const traceDescription = actionDescription.clearText();
|
636
|
+
return this.waitForWithAction(traceDescription);
|
548
637
|
}
|
549
638
|
|
550
639
|
scroll(pixels, direction, startPositionX, startPositionY) {
|
551
640
|
this.action = this.actionableElement.scroll(pixels, direction, startPositionX, startPositionY);
|
552
|
-
|
641
|
+
|
642
|
+
const traceDescription = actionDescription.scroll(pixels, direction, startPositionX, startPositionY);
|
643
|
+
return this.waitForWithAction(traceDescription);
|
553
644
|
}
|
554
645
|
|
555
646
|
scrollTo(edge) {
|
556
647
|
this.action = this.actionableElement.scrollTo(edge);
|
557
|
-
|
648
|
+
const traceDescription = actionDescription.scrollTo(edge);
|
649
|
+
return this.waitForWithAction(traceDescription);
|
558
650
|
}
|
559
651
|
|
560
652
|
swipe(direction, speed, percentage) {
|
561
653
|
this.action = this.actionableElement.swipe(direction, speed, percentage);
|
562
|
-
|
654
|
+
const traceDescription = actionDescription.swipe(direction, speed, percentage);
|
655
|
+
return this.waitForWithAction(traceDescription);
|
563
656
|
}
|
564
657
|
|
565
658
|
setColumnToValue(column, value) {
|
566
659
|
this.action = this.actionableElement.setColumnToValue(column, value);
|
567
|
-
|
660
|
+
const traceDescription = actionDescription.setColumnToValue(column, value);
|
661
|
+
return this.waitForWithAction(traceDescription);
|
568
662
|
}
|
569
663
|
|
570
664
|
setDatePickerDate(dateString, dateFormat) {
|
571
665
|
this.action = this.actionableElement.setDatePickerDate(dateString, dateFormat);
|
572
|
-
|
666
|
+
const traceDescription = actionDescription.setDatePickerDate(dateString, dateFormat);
|
667
|
+
return this.waitForWithAction(traceDescription);
|
668
|
+
}
|
669
|
+
|
670
|
+
performAccessibilityAction(actionName) {
|
671
|
+
this.action = this.actionableElement.performAccessibilityAction(actionName);
|
672
|
+
const traceDescription = actionDescription.performAccessibilityAction(actionName);
|
673
|
+
return this.waitForWithAction(traceDescription);
|
573
674
|
}
|
574
675
|
|
575
676
|
pinch(scale, speed, angle) {
|
576
677
|
this.action = this.actionableElement.pinch(scale, speed, angle);
|
577
|
-
|
678
|
+
const traceDescription = actionDescription.pinch(scale, speed, angle);
|
679
|
+
return this.waitForWithAction(traceDescription);
|
578
680
|
}
|
579
681
|
|
580
682
|
pinchWithAngle(direction, speed, angle) {
|
581
683
|
this.action = this.actionableElement.pinchWithAngle(direction, speed, angle);
|
582
|
-
|
684
|
+
const traceDescription = actionDescription.pinchWithAngle(direction, speed, angle);
|
685
|
+
return this.waitForWithAction(traceDescription);
|
583
686
|
}
|
584
687
|
|
585
|
-
waitForWithAction() {
|
688
|
+
waitForWithAction(actionTraceDescription) {
|
586
689
|
const expectation = this.expectation;
|
587
690
|
const action = this.action;
|
588
691
|
|
589
|
-
|
692
|
+
const invocation = this.createWaitForWithActionInvocation(expectation, action);
|
693
|
+
|
694
|
+
const traceDescription = expectDescription.waitFor(actionTraceDescription);
|
695
|
+
return _executeInvocation(this._invocationManager, invocation, traceDescription);
|
696
|
+
}
|
697
|
+
|
698
|
+
createWaitForWithActionInvocation(expectation, action) {
|
699
|
+
return {
|
590
700
|
...action,
|
591
701
|
while: {
|
592
702
|
...expectation
|
593
703
|
}
|
594
|
-
}
|
704
|
+
};
|
595
705
|
}
|
596
706
|
|
597
|
-
waitForWithTimeout() {
|
707
|
+
waitForWithTimeout(expectTraceDescription) {
|
598
708
|
const expectation = this.expectation;
|
599
709
|
const action = this.action;
|
600
710
|
const timeout = this.timeout;
|
601
711
|
|
602
|
-
|
712
|
+
const invocation = this.createWaitForWithTimeoutInvocation(expectation, action, timeout);
|
713
|
+
|
714
|
+
const traceDescription = expectDescription.waitForWithTimeout(expectTraceDescription, timeout);
|
715
|
+
return _executeInvocation(this._invocationManager, invocation, traceDescription);
|
716
|
+
}
|
717
|
+
|
718
|
+
createWaitForWithTimeoutInvocation(expectation, action, timeout) {
|
719
|
+
return {
|
603
720
|
...action,
|
604
721
|
...expectation,
|
605
722
|
timeout
|
606
|
-
}
|
723
|
+
};
|
607
724
|
}
|
608
725
|
}
|
609
726
|
|
@@ -665,4 +782,8 @@ function throwElementError(param) {
|
|
665
782
|
throw new Error(`${param} is not a Detox element. More about Detox elements here: https://wix.github.io/Detox/docs/api/matchers`);
|
666
783
|
}
|
667
784
|
|
785
|
+
function _executeInvocation(invocationManager, invocation, traceDescription) {
|
786
|
+
return traceInvocationCall(traceDescription, invocation, invocationManager.execute(invocation));
|
787
|
+
}
|
788
|
+
|
668
789
|
module.exports = IosExpect;
|