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.
Files changed (304) hide show
  1. package/.eslintrc.js +2 -7
  2. 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
  3. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.md5 +1 -0
  4. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha1 +1 -0
  5. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha256 +1 -0
  6. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-javadoc.jar.sha512 +1 -0
  7. 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
  8. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.md5 +1 -0
  9. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha1 +1 -0
  10. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha256 +1 -0
  11. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0-sources.jar.sha512 +1 -0
  12. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar +0 -0
  13. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.md5 +1 -0
  14. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha1 +1 -0
  15. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha256 +1 -0
  16. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.aar.sha512 +1 -0
  17. 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
  18. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.md5 +1 -0
  19. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha1 +1 -0
  20. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha256 +1 -0
  21. package/Detox-android/com/wix/detox/21.0.1-rc.0/detox-21.0.1-rc.0.pom.sha512 +1 -0
  22. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  23. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  24. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  25. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  26. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  27. package/Detox-ios-framework.tbz +0 -0
  28. package/Detox-ios-src.tbz +0 -0
  29. package/Detox-ios-xcuitest.tbz +0 -0
  30. package/README.md +1 -1
  31. package/android/build.gradle +13 -8
  32. package/android/detox/build.gradle +24 -13
  33. package/android/detox/proguard-rules-app.pro +6 -0
  34. package/android/detox/proguard-rules.pro +3 -0
  35. package/android/detox/publish-pom.gradle +5 -1
  36. package/android/detox/publishing.gradle +35 -33
  37. package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
  38. package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
  39. package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +4 -4
  40. package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
  41. package/android/detox/src/full/java/com/wix/detox/adapters/server/WebSocketClient.java +3 -1
  42. package/android/detox/src/full/java/com/wix/detox/common/UIExtensions.kt +28 -0
  43. package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +37 -3
  44. package/android/detox/src/full/java/com/wix/detox/espresso/DetoxMatcher.java +11 -1
  45. package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +1 -1
  46. package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +22 -0
  47. package/android/detox/src/{main → full}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +17 -4
  48. package/android/detox/src/full/java/com/wix/detox/espresso/action/RNDetoxAccessibilityAction.kt +46 -0
  49. package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +75 -0
  50. package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
  51. package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
  52. package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +24 -28
  53. package/android/detox/src/full/java/com/wix/detox/espresso/matcher/WithAccessibilityLabelMatcher.kt +23 -0
  54. package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
  55. package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
  56. package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResourceDescription.kt +26 -0
  57. package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
  58. package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
  59. package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +54 -8
  60. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
  61. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +3 -4
  62. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
  63. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
  64. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +43 -34
  65. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
  66. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
  67. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +2 -6
  68. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/RN66Workaround.kt +13 -4
  69. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
  70. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
  71. package/android/detox/src/full/java/com/wix/detox/reactnative/ui/UIExtensions.kt +37 -0
  72. package/android/detox/src/full/java/com/wix/detox/reactnative/utils/RNUtils.kt +6 -0
  73. package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +4 -1
  74. package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
  75. package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +2 -1
  76. package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +10 -0
  77. package/android/detox/src/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
  78. package/android/detox/src/testFull/java/com/wix/detox/UTHelpers.kt +12 -0
  79. package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
  80. package/android/detox/src/testFull/java/com/wix/detox/common/UIExtensionsTest.kt +107 -0
  81. package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
  82. package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +22 -9
  83. package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +39 -0
  84. package/android/detox/src/testFull/java/com/wix/detox/espresso/matcher/ViewAtIndexMatcherSpec.kt +1 -2
  85. package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
  86. package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
  87. package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
  88. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
  89. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
  90. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
  91. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
  92. package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
  93. package/android/gradlew +181 -107
  94. package/index.d.ts +239 -83
  95. package/index.js +12 -1
  96. package/internals.d.ts +219 -45
  97. package/internals.js +10 -3
  98. package/local-cli/build-framework-cache.js +1 -1
  99. package/local-cli/build-xcuitest-cache.js +16 -0
  100. package/local-cli/build.js +2 -2
  101. package/local-cli/clean-framework-cache.js +1 -1
  102. package/local-cli/clean-xcuitest-cache.js +19 -0
  103. package/local-cli/cli.js +13 -7
  104. package/local-cli/init.js +61 -21
  105. package/local-cli/rebuild-framework-cache.js +4 -4
  106. package/local-cli/rebuild-xcuitest-cache.js +21 -0
  107. package/local-cli/reset-lock-file.js +16 -0
  108. package/local-cli/run-server.js +12 -1
  109. package/local-cli/start.js +49 -0
  110. package/local-cli/startCommand/AppStartCommand.js +65 -0
  111. package/local-cli/templates/jest.js +13 -10
  112. package/local-cli/test.js +14 -8
  113. package/local-cli/testCommand/TestRunnerCommand.js +126 -77
  114. package/local-cli/testCommand/TestRunnerError.js +13 -0
  115. package/local-cli/testCommand/builder.js +5 -1
  116. package/local-cli/testCommand/middlewares.js +4 -13
  117. package/local-cli/testCommand/warnings.js +0 -3
  118. package/local-cli/utils/cliErrorHandling.js +15 -0
  119. package/local-cli/utils/jestInternals.js +4 -1
  120. package/package.json +46 -26
  121. package/runners/deprecation.js +42 -44
  122. package/runners/jest/globalSetup.js +1 -1
  123. package/runners/jest/globalTeardown.js +1 -1
  124. package/runners/jest/index.d.ts +61 -0
  125. package/runners/jest/index.js +3 -8
  126. package/runners/jest/reporters/DetoxReporter.js +33 -2
  127. package/runners/jest/testEnvironment/index.js +119 -68
  128. package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +97 -51
  129. package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
  130. package/runners/jest/testEnvironment/listeners/SpecReporter.js +15 -17
  131. package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +3 -7
  132. package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
  133. package/scripts/build_framework.ios.sh +26 -60
  134. package/scripts/build_local_framework.ios.sh +62 -0
  135. package/scripts/build_local_xcuitest.ios.sh +53 -0
  136. package/scripts/build_xcuitest.ios.sh +23 -0
  137. package/scripts/pack_ios.sh +14 -5
  138. package/scripts/postinstall.js +10 -4
  139. package/src/DetoxWorker.js +112 -64
  140. package/src/android/actions/native.js +16 -0
  141. package/src/android/core/NativeElement.js +72 -20
  142. package/src/android/core/NativeExpect.js +28 -9
  143. package/src/android/core/NativeMatcher.js +31 -10
  144. package/src/android/core/NativeWaitFor.js +8 -0
  145. package/src/android/espressoapi/DetoxAction.js +37 -0
  146. package/src/android/espressoapi/DetoxMatcher.js +24 -0
  147. package/src/android/espressoapi/EspressoDetox.js +1 -1
  148. package/src/android/espressoapi/web/WebElement.js +1 -1
  149. package/src/android/interactions/native.js +25 -18
  150. package/src/android/matchers/index.js +2 -2
  151. package/src/android/matchers/native.js +10 -3
  152. package/src/artifacts/ArtifactsManager.js +14 -47
  153. package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
  154. package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
  155. package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
  156. package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
  157. package/src/artifacts/templates/artifact/Artifact.js +1 -1
  158. package/src/artifacts/templates/plugin/ArtifactPlugin.js +2 -2
  159. package/src/artifacts/templates/plugin/TwoSnapshotsPerTestPlugin.js +2 -1
  160. package/src/artifacts/templates/plugin/WholeTestRecorderPlugin.js +3 -2
  161. package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
  162. package/src/artifacts/utils/temporaryPath.js +47 -8
  163. package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
  164. package/src/client/AsyncWebSocket.js +11 -19
  165. package/src/client/Client.js +35 -3
  166. package/src/client/actions/SyncStatusSchema.json +21 -0
  167. package/src/client/actions/actions.js +38 -0
  168. package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
  169. package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
  170. package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
  171. package/src/configuration/collectCliConfig.js +3 -13
  172. package/src/configuration/composeAppsConfig.js +5 -1
  173. package/src/configuration/composeDeviceConfig.js +1 -1
  174. package/src/configuration/composeLoggerConfig.js +20 -10
  175. package/src/configuration/composeRunnerConfig.js +62 -9
  176. package/src/configuration/index.js +14 -9
  177. package/src/configuration/loadExternalConfig.js +1 -1
  178. package/src/devices/allocation/DeviceAllocator.js +15 -2
  179. package/src/devices/allocation/drivers/AllocationDriverBase.js +10 -2
  180. package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +10 -1
  181. package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
  182. package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +28 -29
  183. package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
  184. package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +6 -5
  185. package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
  186. package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +4 -17
  187. package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +27 -18
  188. package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
  189. package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +12 -7
  190. package/src/devices/allocation/factories/base.js +1 -1
  191. package/src/devices/common/drivers/android/exec/ADB.js +9 -0
  192. package/src/devices/common/drivers/android/genycloud/exec/GenyCloudExec.js +1 -1
  193. package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
  194. package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
  195. package/src/devices/common/drivers/android/tools/AppInstallHelper.js +4 -4
  196. package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
  197. package/src/devices/common/drivers/android/tools/{FileXfer.js → FileTransfer.js} +2 -2
  198. package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
  199. package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
  200. package/src/devices/common/drivers/android/tools/TempFileTransfer.js +14 -0
  201. package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +21 -4
  202. package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
  203. package/src/devices/runtime/RuntimeDevice.js +24 -12
  204. package/src/devices/runtime/drivers/DeviceDriverBase.js +2 -1
  205. package/src/devices/runtime/drivers/android/AndroidDriver.js +17 -8
  206. package/src/devices/runtime/drivers/ios/SimulatorDriver.js +42 -2
  207. package/src/devices/runtime/drivers/ios/XCUITestUtils.js +209 -0
  208. package/src/devices/runtime/drivers/ios/allowNetworkPermissionsXCUITest.scpt +14 -0
  209. package/src/devices/runtime/factories/android.js +6 -5
  210. package/src/devices/runtime/factories/base.js +3 -2
  211. package/src/errors/DetoxConfigErrorComposer.js +18 -3
  212. package/src/errors/DetoxError.js +5 -1
  213. package/src/ios/expectTwo.js +199 -78
  214. package/src/ipc/IPCClient.js +36 -27
  215. package/src/ipc/IPCServer.js +40 -21
  216. package/src/ipc/SessionState.js +60 -0
  217. package/src/logger/DetoxLogger.js +287 -154
  218. package/src/logger/index.js +5 -0
  219. package/src/logger/utils/BunyanLogger.js +105 -0
  220. package/src/logger/utils/CategoryThreadDispatcher.js +37 -0
  221. package/src/logger/utils/DetoxLogFinalizer.js +166 -0
  222. package/src/logger/utils/MessageStack.js +35 -0
  223. package/src/logger/utils/ThreadDispatcher.js +61 -0
  224. package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +23 -6
  225. package/src/logger/utils/getMainCategory.js +5 -0
  226. package/src/logger/utils/sanitizeBunyanContext.js +30 -0
  227. package/src/logger/utils/streams/BunyanTransformer.js +72 -0
  228. package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
  229. package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
  230. package/src/logger/utils/streams/JSONLStringer.js +55 -0
  231. package/src/logger/utils/streams/index.js +7 -0
  232. package/src/logger/utils/streams/transformers.js +39 -0
  233. package/src/logger/utils/tracerLegacy.js +37 -0
  234. package/src/realms/DetoxContext.js +83 -66
  235. package/src/realms/DetoxInternalsFacade.js +9 -13
  236. package/src/realms/DetoxPrimaryContext.js +117 -74
  237. package/src/realms/DetoxSecondaryContext.js +32 -35
  238. package/src/{symbols.js → realms/symbols.js} +16 -22
  239. package/src/server/DetoxConnection.js +18 -23
  240. package/src/server/DetoxServer.js +7 -10
  241. package/src/server/DetoxSession.js +9 -6
  242. package/src/server/DetoxSessionManager.js +2 -1
  243. package/src/server/handlers/AnonymousConnectionHandler.js +1 -0
  244. package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
  245. package/src/servicelocator/android/index.js +2 -2
  246. package/src/utils/ExclusiveLockfile.js +1 -0
  247. package/src/utils/Timer.js +59 -36
  248. package/src/utils/argparse.js +11 -27
  249. package/src/utils/childProcess/exec.js +4 -2
  250. package/src/utils/childProcess/spawn.js +1 -1
  251. package/src/utils/dateUtils.js +5 -0
  252. package/src/utils/environment.js +55 -16
  253. package/src/utils/errorUtils.js +24 -3
  254. package/src/utils/invocationTraceDescriptions.js +44 -0
  255. package/src/utils/isPromise.js +8 -1
  256. package/src/utils/logger.js +2 -2
  257. package/src/utils/pathUtils.js +11 -0
  258. package/src/utils/shellUtils.js +17 -0
  259. package/src/utils/traceInvocationCall.js +21 -0
  260. package/src/utils/traceMethods.js +15 -0
  261. package/src/validation/ios/IosSimulatorEnvValidator.js +7 -4
  262. 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
  263. 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
  264. 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
  265. 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
  266. 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
  267. 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
  268. 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
  269. 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
  270. 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
  271. 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
  272. 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
  273. 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
  274. 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
  275. 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
  276. 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
  277. 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
  278. 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
  279. package/Detox-ios.tbz +0 -0
  280. package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
  281. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
  282. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +0 -20
  283. package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
  284. package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -36
  285. package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +0 -59
  286. package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
  287. package/local-cli/build.test.js +0 -104
  288. package/local-cli/run-server.test.js +0 -23
  289. package/local-cli/test.test.js +0 -515
  290. package/runners/jest/deprecation.js +0 -25
  291. package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
  292. package/scripts/build_universal_framework.sh +0 -14
  293. package/scripts/build_universal_framework_legacy.sh +0 -76
  294. package/scripts/build_universal_framework_modern.sh +0 -28
  295. package/src/configuration/utils/warnings.js +0 -12
  296. package/src/devices/common/drivers/android/tools/TempFileXfer.js +0 -16
  297. package/src/ipc/state.js +0 -76
  298. package/src/logger/DetoxTraceEventBuilder.js +0 -21
  299. package/src/logger/DetoxTracer.js +0 -133
  300. package/src/logger/TraceThreadDispatcher.js +0 -52
  301. package/src/realms/index.js +0 -10
  302. package/src/utils/ChromeTracingExporter.js +0 -53
  303. package/src/utils/streamUtils.js +0 -214
  304. package/src/utils/trace.js +0 -19
