@wdio/browserstack-service 0.0.0-canary-20260722132416

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/LICENSE-MIT +20 -0
  2. package/README.md +392 -0
  3. package/browserstack-service.d.ts +43 -0
  4. package/build/Percy/Percy-Handler.d.ts +32 -0
  5. package/build/Percy/Percy-Handler.d.ts.map +1 -0
  6. package/build/Percy/Percy-Handler.js +165 -0
  7. package/build/Percy/Percy-Handler.js.map +1 -0
  8. package/build/Percy/Percy.d.ts +19 -0
  9. package/build/Percy/Percy.d.ts.map +1 -0
  10. package/build/Percy/Percy.js +164 -0
  11. package/build/Percy/Percy.js.map +1 -0
  12. package/build/Percy/PercyBinary.d.ts +10 -0
  13. package/build/Percy/PercyBinary.d.ts.map +1 -0
  14. package/build/Percy/PercyBinary.js +161 -0
  15. package/build/Percy/PercyBinary.js.map +1 -0
  16. package/build/Percy/PercyCaptureMap.d.ts +9 -0
  17. package/build/Percy/PercyCaptureMap.d.ts.map +1 -0
  18. package/build/Percy/PercyCaptureMap.js +36 -0
  19. package/build/Percy/PercyCaptureMap.js.map +1 -0
  20. package/build/Percy/PercyHelper.d.ts +8 -0
  21. package/build/Percy/PercyHelper.d.ts.map +1 -0
  22. package/build/Percy/PercyHelper.js +68 -0
  23. package/build/Percy/PercyHelper.js.map +1 -0
  24. package/build/Percy/PercyLogger.d.ts +15 -0
  25. package/build/Percy/PercyLogger.d.ts.map +1 -0
  26. package/build/Percy/PercyLogger.js +68 -0
  27. package/build/Percy/PercyLogger.js.map +1 -0
  28. package/build/Percy/PercySDK.d.ts +4 -0
  29. package/build/Percy/PercySDK.d.ts.map +1 -0
  30. package/build/Percy/PercySDK.js +86 -0
  31. package/build/Percy/PercySDK.js.map +1 -0
  32. package/build/accessibility-handler.d.ts +52 -0
  33. package/build/accessibility-handler.d.ts.map +1 -0
  34. package/build/accessibility-handler.js +361 -0
  35. package/build/accessibility-handler.js.map +1 -0
  36. package/build/ai-handler.d.ts +23 -0
  37. package/build/ai-handler.d.ts.map +1 -0
  38. package/build/ai-handler.js +184 -0
  39. package/build/ai-handler.js.map +1 -0
  40. package/build/bstackLogger.d.ts +16 -0
  41. package/build/bstackLogger.d.ts.map +1 -0
  42. package/build/bstackLogger.js +71 -0
  43. package/build/bstackLogger.js.map +1 -0
  44. package/build/cleanup.d.ts +9 -0
  45. package/build/cleanup.d.ts.map +1 -0
  46. package/build/cleanup.js +101 -0
  47. package/build/cleanup.js.map +1 -0
  48. package/build/cli/apiUtils.d.ts +14 -0
  49. package/build/cli/apiUtils.d.ts.map +1 -0
  50. package/build/cli/apiUtils.js +25 -0
  51. package/build/cli/apiUtils.js.map +1 -0
  52. package/build/cli/cliLogger.d.ts +17 -0
  53. package/build/cli/cliLogger.d.ts.map +1 -0
  54. package/build/cli/cliLogger.js +82 -0
  55. package/build/cli/cliLogger.js.map +1 -0
  56. package/build/cli/cliUtils.d.ts +64 -0
  57. package/build/cli/cliUtils.d.ts.map +1 -0
  58. package/build/cli/cliUtils.js +461 -0
  59. package/build/cli/cliUtils.js.map +1 -0
  60. package/build/cli/eventDispatcher.d.ts +28 -0
  61. package/build/cli/eventDispatcher.d.ts.map +1 -0
  62. package/build/cli/eventDispatcher.js +49 -0
  63. package/build/cli/eventDispatcher.js.map +1 -0
  64. package/build/cli/frameworks/automationFramework.d.ts +89 -0
  65. package/build/cli/frameworks/automationFramework.d.ts.map +1 -0
  66. package/build/cli/frameworks/automationFramework.js +132 -0
  67. package/build/cli/frameworks/automationFramework.js.map +1 -0
  68. package/build/cli/frameworks/constants/automationFrameworkConstants.d.ts +18 -0
  69. package/build/cli/frameworks/constants/automationFrameworkConstants.d.ts.map +1 -0
  70. package/build/cli/frameworks/constants/automationFrameworkConstants.js +18 -0
  71. package/build/cli/frameworks/constants/automationFrameworkConstants.js.map +1 -0
  72. package/build/cli/frameworks/constants/testFrameworkConstants.d.ts +43 -0
  73. package/build/cli/frameworks/constants/testFrameworkConstants.d.ts.map +1 -0
  74. package/build/cli/frameworks/constants/testFrameworkConstants.js +43 -0
  75. package/build/cli/frameworks/constants/testFrameworkConstants.js.map +1 -0
  76. package/build/cli/frameworks/testFramework.d.ts +89 -0
  77. package/build/cli/frameworks/testFramework.d.ts.map +1 -0
  78. package/build/cli/frameworks/testFramework.js +126 -0
  79. package/build/cli/frameworks/testFramework.js.map +1 -0
  80. package/build/cli/frameworks/wdioAutomationFramework.d.ts +28 -0
  81. package/build/cli/frameworks/wdioAutomationFramework.d.ts.map +1 -0
  82. package/build/cli/frameworks/wdioAutomationFramework.js +67 -0
  83. package/build/cli/frameworks/wdioAutomationFramework.js.map +1 -0
  84. package/build/cli/frameworks/wdioMochaTestFramework.d.ts +82 -0
  85. package/build/cli/frameworks/wdioMochaTestFramework.d.ts.map +1 -0
  86. package/build/cli/frameworks/wdioMochaTestFramework.js +322 -0
  87. package/build/cli/frameworks/wdioMochaTestFramework.js.map +1 -0
  88. package/build/cli/grpcClient.d.ts +86 -0
  89. package/build/cli/grpcClient.d.ts.map +1 -0
  90. package/build/cli/grpcClient.js +532 -0
  91. package/build/cli/grpcClient.js.map +1 -0
  92. package/build/cli/index.d.ts +150 -0
  93. package/build/cli/index.d.ts.map +1 -0
  94. package/build/cli/index.js +464 -0
  95. package/build/cli/index.js.map +1 -0
  96. package/build/cli/instances/automationFrameworkInstance.d.ts +33 -0
  97. package/build/cli/instances/automationFrameworkInstance.d.ts.map +1 -0
  98. package/build/cli/instances/automationFrameworkInstance.js +45 -0
  99. package/build/cli/instances/automationFrameworkInstance.js.map +1 -0
  100. package/build/cli/instances/testFrameworkInstance.d.ts +62 -0
  101. package/build/cli/instances/testFrameworkInstance.d.ts.map +1 -0
  102. package/build/cli/instances/testFrameworkInstance.js +97 -0
  103. package/build/cli/instances/testFrameworkInstance.js.map +1 -0
  104. package/build/cli/instances/trackedContext.d.ts +32 -0
  105. package/build/cli/instances/trackedContext.d.ts.map +1 -0
  106. package/build/cli/instances/trackedContext.js +48 -0
  107. package/build/cli/instances/trackedContext.js.map +1 -0
  108. package/build/cli/instances/trackedInstance.d.ts +40 -0
  109. package/build/cli/instances/trackedInstance.d.ts.map +1 -0
  110. package/build/cli/instances/trackedInstance.js +64 -0
  111. package/build/cli/instances/trackedInstance.js.map +1 -0
  112. package/build/cli/modules/accessibilityModule.d.ts +46 -0
  113. package/build/cli/modules/accessibilityModule.d.ts.map +1 -0
  114. package/build/cli/modules/accessibilityModule.js +447 -0
  115. package/build/cli/modules/accessibilityModule.js.map +1 -0
  116. package/build/cli/modules/automateModule.d.ts +26 -0
  117. package/build/cli/modules/automateModule.d.ts.map +1 -0
  118. package/build/cli/modules/automateModule.js +223 -0
  119. package/build/cli/modules/automateModule.js.map +1 -0
  120. package/build/cli/modules/baseModule.d.ts +33 -0
  121. package/build/cli/modules/baseModule.d.ts.map +1 -0
  122. package/build/cli/modules/baseModule.js +52 -0
  123. package/build/cli/modules/baseModule.js.map +1 -0
  124. package/build/cli/modules/observabilityModule.d.ts +22 -0
  125. package/build/cli/modules/observabilityModule.d.ts.map +1 -0
  126. package/build/cli/modules/observabilityModule.js +46 -0
  127. package/build/cli/modules/observabilityModule.js.map +1 -0
  128. package/build/cli/modules/percyModule.d.ts +19 -0
  129. package/build/cli/modules/percyModule.d.ts.map +1 -0
  130. package/build/cli/modules/percyModule.js +78 -0
  131. package/build/cli/modules/percyModule.js.map +1 -0
  132. package/build/cli/modules/testHubModule.d.ts +30 -0
  133. package/build/cli/modules/testHubModule.d.ts.map +1 -0
  134. package/build/cli/modules/testHubModule.js +233 -0
  135. package/build/cli/modules/testHubModule.js.map +1 -0
  136. package/build/cli/modules/webdriverIOModule.d.ts +29 -0
  137. package/build/cli/modules/webdriverIOModule.d.ts.map +1 -0
  138. package/build/cli/modules/webdriverIOModule.js +129 -0
  139. package/build/cli/modules/webdriverIOModule.js.map +1 -0
  140. package/build/cli/states/automationFrameworkState.d.ts +65 -0
  141. package/build/cli/states/automationFrameworkState.d.ts.map +1 -0
  142. package/build/cli/states/automationFrameworkState.js +62 -0
  143. package/build/cli/states/automationFrameworkState.js.map +1 -0
  144. package/build/cli/states/hookState.d.ts +45 -0
  145. package/build/cli/states/hookState.d.ts.map +1 -0
  146. package/build/cli/states/hookState.js +44 -0
  147. package/build/cli/states/hookState.js.map +1 -0
  148. package/build/cli/states/testFrameworkState.d.ts +125 -0
  149. package/build/cli/states/testFrameworkState.d.ts.map +1 -0
  150. package/build/cli/states/testFrameworkState.js +116 -0
  151. package/build/cli/states/testFrameworkState.js.map +1 -0
  152. package/build/config.d.ts +29 -0
  153. package/build/config.d.ts.map +1 -0
  154. package/build/config.js +52 -0
  155. package/build/config.js.map +1 -0
  156. package/build/constants.d.ts +96 -0
  157. package/build/constants.d.ts.map +1 -0
  158. package/build/constants.js +156 -0
  159. package/build/constants.js.map +1 -0
  160. package/build/crash-reporter.d.ts +18 -0
  161. package/build/crash-reporter.d.ts.map +1 -0
  162. package/build/crash-reporter.js +134 -0
  163. package/build/crash-reporter.js.map +1 -0
  164. package/build/cucumber-types.d.ts +194 -0
  165. package/build/cucumber-types.d.ts.map +1 -0
  166. package/build/cucumber-types.js +2 -0
  167. package/build/cucumber-types.js.map +1 -0
  168. package/build/data-store.d.ts +4 -0
  169. package/build/data-store.d.ts.map +1 -0
  170. package/build/data-store.js +42 -0
  171. package/build/data-store.js.map +1 -0
  172. package/build/exitHandler.d.ts +4 -0
  173. package/build/exitHandler.d.ts.map +1 -0
  174. package/build/exitHandler.js +105 -0
  175. package/build/exitHandler.js.map +1 -0
  176. package/build/fileStream.d.ts +9 -0
  177. package/build/fileStream.d.ts.map +1 -0
  178. package/build/fileStream.js +13 -0
  179. package/build/fileStream.js.map +1 -0
  180. package/build/grpc/generated/sdk-messages-accessibility.d.ts +76 -0
  181. package/build/grpc/generated/sdk-messages-accessibility.d.ts.map +1 -0
  182. package/build/grpc/generated/sdk-messages-accessibility.js +908 -0
  183. package/build/grpc/generated/sdk-messages-accessibility.js.map +1 -0
  184. package/build/grpc/generated/sdk-messages-ai.d.ts +52 -0
  185. package/build/grpc/generated/sdk-messages-ai.d.ts.map +1 -0
  186. package/build/grpc/generated/sdk-messages-ai.js +643 -0
  187. package/build/grpc/generated/sdk-messages-ai.js.map +1 -0
  188. package/build/grpc/generated/sdk-messages-observability.d.ts +44 -0
  189. package/build/grpc/generated/sdk-messages-observability.d.ts.map +1 -0
  190. package/build/grpc/generated/sdk-messages-observability.js +505 -0
  191. package/build/grpc/generated/sdk-messages-observability.js.map +1 -0
  192. package/build/grpc/generated/sdk-messages-percy.d.ts +16 -0
  193. package/build/grpc/generated/sdk-messages-percy.d.ts.map +1 -0
  194. package/build/grpc/generated/sdk-messages-percy.js +111 -0
  195. package/build/grpc/generated/sdk-messages-percy.js.map +1 -0
  196. package/build/grpc/generated/sdk-messages-testhub.d.ts +16 -0
  197. package/build/grpc/generated/sdk-messages-testhub.d.ts.map +1 -0
  198. package/build/grpc/generated/sdk-messages-testhub.js +132 -0
  199. package/build/grpc/generated/sdk-messages-testhub.js.map +1 -0
  200. package/build/grpc/generated/sdk-messages.d.ts +288 -0
  201. package/build/grpc/generated/sdk-messages.d.ts.map +1 -0
  202. package/build/grpc/generated/sdk-messages.js +3958 -0
  203. package/build/grpc/generated/sdk-messages.js.map +1 -0
  204. package/build/grpc/generated/sdk.d.ts +282 -0
  205. package/build/grpc/generated/sdk.d.ts.map +1 -0
  206. package/build/grpc/generated/sdk.js +197 -0
  207. package/build/grpc/generated/sdk.js.map +1 -0
  208. package/build/grpc/index.d.ts +43 -0
  209. package/build/grpc/index.d.ts.map +1 -0
  210. package/build/grpc/index.js +154 -0
  211. package/build/grpc/index.js.map +1 -0
  212. package/build/index.d.ts +20 -0
  213. package/build/index.d.ts.map +1 -0
  214. package/build/index.js +13 -0
  215. package/build/index.js.map +1 -0
  216. package/build/insights-handler.d.ts +76 -0
  217. package/build/insights-handler.d.ts.map +1 -0
  218. package/build/insights-handler.js +855 -0
  219. package/build/insights-handler.js.map +1 -0
  220. package/build/instrumentation/funnelInstrumentation.d.ts +8 -0
  221. package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -0
  222. package/build/instrumentation/funnelInstrumentation.js +235 -0
  223. package/build/instrumentation/funnelInstrumentation.js.map +1 -0
  224. package/build/instrumentation/performance/constants.d.ts +151 -0
  225. package/build/instrumentation/performance/constants.d.ts.map +1 -0
  226. package/build/instrumentation/performance/constants.js +158 -0
  227. package/build/instrumentation/performance/constants.js.map +1 -0
  228. package/build/instrumentation/performance/performance-tester.d.ts +55 -0
  229. package/build/instrumentation/performance/performance-tester.d.ts.map +1 -0
  230. package/build/instrumentation/performance/performance-tester.js +403 -0
  231. package/build/instrumentation/performance/performance-tester.js.map +1 -0
  232. package/build/launcher.d.ts +49 -0
  233. package/build/launcher.d.ts.map +1 -0
  234. package/build/launcher.js +1077 -0
  235. package/build/launcher.js.map +1 -0
  236. package/build/log4jsAppender.d.ts +2 -0
  237. package/build/log4jsAppender.d.ts.map +1 -0
  238. package/build/log4jsAppender.js +20 -0
  239. package/build/log4jsAppender.js.map +1 -0
  240. package/build/logPatcher.d.ts +13 -0
  241. package/build/logPatcher.d.ts.map +1 -0
  242. package/build/logPatcher.js +39 -0
  243. package/build/logPatcher.js.map +1 -0
  244. package/build/logReportingAPI.d.ts +12 -0
  245. package/build/logReportingAPI.d.ts.map +1 -0
  246. package/build/logReportingAPI.js +57 -0
  247. package/build/logReportingAPI.js.map +1 -0
  248. package/build/reporter.d.ts +40 -0
  249. package/build/reporter.d.ts.map +1 -0
  250. package/build/reporter.js +254 -0
  251. package/build/reporter.js.map +1 -0
  252. package/build/request-handler.d.ts +19 -0
  253. package/build/request-handler.d.ts.map +1 -0
  254. package/build/request-handler.js +78 -0
  255. package/build/request-handler.js.map +1 -0
  256. package/build/scripts/accessibility-scripts.d.ts +26 -0
  257. package/build/scripts/accessibility-scripts.d.ts.map +1 -0
  258. package/build/scripts/accessibility-scripts.js +91 -0
  259. package/build/scripts/accessibility-scripts.js.map +1 -0
  260. package/build/service.d.ts +68 -0
  261. package/build/service.d.ts.map +1 -0
  262. package/build/service.js +740 -0
  263. package/build/service.js.map +1 -0
  264. package/build/testHub/utils.d.ts +10 -0
  265. package/build/testHub/utils.d.ts.map +1 -0
  266. package/build/testHub/utils.js +67 -0
  267. package/build/testHub/utils.js.map +1 -0
  268. package/build/testOps/featureStats.d.ts +45 -0
  269. package/build/testOps/featureStats.d.ts.map +1 -0
  270. package/build/testOps/featureStats.js +117 -0
  271. package/build/testOps/featureStats.js.map +1 -0
  272. package/build/testOps/featureUsage.d.ts +22 -0
  273. package/build/testOps/featureUsage.d.ts.map +1 -0
  274. package/build/testOps/featureUsage.js +48 -0
  275. package/build/testOps/featureUsage.js.map +1 -0
  276. package/build/testOps/listener.d.ts +40 -0
  277. package/build/testOps/listener.d.ts.map +1 -0
  278. package/build/testOps/listener.js +269 -0
  279. package/build/testOps/listener.js.map +1 -0
  280. package/build/testOps/requestUtils.d.ts +4 -0
  281. package/build/testOps/requestUtils.d.ts.map +1 -0
  282. package/build/testOps/requestUtils.js +41 -0
  283. package/build/testOps/requestUtils.js.map +1 -0
  284. package/build/testOps/testOpsConfig.d.ts +11 -0
  285. package/build/testOps/testOpsConfig.d.ts.map +1 -0
  286. package/build/testOps/testOpsConfig.js +20 -0
  287. package/build/testOps/testOpsConfig.js.map +1 -0
  288. package/build/testOps/usageStats.d.ts +404 -0
  289. package/build/testOps/usageStats.d.ts.map +1 -0
  290. package/build/testOps/usageStats.js +115 -0
  291. package/build/testOps/usageStats.js.map +1 -0
  292. package/build/testorchestration/apply-orchestration.d.ts +7 -0
  293. package/build/testorchestration/apply-orchestration.d.ts.map +1 -0
  294. package/build/testorchestration/apply-orchestration.js +43 -0
  295. package/build/testorchestration/apply-orchestration.js.map +1 -0
  296. package/build/testorchestration/helpers.d.ts +20 -0
  297. package/build/testorchestration/helpers.d.ts.map +1 -0
  298. package/build/testorchestration/helpers.js +413 -0
  299. package/build/testorchestration/helpers.js.map +1 -0
  300. package/build/testorchestration/request-utils.d.ts +23 -0
  301. package/build/testorchestration/request-utils.d.ts.map +1 -0
  302. package/build/testorchestration/request-utils.js +82 -0
  303. package/build/testorchestration/request-utils.js.map +1 -0
  304. package/build/testorchestration/test-ordering-server.d.ts +33 -0
  305. package/build/testorchestration/test-ordering-server.d.ts.map +1 -0
  306. package/build/testorchestration/test-ordering-server.js +169 -0
  307. package/build/testorchestration/test-ordering-server.js.map +1 -0
  308. package/build/testorchestration/testorcherstrationhandler.d.ts +50 -0
  309. package/build/testorchestration/testorcherstrationhandler.d.ts.map +1 -0
  310. package/build/testorchestration/testorcherstrationhandler.js +134 -0
  311. package/build/testorchestration/testorcherstrationhandler.js.map +1 -0
  312. package/build/testorchestration/testorcherstrationutils.d.ts +86 -0
  313. package/build/testorchestration/testorcherstrationutils.d.ts.map +1 -0
  314. package/build/testorchestration/testorcherstrationutils.js +380 -0
  315. package/build/testorchestration/testorcherstrationutils.js.map +1 -0
  316. package/build/types.d.ts +413 -0
  317. package/build/types.d.ts.map +1 -0
  318. package/build/types.js +2 -0
  319. package/build/types.js.map +1 -0
  320. package/build/util.d.ts +241 -0
  321. package/build/util.d.ts.map +1 -0
  322. package/build/util.js +1665 -0
  323. package/build/util.js.map +1 -0
  324. package/package.json +96 -0
  325. package/src/proto/browserstack/sdk/v1/sdk-messages-accessibility.proto +71 -0
  326. package/src/proto/browserstack/sdk/v1/sdk-messages-ai.proto +48 -0
  327. package/src/proto/browserstack/sdk/v1/sdk-messages-observability.proto +39 -0
  328. package/src/proto/browserstack/sdk/v1/sdk-messages-percy.proto +10 -0
  329. package/src/proto/browserstack/sdk/v1/sdk-messages-testhub.proto +10 -0
  330. package/src/proto/browserstack/sdk/v1/sdk-messages.proto +276 -0
  331. package/src/proto/browserstack/sdk/v1/sdk.proto +41 -0
