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
package/index.d.ts CHANGED
@@ -9,9 +9,9 @@
9
9
  // * Dor Ben Baruch <https://github.com/Dor256>
10
10
 
11
11
  import { BunyanDebugStreamOptions } from 'bunyan-debug-stream';
12
- import { EndHandle } from 'trace-event-lib';
13
12
 
14
13
  declare global {
14
+ const detox: Detox.DetoxExportWrapper;
15
15
  const device: Detox.DetoxExportWrapper['device'];
16
16
  const element: Detox.DetoxExportWrapper['element'];
17
17
  const waitFor: Detox.DetoxExportWrapper['waitFor'];
@@ -21,6 +21,7 @@ declare global {
21
21
 
22
22
  namespace NodeJS {
23
23
  interface Global {
24
+ detox: Detox.DetoxExportWrapper;
24
25
  device: Detox.DetoxExportWrapper['device'];
25
26
  element: Detox.DetoxExportWrapper['element'];
26
27
  waitFor: Detox.DetoxExportWrapper['waitFor'];
@@ -31,7 +32,7 @@ declare global {
31
32
  }
32
33
 
33
34
  namespace Detox {
34
- // region DetoxConfig
35
+ //#region DetoxConfig
35
36
 
36
37
  interface DetoxConfig extends DetoxConfigurationCommon {
37
38
  /**
@@ -81,15 +82,19 @@ declare global {
81
82
  */
82
83
  exposeGlobals?: boolean;
83
84
  /**
84
- * By default, Detox will uninstall and install the app upon the initialization.
85
+ * By default, Detox will uninstall and install the app upon initialization.
85
86
  * If you wish to reuse the existing app for a faster run, set the property to
86
87
  * `false`.
87
88
  */
88
89
  reinstallApp?: boolean;
89
90
  /**
90
- * If you wish to run multiple "detox test" commands in parallel,
91
- * make sure they don't delete the shared lock file only the
92
- * first command should reset the lock file.
91
+ * When false, `detox test` command always deletes the shared lock file on start,
92
+ * assuming it had been left from the previous, already finished test session.
93
+ * The lock file contains information about busy and free devices and ensures
94
+ * no device can be used simultaneously by multiple test workers.
95
+ *
96
+ * Setting it to **true** might be useful when if you need to run multiple
97
+ * `detox test` commands in parallel, e.g. test a few configurations at once.
93
98
  *
94
99
  * @default false
95
100
  */
@@ -101,13 +106,43 @@ declare global {
101
106
  };
102
107
  }
103
108
 
109
+ type _DetoxLoggerOptions = Omit<BunyanDebugStreamOptions, 'out'>;
110
+
104
111
  interface DetoxLoggerConfig {
112
+ /**
113
+ * Log level filters the messages printed to your terminal,
114
+ * and it does not affect the logs written to the artifacts.
115
+ *
116
+ * Use `info` by default.
117
+ * Use `error` or warn when you want to make the output as silent as possible.
118
+ * Use `debug` to control what generally is happening under the hood.
119
+ * Use `trace` when troubleshooting specific issues.
120
+ *
121
+ * @default 'info'
122
+ */
105
123
  level?: DetoxLogLevel;
106
124
  /**
107
- * @default 'sandbox'
125
+ * When enabled, hijacks all the console methods (console.log, console.warn, etc)
126
+ * so that the messages printed via them are formatted and saved as Detox logs.
127
+ *
128
+ * @default true
108
129
  */
109
- overrideConsole?: 'all' | 'sandbox' | 'none';
110
- options?: BunyanDebugStreamOptions;
130
+ overrideConsole?: boolean;
131
+ /**
132
+ * Since Detox is using
133
+ * {@link https://www.npmjs.com/package/bunyan-debug-stream bunyan-debug-stream}
134
+ * for printing logs, all its options are exposed for sake of simplicity
135
+ * of customization.
136
+ *
137
+ * The only exception is {@link BunyanDebugStreamOptions#out} option,
138
+ * which is always set to `process.stdout`.
139
+ *
140
+ * You can also pass a callback function to override the logger config
141
+ * programmatically, e.g. depending on the selected log level.
142
+ *
143
+ * @see {@link BunyanDebugStreamOptions}
144
+ */
145
+ options?: _DetoxLoggerOptions | ((config: Partial<DetoxLoggerConfig>) => _DetoxLoggerOptions);
111
146
  }
112
147
 
113
148
  interface DetoxSessionConfig {
@@ -132,27 +167,110 @@ declare global {
132
167
  */
133
168
  [prop: string]: unknown;
134
169
  };
170
+
135
171
  /**
136
- * Configuration of custom integration features
137
- * between Detox and Jest
172
+ * This is an add-on section used by our Jest integration code (but not Detox core itself).
173
+ * In other words, if you’re implementing (or using) a custom integration with some other test runner, feel free to define a section for yourself (e.g. `testRunner.mocha`)
138
174
  */
139
175
  jest?: {
140
176
  /**
141
- * Device init timeout
177
+ * Environment setup timeout
178
+ *
179
+ * As a part of the environment setup, Detox boots the device and installs the apps.
180
+ * If that takes longer than the specified value, the entire test suite will be considered as failed, e.g.:
181
+ * ```plain text
182
+ * FAIL e2e/starter.test.js
183
+ * ● Test suite failed to run
184
+ *
185
+ * Exceeded timeout of 300000ms while setting up Detox environment
186
+ * ```
187
+ *
188
+ * The default value is 5 minutes.
189
+ *
190
+ * @default 300000
191
+ * @see {@link https://jestjs.io/docs/configuration/#testenvironment-string}
192
+ */
193
+ setupTimeout?: number | undefined;
194
+ /**
195
+ * Environemnt teardown timeout
196
+ *
197
+ * If the environment teardown takes longer than the specified value, Detox will throw a timeout error.
198
+ * The default value is half a minute.
199
+ *
200
+ * @default 30000 (30 seconds)
201
+ * @see {@link https://jestjs.io/docs/configuration/#testenvironment-string}
202
+ */
203
+ teardownTimeout?: number | undefined;
204
+ /**
205
+ * Jest provides an API to re-run individual failed tests: `jest.retryTimes(count)`.
206
+ * When Detox detects the use of this API, it suppresses its own CLI retry mechanism controlled via `detox test … --retries <N>` or {@link DetoxTestRunnerConfig#retries}.
207
+ * The motivation is simple – activating the both mechanisms is apt to increase your test duration dramatically, if your tests are flaky.
208
+ * If you wish nevertheless to use both the mechanisms simultaneously, set it to `true`.
209
+ *
210
+ * @default false
211
+ * @see {@link https://jestjs.io/docs/29.0/jest-object#jestretrytimesnumretries-options}
212
+ */
213
+ retryAfterCircusRetries?: boolean;
214
+ /**
215
+ * By default, Jest prints the test names and their status (_passed_ or _failed_) at the very end of the test session.
216
+ * When enabled, it makes Detox to print messages like these each time the new test starts and ends:
217
+ * ```plain text
218
+ * 18:03:36.258 detox[40125] i Sanity: should have welcome screen
219
+ * 18:03:37.495 detox[40125] i Sanity: should have welcome screen [OK]
220
+ * 18:03:37.496 detox[40125] i Sanity: should show hello screen after tap
221
+ * 18:03:38.928 detox[40125] i Sanity: should show hello screen after tap [OK]
222
+ * 18:03:38.929 detox[40125] i Sanity: should show world screen after tap
223
+ * 18:03:40.351 detox[40125] i Sanity: should show world screen after tap [OK]
224
+ * ```
225
+ * By default, it is enabled automatically in test sessions with a single worker.
226
+ * And vice versa, if multiple tests are executed concurrently, Detox turns it off to avoid confusion in the log.
227
+ * Use boolean values, `true` or `false`, to turn off the automatic choice.
228
+ *
229
+ * @default undefined
142
230
  */
143
- initTimeout?: number | undefined;
144
231
  reportSpecs?: boolean | undefined;
232
+ /**
233
+ * In the environment setup phase, Detox boots the device and installs the apps.
234
+ * This flag tells Detox to print messages like these every time the device gets assigned to a specific suite:
235
+ *
236
+ * ```plain text
237
+ * 18:03:29.869 detox[40125] i starter.test.js is assigned to 4EC84833-C7EA-4CA3-A6E9-5C30A29EA596 (iPhone 12 Pro Max)
238
+ * ```
239
+ *
240
+ * @default true
241
+ */
145
242
  reportWorkerAssign?: boolean | undefined;
146
243
  };
147
244
  /**
148
245
  * Retries count. Zero means a single attempt to run tests.
149
246
  */
150
247
  retries?: number;
248
+ /**
249
+ * When true, tells Detox CLI to cancel next retrying if it gets
250
+ * at least one report about a permanent test suite failure.
251
+ * Has no effect, if {@link DetoxTestRunnerConfig#retries} is
252
+ * undefined or set to zero.
253
+ *
254
+ * @default false
255
+ * @see {DetoxInternals.DetoxTestFileReport#isPermanentFailure}
256
+ */
257
+ bail?: boolean;
151
258
  /**
152
259
  * Custom handler to process --inspect-brk CLI flag.
153
- * Use it when you rely on another test runner than Jest.
260
+ * Use it when you rely on another test runner than Jest to mutate the config.
154
261
  */
155
- inspectBrk?: boolean | ((config: DetoxTestRunnerConfig) => void);
262
+ inspectBrk?: (config: DetoxTestRunnerConfig) => void;
263
+ /**
264
+ * Forward environment variables to the spawned test runner
265
+ * accordingly to the given CLI argument overrides.
266
+ *
267
+ * If false, Detox CLI will be only printing a hint message on
268
+ * how to start the test runner using environment variables,
269
+ * in case when a user wants to avoid using Detox CLI.
270
+ *
271
+ * @default false
272
+ */
273
+ forwardEnv?: boolean;
156
274
  }
157
275
 
158
276
  type DetoxAppConfig = (DetoxBuiltInAppConfig | DetoxCustomAppConfig) & {
@@ -213,6 +331,7 @@ declare global {
213
331
  binaryPath: string;
214
332
  bundleId?: string;
215
333
  build?: string;
334
+ start?: string;
216
335
  launchArgs?: Record<string, any>;
217
336
  }
218
337
 
@@ -221,8 +340,16 @@ declare global {
221
340
  binaryPath: string;
222
341
  bundleId?: string;
223
342
  build?: string;
343
+ start?: string;
224
344
  testBinaryPath?: string;
225
345
  launchArgs?: Record<string, any>;
346
+ /**
347
+ * TCP ports to `adb reverse` upon the installation.
348
+ * E.g. 8081 - to be able to access React Native packager in Debug mode.
349
+ *
350
+ * @example [8081]
351
+ */
352
+ reversePorts?: number[];
226
353
  }
227
354
 
228
355
  interface DetoxCustomAppConfig {
@@ -283,8 +410,6 @@ declare global {
283
410
  os: string;
284
411
  }
285
412
 
286
- type DetoxKnownDeviceType = DetoxBuiltInDeviceConfig['type'];
287
-
288
413
  type DetoxConfiguration = DetoxConfigurationCommon & (
289
414
  | DetoxConfigurationSingleApp
290
415
  | DetoxConfigurationMultiApps
@@ -304,7 +429,7 @@ declare global {
304
429
 
305
430
  type DetoxAliasedApp = string | DetoxAppConfig;
306
431
 
307
- // endregion DetoxConfig
432
+ //#endregion
308
433
 
309
434
  interface DetoxExportWrapper {
310
435
  readonly device: Device;
@@ -339,64 +464,81 @@ declare global {
339
464
  readonly log: Logger;
340
465
 
341
466
  /**
467
+ * @deprecated
468
+ *
469
+ * Deprecated - use {@link Detox.Logger#trace}
342
470
  * Detox tracer instance. Can be used for building timelines in Google Event Tracing format.
343
471
  */
344
- readonly trace: Tracer;
472
+ readonly trace: {
473
+ /** @deprecated */
474
+ readonly startSection: (name: string) => void;
475
+ /** @deprecated */
476
+ readonly endSection: (name: string) => void;
477
+ };
345
478
 
346
479
  /**
480
+ * Trace a single call, with a given name and arguments.
481
+ *
347
482
  * @deprecated
483
+ * @param sectionName The name of the section to trace.
484
+ * @param promiseOrFunction Promise or a function that provides a promise.
485
+ * @param args Optional arguments to pass to the trace.
486
+ * @returns The returned value of the traced call.
487
+ * @see https://wix.github.io/Detox/docs/19.x/api/detox-object-api/#detoxtracecall
348
488
  */
349
- readonly traceCall: _TraceCallSignature;
489
+ readonly traceCall: <T>(event: string, action: () => Promise<T>, args?: Record<string, unknown>) => Promise<T>;
350
490
  }
351
491
 
352
- /** @internal */
353
- type _TraceEventArgs = Record<string, unknown>;
492
+ interface Logger {
493
+ readonly level: DetoxLogLevel;
354
494
 
355
- type TraceEvent = {
356
- name?: string;
357
- cat?: string;
358
- cname?: string;
359
- id?: number;
360
- args?: _TraceEventArgs;
361
- };
495
+ readonly fatal: _LogMethod;
496
+ readonly error: _LogMethod;
497
+ readonly warn: _LogMethod;
498
+ readonly info: _LogMethod;
499
+ readonly debug: _LogMethod;
500
+ readonly trace: _LogMethod;
362
501
 
363
- /**
364
- * Trace a duration event before and after executing the action function
365
- *
366
- * @internal
367
- */
368
- interface _TraceCallSignature {
369
- <T>(event: string | TraceEvent, action: () => T): T;
370
- <T>(event: string | TraceEvent, action: () => Promise<T>): Promise<T>;
502
+ child(context?: Partial<LogEvent>): Logger;
371
503
  }
372
504
 
373
505
  /** @internal */
374
- interface _TraceSectionSignature<T> {
375
- (event?: string, args?: _TraceEventArgs): T;
376
- (event: TraceEvent): T;
506
+ interface _LogMethod extends _LogMethodSignature {
507
+ readonly begin: _LogMethodSignature;
508
+ readonly complete: _CompleteMethodSignature;
509
+ readonly end: _LogMethodSignature;
377
510
  }
378
511
 
379
- interface Tracer extends _TraceCallSignature {
380
- readonly begin: _TraceSectionSignature<EndHandle<{ cname: string; args: _TraceEventArgs; }>>;
381
- readonly end: _TraceSectionSignature<void>;
512
+ /** @internal */
513
+ interface _LogMethodSignature {
514
+ (...args: unknown[]): void
515
+ (event: LogEvent, ...args: unknown[]): void;
516
+ }
382
517
 
383
- /** @deprecated */
384
- readonly startSection: _TraceSectionSignature<void>;
385
- /** @deprecated */
386
- readonly endSection: _TraceSectionSignature<void>;
518
+ /** @internal */
519
+ interface _CompleteMethodSignature {
520
+ <T>(message: string, action: T | (() => T)): T;
521
+ <T>(event: LogEvent, message: string, action: T | (() => T)): T;
387
522
  }
388
523
 
389
- type Logger = {
390
- readonly level: DetoxLogLevel;
524
+ type LogEvent = {
525
+ /** Use when there's a risk of logging several parallel duration events. */
526
+ id?: string | number;
527
+ /** Optional. Event categories (tags) to facilitate filtering. */
528
+ cat?: string | string[];
529
+ /** Optional. Color name (applicable in Google Chrome Trace Format) */
530
+ cname?: string;
391
531
 
392
- fatal(context?: unknown, ...args: any[]): void;
393
- error(context?: unknown, ...args: any[]): void;
394
- warn(context?: unknown, ...args: any[]): void;
395
- info(context?: unknown, ...args: any[]): void;
396
- debug(context?: unknown, ...args: any[]): void;
397
- trace(context?: unknown, ...args: any[]): void;
532
+ /** Reserved property. Process ID. */
533
+ pid?: never;
534
+ /** Reserved property. Thread ID. */
535
+ tid?: never;
536
+ /** Reserved property. Timestamp. */
537
+ ts?: never;
538
+ /** Reserved property. Event phase. */
539
+ ph?: never;
398
540
 
399
- child(context?: Record<string, unknown>): Logger;
541
+ [customProperty: string]: unknown;
400
542
  };
401
543
 
402
544
  type DetoxLogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
@@ -484,9 +626,8 @@ declare global {
484
626
 
485
627
  interface Device {
486
628
  /**
487
- * Holds the environment-unique ID of the device - namely, the adb ID on Android (e.g. emulator-5554) and the Mac-global simulator UDID on iOS,
629
+ * Holds the environment-unique ID of the device, namely, the adb ID on Android (e.g. emulator-5554) and the Mac-global simulator UDID on iOS -
488
630
  * as used by simctl (e.g. AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE).
489
- *
490
631
  */
491
632
  id: string;
492
633
  /**
@@ -539,10 +680,11 @@ declare global {
539
680
  * Relaunch the app. Convenience method that calls {@link Device#launchApp}
540
681
  * with { newInstance: true } override.
541
682
  *
683
+ * @deprecated
542
684
  * @param config
543
685
  * @see Device#launchApp
544
686
  */
545
- relaunchApp(config?: Omit<DeviceLaunchAppConfig, 'newInstance'>): Promise<void>;
687
+ relaunchApp(config?: DeviceLaunchAppConfig): Promise<void>;
546
688
 
547
689
  /**
548
690
  * Access the user-defined launch-arguments predefined through static scopes such as the Detox configuration file and
@@ -979,39 +1121,39 @@ declare global {
979
1121
  * expectation with a `not` expects the view's visible area to be smaller than N%.
980
1122
  * @param pct optional integer ranging from 1 to 100, indicating how much percent of the view should be
981
1123
  * visible to the user to be accepted.
982
- * @example await expect(element(by.id('UniqueId204'))).toBeVisible(35);
1124
+ * @example await expect(element(by.id('mainTitle'))).toBeVisible(35);
983
1125
  */
984
1126
  toBeVisible(pct?: number): R;
985
1127
 
986
1128
  /**
987
1129
  * Negate the expectation.
988
- * @example await expect(element(by.id('UniqueId205'))).not.toBeVisible();
1130
+ * @example await expect(element(by.id('cancelButton'))).not.toBeVisible();
989
1131
  */
990
1132
  not: this;
991
1133
 
992
1134
  /**
993
1135
  * Expect the view to not be visible.
994
- * @example await expect(element(by.id('UniqueId205'))).toBeNotVisible();
1136
+ * @example await expect(element(by.id('cancelButton'))).toBeNotVisible();
995
1137
  * @deprecated Use `.not.toBeVisible()` instead.
996
1138
  */
997
1139
  toBeNotVisible(): R;
998
1140
 
999
1141
  /**
1000
1142
  * Expect the view to exist in the UI hierarchy.
1001
- * @example await expect(element(by.id('UniqueId205'))).toExist();
1143
+ * @example await expect(element(by.id('okButton'))).toExist();
1002
1144
  */
1003
1145
  toExist(): R;
1004
1146
 
1005
1147
  /**
1006
1148
  * Expect the view to not exist in the UI hierarchy.
1007
- * @example await expect(element(by.id('RandomJunk959'))).toNotExist();
1149
+ * @example await expect(element(by.id('cancelButton'))).toNotExist();
1008
1150
  * @deprecated Use `.not.toExist()` instead.
1009
1151
  */
1010
1152
  toNotExist(): R;
1011
1153
 
1012
1154
  /**
1013
1155
  * Expect the view to be focused.
1014
- * @example await expect(element(by.id('loginInput'))).toBeFocused();
1156
+ * @example await expect(element(by.id('emailInput'))).toBeFocused();
1015
1157
  */
1016
1158
  toBeFocused(): R;
1017
1159
 
@@ -1025,21 +1167,23 @@ declare global {
1025
1167
  /**
1026
1168
  * In React Native apps, expect UI component of type <Text> to have text.
1027
1169
  * In native iOS apps, expect UI elements of type UIButton, UILabel, UITextField or UITextViewIn to have inputText with text.
1028
- * @example await expect(element(by.id('UniqueId204'))).toHaveText('I contain some text');
1170
+ * @example await expect(element(by.id('mainTitle'))).toHaveText('Welcome back!);
1029
1171
  */
1030
1172
  toHaveText(text: string): R;
1031
1173
 
1032
1174
  /**
1033
- * It searches by accessibilityLabel on iOS, or by contentDescription on Android.
1034
- * In React Native it can be set for both platforms by defining an accessibilityLabel on the view.
1035
- * @example await expect(element(by.id('UniqueId204'))).toHaveLabel('Done');
1175
+ * Expects a specific accessibilityLabel, as specified via the `accessibilityLabel` prop in React Native.
1176
+ * On the native side (in both React Native and pure-native apps), that is equivalent to `accessibilityLabel`
1177
+ * on iOS and contentDescription on Android. Refer to Detox's documentation in order to learn about caveats
1178
+ * with accessibility-labels in React Native apps.
1179
+ * @example await expect(element(by.id('submitButton'))).toHaveLabel('Submit');
1036
1180
  */
1037
1181
  toHaveLabel(label: string): R;
1038
1182
 
1039
1183
  /**
1040
1184
  * In React Native apps, expect UI component to have testID with that id.
1041
1185
  * In native iOS apps, expect UI element to have accessibilityIdentifier with that id.
1042
- * @example await expect(element(by.text('I contain some text'))).toHaveId('UniqueId204');
1186
+ * @example await expect(element(by.text('Submit'))).toHaveId('submitButton');
1043
1187
  */
1044
1188
  toHaveId(id: string): R;
1045
1189
 
@@ -1052,7 +1196,7 @@ declare global {
1052
1196
 
1053
1197
  /**
1054
1198
  * Expect components like a Switch to have a value ('0' for off, '1' for on).
1055
- * @example await expect(element(by.id('UniqueId533'))).toHaveValue('0');
1199
+ * @example await expect(element(by.id('temperatureDial'))).toHaveValue('25');
1056
1200
  */
1057
1201
  toHaveValue(value: any): R;
1058
1202
 
@@ -1069,7 +1213,7 @@ declare global {
1069
1213
  /**
1070
1214
  * This API polls using the given expectation continuously until the expectation is met. Use manual synchronization with waitFor only as a last resort.
1071
1215
  * NOTE: Every waitFor call must set a timeout using withTimeout(). Calling waitFor without setting a timeout will do nothing.
1072
- * @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000);
1216
+ * @example await waitFor(element(by.id('bigButton'))).toExist().withTimeout(2000);
1073
1217
  */
1074
1218
  (element: NativeElement): Expect<WaitFor>;
1075
1219
  }
@@ -1077,13 +1221,13 @@ declare global {
1077
1221
  interface WaitFor {
1078
1222
  /**
1079
1223
  * Waits for the condition to be met until the specified time (millis) have elapsed.
1080
- * @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000);
1224
+ * @example await waitFor(element(by.id('bigButton'))).toExist().withTimeout(2000);
1081
1225
  */
1082
1226
  withTimeout(millis: number): Promise<void>;
1083
1227
 
1084
1228
  /**
1085
1229
  * Performs the action repeatedly on the element until an expectation is met
1086
- * @example await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down');
1230
+ * @example await waitFor(element(by.text('Item #5'))).toBeVisible().whileElement(by.id('itemsList')).scroll(50, 'down');
1087
1231
  */
1088
1232
  whileElement(by: NativeMatcher): NativeElement & WaitFor;
1089
1233
 
@@ -1224,15 +1368,25 @@ declare global {
1224
1368
  setColumnToValue(column: number, value: string): Promise<void>;
1225
1369
 
1226
1370
  /**
1227
- * Sets the date of a date picker to a date generated from the provided string and date format. (iOS only)
1228
- * @param dateString string representing a date in the supplied `dateFormat`
1229
- * @param dateFormat format for the `dateString` supplied
1371
+ * Sets the date of a date-picker according to the specified date-string and format.
1372
+ * @param dateString Textual representation of a date (e.g. '2023/01/01'). Should be in coherence with the format specified by `dateFormat`.
1373
+ * @param dateFormat Format of `dateString`: Generally either 'ISO8601' or an explicitly specified format (e.g. 'yyyy/MM/dd'); It should
1374
+ * follow the rules of NSDateFormatter for iOS and DateTimeFormatter for Android.
1375
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
1230
1376
  * @example
1231
- * await expect(element(by.id('datePicker'))).toBeVisible();
1232
- * await element(by.id('datePicker')).setDatePickerDate('2019-02-06T05:10:00-08:00', "yyyy-MM-dd'T'HH:mm:ssZZZZZ");
1377
+ * await element(by.id('datePicker')).setDatePickerDate('2023-01-01T00:00:00Z', 'ISO8601');
1378
+ * await element(by.id('datePicker')).setDatePickerDate(new Date().toISOString(), 'ISO8601');
1379
+ * await element(by.id('datePicker')).setDatePickerDate('2023/01/01', 'yyyy/MM/dd');
1233
1380
  */
1234
1381
  setDatePickerDate(dateString: string, dateFormat: string): Promise<void>;
1235
1382
 
1383
+ /**
1384
+ * Triggers a given [accessibility action]{@link https://reactnative.dev/docs/accessibility#accessibility-actions}.
1385
+ * @param actionName - name of the accessibility action
1386
+ * @example await element(by.id('view')).performAccessibilityAction('activate');
1387
+ */
1388
+ performAccessibilityAction(actionName: string): Promise<void>
1389
+
1236
1390
  /**
1237
1391
  * Pinches in the given direction with speed and angle. (iOS only)
1238
1392
  * @param angle value in radiant, default is `0`
@@ -1292,7 +1446,7 @@ declare global {
1292
1446
  interface WebExpect<R = Promise<void>> {
1293
1447
  /**
1294
1448
  * Negate the expectation.
1295
- * @example await expect(web.element(by.web.id('UniqueId205'))).not.toExist();
1449
+ * @example await expect(web.element(by.web.id('sessionTimeout'))).not.toExist();
1296
1450
  */
1297
1451
  not: this;
1298
1452
 
@@ -1300,13 +1454,13 @@ declare global {
1300
1454
  * Expect the element content to have the `text` supplied
1301
1455
  * @param text expected to be on the element content
1302
1456
  * @example
1303
- * await expect(web.element(by.web.id('UniqueId205'))).toHaveText('ExactText');
1457
+ * await expect(web.element(by.web.id('checkoutButton'))).toHaveText('Proceed to check out');
1304
1458
  */
1305
1459
  toHaveText(text: string): R;
1306
1460
 
1307
1461
  /**
1308
1462
  * Expect the view to exist in the webview DOM tree.
1309
- * @example await expect(web.element(by.web.id('UniqueId205'))).toExist();
1463
+ * @example await expect(web.element(by.web.id('submitButton'))).toExist();
1310
1464
  */
1311
1465
  toExist(): R;
1312
1466
  }
@@ -1505,7 +1659,9 @@ declare global {
1505
1659
  */
1506
1660
  text?: string;
1507
1661
  /**
1508
- * The label of the element. Matches accessibilityLabel for ios, and contentDescription for android.
1662
+ * The label of the element. Largely matches accessibilityLabel for ios, and contentDescription for android.
1663
+ * Refer to Detox's documentation (`toHaveLabel()` subsection) in order to learn about caveats associated with
1664
+ * this property in React Native apps.
1509
1665
  */
1510
1666
  label?: string;
1511
1667
  /**
package/index.js CHANGED
@@ -1 +1,12 @@
1
- module.exports = require('./src/realms');
1
+ function create() {
2
+ if (process.env.DETOX_CONFIG_SNAPSHOT_PATH) {
3
+ return require('./src/realms/secondary');
4
+ } else {
5
+ return require('./src/realms/primary');
6
+ }
7
+ }
8
+
9
+ /** @type {Detox.DetoxExportWrapper} */
10
+ module.exports = global['__detox__']
11
+ ? global['__detox__'].clientApi
12
+ : create();