@@ -3,7 +3,7 @@ const { exec } = require('child-process-promise');
3
3
  const _ = require('lodash');
4
4
 
5
5
  const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
6
- const rootLogger = require('../logger').child({ __filename });
6
+ const rootLogger = require('../logger').child({ cat: ['child-process', 'child-process-exec'] });
7
7
  const retry = require('../retry');
8
8
 
9
9
  const execsCounter = require('./opsCounter');
@@ -17,6 +17,7 @@ async function execWithRetriesAndLogs(bin, options = {}) {
17
17
  timeout = 0,
18
18
  statusLogs = {},
19
19
  verbosity = 'normal',
20
+ maxBuffer = 1024 * 1024,
20
21
  } = options;
21
22
 
22
23
  const trackingId = execsCounter.inc();
@@ -35,7 +36,7 @@ async function execWithRetriesAndLogs(bin, options = {}) {
35
36
  } else if (statusLogs.retrying) {
36
37
  _logExecRetrying(logger, cmd, tryNumber, lastError);
37
38
  }
38
- result = await exec(cmd, { timeout });
39
+ result = await exec(cmd, { timeout, maxBuffer });
39
40
  });
40
41
  } catch (err) {
41
42
  const failReason = err.code == null && timeout > 0
@@ -126,6 +127,7 @@ async function execAsync(command) {
126
127
  const result = await exec(command);
127
128
  return _.trim(result.stdout);
128
129
  }
130
+
129
131
  module.exports = {
130
132
  execWithRetriesAndLogs,
131
133
  execAsync
@@ -2,7 +2,7 @@
2
2
  const { spawn } = require('child-process-promise');
3
3
  const _ = require('lodash');
4
4
 
5
- const rootLogger = require('../logger').child({ __filename });
5
+ const rootLogger = require('../logger').child({ cat: ['child-process', 'child-process-spawn'] });
6
6
  const { escape } = require('../pipeCommands');
7
7
  const retry = require('../retry');
8
8
 
@@ -10,6 +10,11 @@ function shortFormat(date) {
10
10
  return `${HH}:${MM}:${ss}.${milli}`;
11
11
  }
12
12
 
13
+ function removeMilliseconds(isoDate) {
14
+ return isoDate.replace(/(T\d\d:\d\d:\d\d)(\.\d\d\d)/, '$1');
15
+ }
16
+
13
17
  module.exports = {
14
18
  shortFormat,
19
+ removeMilliseconds,
15
20
  };
@@ -78,7 +78,7 @@ function getAndroidEmulatorPath() {
78
78
  return legacyPath;
79
79
  }
80
80
 
81
- throwSdkIntegrityError(sdkRoot, 'emulator/emulator');
81
+ throwSdkBinIntegrityError(sdkRoot, 'emulator/emulator');
82
82
  }
83
83
 
84
84
  async function getAaptPath() {
@@ -88,23 +88,33 @@ async function getAaptPath() {
88
88
  }
89
89
 
90
90
  const latestBuildTools = await getLatestBuildToolsPath(sdkRoot);
91
- const defaultPath = latestBuildTools && which('aapt', latestBuildTools);
91
+ if (!latestBuildTools) {
92
+ throwSdkIntegrityError('Failed to find the "aapt" tool under the Android SDK: No build-tools are installed!');
93
+ }
94
+
95
+ const defaultPath = which('aapt', latestBuildTools);
92
96
  if (defaultPath) {
93
97
  return defaultPath;
94
98
  }
95
99
 
96
- throwSdkIntegrityError(sdkRoot, `${latestBuildTools}/aapt`);
100
+ throwSdkToolPathError(`${latestBuildTools}/aapt`);
97
101
  }
98
102
 
99
103
  async function getLatestBuildToolsPath(sdkRoot) {
100
- if (!sdkRoot) return '';
104
+ if (!sdkRoot) {
105
+ return '';
106
+ }
101
107
 
102
108
  const buildToolsDir = path.join(sdkRoot, 'build-tools');
103
- if (!fs.existsSync(buildToolsDir)) return '';
109
+ if (!fs.existsSync(buildToolsDir)) {
110
+ return '';
111
+ }
104
112
 
105
113
  const buildToolsVersions = await fsext.getDirectories(buildToolsDir);
106
114
  const latestBuildToolsVersion = _.last(buildToolsVersions);
107
- if (!latestBuildToolsVersion) return '';
115
+ if (!latestBuildToolsVersion) {
116
+ return '';
117
+ }
108
118
 
109
119
  return path.join(buildToolsDir, latestBuildToolsVersion);
110
120
  }
@@ -120,7 +130,7 @@ function getAdbPath() {
120
130
  return defaultPath;
121
131
  }
122
132
 
123
- throwSdkIntegrityError(sdkRoot, 'platform-tools/adb');
133
+ throwSdkBinIntegrityError(sdkRoot, 'platform-tools/adb');
124
134
  }
