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
@@ -1,17 +1,18 @@
1
+ const CAF = require('caf');
1
2
  const _ = require('lodash');
2
3
 
3
4
  const Client = require('./client/Client');
4
5
  const environmentFactory = require('./environmentFactory');
5
6
  const { DetoxRuntimeErrorComposer } = require('./errors');
6
7
  const { InvocationManager } = require('./invoke');
7
- const symbols = require('./symbols');
8
+ const symbols = require('./realms/symbols');
8
9
  const AsyncEmitter = require('./utils/AsyncEmitter');
9
10
  const uuid = require('./utils/uuid');
10
11
 
11
12
  class DetoxWorker {
12
13
  constructor(context) {
13
14
  this._context = context;
14
- this._isCleaningUp = false;
15
+ this._injectedGlobalProperties = [];
15
16
  this._config = context[symbols.config];
16
17
  this._runtimeErrorComposer = new DetoxRuntimeErrorComposer(this._config);
17
18
  this._client = null;
@@ -32,6 +33,20 @@ class DetoxWorker {
32
33
  onError: this._onEmitError.bind(this),
33
34
  });
34
35
 
36
+
37
+ /** @type {DetoxInternals.RuntimeConfig['apps']} */
38
+ this._appsConfig = null;
39
+ /** @type {DetoxInternals.RuntimeConfig['artifacts']} */
40
+ this._artifactsConfig = null;
41
+ /** @type {DetoxInternals.RuntimeConfig['behavior']} */
42
+ this._behaviorConfig = null;
43
+ /** @type {DetoxInternals.RuntimeConfig['device']} */
44
+ this._deviceConfig = null;
45
+ /** @type {DetoxInternals.RuntimeConfig['session']} */
46
+ this._sessionConfig = null;
47
+
48
+ /** @type {string} */
49
+ this.id = 'worker';
35
50
  /** @type {Detox.Device} */
36
51
  this.device = null;
37
52
  /** @type {Detox.ElementFacade} */
@@ -51,20 +66,40 @@ class DetoxWorker {
51
66
  this.trace = this._context.trace;
52
67
  /** @deprecated */
53
68
  this.traceCall = this._context.traceCall;
69
+
70
+ this._reinstallAppsOnDevice = CAF(this._reinstallAppsOnDevice.bind(this));
71
+ this._initToken = new CAF.cancelToken();
72
+
73
+ this._cafWrap([
74
+ 'init',
75
+ 'onRunDescribeStart',
76
+ 'onTestStart',
77
+ 'onHookFailure',
78
+ 'onTestFnFailure',
79
+ 'onTestDone',
80
+ 'onRunDescribeFinish',
81
+ ]);
54
82
  }
55
83
 
56
- async init() {
57
- if (this._isCleaningUp) return;
84
+ /** @this {DetoxWorker} */
85
+ init = function* (signal) {
86
+ const {
87
+ apps: appsConfig,
88
+ artifacts: artifactsConfig,
89
+ behavior: behaviorConfig,
90
+ device: deviceConfig,
91
+ session: sessionConfig
92
+ } = this._config;
58
93
 
59
- const { appsConfig, artifactsConfig, behaviorConfig, deviceConfig, sessionConfig } = this._config;
60
94
  this._appsConfig = appsConfig;
61
95
  this._artifactsConfig = artifactsConfig;
62
96
  this._behaviorConfig = behaviorConfig;
63
97
  this._deviceConfig = deviceConfig;
64
98
  this._sessionConfig = sessionConfig;
99
+ // @ts-ignore
100
+ this._sessionConfig.sessionId = sessionConfig.sessionId || uuid.UUID();
65
101
  this._runtimeErrorComposer.appsConfig = this._appsConfig;
66
102
 
67
- sessionConfig.sessionId = sessionConfig.sessionId || uuid.UUID();
68
103
  this._client = new Client(sessionConfig);
69
104
  this._client.terminateApp = async () => {
70
105
  // @ts-ignore
@@ -73,8 +108,7 @@ class DetoxWorker {
73
108
  }
74
109
  };
75
110
 
76
- await this._client.connect();
77
- if (this._isCleaningUp) return;
111
+ yield this._client.connect();
78
112
 
79
113
  const invocationManager = new InvocationManager(this._client);
80
114
 
@@ -91,8 +125,7 @@ class DetoxWorker {
91
125
  } = environmentFactory.createFactories(this._deviceConfig);
92
126
 
93
127
  const envValidator = envValidatorFactory.createValidator();
94
- await envValidator.validate();
95
- if (this._isCleaningUp) return;
128
+ yield envValidator.validate();
96
129
 
97
130
  const commonDeps = {
98
131
  invocationManager,
@@ -103,8 +136,9 @@ class DetoxWorker {
103
136
 
104
137
  this._artifactsManager = artifactsManagerFactory.createArtifactsManager(this._artifactsConfig, commonDeps);
105
138
  this._deviceAllocator = deviceAllocatorFactory.createDeviceAllocator(commonDeps);
106
- this._deviceCookie = await this._deviceAllocator.allocate(this._deviceConfig);
107
- if (this._isCleaningUp) return;
139
+ this._deviceCookie = yield this._deviceAllocator.allocate(this._deviceConfig);
140
+
141
+ yield this._deviceAllocator.postAllocate(this._deviceCookie);
108
142
 
109
143
  this.device = runtimeDeviceFactory.createRuntimeDevice(
110
144
  this._deviceCookie,
@@ -115,7 +149,6 @@ class DetoxWorker {
115
149
  deviceConfig: this._deviceConfig,
116
150
  sessionConfig,
117
151
  });
118
- if (this._isCleaningUp) return;
119
152
 
120
153
  const matchers = matchersFactory.createMatchers({
121
154
  invocationManager,
@@ -125,34 +158,37 @@ class DetoxWorker {
125
158
  Object.assign(this, matchers);
126
159
 
127
160
  if (behaviorConfig.init.exposeGlobals) {
128
- Object.assign(DetoxWorker.global, {
161
+ const injectedGlobals = {
129
162
  ...matchers,
130
163
  device: this.device,
131
164
  detox: this,
132
- });
165
+ };
166
+
167
+ this._injectedGlobalProperties = Object.keys(injectedGlobals);
168
+ Object.assign(DetoxWorker.global, injectedGlobals);
133
169
  }
134
170
 
135
171
  // @ts-ignore
136
- await this.device.installUtilBinaries();
137
- if (this._isCleaningUp) return;
172
+ yield this.device.installUtilBinaries();
138
173
 
139
174
  if (behaviorConfig.init.reinstallApp) {
140
- await this._reinstallAppsOnDevice();
141
- if (this._isCleaningUp) return;
175
+ yield this._reinstallAppsOnDevice(signal);
142
176
  }
143
177
 
144
178
  const appAliases = Object.keys(this._appsConfig);
145
179
  if (appAliases.length === 1) {
146
- await this.device.selectApp(appAliases[0]);
180
+ yield this.device.selectApp(appAliases[0]);
147
181
  } else {
148
- await this.device.selectApp(null);
182
+ yield this.device.selectApp(null);
149
183
  }
150
-
151
- return this;
152
- }
184
+ };
153
185
 
154
186
  async cleanup() {
155
- this._isCleaningUp = true;
187
+ this._initToken.abort('CLEANUP');
188
+
189
+ for (const key of this._injectedGlobalProperties) {
190
+ delete DetoxWorker.global[key];
191
+ }
156
192
 
157
193
  if (this._artifactsManager) {
158
194
  await this._artifactsManager.onBeforeCleanup();
@@ -166,9 +202,12 @@ class DetoxWorker {
166
202
  }
167
203
 
168
204
  if (this.device) {
169
- const shutdown = this._behaviorConfig ? this._behaviorConfig.cleanup.shutdownDevice : false;
170
205
  // @ts-ignore
171
206
  await this.device._cleanup();
207
+ }
208
+
209
+ if (this._deviceCookie) {
210
+ const shutdown = this._behaviorConfig ? this._behaviorConfig.cleanup.shutdownDevice : false;
172
211
  await this._deviceAllocator.free(this._deviceCookie, { shutdown });
173
212
  }
174
213
 
@@ -181,46 +220,45 @@ class DetoxWorker {
181
220
  return this._context.log;
182
221
  }
183
222
 
184
- onRunStart = async (...args) => this._artifactsManager.onRunStart(...args);
185
- onRunDescribeStart = async (...args) => this._artifactsManager.onRunDescribeStart(...args);
186
- onTestStart = async (testSummary) => {
187
- if (this._isCleaningUp) return;
223
+ onRunDescribeStart = function* (_signal, ...args) {
224
+ yield this._artifactsManager.onRunDescribeStart(...args);
225
+ };
226
+
227
+ onTestStart = function* (_signal, testSummary) {
188
228
  this._validateTestSummary('beforeEach', testSummary);
189
- this._logTestRunCheckpoint('DETOX_BEFORE_EACH', testSummary);
190
229
 
191
- if (this._isCleaningUp) return;
192
- await this._dumpUnhandledErrorsIfAny({
230
+ yield this._dumpUnhandledErrorsIfAny({
193
231
  pendingRequests: false,
194
232
  testName: testSummary.fullName,
195
233
  });
196
234
 
197
- if (this._isCleaningUp) return;
198
- await this._artifactsManager.onTestStart(testSummary);
235
+ yield this._artifactsManager.onTestStart(testSummary);
236
+ };
237
+
238
+ onHookFailure = function* (_signal, ...args) {
239
+ yield this._artifactsManager.onHookFailure(...args);
240
+ };
241
+
242
+ onTestFnFailure = function* (_signal, ...args) {
243
+ yield this._artifactsManager.onTestFnFailure(...args);
199
244
  };
200
- onHookStart = async (...args) => this._artifactsManager.onHookStart(...args);
201
- onHookFailure = async (...args) => this._artifactsManager.onHookFailure(...args);
202
- onHookSuccess = async (...args) => this._artifactsManager.onHookSuccess(...args);
203
- onTestFnStart = async (...args) => this._artifactsManager.onTestFnStart(...args);
204
- onTestFnFailure = async (...args) => this._artifactsManager.onTestFnFailure(...args);
205
- onTestFnSuccess = async (...args) => this._artifactsManager.onTestFnSuccess(...args);
206
- onTestDone = async (testSummary) => {
207
- if (this._isCleaningUp) return;
245
+
246
+ onTestDone = function* (_signal, testSummary) {
208
247
  this._validateTestSummary('afterEach', testSummary);
209
- this._logTestRunCheckpoint('DETOX_AFTER_EACH', testSummary);
210
248
 
211
- if (this._isCleaningUp) return;
212
- await this._artifactsManager.onTestDone(testSummary);
249
+ yield this._artifactsManager.onTestDone(testSummary);
213
250
 
214
- if (this._isCleaningUp) return;
215
- await this._dumpUnhandledErrorsIfAny({
251
+ yield this._dumpUnhandledErrorsIfAny({
216
252
  pendingRequests: testSummary.timedOut,
217
253
  testName: testSummary.fullName,
218
254
  });
219
255
  };
220
- onRunDescribeFinish = async (...args) => this._artifactsManager.onRunDescribeFinish(...args);
221
- onRunFinish = async (...args) => this._artifactsManager.onRunFinish(...args);
222
256
 
223
- async _reinstallAppsOnDevice() {
257
+ onRunDescribeFinish = function* (_signal, ...args) {
258
+ yield this._artifactsManager.onRunDescribeFinish(...args);
259
+ };
260
+
261
+ *_reinstallAppsOnDevice(_signal) {
224
262
  const appNames = _(this._appsConfig)
225
263
  .map((config, key) => [key, `${config.binaryPath}:${config.testBinaryPath}`])
226
264
  .uniqBy(1)
@@ -228,24 +266,16 @@ class DetoxWorker {
228
266
  .value();
229
267
 
230
268
  for (const appName of appNames) {
231
- await this.device.selectApp(appName);
232
- if (this._isCleaningUp) return;
233
- await this.device.uninstallApp();
234
- if (this._isCleaningUp) return;
269
+ yield this.device.selectApp(appName);
270
+ yield this.device.uninstallApp();
235
271
  }
236
272
 
237
273
  for (const appName of appNames) {
238
- await this.device.selectApp(appName);
239
- if (this._isCleaningUp) return;
240
- await this.device.installApp();
241
- if (this._isCleaningUp) return;
274
+ yield this.device.selectApp(appName);
275
+ yield this.device.installApp();
242
276
  }
243
277
  }
244
278
 
245
- _logTestRunCheckpoint(event, { status, fullName }) {
246
- this.log.trace({ event, status }, `${status} test: ${JSON.stringify(fullName)}`);
247
- }
248
-
249
279
  _validateTestSummary(methodName, testSummary) {
250
280
  if (!_.isPlainObject(testSummary)) {
251
281
  throw this._runtimeErrorComposer.invalidTestSummary(methodName, testSummary);
@@ -274,10 +304,28 @@ class DetoxWorker {
274
304
  error
275
305
  );
276
306
  }
307
+
308
+ _cafWrap(methodNames) {
309
+ for (const methodName of methodNames) {
310
+ const cafMethod = CAF(this[methodName].bind(this));
311
+ this[methodName] = async (...args) => {
312
+ try {
313
+ await cafMethod(this._initToken.signal, ...args);
314
+ } catch (e) {
315
+ if (e !== 'CLEANUP') {
316
+ throw e;
317
+ }
318
+ }
319
+
320
+ return this;
321
+ };
322
+ }
323
+ }
324
+
277
325
  }
278
326
 
279
327
  /**
280
- * @type {NodeJS.Global}
328
+ * @type {NodeJS.Global | {}}
281
329
  */
282
330
  DetoxWorker.global = global;
283
331
 
@@ -124,6 +124,13 @@ class ScrollToIndex extends Action {
124
124
  }
125
125
  }
126
126
 
127
+ class SetDatePickerDateAction extends Action {
128
+ constructor(dateString, formatString) {
129
+ super();
130
+ this._call = invoke.callDirectly(DetoxActionApi.setDatePickerDate(dateString, formatString));
131
+ }
132
+ }
133
+
127
134
  class AdjustSliderToPosition extends Action {
128
135
  constructor(newPosition) {
129
136
  super();
@@ -138,6 +145,13 @@ class TakeElementScreenshot extends Action {
138
145
  }
139
146
  }
140
147
 
148
+ class AccessibilityActionAction extends Action {
149
+ constructor(actionName) {
150
+ super();
151
+ this._call = invoke.callDirectly(DetoxActionApi.accessibilityAction(actionName));
152
+ }
153
+ }
154
+
141
155
  module.exports = {
142
156
  Action,
143
157
  TapAction,
@@ -155,5 +169,7 @@ module.exports = {
155
169
  SwipeAction,
156
170
  TakeElementScreenshot,
157
171
  ScrollToIndex,
172
+ SetDatePickerDateAction,
158
173
  AdjustSliderToPosition,
174
+ AccessibilityActionAction
159
175
  };
@@ -5,6 +5,8 @@ const tempfile = require('tempfile');
5
5
 
6
6
  const DetoxRuntimeError = require('../../errors/DetoxRuntimeError');
7
7
  const invoke = require('../../invoke');
8
+ const { removeMilliseconds } = require('../../utils/dateUtils');
9
+ const { actionDescription } = require('../../utils/invocationTraceDescriptions');
8
10
  const actions = require('../actions/native');
9
11
  const DetoxMatcherApi = require('../espressoapi/DetoxMatcher');
10
12
  const { ActionInteraction } = require('../interactions/native');
@@ -18,12 +20,11 @@ class NativeElement {
18
20
  }
19
21
 
20
22
  _selectElementWithMatcher(matcher) {
21
- // if (!(matcher instanceof NativeMatcher)) throw new DetoxRuntimeError(`Element _selectElementWithMatcher argument must be a valid NativeMatcher, got ${typeof matcher}`);
22
23
  this._call = invoke.call(invoke.Espresso, 'onView', matcher._call);
23
24
  }
24
25
 
25
26
  atIndex(index) {
26
- if (typeof index !== 'number') throw new DetoxRuntimeError(`Element atIndex argument must be a number, got ${typeof index}`);
27
+ if (typeof index !== 'number') throw new DetoxRuntimeError({ message: `Element atIndex argument must be a number, got ${typeof index}` });
27
28
  const matcher = this._originalMatcher;
28
29
  this._originalMatcher._call = invoke.callDirectly(DetoxMatcherApi.matcherForAtIndex(index, matcher._call.value));
29
30
 
@@ -32,56 +33,94 @@ class NativeElement {
32
33
  }
33
34
 
34
35
  async tap(value) {
35
- return await new ActionInteraction(this._invocationManager, this, new actions.TapAction(value)).execute();
36
+ const action = new actions.TapAction(value);
37
+ const traceDescription = actionDescription.tapAtPoint(value);
38
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
36
39
  }
37
40
 
38
41
  async tapAtPoint(value) {
39
- return await new ActionInteraction(this._invocationManager, this, new actions.TapAtPointAction(value)).execute();
42
+ const action = new actions.TapAtPointAction(value);
43
+ const traceDescription = actionDescription.tapAtPoint(value);
44
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
40
45
  }
41
46
 
42
47
  async longPress() {
43
- return await new ActionInteraction(this._invocationManager, this, new actions.LongPressAction()).execute();
48
+ const action = new actions.LongPressAction();
49
+ const traceDescription = actionDescription.longPress();
50
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
44
51
  }
45
52
 
46
53
  async multiTap(times) {
47
- return await new ActionInteraction(this._invocationManager, this, new actions.MultiClickAction(times)).execute();
54
+ if (typeof times !== 'number') throw new Error('times should be a number, but got ' + (times + (' (' + (typeof times + ')'))));
55
+ if (times < 1) throw new Error('times should be greater than 0, but got ' + times);
56
+
57
+ const action = new actions.MultiClickAction(times);
58
+ const traceDescription = actionDescription.multiTap(times);
59
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
48
60
  }
49
61
 
50
62
  async tapBackspaceKey() {
51
- return await new ActionInteraction(this._invocationManager, this, new actions.PressKeyAction(67)).execute();
63
+ const action = new actions.PressKeyAction(67);
64
+ const traceDescription = actionDescription.tapBackspaceKey();
65
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
52
66
  }
53
67
 
54
68
  async tapReturnKey() {
55
- return await new ActionInteraction(this._invocationManager, this, new actions.TypeTextAction('\n')).execute();
69
+ const action = new actions.TypeTextAction('\n');
70
+ const traceDescription = actionDescription.tapReturnKey();
71
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
56
72
  }
57
73
 
58
74
  async typeText(value) {
59
- return await new ActionInteraction(this._invocationManager, this, new actions.TypeTextAction(value)).execute();
75
+ const action = new actions.TypeTextAction(value);
76
+ const traceDescription = actionDescription.typeText(value);
77
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
60
78
  }
61
79
 
62
80
  async replaceText(value) {
63
- return await new ActionInteraction(this._invocationManager, this, new actions.ReplaceTextAction(value)).execute();
81
+ const action = new actions.ReplaceTextAction(value);
82
+ const traceDescription = actionDescription.replaceText(value);
83
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
64
84
  }
65
85
 
66
86
  async clearText() {
67
- return await new ActionInteraction(this._invocationManager, this, new actions.ClearTextAction()).execute();
87
+ const action = new actions.ClearTextAction();
88
+ const traceDescription = actionDescription.clearText();
89
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
68
90
  }
69
91
 
70
92
  async scroll(amount, direction = 'down', startPositionX, startPositionY) {
71
- // override the user's element selection with an extended matcher that looks for UIScrollView children
72
- // this._selectElementWithMatcher(this._originalMatcher._extendToDescendantScrollViews());
73
- return await new ActionInteraction(this._invocationManager, this, new actions.ScrollAmountAction(direction, amount, startPositionX, startPositionY)).execute();
93
+ const action = new actions.ScrollAmountAction(direction, amount, startPositionX, startPositionY);
94
+ const traceDescription = actionDescription.scroll(amount, direction, startPositionX, startPositionY);
95
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
74
96
  }
75
97
 
76
98
  async scrollTo(edge) {
77
99
  // override the user's element selection with an extended matcher that looks for UIScrollView children
78
100
  this._selectElementWithMatcher(this._originalMatcher._extendToDescendantScrollViews());
79
- return await new ActionInteraction(this._invocationManager, this, new actions.ScrollEdgeAction(edge)).execute();
101
+
102
+ const action = new actions.ScrollEdgeAction(edge);
103
+ const traceDescription = actionDescription.scrollTo(edge);
104
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
80
105
  }
81
106
 
82
107
  async scrollToIndex(index) {
108
+ // override the user's element selection with an extended matcher that looks for UIScrollView children
83
109
  this._selectElementWithMatcher(this._originalMatcher._extendToDescendantScrollViews());
84
- return await new ActionInteraction(this._invocationManager, this, new actions.ScrollToIndex(index)).execute();
110
+
111
+ const action = new actions.ScrollToIndex(index);
112
+ const traceDescription = actionDescription.scrollToIndex(index);
113
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
114
+ }
115
+
116
+ async setDatePickerDate(rawDateString, formatString) {
117
+ const dateString = formatString === 'ISO8601'
118
+ ? removeMilliseconds(rawDateString)
119
+ : rawDateString;
120
+
121
+ const action = new actions.SetDatePickerDateAction(dateString, formatString);
122
+ const traceDescription = actionDescription.setDatePickerDate(dateString, formatString);
123
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
85
124
  }
86
125
 
87
126
  /**
@@ -96,13 +135,17 @@ class NativeElement {
96
135
 
97
136
  // override the user's element selection with an extended matcher that avoids RN issues with RCTScrollView
98
137
  this._selectElementWithMatcher(this._originalMatcher._avoidProblematicReactNativeElements());
138
+
99
139
  const action = new actions.SwipeAction(direction, speed, normalizedSwipeOffset, normalizedStartingPointX, normalizedStartingPointY);
100
- return await new ActionInteraction(this._invocationManager, this, action).execute();
140
+ const traceDescription = actionDescription.swipe(direction, speed, normalizedSwipeOffset, normalizedStartingPointX, normalizedStartingPointY);
141
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
101
142
  }
102
143
 
103
144
  async takeScreenshot(screenshotName) {
104
145
  // TODO this should be moved to a lower-layer handler of this use-case
105
- const resultBase64 = await new ActionInteraction(this._invocationManager, this, new actions.TakeElementScreenshot()).execute();
146
+ const action = new actions.TakeElementScreenshot();
147
+ const traceDescription = actionDescription.takeScreenshot(screenshotName);
148
+ const resultBase64 = await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
106
149
  const filePath = tempfile('detox.element-screenshot.png');
107
150
  await fs.writeFile(filePath, resultBase64, 'base64');
108
151
 
@@ -115,12 +158,21 @@ class NativeElement {
115
158
  }
116
159
 
117
160
  async getAttributes() {
118
- const result = await new ActionInteraction(this._invocationManager, this, new actions.GetAttributes()).execute();
161
+ const action = new actions.GetAttributes();
162
+ const traceDescription = actionDescription.getAttributes();
163
+ const result = await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
119
164
  return JSON.parse(result);
120
165
  }
121
166
 
122
167
  async adjustSliderToPosition(newPosition) {
123
- return await new ActionInteraction(this._invocationManager, this, new actions.AdjustSliderToPosition(newPosition)).execute();
168
+ const action = new actions.AdjustSliderToPosition(newPosition);
169
+ const traceDescription = actionDescription.adjustSliderToPosition(newPosition);
170
+ return await new ActionInteraction(this._invocationManager, this, action, traceDescription).execute();
171
+ }
172
+
173
+ async performAccessibilityAction(actionName) {
174
+ const traceDescription = actionDescription.performAccessibilityAction(actionName);
175
+ return await new ActionInteraction(this._invocationManager, this, new actions.AccessibilityActionAction(actionName), traceDescription).execute();
124
176
  }
125
177
  }
126
178
 
@@ -1,3 +1,4 @@
1
+ const { expectDescription } = require('../../utils/invocationTraceDescriptions');
1
2
  const { MatcherAssertionInteraction } = require('../interactions/native');
2
3
  const matchers = require('../matchers/native');
3
4
 
@@ -19,7 +20,9 @@ class NativeExpectElement extends NativeExpect {
19
20
  }
20
21
 
21
22
  async toBeVisible(pct) {
22
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.VisibleMatcher(pct).not : new matchers.VisibleMatcher(pct)).execute();
23
+ const matcher = new matchers.VisibleMatcher(pct);
24
+ const traceDescription = expectDescription.toBeVisible(pct);
25
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
23
26
  }
24
27
 
25
28
  async toBeNotVisible() {
@@ -27,7 +30,9 @@ class NativeExpectElement extends NativeExpect {
27
30
  }
28
31
 
29
32
  async toExist() {
30
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.ExistsMatcher().not : new matchers.ExistsMatcher()).execute();
33
+ const matcher = new matchers.ExistsMatcher();
34
+ const traceDescription = expectDescription.toExist();
35
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
31
36
  }
32
37
 
33
38
  async toNotExist() {
@@ -35,7 +40,9 @@ class NativeExpectElement extends NativeExpect {
35
40
  }
36
41
 
37
42
  async toHaveText(text) {
38
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.TextMatcher(text).not : new matchers.TextMatcher(text)).execute();
43
+ const matcher = new matchers.TextMatcher(text);
44
+ const traceDescription = expectDescription.toHaveText(text);
45
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
39
46
  }
40
47
 
41
48
  async toNotHaveText(text) {
@@ -43,7 +50,9 @@ class NativeExpectElement extends NativeExpect {
43
50
  }
44
51
 
45
52
  async toHaveLabel(value) {
46
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.LabelMatcher(value).not : new matchers.LabelMatcher(value)).execute();
53
+ const matcher = new matchers.LabelMatcher(value);
54
+ const traceDescription = expectDescription.toHaveLabel(value);
55
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
47
56
  }
48
57
 
49
58
  async toNotHaveLabel(value) {
@@ -51,7 +60,9 @@ class NativeExpectElement extends NativeExpect {
51
60
  }
52
61
 
53
62
  async toHaveId(value) {
54
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.IdMatcher(value).not : new matchers.IdMatcher(value)).execute();
63
+ const matcher = new matchers.IdMatcher(value);
64
+ const traceDescription = expectDescription.toHaveId(value);
65
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
55
66
  }
56
67
 
57
68
  async toNotHaveId(value) {
@@ -59,7 +70,9 @@ class NativeExpectElement extends NativeExpect {
59
70
  }
60
71
 
61
72
  async toHaveValue(value) {
62
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.ValueMatcher(value).not : new matchers.ValueMatcher(value)).execute();
73
+ const matcher = new matchers.ValueMatcher(value);
74
+ const traceDescription = expectDescription.toHaveValue(value);
75
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
63
76
  }
64
77
 
65
78
  async toNotHaveValue(value) {
@@ -67,15 +80,21 @@ class NativeExpectElement extends NativeExpect {
67
80
  }
68
81
 
69
82
  async toHaveToggleValue(value) {
70
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.ToggleMatcher(value).not : new matchers.ToggleMatcher(value)).execute();
83
+ const matcher = new matchers.ToggleMatcher(value);
84
+ const traceDescription = expectDescription.toHaveToggleValue(value);
85
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
71
86
  }
72
87
 
73
88
  async toHaveSliderPosition(value, tolerance = 0) {
74
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.SliderPositionMatcher(value, tolerance).not : new matchers.SliderPositionMatcher(value, tolerance)).execute();
89
+ const matcher = new matchers.SliderPositionMatcher(value, tolerance);
90
+ const traceDescription = expectDescription.toHaveSliderPosition(value, tolerance);
91
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
75
92
  }
76
93
 
77
94
  async toBeFocused() {
78
- return await new MatcherAssertionInteraction(this._invocationManager, this._element, this._notCondition ? new matchers.FocusMatcher().not : new matchers.FocusMatcher()).execute();
95
+ const matcher = new matchers.FocusMatcher();
96
+ const traceDescription = expectDescription.toBeFocused();
97
+ return await new MatcherAssertionInteraction(this._invocationManager, this._element, matcher, this._notCondition, traceDescription).execute();
79
98
  }
80
99
 
81
100
  async toBeNotFocused() {