package/LICENSE-MIT ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) OpenJS Foundation and other contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,392 @@
1
+ WebdriverIO BrowserStack Service
2
+ ==========
3
+
4
+ > A WebdriverIO service that manages local tunnel and job metadata for BrowserStack users.
5
+
6
+ ## Installation
7
+
8
+
9
+ The easiest way is to keep `@wdio/browserstack-service` as a devDependency in your `package.json`, via:
10
+
11
+ ```sh
12
+ npm install @wdio/browserstack-service --save-dev
13
+ ```
14
+
15
+ Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
16
+
17
+
18
+ ## Configuration
19
+
20
+ WebdriverIO has BrowserStack support out of the box. You should set `user` and `key` in your `wdio.conf.js` file. This service plugin provides support for [BrowserStack Tunnel](https://www.browserstack.com/docs/automate/selenium/getting-started/nodejs/local-testing). Set `browserstackLocal: true` also to activate this feature.
21
+ Reporting of session status on BrowserStack will respect `strict` setting of Cucumber options.
22
+
23
+ ```js
24
+ // wdio.conf.js
25
+ export const config = {
26
+ // ...
27
+ user: process.env.BROWSERSTACK_USERNAME,
28
+ key: process.env.BROWSERSTACK_ACCESS_KEY,
29
+ services: [
30
+ ['browserstack', {
31
+ testReporting: true,
32
+ testReportingOptions: {
33
+ projectName: "Your project name goes here",
34
+ buildName: "The static build job name goes here e.g. Nightly regression"
35
+ },
36
+ browserstackLocal: true
37
+ }]
38
+ ],
39
+ // ...
40
+ };
41
+ ```
42
+
43
+ ## Options
44
+
45
+ In order to authorize to the BrowserStack service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.
46
+
47
+ ### testReporting (formerly testObservability)
48
+
49
+ Test Reporting and Analytics is an advanced test reporting tool that gives insights to improve your automation tests and helps you debug faster. It's enabled by default by setting the testReporting flag as true for all users of browserstack-service. You can disable this by setting the testReporting flag to false.
50
+
51
+ Once your tests finish running, you can visit [Test Reporting and Analytics](https://automation.browserstack.com/?utm_source=webdriverio&utm_medium=partnered&utm_campaign=documentation) to debug your builds with additional insights like Unique Error Analysis, Automatic Flaky Test Detection, and more.
52
+
53
+ You can use Test Reporting and Analytics even if you don't run your tests on the BrowserStack infrastructure. Even if you run your tests on a CI, a local machine, or even on other cloud service providers, Test Reporting and Analytics can still generate intelligent test reports and advanced analytics on your tests.
54
+
55
+ If you want to use Test Reporting and Analytics without running your tests on BrowserStack infrastructure, you can set your config as follows:
56
+
57
+ ```js
58
+ // wdio.conf.js
59
+ export const config = {
60
+ // ...
61
+ services: [
62
+ ['browserstack', {
63
+ testReporting: true,
64
+ testReportingOptions: {
65
+ user: process.env.BROWSERSTACK_USERNAME,
66
+ key: process.env.BROWSERSTACK_ACCESS_KEY,
67
+ projectName: "Your project name goes here",
68
+ buildName: "The static build job name goes here e.g. Nightly regression"
69
+ }
70
+ }]
71
+ ],
72
+ // ...
73
+ };
74
+ ```
75
+
76
+ For backward compatibility, the legacy `testObservability` and `testObservabilityOptions` flags are still supported:
77
+
78
+ ```js
79
+ // wdio.conf.js (legacy configuration)
80
+ export const config = {
81
+ // ...
82
+ services: [
83
+ ['browserstack', {
84
+ testObservability: true, // deprecated, use testReporting instead
85
+ testObservabilityOptions: { // deprecated, use testReportingOptions instead
86
+ user: process.env.BROWSERSTACK_USERNAME,
87
+ key: process.env.BROWSERSTACK_ACCESS_KEY,
88
+ projectName: "Your project name goes here",
89
+ buildName: "The static build job name goes here e.g. Nightly regression"
90
+ }
91
+ }]
92
+ ],
93
+ // ...
94
+ };
95
+ ```
96
+
97
+ #### Environment Variables
98
+
99
+ The following environment variables are supported:
100
+
101
+ **New (recommended):**
102
+ - `BROWSERSTACK_TEST_REPORTING` - Enable/disable test reporting
103
+ - `BROWSERSTACK_TEST_REPORTING_DEBUG` - Enable debug mode for test reporting
104
+ - `TEST_REPORTING_BUILD_TAG` - Comma-separated build tags
105
+
106
+ **Legacy (still supported):**
107
+ - `BROWSERSTACK_OBSERVABILITY` - Enable/disable test observability (deprecated)
108
+ - `TEST_OBSERVABILITY_BUILD_TAG` - Comma-separated build tags (deprecated)
109
+
110
+ You can explore all the features of Test Reporting and Analytics in [this sandbox](https://automation-demo.browserstack.com/?utm_source=webdriverio&utm_medium=partnered&utm_campaign=documentation) or read more about it [here](https://www.browserstack.com/docs/test-reporting/overview/what-is-test-reporting?utm_source=webdriverio&utm_medium=partnered&utm_campaign=documentation).
111
+
112
+ ### browserstackLocal
113
+ Set this to true to enable routing connections from BrowserStack cloud through your computer.
114
+
115
+ Type: `Boolean`<br />
116
+ Default: `false`
117
+
118
+ ### forcedStop
119
+ Set this to true to kill the BrowserStack Local process on complete, without waiting for the BrowserStack Local stop callback to be called. This is experimental and should not be used by all. Mostly necessary as a workaround for [this issue](https://github.com/browserstack/browserstack-local-nodejs/issues/41).
120
+
121
+ Type: `Boolean`<br />
122
+ Default: `false`
123
+
124
+ ### app
125
+
126
+ [Appium](https://appium.io/) set this with the app file path available locally on your machine to use the app as [application under test](https://www.browserstack.com/docs/app-automate/appium/set-up-tests/specify-app) for Appium sessions.
127
+
128
+ Type: `String` or `JsonObject`<br />
129
+ Default: `undefined`
130
+
131
+ List of available app values:
132
+
133
+ #### path
134
+ Use locally available app file path as an application under test for Appium.
135
+
136
+ ```js
137
+ services: [
138
+ ['browserstack', {
139
+ app: '/path/to/local/app.apk'
140
+ // OR
141
+ app: {
142
+ path: '/path/to/local/app.apk'
143
+ }
144
+ }]
145
+ ]
146
+ ```
147
+
148
+ Pass custom_id while the app upload.
149
+
150
+ ```js
151
+ services: [
152
+ ['browserstack', {
153
+ app: {
154
+ path: '/path/to/local/app.apk',
155
+ custom_id: 'custom_id'
156
+ }
157
+ }]
158
+ ]
159
+ ```
160
+
161
+ #### id
162
+ Use the app URL returned after uploading the app to BrowserStack.
163
+
164
+ ```js
165
+ services: [
166
+ ['browserstack', {
167
+ app: 'bs://<app-id>'
168
+ // OR
169
+ app: {
170
+ id: 'bs://<app-id>'
171
+ }
172
+ }]
173
+ ]
174
+ ```
175
+
176
+ #### custom_id
177
+
178
+ use custom_id of already uploaded apps
179
+
180
+ ```js
181
+ services: [
182
+ ['browserstack', {
183
+ app: 'custom_id'
184
+ // OR
185
+ app: {
186
+ custom_id: 'custom_id'
187
+ }
188
+ }]
189
+ ]
190
+ ```
191
+
192
+ #### shareable_id
193
+
194
+ use shareable_id of already uploaded apps
195
+
196
+ ```js
197
+ services: [
198
+ ['browserstack', {
199
+ app: 'username/custom_id'
200
+ // OR
201
+ app: {
202
+ shareable_id: 'username/custom_id'
203
+ }
204
+ }]
205
+ ]
206
+ ```
207
+
208
+ ### preferScenarioName
209
+
210
+ Cucumber only. Set the BrowserStack Automate session name to the Scenario name if only a single Scenario ran.
211
+ Useful when running in parallel with [wdio-cucumber-parallel-execution](https://github.com/SimitTomar/wdio-cucumber-parallel-execution).
212
+
213
+ Type: `Boolean`<br />
214
+ Default: `false`
215
+
216
+ ### sessionNameFormat
217
+
218
+ Customize the BrowserStack Automate session name format.
219
+
220
+ Type: `Function`<br />
221
+ Default (Cucumber/Jasmine): `(config, capabilities, suiteTitle) => suiteTitle`<br />
222
+ Default (Mocha): `(config, capabilities, suiteTitle, testTitle) => suiteTitle + ' - ' + testTitle`
223
+
224
+ ### sessionNameOmitTestTitle
225
+
226
+ Mocha only. Do not append the test title to the BrowserStack Automate session name.
227
+
228
+ Type: `Boolean`<br />
229
+ Default: `false`
230
+
231
+ ### sessionNamePrependTopLevelSuiteTitle
232
+
233
+ Mocha only. Prepend the top level suite title to the BrowserStack Automate session name.
234
+
235
+ Type: `Boolean`<br />
236
+ Default: `false`
237
+
238
+ ### setSessionName
239
+
240
+ Automatically set the BrowserStack Automate session name.
241
+
242
+ Type: `Boolean`<br />
243
+ Default: `true`
244
+
245
+ ### setSessionStatus
246
+
247
+ Automatically set the BrowserStack Automate session status (passed/failed).
248
+
249
+ Type: `Boolean`<br />
250
+ Default: `true`
251
+
252
+ ### buildIdentifier
253
+
254
+ **buildIdentifier** is a unique id to differentiate every execution that gets appended to buildName. Choose your buildIdentifier format from the available expressions:
255
+ * `BUILD_NUMBER`: Generates an incremental counter with every execution
256
+ * `DATE_TIME`: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
257
+
258
+ ```js
259
+ services: [
260
+ ['browserstack', {
261
+ buildIdentifier: '#${BUILD_NUMBER}'
262
+ }]
263
+ ]
264
+ ```
265
+ Build Identifier supports usage of either or both expressions along with any other characters enabling custom formatting options.
266
+
267
+ ### opts
268
+
269
+ BrowserStack Local options.
270
+
271
+ Type: `Object`<br />
272
+ Default: `{}`
273
+
274
+ List of available local testing modifiers to be passed as opts:
275
+
276
+ #### Local Identifier
277
+
278
+ If doing simultaneous multiple local testing connections, set this uniquely for different processes -
279
+
280
+ ```js
281
+ opts = { localIdentifier: "randomstring" };
282
+ ```
283
+
284
+ #### Verbose Logging
285
+
286
+ To enable verbose logging -
287
+
288
+ ```js
289
+ opts = { verbose: "true" };
290
+ ```
291
+
292
+ Note - Possible values for 'verbose' modifier are '1', '2', '3' and 'true'
293
+
294
+ #### Force Local
295
+
296
+ To route all traffic via local(your) machine -
297
+
298
+ ```js
299
+ opts = { forceLocal: "true" };
300
+ ```
301
+
302
+ #### Folder Testing
303
+
304
+ To test local folder rather internal server, provide path to folder as value of this option -
305
+
306
+ ```js
307
+ opts = { f: "/my/awesome/folder" };
308
+ ```
309
+
310
+ #### Force Start
311
+
312
+ To kill other running BrowserStack Local instances -
313
+
314
+ ```js
315
+ opts = { force: "true" };
316
+ ```
317
+
318
+ #### Only Automate
319
+
320
+ To disable local testing for Live and Screenshots, and enable only Automate -
321
+
322
+ ```js
323
+ opts = { onlyAutomate: "true" };
324
+ ```
325
+
326
+ #### Proxy
327
+
328
+ To use a proxy for local testing -
329
+
330
+ - proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
331
+ - proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
332
+ - proxyUser: Username for connecting to proxy (Basic Auth Only)
333
+ - proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
334
+
335
+ ```js
336
+ opts = {
337
+ proxyHost: "127.0.0.1",
338
+ proxyPort: "8000",
339
+ proxyUser: "user",
340
+ proxyPass: "password",
341
+ };
342
+ ```
343
+
344
+ #### Local Proxy
345
+
346
+ To use local proxy in local testing -
347
+
348
+ - localProxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
349
+ - localProxyPort: Port for the proxy, defaults to 8081 when -localProxyHost is used
350
+ - localProxyUser: Username for connecting to proxy (Basic Auth Only)
351
+ - localProxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
352
+
353
+ ```js
354
+ opts = {
355
+ localProxyHost: "127.0.0.1",
356
+ localProxyPort: "8000",
357
+ localProxyUser: "user",
358
+ localProxyPass: "password",
359
+ };
360
+ ```
361
+
362
+ #### PAC (Proxy Auto-Configuration)
363
+
364
+ To use PAC (Proxy Auto-Configuration) in local testing -
365
+
366
+ - pac-file: PAC (Proxy Auto-Configuration) file’s absolute path
367
+
368
+ ```js
369
+ opts = { "pac-file": "<pac_file_abs_path>" };
370
+ ```
371
+
372
+ #### Binary Path
373
+
374
+ By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument.
375
+ Path to specify local Binary path -
376
+
377
+ ```js
378
+ opts = { binarypath: "/path/to/binary" };
379
+ ```
380
+
381
+ #### Logfile
382
+
383
+ To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory.
384
+ To specify the path to file where the logs will be saved -
385
+
386
+ ```js
387
+ opts = { verbose: "true", logFile: "./local.log" };
388
+ ```
389
+
390
+ ----
391
+
392
+ For more information on WebdriverIO see the [homepage](https://webdriver.io).
@@ -0,0 +1,43 @@
1
+ declare module WebdriverIO {
2
+ interface ServiceOption extends BrowserstackConfig {}
3
+
4
+ interface Suite {
5
+ title: string;
6
+ fullName: string;
7
+ file: string;
8
+ }
9
+
10
+ interface Test extends Suite {
11
+ parent: string;
12
+ passed: boolean;
13
+ }
14
+
15
+ interface TestResult {
16
+ exception: string;
17
+ status: string;
18
+ }
19
+ }
20
+
21
+ interface BrowserstackConfig {
22
+ /**
23
+ * Set this to true to enable routing connections from Browserstack cloud through your computer.
24
+ * You will also need to set `browserstack.local` to true in browser capabilities.
25
+ */
26
+ browserstackLocal?: boolean;
27
+ /**
28
+ * Cucumber only. Set this to true to enable updating the session name to the Scenario name if only
29
+ * a single Scenario was ran. Useful when running in parallel
30
+ * with [wdio-cucumber-parallel-execution](https://github.com/SimitTomar/wdio-cucumber-parallel-execution).
31
+ */
32
+ preferScenarioName?: boolean;
33
+ /**
34
+ * Set this to true to kill the browserstack process on complete, without waiting for the
35
+ * browserstack stop callback to be called. This is experimental and should not be used by all.
36
+ */
37
+ forcedStop?: boolean;
38
+ /**
39
+ * Specified optional will be passed down to BrowserstackLocal. See this list for details:
40
+ * https://stackoverflow.com/questions/39040108/import-class-in-definition-file-d-ts
41
+ */
42
+ opts?: Partial<import('browserstack-local').Options>
43
+ }
@@ -0,0 +1,32 @@
1
+ import type { Capabilities } from '@wdio/types';
2
+ import type { BeforeCommandArgs, AfterCommandArgs } from '@wdio/reporter';
3
+ declare class _PercyHandler {
4
+ private _percyAutoCaptureMode;
5
+ private _browser;
6
+ private _capabilities;
7
+ private _isAppAutomate?;
8
+ private _framework?;
9
+ private _testMetadata;
10
+ private _sessionName?;
11
+ private _isPercyCleanupProcessingUnderway?;
12
+ private _percyScreenshotCounter;
13
+ private _percyDeferredScreenshots;
14
+ private _percyScreenshotInterval;
15
+ private _percyCaptureMap?;
16
+ constructor(_percyAutoCaptureMode: string | undefined, _browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, _capabilities: Capabilities.RemoteCapability, _isAppAutomate?: boolean | undefined, _framework?: string | undefined);
17
+ _setSessionName(name: string): void;
18
+ teardown(): Promise<void>;
19
+ percyAutoCapture(eventName: string | null, sessionName: string | null): Promise<void>;
20
+ before(): Promise<void>;
21
+ deferCapture(sessionName: string, eventName: string | null): void;
22
+ isDOMChangingCommand(args: BeforeCommandArgs): boolean;
23
+ cleanupDeferredScreenshots(): Promise<void>;
24
+ browserBeforeCommand(args: BeforeCommandArgs): Promise<void>;
25
+ browserAfterCommand(args: BeforeCommandArgs & AfterCommandArgs): Promise<void>;
26
+ afterTest(): Promise<void>;
27
+ afterScenario(): Promise<void>;
28
+ }
29
+ declare const PercyHandler: typeof _PercyHandler;
30
+ type PercyHandler = _PercyHandler;
31
+ export default PercyHandler;
32
+ //# sourceMappingURL=Percy-Handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Percy-Handler.d.ts","sourceRoot":"","sources":["../../src/Percy/Percy-Handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAezE,cAAM,aAAa;IAUX,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC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ercyLogger } from './PercyLogger.js';
5
+ import { PERCY_DOM_CHANGING_COMMANDS_ENDPOINTS, CAPTURE_MODES } from '../constants.js';
6
+ import PerformanceTester from '../instrumentation/performance/performance-tester.js';
7
+ import * as PERFORMANCE_SDK_EVENTS from '../instrumentation/performance/constants.js';
8
+ class _PercyHandler {
9
+ _percyAutoCaptureMode;
10
+ _browser;
11
+ _capabilities;
12
+ _isAppAutomate;
13
+ _framework;
14
+ _testMetadata = {};
15
+ _sessionName;
16
+ _isPercyCleanupProcessingUnderway = false;
17
+ _percyScreenshotCounter = 0;
18
+ _percyDeferredScreenshots = [];
19
+ _percyScreenshotInterval = null;
20
+ _percyCaptureMap;
21
+ constructor(_percyAutoCaptureMode, _browser, _capabilities, _isAppAutomate, _framework) {
22
+ this._percyAutoCaptureMode = _percyAutoCaptureMode;
23
+ this._browser = _browser;
24
+ this._capabilities = _capabilities;
25
+ this._isAppAutomate = _isAppAutomate;
26
+ this._framework = _framework;
27
+ if (!_percyAutoCaptureMode || !CAPTURE_MODES.includes(_percyAutoCaptureMode)) {
28
+ this._percyAutoCaptureMode = 'auto';
29
+ }
30
+ }
31
+ _setSessionName(name) {
32
+ this._sessionName = name;
33
+ }
34
+ async teardown() {
35
+ await new Promise((resolve) => {
36
+ setInterval(() => {
37
+ if (this._percyScreenshotCounter === 0) {
38
+ resolve();
39
+ }
40
+ }, 1000);
41
+ });
42
+ }
43
+ async percyAutoCapture(eventName, sessionName) {
44
+ PerformanceTester.start(PERFORMANCE_SDK_EVENTS.PERCY_EVENTS.AUTO_CAPTURE);
45
+ try {
46
+ if (eventName) {
47
+ if (!sessionName) {
48
+ /* Service doesn't wait for handling of browser commands so the below counter is used in teardown method to delay service exit */
49
+ this._percyScreenshotCounter += 1;
50
+ }
51
+ this._percyCaptureMap?.increment(sessionName ? sessionName : this._sessionName, eventName);
52
+ const performanceEventName = this._isAppAutomate ? PERFORMANCE_SDK_EVENTS.PERCY_EVENTS.SCREENSHOT_APP : PERFORMANCE_SDK_EVENTS.PERCY_EVENTS.SCREENSHOT;
53
+ await PerformanceTester.measureWrapper(performanceEventName, async () => {
54
+ await (this._isAppAutomate ? PercySDK.screenshotApp(this._percyCaptureMap?.getName(sessionName ? sessionName : this._sessionName, eventName)) : await PercySDK.screenshot(this._browser, this._percyCaptureMap?.getName(sessionName ? sessionName : this._sessionName, eventName)));
55
+ })();
56
+ this._percyScreenshotCounter -= 1;
57
+ }
58
+ }
59
+ catch (err) {
60
+ this._percyScreenshotCounter -= 1;
61
+ this._percyCaptureMap?.decrement(sessionName ? sessionName : this._sessionName, eventName);
62
+ PerformanceTester.end(PERFORMANCE_SDK_EVENTS.PERCY_EVENTS.AUTO_CAPTURE, false, err, { eventName, sessionName });
63
+ PercyLogger.error(`Error while trying to auto capture Percy screenshot ${err}`);
64
+ }
65
+ PerformanceTester.end(PERFORMANCE_SDK_EVENTS.PERCY_EVENTS.AUTO_CAPTURE, true, null, { eventName, sessionName });
66
+ }
67
+ async before() {
68
+ this._percyCaptureMap = new PercyCaptureMap();
69
+ }
70
+ deferCapture(sessionName, eventName) {
71
+ /* Service doesn't wait for handling of browser commands so the below counter is used in teardown method to delay service exit */
72
+ this._percyScreenshotCounter += 1;
73
+ this._percyDeferredScreenshots.push({ sessionName, eventName });
74
+ }
75
+ isDOMChangingCommand(args) {
76
+ /*
77
+ Percy screenshots which are to be taken on events such as send keys, element click & screenshot are deferred until
78
+ another DOM changing command is seen such that any DOM processing post the previous command is completed
79
+ */
80
+ return (typeof args.method === 'string' && typeof args.endpoint === 'string' &&
81
+ ((args.method === 'POST' &&
82
+ (PERCY_DOM_CHANGING_COMMANDS_ENDPOINTS.includes(args.endpoint) ||
83
+ (
84
+ /* click / clear element */
85
+ args.endpoint.includes('/session/:sessionId/element') &&
86
+ (args.endpoint.includes('click') ||
87
+ args.endpoint.includes('clear'))) ||
88
+ /* execute script sync / async */
89
+ (args.endpoint.includes('/session/:sessionId/execute') && args.body?.script) ||
90
+ /* Touch action for Appium */
91
+ (args.endpoint.includes('/session/:sessionId/touch')))) ||
92
+ (args.method === 'DELETE' && args.endpoint === '/session/:sessionId')));
93
+ }
94
+ async cleanupDeferredScreenshots() {
95
+ this._isPercyCleanupProcessingUnderway = true;
96
+ for (const entry of this._percyDeferredScreenshots) {
97
+ await this.percyAutoCapture(entry.eventName, entry.sessionName);
98
+ }
99
+ this._percyDeferredScreenshots = [];
100
+ this._isPercyCleanupProcessingUnderway = false;
101
+ }
102
+ async browserBeforeCommand(args) {
103
+ try {
104
+ if (!this.isDOMChangingCommand(args)) {
105
+ return;
106
+ }
107
+ do {
108
+ await sleep(1000);
109
+ } while (this._percyScreenshotInterval);
110
+ this._percyScreenshotInterval = setInterval(async () => {
111
+ if (!this._isPercyCleanupProcessingUnderway) {
112
+ clearInterval(this._percyScreenshotInterval);
113
+ await this.cleanupDeferredScreenshots();
114
+ this._percyScreenshotInterval = null;
115
+ }
116
+ }, 1000);
117
+ }
118
+ catch (err) {
119
+ PercyLogger.error(`Error while trying to cleanup deferred screenshots ${err}`);
120
+ }
121
+ }
122
+ async browserAfterCommand(args) {
123
+ try {
124
+ if (!args.endpoint || !this._percyAutoCaptureMode) {
125
+ return;
126
+ }
127
+ let eventName = null;
128
+ const endpoint = args.endpoint;
129
+ if (endpoint.includes('click') && ['click', 'auto'].includes(this._percyAutoCaptureMode)) {
130
+ eventName = 'click';
131
+ }
132
+ else if (endpoint.includes('screenshot') && ['screenshot', 'auto'].includes(this._percyAutoCaptureMode)) {
133
+ eventName = 'screenshot';
134
+ }
135
+ else if (endpoint.includes('actions') && ['auto'].includes(this._percyAutoCaptureMode)) {
136
+ if (args.body && args.body.actions && Array.isArray(args.body.actions) && args.body.actions.length && args.body.actions[0].type === 'key') {
137
+ eventName = 'keys';
138
+ }
139
+ }
140
+ else if (endpoint.includes('/session/:sessionId/element') && endpoint.includes('value') && ['auto'].includes(this._percyAutoCaptureMode)) {
141
+ eventName = 'keys';
142
+ }
143
+ if (eventName) {
144
+ this.deferCapture(this._sessionName, eventName);
145
+ }
146
+ }
147
+ catch (err) {
148
+ PercyLogger.error(`Error while trying to calculate auto capture parameters ${err}`);
149
+ }
150
+ }
151
+ async afterTest() {
152
+ if (this._percyAutoCaptureMode && this._percyAutoCaptureMode === 'testcase') {
153
+ await this.percyAutoCapture('testcase', null);
154
+ }
155
+ }
156
+ async afterScenario() {
157
+ if (this._percyAutoCaptureMode && this._percyAutoCaptureMode === 'testcase') {
158
+ await this.percyAutoCapture('testcase', null);
159
+ }
160
+ }
161
+ }
162
+ // https://github.com/microsoft/TypeScript/issues/6543
163
+ const PercyHandler = o11yClassErrorHandler(_PercyHandler);
164
+ export default PercyHandler;
165
+ //# sourceMappingURL=Percy-Handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Percy-Handler.js","sourceRoot":"","sources":["../../src/Percy/Percy-Handler.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,qBAAqB,EACrB,KAAK,EACR,MAAM,YAAY,CAAA;AACnB,OAAO,eAAe,MAAM,sBAAsB,CAAA;AAElD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,qCAAqC,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACtF,OAAO,iBAAiB,MAAM,sDAAsD,CAAA;AACpF,OAAO,KAAK,sBAAsB,MAAM,6CAA6C,CAAA;AAErF,MAAM,aAAa;IAUH;IACA;IACA;IACA;IACA;IAbJ,aAAa,GAA2B,EAAE,CAAA;IAC1C,YAAY,CAAS;IACrB,iCAAiC,GAAa,KAAK,CAAA;IACnD,uBAAuB,GAAQ,CAAC,CAAA;IAChC,yBAAyB,GAAQ,EAAE,CAAA;IACnC,wBAAwB,GAAQ,IAAI,CAAA;IACpC,gBAAgB,CAAkB;IAE1C,YACY,qBAAyC,EACzC,QAA8D,EAC9D,aAA4C,EAC5C,cAAwB,EACxB,UAAmB;QAJnB,0BAAqB,G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