125
135
 
126
136
  function getGmsaasPath() {
@@ -142,15 +152,20 @@ function throwMissingAvdError(avdName, avdPath, avdIniPath) {
142
152
  );
143
153
  }
144
154
 
145
- function throwSdkIntegrityError(sdkRoot, relativeExecutablePath) {
146
- const executablePath = path.join(sdkRoot, relativeExecutablePath);
147
- const name = path.basename(executablePath);
148
- const dir = path.dirname(executablePath);
155
+ function throwSdkBinIntegrityError(sdkRoot, relativeBinPath) {
156
+ const executablePath = path.join(sdkRoot, relativeBinPath);
157
+ throwSdkToolPathError(executablePath);
158
+ }
149
159
 
150
- throw new DetoxRuntimeError(
151
- `There was no "${name}" executable file in directory: ${dir}.\n` +
152
- `Check integrity of your Android SDK.`
153
- );
160
+ function throwSdkToolPathError(sdkToolPath) {
161
+ const name = path.basename(sdkToolPath);
162
+ const dir = path.dirname(sdkToolPath);
163
+
164
+ throwSdkIntegrityError(`There was no "${name}" executable file in directory: ${dir}`);
165
+ }
166
+
167
+ function throwSdkIntegrityError(errMessage) {
168
+ throw new DetoxRuntimeError(`${errMessage}\nCheck the integrity of your Android SDK.`);
154
169
  }
155
170
 
156
171
  function throwMissingGmsaasError() {
@@ -173,7 +188,30 @@ async function getFrameworkPath() {
173
188
  async function _doGetFrameworkPath() {
174
189
  const detoxVersion = getDetoxVersion();
175
190
  const sha1 = (await exec(`(echo "${detoxVersion}" && xcodebuild -version) | shasum | awk '{print $1}'`)).stdout.trim();
176
- return `${DETOX_LIBRARY_ROOT_PATH}/ios/${sha1}/Detox.framework`;
191
+ return `${DETOX_LIBRARY_ROOT_PATH}/ios/framework/${sha1}/Detox.framework`;
192
+ }
193
+
194
+ let _iosXCUITestRunnerPath;
195
+ async function getXCUITestRunnerPath() {
196
+ if (!_iosXCUITestRunnerPath) {
197
+ _iosXCUITestRunnerPath = _doGetXCUITestRunnerPath();
198
+ }
199
+
200
+ return _iosXCUITestRunnerPath;
201
+ }
202
+
203
+ async function _doGetXCUITestRunnerPath() {
204
+ const detoxVersion = getDetoxVersion();
205
+ const sha1 = (await exec(`(echo "${detoxVersion}" && xcodebuild -version) | shasum | awk '{print $1}'`)).stdout.trim();
206
+
207
+ const derivedDataPath = `${DETOX_LIBRARY_ROOT_PATH}/ios/xcuitest-runner/${sha1}`;
208
+
209
+ const xctestrunPath = (await exec(`find ${derivedDataPath} -name "*.xctestrun" -print -quit`)).stdout.trim();
210
+ if (!xctestrunPath) {
211
+ throw new DetoxRuntimeError(`Failed to find .xctestrun file in ${derivedDataPath}`);
212
+ }
213
+
214
+ return xctestrunPath;
177
215
  }
178
216
 
179
217
  function getDetoxLibraryRootPath() {
@@ -211,6 +249,7 @@ module.exports = {
211
249
  getGmsaasPath,
212
250
  getDetoxVersion,
213
251
  getFrameworkPath,
252
+ getXCUITestRunnerPath,
214
253
  getAndroidSDKPath,
215
254
  getAndroidEmulatorPath,
216
255
  getDetoxLibraryRootPath,
@@ -1,4 +1,6 @@
1
1
  const { isError } = require('lodash');
2
+ const { deserializeError, serializeError } = require('serialize-error');
3
+
2
4
  const CLEAN_AT = /\n\s*at [\s\S]*/m;
3
5
 
4
6
  function filterErrorStack(error, predicate) {
@@ -16,11 +18,12 @@ function filterErrorStack(error, predicate) {
16
18
  }
17
19
 
18
20
  function replaceErrorStack(source, target) {
19
- const sourceStack = source.stack || source.message;
20
- const targetStack = target.stack || target.message;
21
+ const sourceStack = (source.stack || '');
21
22
  const sourceMessage = sourceStack.replace(CLEAN_AT, '');
22
- const targetMessage = targetStack.replace(CLEAN_AT, '');
23
23
  const actualSourceStack = sourceStack.slice(sourceMessage.length);
24
+
25
+ const targetMessage = target.message || target.stack.replace(CLEAN_AT, '');
26
+
24
27
  target.stack = targetMessage + actualSourceStack;
25
28
  return target;
26
29
  }
@@ -37,9 +40,27 @@ function asError(error) {
37
40
  return isError(error) ? error : new Error(error);
38
41
  }
39
42
 
43
+ function serializeObjectWithError(obj, errorKey) {
44
+ if (obj[errorKey]) {
45
+ return { ...obj, [errorKey]: serializeError(obj[errorKey]) };
46
+ }
47
+
48
+ return obj;
49
+ }
50
+
51
+ function deserializeObjectWithError(obj, errorKey) {
52
+ if (typeof obj[errorKey] === 'object' && !(obj[errorKey] instanceof Error)) {
53
+ return { ...obj, [errorKey]: deserializeError(obj[errorKey]) };
54
+ }
55
+
56
+ return obj;
57
+ }
58
+
40
59
  module.exports = {
41
60
  asError,
42
61
  replaceErrorStack,
43
62
  filterErrorStack,
44
63
  createErrorWithUserStack,
64
+ serializeObjectWithError,
65
+ deserializeObjectWithError,
45
66
  };
@@ -0,0 +1,44 @@
1
+ module.exports = {
2
+ actionDescription: {
3
+ adjustSliderToPosition: (newPosition) => `adjust slider to position ${newPosition}`,
4
+ clearText: () => 'clear input text',
5
+ getAttributes: () => 'get element attributes',
6
+ longPress: (duration) => `long press${duration !== undefined ? ` for ${duration}ms` : ''}`,
7
+ longPressAndDrag: (duration, startX, startY, targetElement, endX, endY, speed, holdDuration) =>
8
+ `long press and drag from ${startX}, ${startY} to ${endX}, ${endY} with speed ${speed} and hold duration ${holdDuration}`,
9
+ multiTap: (times) => `tap ${times} times`,
10
+ performAccessibilityAction: (actionName) => `perform ${actionName} accessibilityAction`,
11
+ pinch: (scale, speed, angle) => `pinch with scale ${scale}, speed ${speed}, and angle ${angle}`,
12
+ pinchWithAngle: (direction, speed, angle) => `pinch with direction ${direction}, speed ${speed}, and angle ${angle}`,
13
+ replaceText: (value) => `replace input text: "${value}"`,
14
+ scroll: (amount, direction, startPositionX, startPositionY) =>
15
+ `scroll ${amount} pixels ${direction}${startPositionX !== undefined && startPositionY !== undefined ? ` from normalized position (${startPositionX}, ${startPositionY})` : ''}`,
16
+ scrollTo: (edge) => `scroll to ${edge}`,
17
+ scrollToIndex: (index) => `scroll to index #${index}`,
18
+ setColumnToValue: (column, value) => `set column ${column} to value ${value}`,
19
+ setDatePickerDate: (dateString, dateFormat) => `set date picker date to ${dateString} using format ${dateFormat}`,
20
+ swipe: (direction, speed, normalizedSwipeOffset, normalizedStartingPointX, normalizedStartingPointY) =>
21
+ `swipe ${direction} ${speed} with offset ${normalizedSwipeOffset}
22
+ ${!isNaN(normalizedStartingPointX) && !isNaN(normalizedStartingPointY) ? ` from normalized position (${normalizedStartingPointX}, ${normalizedStartingPointY})` : ''}`,
23
+ takeScreenshot: (screenshotName) => `take screenshot${screenshotName !== undefined ? ` with name "${screenshotName}"` : ''}`,
24
+ tapAtPoint: (value) => `tap${value !== undefined ? ` at ${JSON.stringify(value)}` : ''}`,
25
+ tapBackspaceKey: () => 'tap on backspace key',
26
+ tapReturnKey: () => 'tap on return key',
27
+ typeText: (value) => `type input text: "${value}"`,
28
+ },
29
+ expectDescription: {
30
+ waitFor: (actionDescription) => `wait for expectation while ${actionDescription}`,
31
+ waitForWithTimeout: (expectDescription, timeout) => `${expectDescription} with timeout (${timeout} ms)`,
32
+ withTimeout: (timeout) => `wait until timeout (${timeout} ms)`,
33
+ toBeFocused: () => 'to be focused',
34
+ toBeVisible: (percent) => `to be visible${percent !== undefined ? ` ${percent}%` : ''}`,
35
+ toExist: () => 'to exist',
36
+ toHaveText: (text) => `to have text: "${text}"`,
37
+ toHaveLabel: (label) => `to have label: "${label}"`,
38
+ toHaveId: (id) => `to have id: "${id}"`,
39
+ toHaveValue: (value) => `to have value: "${value}"`,
40
+ toHaveSliderPosition: (position, tolerance) => `to have slider position: ${position}${tolerance > 0 ? ` with tolerance ${tolerance}` : ''}`,
41
+ toHaveToggleValue: (value) => `to have toggle value: ${value}`,
42
+ full: (expectDescription, notCondition) => `expect element ${notCondition ? `not ${expectDescription}` : expectDescription}`
43
+ }
44
+ };
@@ -2,4 +2,11 @@ function isPromise(value) {
2
2
  return Promise.resolve(value) === value;
3
3
  }
4
4
 
5
- module.exports = isPromise;
5
+ function isPromiseLike(value) {
6
+ return value ? typeof value.then === 'function' : false;
7
+ }
8
+
9
+ module.exports = {
10
+ isPromise,
11
+ isPromiseLike,
12
+ };
@@ -1,4 +1,4 @@
1
1
  /**
2
- * @type {Detox.Logger}
2
+ * @type {import('../logger/DetoxLogger')}
3
3
  */
4
- module.exports = require('../..').log;
4
+ module.exports = require('../../internals').log;
@@ -0,0 +1,11 @@
1
+ const path = require('path');
2
+
3
+ function toSimplePath(filePath, cwd = process.cwd()) {
4
+ const relativePath = path.relative(cwd, filePath);
5
+ const isOutsideCwd = relativePath.split(path.sep, 1)[0] === '..';
6
+ return isOutsideCwd ? filePath : relativePath;
7
+ }
8
+
9
+ module.exports = {
10
+ toSimplePath,
11
+ };
@@ -1,5 +1,6 @@
1
1
  const SPACE = ' ';
2
2
  const BACK_SLASH = '\\';
3
+ const FORWARD_SLASH = '/';
3
4
  const SINGLE_QUOTE = "'";
4
5
  const DOUBLE_QUOTE = '"';
5
6
 
@@ -64,6 +65,14 @@ function autoEscapeCmd(str) {
64
65
  return escapeWithDoubleQuotedString(str);
65
66
  }
66
67
 
68
+ function useForwardSlashesCMD(str) {
69
+ return str.split(BACK_SLASH).join(FORWARD_SLASH);
70
+ }
71
+
72
+ function useForwardSlashesShell(str) {
73
+ return str; // already POSIX, so no-op
74
+ }
75
+
67
76
  const hasUnsafeChars = isRunningInCMDEXE()
68
77
  /* istanbul ignore next */ ? hasUnsafeCMDChars
69
78
  /* istanbul ignore next */ : hasUnsafeShellChars;
@@ -76,6 +85,10 @@ const escapeSpaces = isRunningInCMDEXE()
76
85
  /* istanbul ignore next */ ? escapeSpacesCMD
77
86
  /* istanbul ignore next */ : escapeSpacesShell;
78
87
 
88
+ const usePosixSlashes = isRunningInCMDEXE()
89
+ /* istanbul ignore next */ ? useForwardSlashesCMD
90
+ /* istanbul ignore next */ : useForwardSlashesShell;
91
+
79
92
  module.exports = {
80
93
  escapeInDoubleQuotedString,
81
94
  escapeInDoubleQuotedRegexp,
@@ -94,4 +107,8 @@ module.exports = {
94
107
  cmd: autoEscapeCmd,
95
108
  shell: autoEscapeShell,
96
109
  }),
110
+ useForwardSlashes: Object.assign(usePosixSlashes, {
111
+ cmd: useForwardSlashesCMD,
112
+ shell: useForwardSlashesShell,
113
+ }),
97
114
  };
@@ -0,0 +1,21 @@
1
+ function _getCallStackTrace() {
2
+ return new Error().stack
3
+ .split('\n')
4
+ .slice(1) // Ignore Error message
5
+ .map(line => line
6
+ .replace(/^\s*at\s+/, '')
7
+ .replace(process.cwd(), '')
8
+ )
9
+ .filter(line => !line.includes('/detox/src')) // Ignore detox internal calls
10
+ .join('\n');
11
+ }
12
+
13
+ function invocationCall(logger, sectionName, invocation, action) {
14
+ return logger.trace.complete({
15
+ cat: 'ws-client,ws-client-invocation',
16
+ data: invocation,
17
+ stack: _getCallStackTrace(),
18
+ }, sectionName, action);
19
+ }
20
+
21
+ module.exports = invocationCall;
@@ -0,0 +1,15 @@
1
+ function traceMethods(logger, obj, methodNames) {
2
+ for (const name of methodNames) {
3
+ const originalMethod = obj[name];
4
+
5
+ obj[name] = function tracedMethod(...args) {
6
+ return logger.trace.complete(
7
+ { args },
8
+ name,
9
+ originalMethod.apply.bind(originalMethod, obj, args)
10
+ );
11
+ };
12
+ }
13
+ }
14
+
15
+ module.exports = traceMethods;
@@ -8,14 +8,17 @@ class IosSimulatorEnvValidator extends EnvironmentValidatorBase {
8
8
  async validate() {
9
9
  const detoxFrameworkPath = await environment.getFrameworkPath();
10
10
 
11
- if (!this._frameworkPathExists(detoxFrameworkPath)) {
11
+ if (!fs.existsSync(detoxFrameworkPath)) {
12
12
  throw new DetoxRuntimeError(`${detoxFrameworkPath} could not be found, this means either you changed a version of Xcode or Detox postinstall script was unsuccessful.
13
13
  To attempt a fix try running 'detox clean-framework-cache && detox build-framework-cache'`);
14
14
  }
15
- }
16
15
 
17
- _frameworkPathExists(detoxFrameworkPath) {
18
- return fs.existsSync(detoxFrameworkPath);
16
+ const detoxXCUITestRunnerPath = await environment.getXCUITestRunnerPath();
17
+
18
+ if (!fs.existsSync(detoxXCUITestRunnerPath)) {
19
+ throw new DetoxRuntimeError(`${detoxXCUITestRunnerPath} could not be found, this means either you changed a version of Xcode or Detox postinstall script was unsuccessful.
20
+ To attempt a fix try running 'detox clean-xcuitest-cache && detox build-xcuitest-cache'`);
21
+ }
19
22
  }
20
23
  }
21
24
 
@@ -1 +0,0 @@
1
- acc211b70fb65685f6bc4485877bbbb2eff3bc39c6c827eb2e3c7718a4483f3f
@@ -1 +0,0 @@
1
- a04e99a05821a7eee3dd52681ad4f5f90f79db30148dc725c0857dc6816d3a2321e0325301956b42135eeafba91730cbf1ea3e9bb2c7fd8907b6b3622554e681
@@ -1 +0,0 @@
1
- aea2cd38e84670f4c1247a91ed192dfb7aa8e7b6b8caf0ab9e4653e9d3d534f3
@@ -1 +0,0 @@
1
- bde9ea969c3dc598bd83269cb194a45b2541a72cfb957cb73739e6bcc696db72f03083bd89d5487165259a6ec69290efddfe686456c37a26a5b756f48d2c16f3
@@ -1 +0,0 @@
1
- 87990259e9864e07f8a1ccde34e69dfcadfba39167d7384062c272e81b307231
@@ -1 +0,0 @@
1
- 34165b1c6d6ea54d5c3420bd7f387dfa9fc81f8a43d50c404d06c9d24a6d6377dc84ba4f0b699dda5780658fb8796d197f368ef396cbf29240270e9fea78bddc
@@ -1 +0,0 @@
1
- a815eb45d190075410faa418d75636120436338083a8c56b48c0314bf2370afe
@@ -1 +0,0 @@
1
- 9566b64dce8fc2983da565d015b787f1d13f1ea79c95f2062fcdb5ff06ef2c00c2fd96fc9680737d979c4f299570ef448ebac2489e5370f8efc94b08814e5f37
package/Detox-ios.tbz DELETED
Binary file
@@ -1,24 +0,0 @@
1
- package com.wix.detox.espresso.registry
2
-
3
- import androidx.test.espresso.Espresso
4
- import androidx.test.espresso.IdlingResource
5
- import androidx.test.espresso.base.IdlingResourceRegistry
6
- import com.wix.detox.common.UIThread
7
- import org.joor.Reflect
8
- import java.util.concurrent.Callable
9
-
10
- class IRStatusInquirer(private val registry: IdlingResourceRegistry) {
11
- fun getAllBusyResources(): List<IdlingResource> {
12
- return UIThread.postFirstSync(Callable<List<IdlingResource>> {
13
- registry.resources.filter { resource ->
14
- !resource.isIdleNow
15
- }
16
- })
17
- }
18
-
19
- companion object {
20
- val INSTANCE = IRStatusInquirer(getRegistryDefault())
21
- }
22
- }
23
-
24
- private fun getRegistryDefault() = Reflect.on(Espresso::class.java).get<IdlingResourceRegistry>("baseRegistry")
@@ -1,10 +0,0 @@
1
- package com.wix.detox.reactnative.idlingresources
2
-
3
- import androidx.test.espresso.IdlingResource
4
-
5
- interface DescriptiveIdlingResource: IdlingResource {
6
- /**
7
- * Returns a descriptive representation of the resource.
8
- */
9
- fun getDescription(): IdlingResourceDescription
10
- }
@@ -1,20 +0,0 @@
1
- package com.wix.detox.reactnative.idlingresources
2
-
3
- class IdlingResourceDescription private constructor(
4
- private val name: String,
5
- private val description: Map<String, Any>) {
6
- fun json(): Map<String, Any> = mutableMapOf<String, Any>("name" to name)
7
- .apply { if (description.isNotEmpty()) put("description", description) }
8
-
9
- override fun equals(other: Any?): Boolean = other is IdlingResourceDescription &&
10
- other.json() == this.json()
11
-
12
- data class Builder(
13
- var name: String = "unknown",
14
- var description: MutableMap<String, Any> = mutableMapOf()) {
15
-
16
- fun name(name: String) = apply { this.name = name }
17
- fun addDescription(key: String, value: Any) = apply { this.description[key] = value }
18
- fun build() = IdlingResourceDescription(name, description)
19
- }
20
- }
@@ -1,84 +0,0 @@
1
- @file:RNDropSupportTodo(62, "Remove all of this; Use DelegatedIdleInterrogationStrategy, instead.")
2
-
3
- package com.wix.detox.reactnative.idlingresources.timers
4
-
5
- import com.facebook.react.bridge.ReactContext
6
- import com.wix.detox.common.RNDropSupportTodo
7
- import com.wix.detox.reactnative.helpers.RNHelpers
8
- import org.joor.Reflect
9
- import java.util.*
10
-
11
- private const val BUSY_WINDOW_THRESHOLD = 1500
12
-
13
- private class TimerReflected(timer: Any) {
14
- private var reflected = Reflect.on(timer)
15
-
16
- val isRepeating: Boolean
17
- get() = reflected.field("mRepeat").get()
18
- val interval: Int
19
- get() = reflected.field("mInterval").get()
20
- val targetTime: Long
21
- get() = reflected.field("mTargetTime").get()
22
- }
23
-
24
- private class TimingModuleReflected(private val timingModule: Any) {
25
- val timersQueue: PriorityQueue<Any>
26
- get() = Reflect.on(timingModule).field("mTimers").get()
27
- val timersLock: Any
28
- get() = Reflect.on(timingModule).field("mTimerGuard").get()
29
-
30
- operator fun component1() = timersQueue
31
- operator fun component2() = timersLock
32
- }
33
-
34
- class DefaultIdleInterrogationStrategy
35
- internal constructor(private val timersModule: Any)
36
- : IdleInterrogationStrategy {
37
-
38
- override fun isIdleNow(): Boolean {
39
- val (timersQueue, timersLock) = TimingModuleReflected(timersModule)
40
- synchronized(timersLock) {
41
- val nextTimer = timersQueue.peek()
42
- nextTimer?.let {
43
- return !isTimerInBusyWindow(it) && !hasBusyTimers(timersQueue)
44
- }
45
- return true
46
- }
47
- }
48
-
49
- private fun isTimerInBusyWindow(timer: Any): Boolean {
50
- val timerReflected = TimerReflected(timer)
51
- return when {
52
- timerReflected.isRepeating -> false
53
- timerReflected.interval > BUSY_WINDOW_THRESHOLD -> false
54
- else -> true
55
- }
56
- }
57
-
58
- private fun hasBusyTimers(timersQueue: PriorityQueue<Any>): Boolean {
59
- timersQueue.forEach {
60
- if (isTimerInBusyWindow(it)) {
61
- return true
62
- }
63
- }
64
- return false
65
- }
66
-
67
- companion object {
68
- fun createIfSupported(reactContext: ReactContext): DefaultIdleInterrogationStrategy? {
69
- // RN = 0.62.0:
70
- // Should have been handled by DelegatedIdleInterrogationStrategy.createIfSupported() but seems the new TimingModule class
71
- // was released without the awaited-for "hasActiveTimersInRange()" method.
72
- try {
73
- val timingModule = RNHelpers.getNativeModule(reactContext, "com.facebook.react.modules.core.TimingModule")
74
- val timersManager = Reflect.on(timingModule).get<Any>("mJavaTimerManager")
75
- return DefaultIdleInterrogationStrategy(timersManager)
76
- } catch (ex: Exception) {
77
- }
78
-
79
- // RN < 0.62
80
- val timingModule = RNHelpers.getNativeModule(reactContext, "com.facebook.react.modules.core.Timing") ?: return null
81
- return DefaultIdleInterrogationStrategy(timingModule)
82
- }
83
- }
84
- }
@@ -1,36 +0,0 @@
1
- package com.wix.detox.espresso.action
2
-
3
- import android.view.View
4
- import androidx.test.espresso.UiController
5
- import androidx.test.espresso.ViewAction
6
- import androidx.test.espresso.matcher.ViewMatchers
7
- import com.facebook.react.bridge.JavaOnlyMap
8
- import com.facebook.react.uimanager.ReactStylesDiffMap
9
- import com.facebook.react.views.slider.ReactSlider
10
- import com.facebook.react.views.slider.ReactSliderManager
11
- import org.hamcrest.Matcher
12
- import org.hamcrest.Matchers
13
-
14
- class AdjustSliderToPositionAction(private val desiredPosition: Double, private val mManager: ReactSliderManager) : ViewAction {
15
- override fun getConstraints(): Matcher<View?>? = Matchers.allOf(
16
- ViewMatchers.isAssignableFrom(ReactSlider::class.java),
17
- getIsDisplayed())
18
-
19
- override fun getDescription() = "adjustSliderToPosition"
20
-
21
- fun getIsDisplayed(): Matcher<View?> = ViewMatchers.isDisplayed()
22
-
23
- private fun buildStyles(vararg keysAndValues: Any) = ReactStylesDiffMap(JavaOnlyMap.of(*keysAndValues))
24
-
25
- private fun calculateProgressTarget(view: ReactSlider): Double {
26
- val sliderProgress = view.toRealProgress(view.progress)
27
- val sliderScrollFactor = view.max / view.progress.toDouble()
28
- val sliderMaxValue = sliderProgress * sliderScrollFactor
29
- return desiredPosition * sliderMaxValue
30
- }
31
-
32
- override fun perform(uiController: UiController?, view: View) {
33
- val progressNewValue = calculateProgressTarget(view as ReactSlider)
34
- mManager.updateProperties(view, buildStyles("value", progressNewValue))
35
- }
36
- }