detox 21.0.0-breaking.new-global-lifecycle.0 → 21.0.1-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +2 -7
- package/Detox-android/com/wix/detox/{21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar → 21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar → 21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom → 21.0.1-rc.0/detox-21.0.1-rc.0.pom} +22 -10
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-framework.tbz +0 -0
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios-xcuitest.tbz +0 -0
- package/README.md +1 -1
- package/android/build.gradle +13 -8
- package/android/detox/build.gradle +24 -13
- package/android/detox/proguard-rules-app.pro +6 -0
- package/android/detox/proguard-rules.pro +3 -0
- package/android/detox/publish-pom.gradle +5 -1
- package/android/detox/publishing.gradle +35 -33
- package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +4 -4
- package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
- package/android/detox/src/full/java/com/wix/detox/adapters/server/WebSocketClient.java +3 -1
- package/android/detox/src/full/java/com/wix/detox/common/UIExtensions.kt +28 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +37 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxMatcher.java +11 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +1 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +22 -0
- package/android/detox/src/{main → full}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +17 -4
- package/android/detox/src/full/java/com/wix/detox/espresso/action/RNDetoxAccessibilityAction.kt +46 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +75 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +24 -28
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/WithAccessibilityLabelMatcher.kt +23 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResourceDescription.kt +26 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +54 -8
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +3 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +43 -34
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +2 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/RN66Workaround.kt +13 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/ui/UIExtensions.kt +37 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/utils/RNUtils.kt +6 -0
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +4 -1
- package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +2 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +10 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/UTHelpers.kt +12 -0
- package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
- package/android/detox/src/testFull/java/com/wix/detox/common/UIExtensionsTest.kt +107 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +22 -9
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +39 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/matcher/ViewAtIndexMatcherSpec.kt +1 -2
- package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
- package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
- package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/android/gradlew +181 -107
- package/index.d.ts +239 -83
- package/index.js +12 -1
- package/internals.d.ts +219 -45
- package/internals.js +10 -3
- package/local-cli/build-framework-cache.js +1 -1
- package/local-cli/build-xcuitest-cache.js +16 -0
- package/local-cli/build.js +2 -2
- package/local-cli/clean-framework-cache.js +1 -1
- package/local-cli/clean-xcuitest-cache.js +19 -0
- package/local-cli/cli.js +13 -7
- package/local-cli/init.js +61 -21
- package/local-cli/rebuild-framework-cache.js +4 -4
- package/local-cli/rebuild-xcuitest-cache.js +21 -0
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/run-server.js +12 -1
- package/local-cli/start.js +49 -0
- package/local-cli/startCommand/AppStartCommand.js +65 -0
- package/local-cli/templates/jest.js +13 -10
- package/local-cli/test.js +14 -8
- package/local-cli/testCommand/TestRunnerCommand.js +126 -77
- package/local-cli/testCommand/TestRunnerError.js +13 -0
- package/local-cli/testCommand/builder.js +5 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/local-cli/utils/cliErrorHandling.js +15 -0
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +46 -26
- package/runners/deprecation.js +42 -44
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- package/runners/jest/index.d.ts +61 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/reporters/DetoxReporter.js +33 -2
- package/runners/jest/testEnvironment/index.js +119 -68
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +97 -51
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +15 -17
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +3 -7
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/scripts/build_framework.ios.sh +26 -60
- package/scripts/build_local_framework.ios.sh +62 -0
- package/scripts/build_local_xcuitest.ios.sh +53 -0
- package/scripts/build_xcuitest.ios.sh +23 -0
- package/scripts/pack_ios.sh +14 -5
- package/scripts/postinstall.js +10 -4
- package/src/DetoxWorker.js +112 -64
- package/src/android/actions/native.js +16 -0
- package/src/android/core/NativeElement.js +72 -20
- package/src/android/core/NativeExpect.js +28 -9
- package/src/android/core/NativeMatcher.js +31 -10
- package/src/android/core/NativeWaitFor.js +8 -0
- package/src/android/espressoapi/DetoxAction.js +37 -0
- package/src/android/espressoapi/DetoxMatcher.js +24 -0
- package/src/android/espressoapi/EspressoDetox.js +1 -1
- package/src/android/espressoapi/web/WebElement.js +1 -1
- package/src/android/interactions/native.js +25 -18
- package/src/android/matchers/index.js +2 -2
- package/src/android/matchers/native.js +10 -3
- package/src/artifacts/ArtifactsManager.js +14 -47
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +2 -2
- package/src/artifacts/templates/plugin/TwoSnapshotsPerTestPlugin.js +2 -1
- package/src/artifacts/templates/plugin/WholeTestRecorderPlugin.js +3 -2
- package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
- package/src/artifacts/utils/temporaryPath.js +47 -8
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +11 -19
- package/src/client/Client.js +35 -3
- package/src/client/actions/SyncStatusSchema.json +21 -0
- package/src/client/actions/actions.js +38 -0
- package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
- package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
- package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
- package/src/configuration/collectCliConfig.js +3 -13
- package/src/configuration/composeAppsConfig.js +5 -1
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +20 -10
- package/src/configuration/composeRunnerConfig.js +62 -9
- package/src/configuration/index.js +14 -9
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +15 -2
- package/src/devices/allocation/drivers/AllocationDriverBase.js +10 -2
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +10 -1
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +28 -29
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +6 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +4 -17
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +27 -18
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +12 -7
- package/src/devices/allocation/factories/base.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +9 -0
- package/src/devices/common/drivers/android/genycloud/exec/GenyCloudExec.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
- package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/AppInstallHelper.js +4 -4
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/{FileXfer.js → FileTransfer.js} +2 -2
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
- package/src/devices/common/drivers/android/tools/TempFileTransfer.js +14 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +21 -4
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +24 -12
- package/src/devices/runtime/drivers/DeviceDriverBase.js +2 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +17 -8
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +42 -2
- package/src/devices/runtime/drivers/ios/XCUITestUtils.js +209 -0
- package/src/devices/runtime/drivers/ios/allowNetworkPermissionsXCUITest.scpt +14 -0
- package/src/devices/runtime/factories/android.js +6 -5
- package/src/devices/runtime/factories/base.js +3 -2
- package/src/errors/DetoxConfigErrorComposer.js +18 -3
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +199 -78
- package/src/ipc/IPCClient.js +36 -27
- package/src/ipc/IPCServer.js +40 -21
- package/src/ipc/SessionState.js +60 -0
- package/src/logger/DetoxLogger.js +287 -154
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +105 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +37 -0
- package/src/logger/utils/DetoxLogFinalizer.js +166 -0
- package/src/logger/utils/MessageStack.js +35 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +23 -6
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxContext.js +83 -66
- package/src/realms/DetoxInternalsFacade.js +9 -13
- package/src/realms/DetoxPrimaryContext.js +117 -74
- package/src/realms/DetoxSecondaryContext.js +32 -35
- package/src/{symbols.js → realms/symbols.js} +16 -22
- package/src/server/DetoxConnection.js +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +9 -6
- package/src/server/DetoxSessionManager.js +2 -1
- package/src/server/handlers/AnonymousConnectionHandler.js +1 -0
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/servicelocator/android/index.js +2 -2
- package/src/utils/ExclusiveLockfile.js +1 -0
- package/src/utils/Timer.js +59 -36
- package/src/utils/argparse.js +11 -27
- package/src/utils/childProcess/exec.js +4 -2
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/dateUtils.js +5 -0
- package/src/utils/environment.js +55 -16
- package/src/utils/errorUtils.js +24 -3
- package/src/utils/invocationTraceDescriptions.js +44 -0
- package/src/utils/isPromise.js +8 -1
- package/src/utils/logger.js +2 -2
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/src/validation/ios/IosSimulatorEnvValidator.js +7 -4
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
- package/Detox-ios.tbz +0 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +0 -20
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
- package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -36
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +0 -59
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
- package/local-cli/build.test.js +0 -104
- package/local-cli/run-server.test.js +0 -23
- package/local-cli/test.test.js +0 -515
- package/runners/jest/deprecation.js +0 -25
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
- package/scripts/build_universal_framework.sh +0 -14
- package/scripts/build_universal_framework_legacy.sh +0 -76
- package/scripts/build_universal_framework_modern.sh +0 -28
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/common/drivers/android/tools/TempFileXfer.js +0 -16
- package/src/ipc/state.js +0 -76
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/logger/TraceThreadDispatcher.js +0 -52
- package/src/realms/index.js +0 -10
- package/src/utils/ChromeTracingExporter.js +0 -53
- package/src/utils/streamUtils.js +0 -214
- package/src/utils/trace.js +0 -19
package/local-cli/test.test.js
DELETED
@@ -1,515 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
if (process.platform === 'win32') {
|
3
|
-
jest.retryTimes(1); // TODO: investigate why it gets stuck for the 1st time on Windows
|
4
|
-
}
|
5
|
-
|
6
|
-
jest.mock('../src/logger/DetoxLogger');
|
7
|
-
jest.mock('../src/devices/DeviceRegistry');
|
8
|
-
jest.mock('../src/devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory');
|
9
|
-
jest.mock('./utils/jestInternals');
|
10
|
-
|
11
|
-
const os = require('os');
|
12
|
-
const path = require('path');
|
13
|
-
|
14
|
-
const fs = require('fs-extra');
|
15
|
-
const _ = require('lodash');
|
16
|
-
const yargs = require('yargs');
|
17
|
-
|
18
|
-
const { DEVICE_LAUNCH_ARGS_DEPRECATION } = require('./testCommand/warnings');
|
19
|
-
|
20
|
-
describe('CLI', () => {
|
21
|
-
let _cliCallDump;
|
22
|
-
let _env;
|
23
|
-
let logger;
|
24
|
-
let _temporaryFiles;
|
25
|
-
let detoxConfig;
|
26
|
-
let detoxConfigPath;
|
27
|
-
let DeviceRegistry;
|
28
|
-
let GenyDeviceRegistryFactory;
|
29
|
-
let jestInternals;
|
30
|
-
|
31
|
-
beforeEach(() => {
|
32
|
-
_cliCallDump = undefined;
|
33
|
-
_env = process.env;
|
34
|
-
_temporaryFiles = [];
|
35
|
-
|
36
|
-
process.env = {
|
37
|
-
..._env,
|
38
|
-
CLI_TEST_STDOUT: tempfile('.txt'),
|
39
|
-
};
|
40
|
-
|
41
|
-
const executable = path.relative(process.cwd(), path.join(__dirname, '__mocks__/executable'));
|
42
|
-
|
43
|
-
detoxConfig = {
|
44
|
-
testRunner: {
|
45
|
-
args: {
|
46
|
-
$0: os.platform() === 'win32' ? `node ${executable}` : executable,
|
47
|
-
config: 'e2e/config.json'
|
48
|
-
},
|
49
|
-
},
|
50
|
-
configurations: {
|
51
|
-
single: {
|
52
|
-
device: {
|
53
|
-
type: 'ios.simulator',
|
54
|
-
device: 'iPhone X'
|
55
|
-
},
|
56
|
-
apps: [],
|
57
|
-
},
|
58
|
-
},
|
59
|
-
};
|
60
|
-
|
61
|
-
const realJestInternals = jest.requireActual('./utils/jestInternals');
|
62
|
-
jestInternals = require('./utils/jestInternals');
|
63
|
-
Object.assign(jestInternals, realJestInternals);
|
64
|
-
jestInternals.readJestConfig = jest.fn(async (argv) => {
|
65
|
-
const runnerConfigTemplate = _.omit(
|
66
|
-
JSON.parse(require('./templates/jest').runnerConfig),
|
67
|
-
['reporters', 'testEnvironment']
|
68
|
-
);
|
69
|
-
|
70
|
-
return realJestInternals.readJestConfig({
|
71
|
-
...argv,
|
72
|
-
config: tempfile('.json', JSON.stringify(runnerConfigTemplate)),
|
73
|
-
});
|
74
|
-
});
|
75
|
-
|
76
|
-
logger = () => require('../src/logger/DetoxLogger').instances[0];
|
77
|
-
DeviceRegistry = require('../src/devices/DeviceRegistry');
|
78
|
-
DeviceRegistry.forAndroid.mockImplementation(() => new DeviceRegistry());
|
79
|
-
DeviceRegistry.forIOS.mockImplementation(() => new DeviceRegistry());
|
80
|
-
GenyDeviceRegistryFactory = require('../src/devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory');
|
81
|
-
GenyDeviceRegistryFactory.forGlobalShutdown.mockImplementation(() => new DeviceRegistry());
|
82
|
-
});
|
83
|
-
|
84
|
-
afterEach(async () => {
|
85
|
-
process.env = _env;
|
86
|
-
|
87
|
-
await Promise.all(_temporaryFiles.map(name => fs.remove(name)));
|
88
|
-
});
|
89
|
-
|
90
|
-
describe('by default', () => {
|
91
|
-
test('by default, should attempt to load config from package.json or .detoxrc', async () => {
|
92
|
-
const expectedError = /^Cannot run Detox without a configuration/;
|
93
|
-
await expect(runRaw('test')).rejects.toThrowError(expectedError);
|
94
|
-
});
|
95
|
-
});
|
96
|
-
|
97
|
-
describe.each([
|
98
|
-
['iOS', 'ios.simulator'],
|
99
|
-
['Android', 'android.emulator'],
|
100
|
-
])('given no extra args (%s)', (_platform, deviceType) => {
|
101
|
-
beforeEach(async () => {
|
102
|
-
singleConfig().device.type = deviceType;
|
103
|
-
await run();
|
104
|
-
});
|
105
|
-
|
106
|
-
test('should produce a default command', () => {
|
107
|
-
expect(cliCall().argv).toEqual([expect.stringContaining('executable'), '--config', 'e2e/config.json']);
|
108
|
-
});
|
109
|
-
|
110
|
-
test('should not override environment variables', () => {
|
111
|
-
expect(cliCall().env).toEqual({ DETOX_CONFIG_SNAPSHOT_PATH: expect.any(String) });
|
112
|
-
});
|
113
|
-
|
114
|
-
test('should hint essential environment variables', () => {
|
115
|
-
expect(cliCall().fullCommand).toMatch(/^DETOX_CONFIG_PATH=.*\bexecutable/);
|
116
|
-
});
|
117
|
-
});
|
118
|
-
|
119
|
-
test('should use runnerConfig.specs as default specs', async () => {
|
120
|
-
detoxConfig.testRunner.args._ = ['e2e/sanity'];
|
121
|
-
await run();
|
122
|
-
expect(_.last(cliCall().argv)).toEqual('e2e/sanity');
|
123
|
-
});
|
124
|
-
|
125
|
-
test.each([['--config']])('%s <path> should point to the specified Jest config', async (__runnerConfig) => {
|
126
|
-
await run(__runnerConfig, 'e2e/custom.config.js');
|
127
|
-
expect(cliCall().argv).toEqual([expect.stringContaining('executable'), '--config', 'e2e/custom.config.js']);
|
128
|
-
});
|
129
|
-
|
130
|
-
test.each([['-l'], ['--loglevel']])('%s <value> should be passed as environment variable', async (__loglevel) => {
|
131
|
-
await run(__loglevel, 'trace');
|
132
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_LOGLEVEL');
|
133
|
-
expect(cliCall().fullCommand).toMatch(/ DETOX_LOGLEVEL="trace" /);
|
134
|
-
});
|
135
|
-
|
136
|
-
test.each([['-R'], ['--retries']])('%s <value> should execute successful run once', async (__retries) => {
|
137
|
-
await run(__retries, 1);
|
138
|
-
expect(cliCall(1)).toBe(null);
|
139
|
-
});
|
140
|
-
|
141
|
-
test.each([['-R'], ['--retries']])('%s <value> should execute unsuccessful run N extra times', async (__retries) => {
|
142
|
-
const context = require('../internals');
|
143
|
-
context.session.failedTestFiles = ['e2e/failing1.test.js', 'e2e/failing2.test.js'];
|
144
|
-
context.session.failedTestFiles.splice = jest.fn(() => {
|
145
|
-
context.session.failedTestFiles = ['e2e/failing2.test.js'];
|
146
|
-
});
|
147
|
-
|
148
|
-
mockExitCode(1);
|
149
|
-
|
150
|
-
await run(__retries, 2).catch(_.noop);
|
151
|
-
|
152
|
-
expect(cliCall(0).env).not.toHaveProperty('DETOX_RERUN_INDEX');
|
153
|
-
expect(cliCall(0).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json']);
|
154
|
-
expect(cliCall(0).fullCommand).not.toMatch(/DETOX_RERUN_INDEX/);
|
155
|
-
|
156
|
-
expect(cliCall(1).env.DETOX_RERUN_INDEX).toBe('1');
|
157
|
-
expect(cliCall(1).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', 'e2e/failing1.test.js', 'e2e/failing2.test.js']);
|
158
|
-
expect(cliCall(1).fullCommand).not.toMatch(/DETOX_RERUN_INDEX/);
|
159
|
-
|
160
|
-
expect(cliCall(2).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', 'e2e/failing2.test.js']);
|
161
|
-
expect(cliCall(2).env.DETOX_RERUN_INDEX).toBe('2');
|
162
|
-
expect(cliCall(2).fullCommand).not.toMatch(/DETOX_RERUN_INDEX/);
|
163
|
-
});
|
164
|
-
|
165
|
-
test.each([['-R'], ['--retries']])('%s <value> should not restart test runner if there are no failing tests paths', async (__retries) => {
|
166
|
-
mockExitCode(1);
|
167
|
-
|
168
|
-
await run(__retries, 1).catch(_.noop);
|
169
|
-
expect(cliCall(0)).not.toBe(null);
|
170
|
-
expect(cliCall(1)).toBe(null);
|
171
|
-
});
|
172
|
-
|
173
|
-
test.each([['-R'], ['--retries']])('%s <value> should retain -- <...explicitPassthroughArgs>', async (__retries) => {
|
174
|
-
const context = require('../internals');
|
175
|
-
context.session.failedTestFiles = ['tests/failing.test.js'];
|
176
|
-
|
177
|
-
mockExitCode(1);
|
178
|
-
|
179
|
-
await run(__retries, 1, 'tests', '--', '--debug').catch(_.noop);
|
180
|
-
|
181
|
-
expect(cliCall(0).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', '--debug', 'tests']);
|
182
|
-
expect(cliCall(1).argv).toEqual([expect.stringMatching(/executable$/), '--config', 'e2e/config.json', '--debug', 'tests/failing.test.js']);
|
183
|
-
});
|
184
|
-
|
185
|
-
test.each([['-r'], ['--reuse']])('%s <value> should be passed as environment variable', async (__reuse) => {
|
186
|
-
await run(__reuse);
|
187
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_REUSE');
|
188
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_REUSE=true /);
|
189
|
-
});
|
190
|
-
|
191
|
-
test.each([['-u'], ['--cleanup']])('%s <value> should be passed as environment variable', async (__cleanup) => {
|
192
|
-
await run(__cleanup);
|
193
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_CLEANUP');
|
194
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_CLEANUP=true /);
|
195
|
-
});
|
196
|
-
|
197
|
-
test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as environment variable', async (__debug_synchronization) => {
|
198
|
-
await run(__debug_synchronization, 5000);
|
199
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
200
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=5000 /);
|
201
|
-
});
|
202
|
-
|
203
|
-
test.each([['-d'], ['--debug-synchronization']])('%s <value> should be passed as 0 when given false', async (__debug_synchronization) => {
|
204
|
-
await run(__debug_synchronization, false);
|
205
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
206
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=0 /);
|
207
|
-
});
|
208
|
-
|
209
|
-
test.each([['-d'], ['--debug-synchronization']])('%s <value> should have default value = 3000', async (__debug_synchronization) => {
|
210
|
-
await run(`${__debug_synchronization}`);
|
211
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEBUG_SYNCHRONIZATION');
|
212
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEBUG_SYNCHRONIZATION=3000 /);
|
213
|
-
});
|
214
|
-
|
215
|
-
test.each([['-a'], ['--artifacts-location']])('%s <value> should be passed as environment variable', async (__artifacts_location) => {
|
216
|
-
await run(__artifacts_location, '/tmp');
|
217
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_ARTIFACTS_LOCATION');
|
218
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_ARTIFACTS_LOCATION="\/tmp" /);
|
219
|
-
});
|
220
|
-
|
221
|
-
test('--record-logs <value> should be passed as environment variable', async () => {
|
222
|
-
await run('--record-logs', 'all');
|
223
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_RECORD_LOGS');
|
224
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_RECORD_LOGS="all" /);
|
225
|
-
});
|
226
|
-
|
227
|
-
test('--take-screenshots <value> should be passed as environment variable', async () => {
|
228
|
-
await run('--take-screenshots', 'failing');
|
229
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_TAKE_SCREENSHOTS');
|
230
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_TAKE_SCREENSHOTS="failing" /);
|
231
|
-
});
|
232
|
-
|
233
|
-
test('--record-videos <value> should be passed as environment variable', async () => {
|
234
|
-
await run('--record-videos', 'failing');
|
235
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_RECORD_VIDEOS');
|
236
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_RECORD_VIDEOS="failing" /);
|
237
|
-
});
|
238
|
-
|
239
|
-
test('--record-performance <value> should be passed as environment variable', async () => {
|
240
|
-
await run('--record-performance', 'all');
|
241
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_RECORD_PERFORMANCE');
|
242
|
-
expect(cliCall().fullCommand).toMatch(/\DETOX_RECORD_PERFORMANCE="all" /);
|
243
|
-
});
|
244
|
-
|
245
|
-
test('--capture-view-hierarchy <value> should be passed as environment variable', async () => {
|
246
|
-
await run('--capture-view-hierarchy', 'enabled');
|
247
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_CAPTURE_VIEW_HIERARCHY');
|
248
|
-
expect(cliCall().fullCommand).toMatch(/\DETOX_CAPTURE_VIEW_HIERARCHY="enabled" /);
|
249
|
-
});
|
250
|
-
|
251
|
-
test('--jest-report-specs, set explicitly, should be passed as an environment variable', async () => {
|
252
|
-
await run('--jest-report-specs');
|
253
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_REPORT_SPECS');
|
254
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_REPORT_SPECS=true /);
|
255
|
-
});
|
256
|
-
|
257
|
-
test.each([['-H'], ['--headless']])('%s <value> should be passed as environment variable', async (__headless) => {
|
258
|
-
await run(__headless);
|
259
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_HEADLESS');
|
260
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_HEADLESS=true /);
|
261
|
-
});
|
262
|
-
|
263
|
-
test('--gpu <value> should be passed as environment variable', async () => {
|
264
|
-
await run('--gpu', 'angle_indirect');
|
265
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_GPU');
|
266
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_GPU="angle_indirect" /);
|
267
|
-
});
|
268
|
-
|
269
|
-
test('--device-boot-args should be passed as an environment variable (without deprecation warnings)', async () => {
|
270
|
-
await run('--device-boot-args="--verbose"');
|
271
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
272
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
273
|
-
expect(logger().warn).not.toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
274
|
-
});
|
275
|
-
|
276
|
-
test('--device-launch-args should serve as a deprecated alias to --device-boot-args', async () => {
|
277
|
-
await run(`--device-launch-args="--verbose"`);
|
278
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEVICE_BOOT_ARGS');
|
279
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="--verbose" /);
|
280
|
-
expect(logger().warn).toHaveBeenCalledWith(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
281
|
-
});
|
282
|
-
|
283
|
-
test('--app-launch-args should be passed as an environment variable', async () => {
|
284
|
-
await run(`--app-launch-args="--debug yes"`);
|
285
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_APP_LAUNCH_ARGS');
|
286
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_APP_LAUNCH_ARGS="--debug yes" /);
|
287
|
-
});
|
288
|
-
|
289
|
-
test('--use-custom-logger false should be prevent passing environment variable', async () => {
|
290
|
-
await run(`--use-custom-logger=false`);
|
291
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_USE_CUSTOM_LOGGER');
|
292
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_USE_CUSTOM_LOGGER=false /);
|
293
|
-
});
|
294
|
-
|
295
|
-
test('--force-adb-install should be ignored for iOS', async () => {
|
296
|
-
singleConfig().device.type = 'ios.simulator';
|
297
|
-
await run(`--force-adb-install`);
|
298
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_FORCE_ADB_INSTALL');
|
299
|
-
expect(cliCall().fullCommand).not.toMatch(/DETOX_FORCE_ADB_INSTALL/);
|
300
|
-
});
|
301
|
-
|
302
|
-
test('--force-adb-install should be passed as environment variable', async () => {
|
303
|
-
singleConfig().device.type = 'android.emulator';
|
304
|
-
await run(`--force-adb-install`);
|
305
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_FORCE_ADB_INSTALL');
|
306
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_FORCE_ADB_INSTALL=true /);
|
307
|
-
});
|
308
|
-
|
309
|
-
test.each([['-n'], ['--device-name']])('%s <value> should be passed as environment variable', async (__device_name) => {
|
310
|
-
await run(__device_name, 'TheDevice');
|
311
|
-
expect(cliCall().env).not.toHaveProperty('DETOX_DEVICE_NAME');
|
312
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_NAME="TheDevice" /);
|
313
|
-
});
|
314
|
-
|
315
|
-
test('specifying direct test paths instead of default args._', async () => {
|
316
|
-
detoxConfig.testRunner.args._ = ['e2e/'];
|
317
|
-
await run('e2e/01.sanity.test.js', 'e2e/02.sanity.test.js');
|
318
|
-
|
319
|
-
expect(cliCall().argv).not.toContain('e2e');
|
320
|
-
expect(cliCall().argv.slice(-2)).toEqual(['e2e/01.sanity.test.js', 'e2e/02.sanity.test.js']);
|
321
|
-
});
|
322
|
-
|
323
|
-
test.todo('--inspect-brk should work');
|
324
|
-
|
325
|
-
test.each([
|
326
|
-
['-d e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
|
327
|
-
['--debug-synchronization e2eFolder', / e2eFolder$/, /\bDETOX_DEBUG_SYNCHRONIZATION=3000/],
|
328
|
-
['-r e2eFolder', / e2eFolder$/, /\bDETOX_REUSE=true/],
|
329
|
-
['--reuse e2eFolder', / e2eFolder$/, /\bDETOX_REUSE=true/],
|
330
|
-
['-u e2eFolder', / e2eFolder$/, /\bDETOX_CLEANUP=true/],
|
331
|
-
['--cleanup e2eFolder', / e2eFolder$/, /\bDETOX_CLEANUP=true/],
|
332
|
-
['--jest-report-specs e2eFolder', / e2eFolder$/, /\bDETOX_REPORT_SPECS=true/],
|
333
|
-
['-H e2eFolder', / e2eFolder$/, /\bDETOX_HEADLESS=true/],
|
334
|
-
['--headless e2eFolder', / e2eFolder$/, /\bDETOX_HEADLESS=true/],
|
335
|
-
['--keepLockFile e2eFolder', / e2eFolder$/, /\bDETOX_KEEP_LOCKFILE=true/],
|
336
|
-
['--use-custom-logger e2eFolder', / e2eFolder$/, /\bDETOX_USE_CUSTOM_LOGGER=true/],
|
337
|
-
['--force-adb-install e2eFolder', / e2eFolder$/, /\bDETOX_FORCE_ADB_INSTALL=true/],
|
338
|
-
])('"%s" should be disambigued correctly', async (command, commandMatcher, envMatcher) => {
|
339
|
-
singleConfig().device.type = 'android.emulator';
|
340
|
-
await run(...command.split(' '));
|
341
|
-
|
342
|
-
expect(cliCall().argv.join(' ')).toMatch(commandMatcher);
|
343
|
-
expect(cliCall().fullCommand).toEqual(expect.objectContaining(envMatcher));
|
344
|
-
});
|
345
|
-
|
346
|
-
test('e.g., --debug should be passed through', async () => {
|
347
|
-
await run(`--debug`);
|
348
|
-
expect(cliCall().argv).toContain('--debug');
|
349
|
-
});
|
350
|
-
|
351
|
-
test('e.g., --coverageProvider v8 should be passed through', async () => {
|
352
|
-
await run('--coverageProvider', 'v8');
|
353
|
-
expect(cliCall().argv.slice(-2)).toEqual(['--coverageProvider', 'v8']);
|
354
|
-
});
|
355
|
-
|
356
|
-
test('e.g., --debug e2e/Login.test.js should be split to --debug and e2e/Login.test.js', async () => {
|
357
|
-
await run('--debug', 'e2e/Login.test.js', '--coverageProvider', 'v8');
|
358
|
-
|
359
|
-
expect(cliCall().argv).toEqual([
|
360
|
-
expect.stringMatching(/executable$/),
|
361
|
-
'--config', 'e2e/config.json',
|
362
|
-
'--debug',
|
363
|
-
'--coverageProvider', 'v8',
|
364
|
-
'e2e/Login.test.js'
|
365
|
-
]);
|
366
|
-
});
|
367
|
-
|
368
|
-
test('should escape whitespaces when forwarding a CLI argument', async () => {
|
369
|
-
await run(`e2e tests/first test.spec.js`);
|
370
|
-
expect(_.last(cliCall().argv)).toEqual(`e2e tests/first test.spec.js`);
|
371
|
-
});
|
372
|
-
|
373
|
-
test(`should be able to use custom test runner commands`, async () => {
|
374
|
-
detoxConfig.testRunner.args.$0 += ' --hello';
|
375
|
-
await run();
|
376
|
-
expect(cliCall().argv).toContain('--hello');
|
377
|
-
});
|
378
|
-
|
379
|
-
test('-- <...explicitPassthroughArgs> should be forwarded to the test runner CLI as-is', async () => {
|
380
|
-
await run('--device-boot-args', 'detoxArgs', 'e2eFolder', '--', 'a', '-a', '--a', '--device-boot-args', 'runnerArgs');
|
381
|
-
expect(cliCall().argv).toEqual([
|
382
|
-
expect.stringMatching(/executable$/),
|
383
|
-
'--config', 'e2e/config.json',
|
384
|
-
'a',
|
385
|
-
'-a',
|
386
|
-
'--a',
|
387
|
-
'--device-boot-args',
|
388
|
-
'runnerArgs',
|
389
|
-
'e2eFolder',
|
390
|
-
]);
|
391
|
-
|
392
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_DEVICE_BOOT_ARGS="detoxArgs" /);
|
393
|
-
});
|
394
|
-
|
395
|
-
test('-- <...explicitPassthroughArgs> should omit double-dash "--" only once when forwarding args', async () => {
|
396
|
-
await run('--', '--', '--deepParameter');
|
397
|
-
|
398
|
-
expect(cliCall().argv).toContain('--');
|
399
|
-
expect(cliCall().argv).toContain('--deepParameter');
|
400
|
-
});
|
401
|
-
|
402
|
-
// TODO: revive this test
|
403
|
-
test.skip('--inspect-brk should prepend "node --inspect-brk" to the command', async () => {
|
404
|
-
await run('--inspect-brk');
|
405
|
-
|
406
|
-
if (process.platform === 'win32') {
|
407
|
-
expect(cliCall().argv).toMatch(/^node --inspect-brk \.\/node_modules\/jest\/bin\/jest\.js/);
|
408
|
-
} else {
|
409
|
-
expect(cliCall().argv).toMatch(/^node --inspect-brk \.\/node_modules\/\.bin\/jest/);
|
410
|
-
}
|
411
|
-
});
|
412
|
-
|
413
|
-
test('should append $DETOX_ARGV_OVERRIDE to detox test ... command and print a warning', async () => {
|
414
|
-
process.env.PLATFORM = 'ios';
|
415
|
-
process.env.DETOX_ARGV_OVERRIDE = os.platform() === 'win32'
|
416
|
-
? '--testNamePattern="[%PLATFORM%] tap" -l trace e2e/sanity/*.test.js'
|
417
|
-
: '--testNamePattern="[$PLATFORM] tap" -l trace e2e/sanity/*.test.js';
|
418
|
-
|
419
|
-
await run();
|
420
|
-
|
421
|
-
expect(cliCall().fullCommand).toMatch(/\bDETOX_LOGLEVEL="trace" /);
|
422
|
-
expect(cliCall().argv.slice(-3)).toEqual(['--testNamePattern', '[ios] tap', 'e2e/sanity/*.test.js']);
|
423
|
-
expect(logger().warn).toHaveBeenCalledWith(expect.stringContaining('$DETOX_ARGV_OVERRIDE is detected'));
|
424
|
-
});
|
425
|
-
|
426
|
-
// Helpers
|
427
|
-
|
428
|
-
function tempfile(extension, content) {
|
429
|
-
const tempFilePath = require('tempfile')(extension);
|
430
|
-
|
431
|
-
fs.ensureFileSync(tempFilePath);
|
432
|
-
if (content) {
|
433
|
-
fs.writeFileSync(tempFilePath, content);
|
434
|
-
}
|
435
|
-
|
436
|
-
_temporaryFiles.push(tempFilePath);
|
437
|
-
return tempFilePath;
|
438
|
-
}
|
439
|
-
|
440
|
-
async function runRaw(...command) {
|
441
|
-
let memArgv;
|
442
|
-
|
443
|
-
try {
|
444
|
-
memArgv = process.argv.splice(2, Infinity, ...command);
|
445
|
-
|
446
|
-
return await new Promise((resolve, reject) => {
|
447
|
-
const testCommand = require('./test');
|
448
|
-
const originalHandler = testCommand.handler;
|
449
|
-
|
450
|
-
const parser = yargs()
|
451
|
-
.scriptName('detox')
|
452
|
-
.parserConfiguration({
|
453
|
-
'boolean-negation': false,
|
454
|
-
'camel-case-expansion': false,
|
455
|
-
'dot-notation': false,
|
456
|
-
'duplicate-arguments-array': false,
|
457
|
-
'populate--': true,
|
458
|
-
})
|
459
|
-
.command({
|
460
|
-
...testCommand,
|
461
|
-
async handler(argv) {
|
462
|
-
try {
|
463
|
-
await originalHandler(argv);
|
464
|
-
resolve();
|
465
|
-
} catch (e) {
|
466
|
-
reject(e);
|
467
|
-
}
|
468
|
-
},
|
469
|
-
})
|
470
|
-
.wrap(null);
|
471
|
-
|
472
|
-
parser.parse(command, err => err && reject(err));
|
473
|
-
});
|
474
|
-
} finally {
|
475
|
-
memArgv && process.argv.splice(2, Infinity, ...memArgv);
|
476
|
-
}
|
477
|
-
}
|
478
|
-
|
479
|
-
async function run(...args) {
|
480
|
-
detoxConfigPath = tempfile('.json', JSON.stringify(detoxConfig));
|
481
|
-
const __configPath = Math.random() > 0.5 ? '-C' : '--config-path';
|
482
|
-
return runRaw('test', __configPath, detoxConfigPath, ...args);
|
483
|
-
}
|
484
|
-
|
485
|
-
function cliCall(index = 0) {
|
486
|
-
if (!_cliCallDump) {
|
487
|
-
_cliCallDump = fs.readFileSync(process.env.CLI_TEST_STDOUT, 'utf8')
|
488
|
-
.split('\n')
|
489
|
-
.filter(Boolean)
|
490
|
-
.map(line => JSON.parse(line));
|
491
|
-
}
|
492
|
-
|
493
|
-
const mockCall = _cliCallDump[index];
|
494
|
-
if (!mockCall) {
|
495
|
-
return null;
|
496
|
-
}
|
497
|
-
|
498
|
-
return {
|
499
|
-
...mockCall,
|
500
|
-
fullCommand: _.chain(logger().log.mock.calls)
|
501
|
-
.filter(([_level, _childMeta, meta]) => meta && meta.event === 'RUN_START')
|
502
|
-
.get(index)
|
503
|
-
.get(3)
|
504
|
-
.value(),
|
505
|
-
};
|
506
|
-
}
|
507
|
-
|
508
|
-
function singleConfig() {
|
509
|
-
return Object.values(detoxConfig.configurations)[0];
|
510
|
-
}
|
511
|
-
|
512
|
-
function mockExitCode(code) {
|
513
|
-
process.env.CLI_EXIT_CODE = code;
|
514
|
-
}
|
515
|
-
});
|
@@ -1,25 +0,0 @@
|
|
1
|
-
const chalk = require('chalk');
|
2
|
-
|
3
|
-
// @ts-ignore
|
4
|
-
console.error(chalk.yellow(`
|
5
|
-
========================= THE NEW JOURNEY BEGINS =============================
|
6
|
-
|
7
|
-
https://wix.github.io/Detox/docs/guide/jest
|
8
|
-
|
9
|
-
Sorry to say that Detox 20 comes without old adapters for Jest.
|
10
|
-
You have to rearrange your init code before you can continue your journey.
|
11
|
-
|
12
|
-
Navigate to the link and follow the migration guide steps.
|
13
|
-
|
14
|
-
Sincerely yours,
|
15
|
-
Detox team.
|
16
|
-
|
17
|
-
https://wix.github.io/Detox/docs/guide/jest
|
18
|
-
|
19
|
-
========================= THE NEW JOURNEY BEGINS =============================
|
20
|
-
|
21
|
-
`));
|
22
|
-
|
23
|
-
throw Object.assign(new Error(
|
24
|
-
'\n\nPlease follow the new Jest setup guide:\nhttps://wix.github.io/Detox/docs/guide/jest\n\n'
|
25
|
-
), { stack: '' });
|
@@ -1,23 +0,0 @@
|
|
1
|
-
const { assertSupportedVersion } = require('./assertJestCircus27');
|
2
|
-
|
3
|
-
describe('assertSupportedVersion', () => {
|
4
|
-
test.each([
|
5
|
-
['27.2.5'],
|
6
|
-
['27.2.6-prerelease.0'],
|
7
|
-
['27.3.0'],
|
8
|
-
['28.0.0-alpha.1'],
|
9
|
-
['28.0.0'],
|
10
|
-
['28.1.0'],
|
11
|
-
['29.0.0-next.0'],
|
12
|
-
['30.0.0'],
|
13
|
-
])('should pass for %j', (version) => {
|
14
|
-
expect(() => assertSupportedVersion(version)).not.toThrow();
|
15
|
-
});
|
16
|
-
|
17
|
-
test.each([
|
18
|
-
['26.0.0'],
|
19
|
-
['27.2.4'],
|
20
|
-
])('should throw an error for %j', (version) => {
|
21
|
-
expect(() => assertSupportedVersion(version)).toThrowError(/unsupported jest.*version/);
|
22
|
-
});
|
23
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/bin/bash -e
|
2
|
-
|
3
|
-
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
4
|
-
|
5
|
-
XCODEVERSION=$(xcodebuild -version | grep -oEi "([0-9]*(\.[0-9]*)+)")
|
6
|
-
if [ "${XCODEVERSION}" == "`echo -e "${XCODEVERSION}\n12.0" | sort --version-sort -r | head -n1`" ]; then
|
7
|
-
echo "Xcode 12 and above; using modern script for building the framework to support Apple Silicon"
|
8
|
-
FRAMEWORK_SCRIPT="build_universal_framework_modern.sh"
|
9
|
-
else
|
10
|
-
echo "Xcode 11 and below; using legacy script for building"
|
11
|
-
FRAMEWORK_SCRIPT="build_universal_framework_legacy.sh"
|
12
|
-
fi
|
13
|
-
|
14
|
-
"${SCRIPTPATH}/${FRAMEWORK_SCRIPT}" "$@"
|
@@ -1,76 +0,0 @@
|
|
1
|
-
#!/bin/bash -e
|
2
|
-
|
3
|
-
PROJECT=$1
|
4
|
-
OUTPUT_DIR=$2
|
5
|
-
CONFIGURATION=Release
|
6
|
-
PROJECT_NAME=Detox
|
7
|
-
|
8
|
-
set -e
|
9
|
-
|
10
|
-
function remove_arch() {
|
11
|
-
lipo -create "${1}" "${2}" -output "${3}"
|
12
|
-
}
|
13
|
-
|
14
|
-
# Make sure the output directory exists
|
15
|
-
|
16
|
-
mkdir -p "${OUTPUT_DIR}"
|
17
|
-
rm -fr "${OUTPUT_DIR}/${PROJECT_NAME}.framework"
|
18
|
-
|
19
|
-
TEMP_DIR=$(mktemp -d "$TMPDIR"DetoxBuild.XXXX)
|
20
|
-
echo TEMP_DIR = "${TEMP_DIR}"
|
21
|
-
|
22
|
-
# Step 0. Xcode version
|
23
|
-
|
24
|
-
XCODEVERSION=$(xcodebuild -version | grep -oEi "([0-9]*(\.[0-9]*)+)")
|
25
|
-
echo "Xcode ${XCODEVERSION}"
|
26
|
-
USE_NEW_BUILD_SYSTEM="YES"
|
27
|
-
if [ "${XCODEVERSION}" != "`echo -e "${XCODEVERSION}\n11.0" | sort --version-sort -r | head -n1`" ]; then
|
28
|
-
USE_NEW_BUILD_SYSTEM="NO"
|
29
|
-
fi
|
30
|
-
echo "Using -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM}"
|
31
|
-
|
32
|
-
# Step 1. Build Device and Simulator versions
|
33
|
-
|
34
|
-
BUILD_IOS=`xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch arm64 -sdk iphoneos ONLY_ACTIVE_ARCH=NO VALID_ARCHS=arm64 -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
|
35
|
-
BUILD_SIM=`xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch x86_64 -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO VALID_ARCHS=x86_64 -showBuildSettings | awk -F= '/TARGET_BUILD_DIR/{x=$NF; gsub(/^[ \t]+|[ \t]+$/,"",x); print x}'`
|
36
|
-
|
37
|
-
echo ${BUILD_IOS}
|
38
|
-
echo ${BUILD_SIM}
|
39
|
-
|
40
|
-
xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch arm64 -sdk iphoneos ONLY_ACTIVE_ARCH=NO clean build VALID_ARCHS=arm64 -quiet
|
41
|
-
xcodebuild -project "${PROJECT}" -UseNewBuildSystem=${USE_NEW_BUILD_SYSTEM} -scheme Detox -configuration "${CONFIGURATION}" -arch x86_64 -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO build VALID_ARCHS=x86_64 -quiet
|
42
|
-
|
43
|
-
# Step 2. Copy the framework structure (from iphoneos build) to the universal folder
|
44
|
-
|
45
|
-
cp -fR "${BUILD_IOS}/${PROJECT_NAME}.framework" "${TEMP_DIR}/"
|
46
|
-
|
47
|
-
# Step 3. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory
|
48
|
-
|
49
|
-
SIMULATOR_SWIFT_MODULES_DIR="${BUILD_SIM}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/."
|
50
|
-
if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then
|
51
|
-
cp -fR "${SIMULATOR_SWIFT_MODULES_DIR}" "${TEMP_DIR}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule"
|
52
|
-
fi
|
53
|
-
|
54
|
-
# Step 4. Create universal binary file using lipo and place the combined executable in the copied framework directory
|
55
|
-
|
56
|
-
remove_arch "${BUILD_SIM}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_IOS}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${TEMP_DIR}/${PROJECT_NAME}.framework/${PROJECT_NAME}"
|
57
|
-
|
58
|
-
# Step 5. Create universal binaries for embedded frameworks
|
59
|
-
|
60
|
-
for SUB_FRAMEWORK in $( ls "${TEMP_DIR}/${PROJECT_NAME}.framework/Frameworks" ); do
|
61
|
-
if [ -d "${TEMP_DIR}/${PROJECT_NAME}.framework/Frameworks/$SUB_FRAMEWORK" ]; then
|
62
|
-
echo "Processing ${SUB_FRAMEWORK} as a dir"
|
63
|
-
BINARY_NAME="${SUB_FRAMEWORK%.*}"
|
64
|
-
|
65
|
-
remove_arch "${BUILD_SIM}/${PROJECT_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}" "${BUILD_IOS}/${PROJECT_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}" "${TEMP_DIR}/${PROJECT_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}"
|
66
|
-
|
67
|
-
else
|
68
|
-
echo "Processing ${SUB_FRAMEWORK} as a file"
|
69
|
-
|
70
|
-
remove_arch "${BUILD_SIM}/${PROJECT_NAME}.framework/Frameworks/${SUB_FRAMEWORK}" "${BUILD_IOS}/${PROJECT_NAME}.framework/Frameworks/${SUB_FRAMEWORK}" "${TEMP_DIR}/${PROJECT_NAME}.framework/Frameworks/${SUB_FRAMEWORK}"
|
71
|
-
|
72
|
-
fi
|
73
|
-
done
|
74
|
-
|
75
|
-
mv "${TEMP_DIR}/${PROJECT_NAME}.framework" "${OUTPUT_DIR}"/
|
76
|
-
rm -fr "${TEMP_DIR}"
|