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