@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
@@ -0,0 +1,380 @@
1
+ import fs from 'node:fs';
2
+ import { BStackLogger } from '../bstackLogger.js';
3
+ import { isValidEnabledValue } from '../util.js';
4
+ const RUN_SMART_SELECTION = 'runSmartSelection';
5
+ const ALLOWED_ORCHESTRATION_KEYS = [
6
+ RUN_SMART_SELECTION
7
+ ];
8
+ /**
9
+ * Class to handle test ordering functionality
10
+ */
11
+ class TestOrdering {
12
+ enabled;
13
+ name;
14
+ constructor() {
15
+ this.enabled = false;
16
+ this.name = null;
17
+ }
18
+ enable(name) {
19
+ this.enabled = true;
20
+ this.name = name;
21
+ }
22
+ disable() {
23
+ this.enabled = false;
24
+ this.name = null;
25
+ }
26
+ getEnabled() {
27
+ return this.enabled;
28
+ }
29
+ getName() {
30
+ return this.name;
31
+ }
32
+ }
33
+ /**
34
+ * Utility class for test orchestration
35
+ */
36
+ export class OrchestrationUtils {
37
+ static _instance = null;
38
+ runSmartSelection;
39
+ smartSelectionMode;
40
+ testOrdering;
41
+ smartSelectionSource;
42
+ projectName;
43
+ buildName;
44
+ buildIdentifier;
45
+ /**
46
+ * @param config Configuration object
47
+ */
48
+ constructor(config) {
49
+ this.runSmartSelection = false;
50
+ this.smartSelectionMode = 'relevantFirst';
51
+ this.testOrdering = new TestOrdering();
52
+ this.smartSelectionSource = null; // Store source paths if provided
53
+ // Check both possible configuration paths: direct or nested in services
54
+ let testOrchOptions = config.testOrchestrationOptions || {};
55
+ // If not found at top level, check if it's in the browserstack service config
56
+ if (Object.keys(testOrchOptions).length === 0 && config.services && Array.isArray(config.services)) {
57
+ // Look for browserstack service configuration
58
+ for (const service of config.services) {
59
+ if (Array.isArray(service) && service[0] === 'browserstack' && service[1] && service[1].testOrchestrationOptions) {
60
+ testOrchOptions = service[1].testOrchestrationOptions;
61
+ BStackLogger.debug('[constructor] Found testOrchestrationOptions in browserstack service config');
62
+ break;
63
+ }
64
+ }
65
+ }
66
+ // Try to get runSmartSelection options
67
+ const runSmartSelectionOpts = testOrchOptions[RUN_SMART_SELECTION] || {};
68
+ this._setRunSmartSelection(runSmartSelectionOpts.enabled || false, runSmartSelectionOpts.mode || 'relevantFirst', runSmartSelectionOpts.source || null);
69
+ // Extract build details from capabilities
70
+ this._extractBuildDetails(config);
71
+ }
72
+ /**
73
+ * Extract build details from capabilities
74
+ */
75
+ _extractBuildDetails(config) {
76
+ try {
77
+ const capabilities = config.capabilities;
78
+ if (Array.isArray(capabilities)) {
79
+ capabilities.forEach((capability) => {
80
+ if (!capability['bstack:options']) {
81
+ // Extract from legacy format
82
+ this.buildIdentifier = capability['browserstack.buildIdentifier']?.toString();
83
+ this.buildName = capability.build?.toString();
84
+ }
85
+ else {
86
+ // Extract from bstack:options format
87
+ this.buildName = capability['bstack:options'].buildName;
88
+ this.projectName = capability['bstack:options'].projectName;
89
+ this.buildIdentifier = capability['bstack:options'].buildIdentifier;
90
+ }
91
+ });
92
+ }
93
+ else if (typeof capabilities === 'object' && capabilities) {
94
+ // Handle multiremote capabilities
95
+ Object.entries(capabilities).forEach(([, caps]) => {
96
+ if (caps.capabilities) {
97
+ if (!caps.capabilities['bstack:options']) {
98
+ this.buildIdentifier = caps.capabilities['browserstack.buildIdentifier'];
99
+ }
100
+ else {
101
+ const bstackOptions = caps.capabilities['bstack:options'];
102
+ this.buildName = bstackOptions.buildName;
103
+ this.projectName = bstackOptions.projectName;
104
+ this.buildIdentifier = bstackOptions.buildIdentifier;
105
+ }
106
+ }
107
+ });
108
+ }
109
+ BStackLogger.debug(`[_extractBuildDetails] Extracted - projectName: ${this.projectName}, buildName: ${this.buildName}, buildIdentifier: ${this.buildIdentifier}`);
110
+ }
111
+ catch (e) {
112
+ BStackLogger.error(`[_extractBuildDetails] ${e}`);
113
+ }
114
+ }
115
+ /**
116
+ * Get or create an instance of OrchestrationUtils
117
+ */
118
+ static getInstance(config) {
119
+ if (!OrchestrationUtils._instance && config) {
120
+ OrchestrationUtils._instance = new OrchestrationUtils(config);
121
+ }
122
+ return OrchestrationUtils._instance;
123
+ }
124
+ /**
125
+ * Get orchestration data from config
126
+ */
127
+ static getOrchestrationData(config) {
128
+ const orchestrationData = config.testOrchestrationOptions || {};
129
+ const result = {};
130
+ Object.entries(orchestrationData).forEach(([key, value]) => {
131
+ if (ALLOWED_ORCHESTRATION_KEYS.includes(key)) {
132
+ result[key] = value;
133
+ }
134
+ });
135
+ return result;
136
+ }
137
+ /**
138
+ * Get run smart selection setting
139
+ */
140
+ getRunSmartSelection() {
141
+ return this.runSmartSelection;
142
+ }
143
+ /**
144
+ * Get smart selection mode
145
+ */
146
+ getSmartSelectionMode() {
147
+ return this.smartSelectionMode;
148
+ }
149
+ /**
150
+ * Get smart selection source
151
+ */
152
+ getSmartSelectionSource() {
153
+ return this.smartSelectionSource;
154
+ }
155
+ /**
156
+ * Get project name
157
+ */
158
+ getProjectName() {
159
+ return this.projectName;
160
+ }
161
+ /**
162
+ * Get build name
163
+ */
164
+ getBuildName() {
165
+ return this.buildName;
166
+ }
167
+ /**
168
+ * Get build identifier
169
+ */
170
+ getBuildIdentifier() {
171
+ return this.buildIdentifier;
172
+ }
173
+ /**
174
+ * Set build details
175
+ */
176
+ setBuildDetails(projectName, buildName, buildIdentifier) {
177
+ this.projectName = projectName;
178
+ this.buildName = buildName;
179
+ this.buildIdentifier = buildIdentifier;
180
+ BStackLogger.debug(`[setBuildDetails] Set - projectName: ${this.projectName}, buildName: ${this.buildName}, buildIdentifier: ${this.buildIdentifier}`);
181
+ }
182
+ /**
183
+ * Set run smart selection
184
+ */
185
+ _setRunSmartSelection(enabled, mode, source = null) {
186
+ try {
187
+ // Properly validate enabled value - only accept true boolean or string "true"
188
+ this.runSmartSelection = isValidEnabledValue(enabled);
189
+ this.smartSelectionMode = mode;
190
+ this.smartSelectionSource = [];
191
+ // Log the configuration for debugging
192
+ BStackLogger.debug(`Setting runSmartSelection: enabled=${this.runSmartSelection}, mode=${this.smartSelectionMode}`);
193
+ if (this.runSmartSelection) {
194
+ // Mode validation - only when smart selection is enabled
195
+ const validModes = ['relevantFirst', 'relevantOnly'];
196
+ if (!validModes.includes(this.smartSelectionMode)) {
197
+ BStackLogger.warn(`Invalid smart selection mode '${this.smartSelectionMode}' provided. Defaulting to 'relevantFirst'.`);
198
+ this.smartSelectionMode = 'relevantFirst';
199
+ }
200
+ if (source === null) {
201
+ this.smartSelectionSource = null;
202
+ BStackLogger.debug('No source provided for smart selection; defaulting to null.');
203
+ }
204
+ else if (Array.isArray(source)) {
205
+ this.smartSelectionSource = source;
206
+ BStackLogger.debug(`Smart selection source set to array: ${JSON.stringify(source)}`);
207
+ }
208
+ else if (typeof source === 'string' && source.endsWith('.json')) {
209
+ this.smartSelectionSource = this._loadSourceFromFile(source) || [];
210
+ BStackLogger.debug(`Smart selection source loaded from file: ${source}`);
211
+ }
212
+ this._setTestOrdering();
213
+ }
214
+ }
215
+ catch (e) {
216
+ BStackLogger.error(`[_setRunSmartSelection] ${e}`);
217
+ }
218
+ }
219
+ /**
220
+ * Parse JSON source configuration file and format it for smart selection.
221
+ *
222
+ * @param filePath - Path to the JSON configuration file
223
+ * @returns Formatted list of repository configurations
224
+ */
225
+ _loadSourceFromFile(filePath) {
226
+ if (!fs.existsSync(filePath)) {
227
+ BStackLogger.error(`Source file '${filePath}' does not exist.`);
228
+ return [];
229
+ }
230
+ let data = null;
231
+ try {
232
+ const fileContent = fs.readFileSync(filePath, 'utf8');
233
+ data = JSON.parse(fileContent);
234
+ }
235
+ catch (error) {
236
+ BStackLogger.error(`Error parsing JSON from source file '${filePath}': ${error.message}`);
237
+ return [];
238
+ }
239
+ // Cache feature branch mappings from env to avoid repeated parsing
240
+ let featureBranchEnvMap = null;
241
+ const loadFeatureBranchMaps = () => {
242
+ let envMap = {};
243
+ try {
244
+ const envVar = process.env.BROWSERSTACK_ORCHESTRATION_SMART_SELECTION_FEATURE_BRANCHES || '';
245
+ envMap = envVar.startsWith('{') && envVar.endsWith('}')
246
+ ? JSON.parse(envVar)
247
+ : envVar.split(',')
248
+ .filter(item => item.includes(':'))
249
+ .reduce((acc, item) => {
250
+ const [key, value] = item.split(':');
251
+ if (key && value) {
252
+ acc[key.trim()] = value.trim();
253
+ }
254
+ return acc;
255
+ }, {});
256
+ }
257
+ catch (error) {
258
+ BStackLogger.error(`Error parsing feature branch mappings: ${error.message}`);
259
+ }
260
+ BStackLogger.debug(`Feature branch mappings from env: ${JSON.stringify(envMap)}`);
261
+ return envMap;
262
+ };
263
+ featureBranchEnvMap = loadFeatureBranchMaps();
264
+ const getFeatureBranch = (name, repoInfo) => {
265
+ // 1. Check in environment variable map
266
+ if (featureBranchEnvMap && featureBranchEnvMap[name]) {
267
+ return featureBranchEnvMap[name];
268
+ }
269
+ // 2. Check in repo_info
270
+ if (repoInfo.featureBranch) {
271
+ return repoInfo.featureBranch;
272
+ }
273
+ return null;
274
+ };
275
+ if (typeof data === 'object' && data !== null && !Array.isArray(data)) {
276
+ const formattedData = [];
277
+ const namePattern = /^[A-Z0-9_]+$/;
278
+ for (const [name, repoInfo] of Object.entries(data)) {
279
+ if (typeof repoInfo !== 'object' || repoInfo === null) {
280
+ continue;
281
+ }
282
+ const typedRepoInfo = repoInfo;
283
+ // Validate that url is a string and is present
284
+ if (!typedRepoInfo.url || typeof typedRepoInfo.url !== 'string') {
285
+ BStackLogger.warn(`Repository URL is missing or invalid for source '${name}': ${JSON.stringify(repoInfo)}`);
286
+ continue;
287
+ }
288
+ // Validate that baseBranch, if provided, is a string
289
+ if (typedRepoInfo.baseBranch !== undefined && typeof typedRepoInfo.baseBranch !== 'string') {
290
+ BStackLogger.warn(`Base branch must be a string for source '${name}': ${JSON.stringify(repoInfo)}`);
291
+ continue;
292
+ }
293
+ // Validate name
294
+ if (!namePattern.test(name)) {
295
+ BStackLogger.warn(`Invalid source identifier format for '${name}': ${JSON.stringify(repoInfo)}`);
296
+ continue;
297
+ }
298
+ // Validate length
299
+ if (name.length > 30 || name.length < 1) {
300
+ BStackLogger.warn(`Source identifier '${name}' must have a length between 1 and 30 characters.`);
301
+ continue;
302
+ }
303
+ const featureBranch = getFeatureBranch(name, typedRepoInfo);
304
+ // Validate that featureBranch, if provided, is a string
305
+ if (featureBranch !== undefined && featureBranch !== null && typeof featureBranch !== 'string') {
306
+ BStackLogger.warn(`Feature branch must be a string for source '${name}': ${JSON.stringify(repoInfo)}`);
307
+ continue;
308
+ }
309
+ // Create filtered repo info object with only allowed fields
310
+ const filteredRepoInfo = {
311
+ name,
312
+ url: typedRepoInfo.url,
313
+ featureBranch: featureBranch ?? undefined
314
+ };
315
+ // Only add baseBranch if it's provided
316
+ if (typedRepoInfo.baseBranch) {
317
+ filteredRepoInfo.baseBranch = typedRepoInfo.baseBranch;
318
+ }
319
+ if (!filteredRepoInfo.featureBranch || filteredRepoInfo.featureBranch === '') {
320
+ BStackLogger.warn(`Feature branch not specified for source '${name}': ${JSON.stringify(repoInfo)}`);
321
+ continue;
322
+ }
323
+ if (filteredRepoInfo.baseBranch && filteredRepoInfo.baseBranch === filteredRepoInfo.featureBranch) {
324
+ BStackLogger.warn(`Feature branch and base branch cannot be the same for source '${name}': ${JSON.stringify(repoInfo)}`);
325
+ continue;
326
+ }
327
+ formattedData.push(filteredRepoInfo);
328
+ }
329
+ return formattedData;
330
+ }
331
+ return Array.isArray(data) ? data : [];
332
+ }
333
+ /**
334
+ * Set test ordering based on priorities
335
+ */
336
+ _setTestOrdering() {
337
+ if (this.runSmartSelection) { // Highest priority
338
+ this.testOrdering.enable(RUN_SMART_SELECTION);
339
+ }
340
+ else {
341
+ this.testOrdering.disable();
342
+ }
343
+ }
344
+ /**
345
+ * Get test ordering name
346
+ */
347
+ getTestOrderingName() {
348
+ if (this.testOrdering.getEnabled()) {
349
+ return this.testOrdering.getName();
350
+ }
351
+ return null;
352
+ }
353
+ /**
354
+ * Get test orchestration metadata
355
+ */
356
+ getTestOrchestrationMetadata() {
357
+ const data = {
358
+ 'run_smart_selection': {
359
+ 'enabled': this.getRunSmartSelection(),
360
+ 'mode': this.getSmartSelectionMode(),
361
+ 'source': this.getSmartSelectionSource()
362
+ }
363
+ };
364
+ return data;
365
+ }
366
+ /**
367
+ * Get build start data
368
+ */
369
+ getBuildStartData() {
370
+ const testOrchestrationData = {};
371
+ testOrchestrationData.run_smart_selection = {
372
+ 'enabled': this.getRunSmartSelection(),
373
+ 'mode': this.getSmartSelectionMode()
374
+ // Not sending "source" to TH builds
375
+ };
376
+ return testOrchestrationData;
377
+ }
378
+ }
379
+ export default OrchestrationUtils;
380
+ //# sourceMappingURL=testorcherstrationutils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testorcherstrationutils.js","sourceRoot":"","sources":["../../src/testorchestration/testorcherstrationutils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,mBAAmB,GAAG,mBAAmB,CAAA;AAE/C,MAAM,0BAA0B,GAAG;IAC/B,mBAAmB;CACtB,CAAA;AAED;;GAEG;AACH,MAAM,YAAY;IACN,OAAO,CAAS;IAChB,IAAI,CAAe;IAE3B;QACI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,IAAY;QACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED,OAAO;QACH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACnB,MAAM,CAAC,SAAS,GAA8B,IAAI,CAAA;IAClD,iBAAiB,CAAS;IAC1B,kBAAkB,CAAQ;IAC1B,YAAY,CAAc;IAC1B,oBAAoB,CAA8C;IAClE,WAAW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