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
@@ -1,30 +1,51 @@
|
|
1
|
+
const { inspect } = require('util');
|
2
|
+
|
3
|
+
const { DetoxRuntimeError } = require('../../errors');
|
1
4
|
const invoke = require('../../invoke');
|
2
5
|
const DetoxMatcherApi = require('../espressoapi/DetoxMatcher');
|
3
6
|
|
4
7
|
class NativeMatcher {
|
8
|
+
static _assertMatcher(matcher) {
|
9
|
+
if (!(matcher instanceof NativeMatcher)) {
|
10
|
+
throw new DetoxRuntimeError({ message: `Expected a matcher, got: ${inspect(matcher)}` });
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
constructor(call) {
|
15
|
+
this._call = call || null;
|
16
|
+
}
|
17
|
+
|
5
18
|
withAncestor(matcher) {
|
6
|
-
|
7
|
-
|
19
|
+
NativeMatcher._assertMatcher(matcher);
|
20
|
+
|
21
|
+
const call = invoke.callDirectly(DetoxMatcherApi.matcherWithAncestor(this, matcher));
|
22
|
+
return new NativeMatcher(call);
|
8
23
|
}
|
9
24
|
|
10
25
|
withDescendant(matcher) {
|
11
|
-
|
12
|
-
|
26
|
+
NativeMatcher._assertMatcher(matcher);
|
27
|
+
|
28
|
+
const call = invoke.callDirectly(DetoxMatcherApi.matcherWithDescendant(this, matcher));
|
29
|
+
return new NativeMatcher(call);
|
13
30
|
}
|
14
31
|
|
15
32
|
and(matcher) {
|
16
|
-
|
17
|
-
|
33
|
+
NativeMatcher._assertMatcher(matcher);
|
34
|
+
|
35
|
+
const call = invoke.callDirectly(DetoxMatcherApi.matcherForAnd(this, matcher));
|
36
|
+
return new NativeMatcher(call);
|
18
37
|
}
|
19
38
|
|
20
39
|
or(matcher) {
|
21
|
-
|
22
|
-
|
40
|
+
NativeMatcher._assertMatcher(matcher);
|
41
|
+
|
42
|
+
const call = invoke.callDirectly(DetoxMatcherApi.matcherForOr(this, matcher));
|
43
|
+
return new NativeMatcher(call);
|
23
44
|
}
|
24
45
|
|
25
46
|
get not() {
|
26
|
-
|
27
|
-
return
|
47
|
+
const call = invoke.callDirectly(DetoxMatcherApi.matcherForNot(this));
|
48
|
+
return new NativeMatcher(call);
|
28
49
|
}
|
29
50
|
|
30
51
|
_avoidProblematicReactNativeElements() {
|
@@ -65,6 +65,14 @@ class NativeWaitForElement extends NativeWaitFor {
|
|
65
65
|
toNotHaveValue(value) {
|
66
66
|
return this.not.toHaveValue(value);
|
67
67
|
}
|
68
|
+
|
69
|
+
toBeFocused() {
|
70
|
+
return new WaitForInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.FocusMatcher().not : new matchers.FocusMatcher());
|
71
|
+
}
|
72
|
+
|
73
|
+
toBeNotFocused() {
|
74
|
+
return this.not.toBeFocused();
|
75
|
+
}
|
68
76
|
}
|
69
77
|
|
70
78
|
module.exports = {
|
@@ -194,6 +194,19 @@ class DetoxAction {
|
|
194
194
|
};
|
195
195
|
}
|
196
196
|
|
197
|
+
static setDatePickerDate(dateString, formatString) {
|
198
|
+
if (typeof dateString !== "string") throw new Error("dateString should be a string, but got " + (dateString + (" (" + (typeof dateString + ")"))));
|
199
|
+
if (typeof formatString !== "string") throw new Error("formatString should be a string, but got " + (formatString + (" (" + (typeof formatString + ")"))));
|
200
|
+
return {
|
201
|
+
target: {
|
202
|
+
type: "Class",
|
203
|
+
value: "com.wix.detox.espresso.DetoxAction"
|
204
|
+
},
|
205
|
+
method: "setDatePickerDate",
|
206
|
+
args: [dateString, formatString]
|
207
|
+
};
|
208
|
+
}
|
209
|
+
|
197
210
|
static adjustSliderToPosition(newPosition) {
|
198
211
|
if (typeof newPosition !== "number") throw new Error("newPosition should be a number, but got " + (newPosition + (" (" + (typeof newPosition + ")"))));
|
199
212
|
return {
|
@@ -220,6 +233,30 @@ class DetoxAction {
|
|
220
233
|
};
|
221
234
|
}
|
222
235
|
|
236
|
+
static accessibilityAction(actionName) {
|
237
|
+
if (typeof actionName !== "string") throw new Error("actionName should be a string, but got " + (actionName + (" (" + (typeof actionName + ")"))));
|
238
|
+
return {
|
239
|
+
target: {
|
240
|
+
type: "Class",
|
241
|
+
value: "com.wix.detox.espresso.DetoxAction"
|
242
|
+
},
|
243
|
+
method: "accessibilityAction",
|
244
|
+
args: [actionName]
|
245
|
+
};
|
246
|
+
}
|
247
|
+
|
248
|
+
static parseDateISO8601(dateString) {
|
249
|
+
if (typeof dateString !== "string") throw new Error("dateString should be a string, but got " + (dateString + (" (" + (typeof dateString + ")"))));
|
250
|
+
return {
|
251
|
+
target: {
|
252
|
+
type: "Class",
|
253
|
+
value: "com.wix.detox.espresso.DetoxAction"
|
254
|
+
},
|
255
|
+
method: "parseDateISO8601",
|
256
|
+
args: [dateString]
|
257
|
+
};
|
258
|
+
}
|
259
|
+
|
223
260
|
}
|
224
261
|
|
225
262
|
module.exports = DetoxAction;
|
@@ -26,6 +26,30 @@ class DetoxMatcher {
|
|
26
26
|
};
|
27
27
|
}
|
28
28
|
|
29
|
+
static matcherForAccessibilityLabel(label) {
|
30
|
+
if (typeof label !== "string") throw new Error("label should be a string, but got " + (label + (" (" + (typeof label + ")"))));
|
31
|
+
return {
|
32
|
+
target: {
|
33
|
+
type: "Class",
|
34
|
+
value: "com.wix.detox.espresso.DetoxMatcher"
|
35
|
+
},
|
36
|
+
method: "matcherForAccessibilityLabel",
|
37
|
+
args: [label]
|
38
|
+
};
|
39
|
+
}
|
40
|
+
|
41
|
+
static matcherForShallowAccessibilityLabel(label) {
|
42
|
+
if (typeof label !== "string") throw new Error("label should be a string, but got " + (label + (" (" + (typeof label + ")"))));
|
43
|
+
return {
|
44
|
+
target: {
|
45
|
+
type: "Class",
|
46
|
+
value: "com.wix.detox.espresso.DetoxMatcher"
|
47
|
+
},
|
48
|
+
method: "matcherForShallowAccessibilityLabel",
|
49
|
+
args: [label]
|
50
|
+
};
|
51
|
+
}
|
52
|
+
|
29
53
|
static matcherForContentDescription(contentDescription) {
|
30
54
|
if (typeof contentDescription !== "string") throw new Error("contentDescription should be a string, but got " + (contentDescription + (" (" + (typeof contentDescription + ")"))));
|
31
55
|
return {
|
@@ -69,7 +69,7 @@ class WebElement {
|
|
69
69
|
static runScriptWithArgs(element, script, args) {
|
70
70
|
if (typeof script !== "string") throw new Error("script should be a string, but got " + (script + (" (" + (typeof script + ")"))));
|
71
71
|
|
72
|
-
if (typeof args !== 'object' || !args
|
72
|
+
if (typeof args !== 'object' || !Array.isArray(args)) {
|
73
73
|
throw new Error('args must be an array, got ' + typeof args);
|
74
74
|
}
|
75
75
|
|
@@ -1,4 +1,7 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
|
2
|
+
const { expectDescription, actionDescription } = require('../../utils/invocationTraceDescriptions');
|
3
|
+
const log = require('../../utils/logger').child({ cat: 'ws-client, ws' });
|
4
|
+
const traceInvocationCall = require('../../utils/traceInvocationCall').bind(null, log);
|
2
5
|
const { ScrollAmountStopAtEdgeAction } = require('../actions/native');
|
3
6
|
const { NativeMatcher } = require('../core/NativeMatcher');
|
4
7
|
const DetoxAssertionApi = require('../espressoapi/DetoxAssertion');
|
@@ -9,45 +12,50 @@ function call(maybeAFunction) {
|
|
9
12
|
}
|
10
13
|
|
11
14
|
class Interaction {
|
12
|
-
constructor(invocationManager) {
|
15
|
+
constructor(invocationManager, traceDescription) {
|
13
16
|
this._call = undefined;
|
17
|
+
this._traceDescription = traceDescription;
|
14
18
|
this._invocationManager = invocationManager;
|
15
19
|
}
|
16
20
|
|
17
21
|
async execute() {
|
18
|
-
|
19
|
-
|
22
|
+
return traceInvocationCall(this._traceDescription, this._call,
|
23
|
+
this._invocationManager.execute(this._call).then((resultObj) => resultObj ? resultObj.result : undefined));
|
20
24
|
}
|
21
25
|
}
|
22
26
|
|
23
27
|
class ActionInteraction extends Interaction {
|
24
|
-
constructor(invocationManager, element, action) {
|
25
|
-
super(invocationManager);
|
28
|
+
constructor(invocationManager, element, action, traceDescription) {
|
29
|
+
super(invocationManager, traceDescription);
|
26
30
|
this._call = EspressoDetoxApi.perform(call(element._call), action._call);
|
27
31
|
// TODO: move this.execute() here from the caller
|
28
32
|
}
|
29
33
|
}
|
30
34
|
|
31
35
|
class MatcherAssertionInteraction extends Interaction {
|
32
|
-
constructor(invocationManager, element, matcher) {
|
33
|
-
|
36
|
+
constructor(invocationManager, element, matcher, notCondition, traceDescription) {
|
37
|
+
traceDescription = expectDescription.full(traceDescription, notCondition);
|
38
|
+
super(invocationManager, traceDescription);
|
39
|
+
|
40
|
+
matcher = notCondition ? matcher.not : matcher;
|
34
41
|
this._call = DetoxAssertionApi.assertMatcher(call(element._call), matcher._call.value);
|
35
42
|
// TODO: move this.execute() here from the caller
|
36
43
|
}
|
37
44
|
}
|
38
45
|
|
39
46
|
class WaitForInteraction extends Interaction {
|
40
|
-
constructor(invocationManager, element, assertionMatcher) {
|
41
|
-
super(invocationManager);
|
47
|
+
constructor(invocationManager, element, assertionMatcher, expectTraceDescription) {
|
48
|
+
super(invocationManager, expectTraceDescription);
|
42
49
|
this._element = element;
|
43
50
|
this._assertionMatcher = assertionMatcher;
|
44
51
|
this._element._selectElementWithMatcher(this._element._originalMatcher);
|
45
52
|
}
|
46
53
|
|
47
54
|
async withTimeout(timeout) {
|
48
|
-
if (typeof timeout !== 'number') throw new DetoxRuntimeError(`WaitForInteraction withTimeout argument must be a number, got ${typeof timeout}`);
|
49
|
-
if (timeout < 0) throw new DetoxRuntimeError('timeout must be larger than 0');
|
55
|
+
if (typeof timeout !== 'number') throw new DetoxRuntimeError({ message: `WaitForInteraction withTimeout argument must be a number, got ${typeof timeout}` });
|
56
|
+
if (timeout < 0) throw new DetoxRuntimeError({ message: 'timeout must be larger than 0' });
|
50
57
|
|
58
|
+
this._traceDescription = expectDescription.waitForWithTimeout(this._traceDescription, timeout);
|
51
59
|
this._call = DetoxAssertionApi.waitForAssertMatcher(call(this._element._call), this._assertionMatcher._call.value, timeout / 1000);
|
52
60
|
await this.execute();
|
53
61
|
}
|
@@ -58,20 +66,18 @@ class WaitForInteraction extends Interaction {
|
|
58
66
|
}
|
59
67
|
|
60
68
|
class WaitForActionInteractionBase extends Interaction {
|
61
|
-
constructor(invocationManager, element, matcher, searchMatcher) {
|
62
|
-
super(invocationManager);
|
63
|
-
|
64
|
-
//if (!(matcher instanceof NativeMatcher)) throw new DetoxRuntimeError(`WaitForActionInteraction ctor 2nd argument must be a valid NativeMatcher, got ${typeof matcher}`);
|
69
|
+
constructor(invocationManager, element, matcher, searchMatcher, traceDescription) {
|
70
|
+
super(invocationManager, traceDescription);
|
71
|
+
|
65
72
|
if (!(searchMatcher instanceof NativeMatcher))
|
66
|
-
throw new DetoxRuntimeError(`WaitForActionInteraction ctor 3rd argument must be a valid NativeMatcher, got ${typeof searchMatcher}`);
|
73
|
+
throw new DetoxRuntimeError({ message: `WaitForActionInteraction ctor 3rd argument must be a valid NativeMatcher, got ${typeof searchMatcher}` });
|
74
|
+
|
67
75
|
this._element = element;
|
68
76
|
this._originalMatcher = matcher;
|
69
77
|
this._searchMatcher = searchMatcher;
|
70
78
|
}
|
71
79
|
|
72
80
|
_prepare(searchAction) {
|
73
|
-
//if (!searchAction instanceof Action) throw new DetoxRuntimeError(`WaitForActionInteraction _execute argument must be a valid Action, got ${typeof searchAction}`);
|
74
|
-
|
75
81
|
this._call = DetoxAssertionApi.waitForAssertMatcherWithSearchAction(
|
76
82
|
call(this._element._call),
|
77
83
|
call(this._originalMatcher._call).value,
|
@@ -83,6 +89,7 @@ class WaitForActionInteractionBase extends Interaction {
|
|
83
89
|
|
84
90
|
class WaitForActionInteraction extends WaitForActionInteractionBase {
|
85
91
|
async scroll(amount, direction = 'down', scrollPositionX, scrollPositionY) {
|
92
|
+
this._traceDescription = expectDescription.waitFor(actionDescription.scroll(amount, direction, scrollPositionX, scrollPositionY));
|
86
93
|
this._prepare(new ScrollAmountStopAtEdgeAction(direction, amount, scrollPositionX, scrollPositionY));
|
87
94
|
await this.execute();
|
88
95
|
}
|
@@ -2,9 +2,9 @@ const native = require('./native');
|
|
2
2
|
const web = require('./web');
|
3
3
|
|
4
4
|
module.exports = {
|
5
|
-
accessibilityLabel: (value) => new native.LabelMatcher(value),
|
6
5
|
id: (value) => new native.IdMatcher(value),
|
7
|
-
label: (value) => new native.
|
6
|
+
label: (value) => new native.ShallowLabelMatcher(value),
|
7
|
+
accessibilityLabel: (value) => new native.ShallowLabelMatcher(value),
|
8
8
|
text: (value) => new native.TextMatcher(value),
|
9
9
|
traits: (value) => new native.TraitsMatcher(value),
|
10
10
|
type: (value) => new native.TypeMatcher(value),
|
@@ -6,7 +6,14 @@ const DetoxMatcherApi = require('../espressoapi/DetoxMatcher');
|
|
6
6
|
class LabelMatcher extends NativeMatcher {
|
7
7
|
constructor(value) {
|
8
8
|
super();
|
9
|
-
this._call = invoke.callDirectly(DetoxMatcherApi.
|
9
|
+
this._call = invoke.callDirectly(DetoxMatcherApi.matcherForAccessibilityLabel(value));
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
class ShallowLabelMatcher extends NativeMatcher {
|
14
|
+
constructor(value) {
|
15
|
+
super();
|
16
|
+
this._call = invoke.callDirectly(DetoxMatcherApi.matcherForShallowAccessibilityLabel(value));
|
10
17
|
}
|
11
18
|
}
|
12
19
|
|
@@ -64,8 +71,7 @@ class ToggleMatcher extends NativeMatcher {
|
|
64
71
|
}
|
65
72
|
}
|
66
73
|
|
67
|
-
// TODO
|
68
|
-
// Please be aware, that this is just a dummy matcher
|
74
|
+
// TODO: Please be aware, that this is just a dummy matcher
|
69
75
|
class TraitsMatcher extends NativeMatcher {
|
70
76
|
constructor(value) {
|
71
77
|
super();
|
@@ -91,6 +97,7 @@ class SliderPositionMatcher extends NativeMatcher {
|
|
91
97
|
|
92
98
|
module.exports = {
|
93
99
|
LabelMatcher,
|
100
|
+
ShallowLabelMatcher,
|
94
101
|
IdMatcher,
|
95
102
|
TypeMatcher,
|
96
103
|
TraitsMatcher,
|
@@ -1,14 +1,13 @@
|
|
1
1
|
const EventEmitter = require('events');
|
2
2
|
const path = require('path');
|
3
|
-
const util = require('util');
|
4
3
|
|
5
4
|
const fs = require('fs-extra');
|
6
5
|
const _ = require('lodash');
|
7
6
|
|
8
7
|
const DetoxRuntimeError = require('../errors/DetoxRuntimeError');
|
9
|
-
const log = require('../utils/logger').child({
|
8
|
+
const log = require('../utils/logger').child({ cat: 'artifacts-manager,artifact' });
|
10
9
|
const resolveModuleFromPath = require('../utils/resolveModuleFromPath');
|
11
|
-
const
|
10
|
+
const traceMethods = require('../utils/traceMethods');
|
12
11
|
|
13
12
|
const FileArtifact = require('./templates/artifact/FileArtifact');
|
14
13
|
const ArtifactPathBuilder = require('./utils/ArtifactPathBuilder');
|
@@ -23,7 +22,7 @@ class ArtifactsManager extends EventEmitter {
|
|
23
22
|
this._artifactPlugins = {};
|
24
23
|
this._pathBuilder = this._resolveArtifactsPathBuilder(pathBuilder, rootDir);
|
25
24
|
|
26
|
-
traceMethods(
|
25
|
+
traceMethods(log, this, [
|
27
26
|
'onAppReady',
|
28
27
|
'onBeforeCleanup',
|
29
28
|
'onBeforeLaunchApp',
|
@@ -33,19 +32,13 @@ class ArtifactsManager extends EventEmitter {
|
|
33
32
|
'onBootDevice',
|
34
33
|
'onCreateExternalArtifact',
|
35
34
|
'onHookFailure',
|
36
|
-
'onHookStart',
|
37
|
-
'onHookSuccess',
|
38
35
|
'onLaunchApp',
|
39
36
|
'onRunDescribeFinish',
|
40
37
|
'onRunDescribeStart',
|
41
|
-
'onRunFinish',
|
42
|
-
'onRunStart',
|
43
38
|
'onShutdownDevice',
|
44
39
|
'onTerminateApp',
|
45
40
|
'onTestDone',
|
46
41
|
'onTestFnFailure',
|
47
|
-
'onTestFnStart',
|
48
|
-
'onTestFnSuccess',
|
49
42
|
'onTestStart',
|
50
43
|
]);
|
51
44
|
}
|
@@ -53,13 +46,13 @@ class ArtifactsManager extends EventEmitter {
|
|
53
46
|
_resolveArtifactsPathBuilder(pathBuilder, rootDir) {
|
54
47
|
if (typeof pathBuilder === 'string') {
|
55
48
|
pathBuilder = resolveModuleFromPath(pathBuilder);
|
49
|
+
}
|
56
50
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
51
|
+
if (typeof pathBuilder === 'function') {
|
52
|
+
try {
|
53
|
+
pathBuilder = pathBuilder({ rootDir });
|
54
|
+
} catch (e) {
|
55
|
+
pathBuilder = new pathBuilder({ rootDir });
|
63
56
|
}
|
64
57
|
}
|
65
58
|
|
@@ -186,8 +179,6 @@ class ArtifactsManager extends EventEmitter {
|
|
186
179
|
});
|
187
180
|
}
|
188
181
|
|
189
|
-
async onRunStart() {}
|
190
|
-
|
191
182
|
async onRunDescribeStart(suite) {
|
192
183
|
await this._callPlugins('ascending', 'onRunDescribeStart', suite);
|
193
184
|
}
|
@@ -196,22 +187,14 @@ class ArtifactsManager extends EventEmitter {
|
|
196
187
|
await this._callPlugins('ascending', 'onTestStart', testSummary);
|
197
188
|
}
|
198
189
|
|
199
|
-
async onHookStart() {}
|
200
|
-
|
201
190
|
async onHookFailure(testSummary) {
|
202
191
|
await this._callPlugins('plain', 'onHookFailure', testSummary);
|
203
192
|
}
|
204
193
|
|
205
|
-
async onHookSuccess() {}
|
206
|
-
|
207
|
-
async onTestFnStart() {}
|
208
|
-
|
209
194
|
async onTestFnFailure(testSummary) {
|
210
195
|
await this._callPlugins('plain', 'onTestFnFailure', testSummary);
|
211
196
|
}
|
212
197
|
|
213
|
-
async onTestFnSuccess() {}
|
214
|
-
|
215
198
|
async onTestDone(testSummary) {
|
216
199
|
await this._callPlugins('descending', 'onTestDone', testSummary);
|
217
200
|
}
|
@@ -220,35 +203,27 @@ class ArtifactsManager extends EventEmitter {
|
|
220
203
|
await this._callPlugins('descending', 'onRunDescribeFinish', suite);
|
221
204
|
}
|
222
205
|
|
223
|
-
async onRunFinish() {}
|
224
|
-
|
225
206
|
async onBeforeCleanup() {
|
226
207
|
await this._callPlugins('descending', 'onBeforeCleanup');
|
227
208
|
await this._idlePromise;
|
228
209
|
}
|
229
210
|
|
230
211
|
async _callSinglePlugin(pluginId, methodName, ...args) {
|
231
|
-
const callSignature = this._composeCallSignature('artifactsManager', methodName, args);
|
232
|
-
log.trace(Object.assign({ event: 'ARTIFACTS_LIFECYCLE', fn: methodName }, ...args), callSignature);
|
233
|
-
|
234
212
|
const plugin = this._artifactPlugins[pluginId];
|
235
213
|
try {
|
236
214
|
await plugin[methodName](...args);
|
237
215
|
} catch (e) {
|
238
|
-
this._unhandledPluginExceptionHandler(e, { plugin, methodName
|
216
|
+
this._unhandledPluginExceptionHandler(e, { plugin, methodName });
|
239
217
|
}
|
240
218
|
}
|
241
219
|
|
242
220
|
async _callPlugins(strategy, methodName, ...args) {
|
243
|
-
const callSignature = this._composeCallSignature('artifactsManager', methodName, args);
|
244
|
-
log.trace(Object.assign({ event: 'ARTIFACTS_LIFECYCLE', fn: methodName }, ...args), callSignature);
|
245
|
-
|
246
221
|
for (const pluginGroup of this._groupPlugins(strategy)) {
|
247
222
|
await Promise.all(pluginGroup.map(async (plugin) => {
|
248
223
|
try {
|
249
224
|
await plugin[methodName](...args);
|
250
225
|
} catch (e) {
|
251
|
-
this._unhandledPluginExceptionHandler(e, { plugin, methodName
|
226
|
+
this._unhandledPluginExceptionHandler(e, { plugin, methodName });
|
252
227
|
}
|
253
228
|
}));
|
254
229
|
}
|
@@ -278,28 +253,20 @@ class ArtifactsManager extends EventEmitter {
|
|
278
253
|
}
|
279
254
|
}
|
280
255
|
|
281
|
-
|
282
|
-
const argsString = args.map(arg => util.inspect(arg)).join(', ');
|
283
|
-
return `${object}.${methodName}(${argsString})`;
|
284
|
-
}
|
285
|
-
|
286
|
-
_unhandledPluginExceptionHandler(err, { plugin, methodName, args }) {
|
256
|
+
_unhandledPluginExceptionHandler(err, { plugin, methodName }) {
|
287
257
|
const logObject = {
|
288
|
-
event: 'ERROR',
|
289
258
|
plugin: plugin.name,
|
290
|
-
err,
|
291
259
|
methodName,
|
260
|
+
err,
|
292
261
|
};
|
293
262
|
|
294
|
-
|
295
|
-
log.warn(logObject, `Suppressed error inside function call: ${callSignature}`);
|
263
|
+
log.warn(logObject, `Suppressed error inside function call.`);
|
296
264
|
}
|
297
265
|
|
298
266
|
_idleCallbackErrorHandle(err, caller) {
|
299
267
|
this._unhandledPluginExceptionHandler(err, {
|
300
268
|
plugin: caller,
|
301
269
|
methodName: 'onIdleCallback',
|
302
|
-
args: []
|
303
270
|
});
|
304
271
|
}
|
305
272
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
const fs = require('fs-extra');
|
3
3
|
const _ = require('lodash');
|
4
4
|
|
5
|
-
const log = require('../../../utils/logger').child({
|
5
|
+
const log = require('../../../utils/logger').child({ cat: 'artifact' });
|
6
6
|
const FileArtifact = require('../../templates/artifact/FileArtifact');
|
7
7
|
const InstrumentsArtifactRecording = require('../InstrumentsArtifactRecording');
|
8
8
|
|
@@ -37,9 +37,9 @@ class SimulatorInstrumentsRecording extends InstrumentsArtifactRecording {
|
|
37
37
|
SimulatorInstrumentsRecording.hintAboutDetoxInstruments = _.once(() => {
|
38
38
|
log.warn(`Make sure either:
|
39
39
|
1. You have installed Detox Instruments:
|
40
|
-
https://github.com/wix/DetoxInstruments#installation
|
40
|
+
https://github.com/wix/DetoxInstruments#installation
|
41
41
|
2. You have integrated Detox Instruments in your app:
|
42
|
-
https://github.com/wix/DetoxInstruments/blob/master/Documentation/XcodeIntegrationGuide.md
|
42
|
+
https://github.com/wix/DetoxInstruments/blob/master/Documentation/XcodeIntegrationGuide.md
|
43
43
|
3. You have set the environment variable with your custom Detox Instruments location:
|
44
44
|
export DETOX_INSTRUMENTS_PATH="/path/to/Detox Instruments.app"`);
|
45
45
|
});
|
@@ -1,6 +1,5 @@
|
|
1
1
|
const DetoxRuntimeError = require('../../../errors/DetoxRuntimeError');
|
2
2
|
const { interruptProcess } = require('../../../utils/childProcess');
|
3
|
-
const log = require('../../../utils/logger').child({ __filename });
|
4
3
|
const retry = require('../../../utils/retry');
|
5
4
|
const sleep = require('../../../utils/sleep');
|
6
5
|
const Artifact = require('../../templates/artifact/Artifact');
|
@@ -26,26 +25,18 @@ class ADBLogcatRecording extends Artifact {
|
|
26
25
|
this._waitUntilLogFileIsCreated = null;
|
27
26
|
}
|
28
27
|
|
29
|
-
get hasRecordedFile() {
|
30
|
-
return !!this._waitUntilLogFileIsCreated;
|
31
|
-
}
|
32
|
-
|
33
28
|
async doStart() {
|
34
29
|
const pid = this.pid.get();
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
});
|
31
|
+
this.processPromise = this.adb.logcat(this.deviceId, {
|
32
|
+
file: this.pathToLogOnDevice,
|
33
|
+
time: this.since.get(),
|
34
|
+
pid: pid > 0 ? pid : 0,
|
35
|
+
});
|
42
36
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
} else {
|
47
|
-
log.debug('Ignoring a command to start recording, because PID of the app is missing');
|
48
|
-
}
|
37
|
+
this._waitUntilLogFileIsCreated = sleep(300).then(() => {
|
38
|
+
return retry(() => this._assertLogIsCreated());
|
39
|
+
});
|
49
40
|
}
|
50
41
|
|
51
42
|
async doStop() {
|
@@ -61,20 +52,12 @@ class ADBLogcatRecording extends Artifact {
|
|
61
52
|
}
|
62
53
|
|
63
54
|
async doSave(artifactPath) {
|
64
|
-
|
65
|
-
|
66
|
-
await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
|
67
|
-
} else {
|
68
|
-
log.debug(`Skipping saving artifact because the recording has not started: ${artifactPath}`);
|
69
|
-
}
|
55
|
+
await this.adb.pull(this.deviceId, this.pathToLogOnDevice, artifactPath);
|
56
|
+
await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
|
70
57
|
}
|
71
58
|
|
72
59
|
async doDiscard() {
|
73
|
-
|
74
|
-
await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
|
75
|
-
} else {
|
76
|
-
log.debug(`Skipping discarding artifact due to a not started recording: ${this.pathToLogOnDevice}`);
|
77
|
-
}
|
60
|
+
await this.adb.rm(this.deviceId, this.pathToLogOnDevice);
|
78
61
|
}
|
79
62
|
|
80
63
|
async _assertLogIsCreated() {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
const fs = require('fs-extra');
|
3
3
|
|
4
4
|
const childProcess = require('../../../utils/childProcess');
|
5
|
-
const log = require('../../../utils/logger').child({
|
5
|
+
const log = require('../../../utils/logger').child({ cat: 'artifact' });
|
6
6
|
const sleep = require('../../../utils/sleep');
|
7
7
|
const Artifact = require('../../templates/artifact/Artifact');
|
8
8
|
const FileArtifact = require('../../templates/artifact/FileArtifact');
|
@@ -1,7 +1,7 @@
|
|
1
1
|
const path = require('path');
|
2
2
|
|
3
3
|
const fs = require('../../utils/fsext');
|
4
|
-
const log = require('../../utils/logger').child({
|
4
|
+
const log = require('../../utils/logger').child({ cat: 'artifacts-plugin,artifacts' });
|
5
5
|
const FileArtifact = require('../templates/artifact/FileArtifact');
|
6
6
|
const temporaryPath = require('../utils/temporaryPath');
|
7
7
|
|
@@ -1,9 +1,9 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
// @ts-nocheck
|
2
|
-
/* eslint-disable no-unused-vars */
|
3
3
|
|
4
4
|
const _ = require('lodash');
|
5
5
|
|
6
|
-
const log = require('../../../utils/logger').child({
|
6
|
+
const log = require('../../../utils/logger').child({ cat: 'artifacts-plugin,artifacts' });
|
7
7
|
|
8
8
|
/***
|
9
9
|
* Almost non-opinionated building block for any artifact type
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
1
2
|
// @ts-nocheck
|
2
3
|
const DetoxRuntimeError = require('../../../errors/DetoxRuntimeError');
|
3
4
|
|
@@ -85,7 +86,7 @@ class TwoSnapshotsPerTestPlugin extends ArtifactPlugin {
|
|
85
86
|
* @protected
|
86
87
|
* @abstract
|
87
88
|
*/
|
88
|
-
async preparePathForSnapshot(testSummary, snapshotName) {}
|
89
|
+
async preparePathForSnapshot(testSummary, snapshotName) {}
|
89
90
|
|
90
91
|
/***
|
91
92
|
* Creates a handle for a test artifact (video recording, log, etc.)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
/* eslint @typescript-eslint/no-unused-vars: ["error", { "args": "none" }] */
|
2
2
|
const ArtifactPlugin = require('./ArtifactPlugin');
|
3
3
|
|
4
4
|
/***
|
@@ -8,6 +8,7 @@ class WholeTestRecorderPlugin extends ArtifactPlugin {
|
|
8
8
|
constructor({ api }) {
|
9
9
|
super({ api });
|
10
10
|
|
11
|
+
/** @type {*} */
|
11
12
|
this.testRecording = null;
|
12
13
|
}
|
13
14
|
|
@@ -51,7 +52,7 @@ class WholeTestRecorderPlugin extends ArtifactPlugin {
|
|
51
52
|
* @abstract
|
52
53
|
* @protected
|
53
54
|
*/
|
54
|
-
createTestRecording() {}
|
55
|
+
createTestRecording(config) {}
|
55
56
|
|
56
57
|
/***
|
57
58
|
* @abstract
|