browserstack-node-sdk 1.65.6 → 1.66.0

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 (234) hide show
  1. package/ats/src/cloudproviders/AWS.js +1 -1
  2. package/ats/src/cloudproviders/Azure.js +1 -1
  3. package/ats/src/cloudproviders/CloudProvider.js +1 -1
  4. package/ats/src/cloudproviders/GoogleCloudProvider.js +1 -1
  5. package/ats/src/cloudproviders/utils.js +1 -1
  6. package/ats/src/commands/configure.js +1 -1
  7. package/ats/src/commands/connect.js +1 -1
  8. package/ats/src/commands/connect_commands/grid.js +1 -1
  9. package/ats/src/commands/create.js +1 -1
  10. package/ats/src/commands/create_commands/grid.js +1 -1
  11. package/ats/src/commands/delete.js +1 -1
  12. package/ats/src/commands/delete_commands/grid.js +1 -1
  13. package/ats/src/commands/init.js +1 -1
  14. package/ats/src/commands/list.js +1 -1
  15. package/ats/src/commands/list_commands/grid_profiles.js +1 -1
  16. package/ats/src/commands/list_commands/grids.js +1 -1
  17. package/ats/src/commands/precheck.js +1 -1
  18. package/ats/src/commands/precheck_commands/setup_precheck.js +1 -1
  19. package/ats/src/commands/start.js +1 -1
  20. package/ats/src/commands/start_commands/grid.js +1 -1
  21. package/ats/src/commands/stop.js +1 -1
  22. package/ats/src/commands/stop_commands/grid.js +1 -1
  23. package/ats/src/config/constants.js +1 -1
  24. package/ats/src/config/logger.js +1 -1
  25. package/ats/src/index.js +1 -1
  26. package/ats/src/utils/AWSUtils.js +1 -1
  27. package/ats/src/utils/createAutoscalerStack.js +1 -1
  28. package/ats/src/utils/createClusterStack.js +1 -1
  29. package/ats/src/utils/createHubHaStack.js +1 -1
  30. package/ats/src/utils/createk8sClient.js +1 -1
  31. package/ats/src/utils/deleteEFSMountTargets.js +1 -1
  32. package/ats/src/utils/deleteStack.js +1 -1
  33. package/ats/src/utils/describeStack.js +1 -1
  34. package/ats/src/utils/gridComponents.js +1 -1
  35. package/ats/src/utils/hstUtils.js +1 -1
  36. package/ats/src/utils/instrumentationUtils.js +1 -1
  37. package/ats/src/utils/userInput.js +1 -1
  38. package/ats/src/utils/utilityMethods.js +1 -1
  39. package/ats/src/utils/webSocketUtils.js +1 -1
  40. package/generated/sdk-messages_pb.d.ts +118 -0
  41. package/generated/sdk-messages_pb.js +908 -0
  42. package/generated/sdk_grpc_pb.d.ts +10 -0
  43. package/generated/sdk_grpc_pb.js +74 -0
  44. package/package.json +1 -1
  45. package/src/bin/codeceptjs/BrowserStackPlugin.js +1 -1
  46. package/src/bin/codeceptjs/command.js +1 -1
  47. package/src/bin/codeceptjs/helper.js +1 -1
  48. package/src/bin/codeceptjs/o11yHelper.js +1 -1
  49. package/src/bin/cucumber-js/command.js +1 -1
  50. package/src/bin/cucumber-js/formatter/custom_formatter.js +1 -1
  51. package/src/bin/cucumber-js/formatter/custom_formatter_old_versions.js +1 -1
  52. package/src/bin/cucumber-js/test-observability.js +1 -1
  53. package/src/bin/cucumber-js/test.setup.js +1 -1
  54. package/src/bin/cucumber-js/test_old.setup.js +1 -1
  55. package/src/bin/cucumber-js/timeout.setup.js +1 -1
  56. package/src/bin/detox/a11ySetup.js +1 -0
  57. package/src/bin/detox/command.js +2 -0
  58. package/src/bin/detox/modifyDetoxConf.js +1 -0
  59. package/src/bin/detox/traEmitter.js +1 -0
  60. package/src/bin/integrations/command.js +1 -1
  61. package/src/bin/integrations/constants.js +1 -1
  62. package/src/bin/jasmine/bstack-reporter/customReporter.js +1 -1
  63. package/src/bin/jasmine/command.js +1 -1
  64. package/src/bin/jasmine/test.setup.js +1 -1
  65. package/src/bin/jasmine/testRunMap.js +1 -1
  66. package/src/bin/jest/command.js +1 -1
  67. package/src/bin/jest/customImplements/customCircus.js +1 -1
  68. package/src/bin/jest/customImplements/customEnvironment.js +1 -1
  69. package/src/bin/jest/customImplements/customJestAdapterInit.js +1 -1
  70. package/src/bin/jest/customImplements/customSequencer.js +1 -1
  71. package/src/bin/jest/customImplements/customTestRunnerTemplate.js +1 -1
  72. package/src/bin/jest/jest.setup.js +1 -1
  73. package/src/bin/jest/test-observability/data-hooks.js +1 -1
  74. package/src/bin/jest/test-observability/helper.js +1 -1
  75. package/src/bin/jest/test-observability/obsReporter.js +1 -1
  76. package/src/bin/jest/test-observability/test-details.js +1 -1
  77. package/src/bin/jest/test.setup.js +1 -1
  78. package/src/bin/jest/test_before.setup.js +1 -1
  79. package/src/bin/launcher/launcher.js +1 -1
  80. package/src/bin/load/index.js +1 -1
  81. package/src/bin/load/loadErrors.js +1 -1
  82. package/src/bin/load/loadUtils.js +1 -1
  83. package/src/bin/mocha/accessibility-automation/helper.js +1 -1
  84. package/src/bin/mocha/bstack-reporter/customReporter.js +1 -1
  85. package/src/bin/mocha/command.js +1 -1
  86. package/src/bin/mocha/test-observability/data-hooks.js +1 -1
  87. package/src/bin/mocha/test-observability/mochaUtils.js +1 -1
  88. package/src/bin/mocha/test.setup.js +1 -1
  89. package/src/bin/newman/command.js +1 -1
  90. package/src/bin/newman/helper.js +1 -1
  91. package/src/bin/newman/reporter/index.js +1 -1
  92. package/src/bin/newman/scriptRunner.js +1 -1
  93. package/src/bin/nightwatch/command.js +1 -1
  94. package/src/bin/node-generic/client.js +1 -1
  95. package/src/bin/playwright/accessibility-helper.js +1 -1
  96. package/src/bin/playwright/command.js +1 -1
  97. package/src/bin/playwright/globalSetup.js +1 -1
  98. package/src/bin/playwright/mock-process.js +1 -1
  99. package/src/bin/playwright/modifyPlaywrightConf.js +1 -1
  100. package/src/bin/playwright/patches.js +1 -1
  101. package/src/bin/playwright/reporter/pwUtils.js +1 -1
  102. package/src/bin/playwright/reporter/reporter.js +1 -1
  103. package/src/bin/playwright/reporter/test-details.js +1 -1
  104. package/src/bin/playwright/reporterArgs.js +1 -1
  105. package/src/bin/playwright/sessionDetails.js +1 -1
  106. package/src/bin/puppeteer/patches.js +1 -1
  107. package/src/bin/puppeteer/sessionDetails.js +1 -1
  108. package/src/bin/puppeteer/test.setup.js +1 -1
  109. package/src/bin/runner.js +1 -1
  110. package/src/bin/setup.js +1 -1
  111. package/src/bin/test-runner/index.js +1 -1
  112. package/src/bin/test-runner/runTest.js +1 -1
  113. package/src/bin/test-runner/testWorker.js +1 -1
  114. package/src/bin/testcafe/a11y-runner.js +1 -1
  115. package/src/bin/testcafe/command.js +1 -1
  116. package/src/bin/testcafe/reporter/index.js +1 -1
  117. package/src/bin/testcafe/reporter/tcUtils.js +1 -1
  118. package/src/bin/testcafe/session-registry.js +1 -1
  119. package/src/bin/testcafe/stdout-interceptor.js +1 -1
  120. package/src/bin/testcafe/testcafe-action-patcher.js +1 -1
  121. package/src/bin/testcafe/w3c-driver.js +1 -1
  122. package/src/bin/utils/apiUtilityMethods.js +1 -1
  123. package/src/bin/utils/clientTroubleshootingService.js +1 -1
  124. package/src/bin/utils/constants.js +1 -1
  125. package/src/bin/utils/log4jsAppender.js +1 -1
  126. package/src/bin/utils/logPatcher.js +1 -1
  127. package/src/bin/utils/logReportingAPI.js +1 -1
  128. package/src/bin/utils/playwright-patcher.js +1 -1
  129. package/src/bin/utils/puppeteer-patcher.js +1 -1
  130. package/src/bin/utils/sharedPlaywrightSessionDetails.js +1 -1
  131. package/src/bin/utils/sharedUtils.js +1 -1
  132. package/src/bin/v2/TestInfo.js +1 -1
  133. package/src/bin/v2/browserstackCLI.js +1 -1
  134. package/src/bin/v2/cliUtils.js +1 -1
  135. package/src/bin/v2/customTagManager.js +1 -1
  136. package/src/bin/v2/eventDispatcher.js +1 -1
  137. package/src/bin/v2/framework/automationFramework.js +1 -1
  138. package/src/bin/v2/framework/constants/automationFrameworkConstants.js +1 -1
  139. package/src/bin/v2/framework/constants/testFrameworkConstants.js +1 -1
  140. package/src/bin/v2/framework/cucumberTestFramework.js +1 -1
  141. package/src/bin/v2/framework/jestTestFramework.js +1 -1
  142. package/src/bin/v2/framework/newmanTestFramework.js +1 -1
  143. package/src/bin/v2/framework/nodeGenericTestFramework.js +1 -1
  144. package/src/bin/v2/framework/playwrightAutomationFramework.js +1 -1
  145. package/src/bin/v2/framework/playwrightTestFramework.js +1 -1
  146. package/src/bin/v2/framework/puppeteerAutomationFramework.js +1 -1
  147. package/src/bin/v2/framework/testFramework.js +1 -1
  148. package/src/bin/v2/framework/testcafeAutomationFramework.js +1 -1
  149. package/src/bin/v2/framework/testcafeTestFramework.js +1 -1
  150. package/src/bin/v2/grpcClient.js +1 -1
  151. package/src/bin/v2/instances/automationFrameworkInstance.js +1 -1
  152. package/src/bin/v2/instances/testFrameworkInstance.js +1 -1
  153. package/src/bin/v2/instances/trackedContext.js +1 -1
  154. package/src/bin/v2/instances/trackedInstance.js +1 -1
  155. package/src/bin/v2/modules/accessibilityModule.js +1 -1
  156. package/src/bin/v2/modules/baseModule.js +1 -1
  157. package/src/bin/v2/modules/loadTestModule.js +1 -1
  158. package/src/bin/v2/modules/observabilityModule.js +1 -1
  159. package/src/bin/v2/modules/playwrightDriverModule.js +1 -1
  160. package/src/bin/v2/modules/puppeteerDriverModule.js +1 -1
  161. package/src/bin/v2/modules/testcafeDriverModule.js +1 -1
  162. package/src/bin/v2/modules/testhubModule.js +1 -1
  163. package/src/bin/v2/sdkErrorHandler.js +1 -1
  164. package/src/bin/v2/state/automationFrameworkState.js +1 -1
  165. package/src/bin/v2/state/hookState.js +1 -1
  166. package/src/bin/v2/state/testFrameworkState.js +1 -1
  167. package/src/bin/v2/uploadAttachmentsManager.js +1 -1
  168. package/src/bin/v2/utils/cucumber-utils.js +1 -1
  169. package/src/bin/v2/utils/jest-utils.js +1 -1
  170. package/src/bin/vanilla-js/command.js +1 -1
  171. package/src/browserStackSdk.js +1 -1
  172. package/src/detox-driver/a11y.js +574 -0
  173. package/src/detox-driver/allocationDriver.js +26 -0
  174. package/src/detox-driver/cloudPlatformAction.js +111 -0
  175. package/src/detox-driver/environment.js +253 -0
  176. package/src/detox-driver/expect.js +44 -0
  177. package/src/detox-driver/index.js +12 -0
  178. package/src/detox-driver/login-timeout-preload.js +25 -0
  179. package/src/detox-driver/runtimeDriver.js +351 -0
  180. package/src/detox-driver/session-reporter.js +41 -0
  181. package/src/detox-driver/tra-capture.js +81 -0
  182. package/src/helpers/BrowserStackSetup.js +1 -1
  183. package/src/helpers/accessibility-automation/accessibilityRetryHelper.js +1 -1
  184. package/src/helpers/accessibility-automation/constants.js +1 -1
  185. package/src/helpers/accessibility-automation/helper.js +1 -1
  186. package/src/helpers/accessibility-automation/scripts.js +1 -1
  187. package/src/helpers/ats/constants.js +1 -1
  188. package/src/helpers/ats/helper.js +1 -1
  189. package/src/helpers/caCertHelper.js +1 -1
  190. package/src/helpers/capsMapping.js +1 -1
  191. package/src/helpers/central-scanner/constants.js +1 -1
  192. package/src/helpers/central-scanner/helpers.js +1 -1
  193. package/src/helpers/classLogger.js +1 -1
  194. package/src/helpers/driverInitErrorReporter.js +1 -1
  195. package/src/helpers/globals.js +1 -1
  196. package/src/helpers/helper.js +1 -1
  197. package/src/helpers/logger.js +1 -1
  198. package/src/helpers/metadata.js +1 -1
  199. package/src/helpers/patchHelper.js +1 -1
  200. package/src/helpers/patchHelpers.js +1 -1
  201. package/src/helpers/percy/Percy.js +1 -1
  202. package/src/helpers/percy/PercyBinary.js +1 -1
  203. package/src/helpers/percy/PercyCaptureMap.js +1 -1
  204. package/src/helpers/percy/PercyCaptureModes.js +1 -1
  205. package/src/helpers/percy/PercySDK.js +1 -1
  206. package/src/helpers/percy/index.js +1 -1
  207. package/src/helpers/percy/utils.js +1 -1
  208. package/src/helpers/performance/constants.js +1 -1
  209. package/src/helpers/performance/performance-tester.js +1 -1
  210. package/src/helpers/playwright-helper.js +1 -1
  211. package/src/helpers/processHelper.js +1 -1
  212. package/src/helpers/puppeteer-helper.js +1 -1
  213. package/src/helpers/request-spy.js +1 -1
  214. package/src/helpers/setKeepAlive.js +1 -1
  215. package/src/helpers/stackFrameUtils.js +1 -1
  216. package/src/helpers/test-observability/constants.js +1 -1
  217. package/src/helpers/test-observability/error-handler.js +1 -1
  218. package/src/helpers/test-observability/requestQueueHandler.js +1 -1
  219. package/src/helpers/test-observability/sessionHandler.js +1 -1
  220. package/src/helpers/test-observability/utils.js +1 -1
  221. package/src/helpers/test-orchestration/constants.js +1 -1
  222. package/src/helpers/test-orchestration/failfastManager.js +1 -1
  223. package/src/helpers/test-orchestration/fileHelper.js +1 -1
  224. package/src/helpers/test-orchestration/orchestrationUtils.js +1 -1
  225. package/src/helpers/test-orchestration/requestUtils.js +1 -1
  226. package/src/helpers/test-orchestration/testOrchestrationHandler.js +1 -1
  227. package/src/helpers/test-orchestration/testOrderingServerHandler.js +1 -1
  228. package/src/helpers/testhub/constants.js +1 -1
  229. package/src/helpers/testhub/testhubHandler.js +1 -1
  230. package/src/helpers/testhub/utils.js +1 -1
  231. package/src/helpers/utilities.js +1 -1
  232. package/src/helpers/w3cMapping.js +1 -1
  233. package/src/hubAllocationMethods.js +1 -1
  234. package/src/index.js +1 -1
@@ -0,0 +1,351 @@
1
+ 'use strict';
2
+
3
+ // Runtime device driver for BrowserStack cloud Detox sessions. Extends detox's
4
+ // DeviceDriverBase (NOT AndroidDriver — AndroidDriver's constructor needs adb/aapt/
5
+ // apkValidator/instrumentation/etc. that the external runtime factory does not supply;
6
+ // the device runs server-side, so those local deps are irrelevant). launch/terminate
7
+ // go through the CloudPlatform action; device commands reuse vanilla detox's own
8
+ // invocationManager + espresso APIs. Verified green on a real Samsung Galaxy S23-13.0.
9
+ //
10
+ // detox is resolved from process.cwd() (the customer's install) — the SDK package
11
+ // itself has no detox dependency.
12
+ const fs = require('fs');
13
+ const os = require('os');
14
+ const path = require('path');
15
+ const _ = require('lodash');
16
+
17
+ const detoxRoot = path.dirname(require.resolve('detox/package.json', {paths: [process.cwd()]}));
18
+ const DeviceDriverBase = require(path.join(detoxRoot, 'src/devices/runtime/drivers/DeviceDriverBase'));
19
+ const EspressoDetoxApi = require(path.join(detoxRoot, 'src/android/espressoapi/EspressoDetox'));
20
+ const DetoxApi = require(path.join(detoxRoot, 'src/android/espressoapi/Detox'));
21
+ const UiDeviceProxy = require(path.join(detoxRoot, 'src/android/espressoapi/UiDeviceProxy'));
22
+ const detoxActions = require(path.join(detoxRoot, 'src/android/actions/native'));
23
+ const detoxMatchers = require(path.join(detoxRoot, 'src/android/matchers/native'));
24
+ const {ActionInteraction} = require(path.join(detoxRoot, 'src/android/interactions/native'));
25
+
26
+ const {executeCloudPlatform} = require('./cloudPlatformAction');
27
+ const traCapture = require('./tra-capture');
28
+ const a11y = require('./a11y');
29
+
30
+ const ORIENTATION_MAP = {landscape: 1, portrait: 0};
31
+ const LAUNCH_RETRIES = 3;
32
+
33
+ // RuntimeDevice hands unset device-command arguments over as **null**, not undefined, and the
34
+ // espresso bindings type-check strictly ("shouldIgnoreStatusBar should be a boolean, but got
35
+ // null"). Stock detox absorbs both with `??`; this is the same defaulting without the operator.
36
+ const orDefault = (value, fallback) => (value === undefined || value === null ? fallback : value);
37
+
38
+ // Views tried, in order, as the capture target for a whole-screen screenshot.
39
+ // DecorView is the window root (Espresso's own `isRoot()` target) and yields the
40
+ // full window; the React Native host views are the fallback when the internal
41
+ // DecorView class name differs by OEM/API level. Detox exposes no root matcher,
42
+ // so the target has to be named by class.
43
+ // Attribute a capture to the running test and append it to the TRA stream. The owning
44
+ // test's uuid and the spec path are published on the Node-realm global by the SDK's
45
+ // jest environment (same realm as this driver — the mechanism __BSTACK_DETOX_SPEC__
46
+ // already uses). Without a uuid there is nothing to attach the image to, so the record
47
+ // is skipped rather than emitted as an orphan the binary would drop anyway.
48
+ const recordScreenshot = ({base64, filePath, name}) => {
49
+ try {
50
+ const testUuid = global.__BSTACK_DETOX_TEST_UUID__;
51
+ if (!traCapture.enabled() || !testUuid) {
52
+ return;
53
+ }
54
+ traCapture.append({
55
+ kind: 'screenshot',
56
+ testUuid,
57
+ specPath: global.__BSTACK_DETOX_SPEC__ || '',
58
+ filePath,
59
+ base64,
60
+ name,
61
+ timestamp: new Date().toISOString()
62
+ });
63
+ } catch (err) { /* best-effort: a screenshot must never affect the run */ }
64
+ };
65
+
66
+ const SCREENSHOT_ROOT_VIEWS = [
67
+ 'com.android.internal.policy.DecorView',
68
+ 'com.android.internal.policy.PhoneWindow$DecorView',
69
+ 'com.facebook.react.ReactRootView',
70
+ 'com.facebook.react.runtime.ReactSurfaceView'
71
+ ];
72
+
73
+ // App Accessibility names device commands after detox's PUBLIC RuntimeDevice API, not
74
+ // after this driver's methods, and the two differ in one place: `device.openURL()` lands
75
+ // on the driver as `deliverPayload`. Mapping them here keeps the served command list the
76
+ // single source of truth for WHICH commands scan, while this table owns only the
77
+ // driver-method → public-name translation.
78
+ //
79
+ // Deliberately absent: `terminate`, `sendToHome` and `takeScreenshot` (none is a scannable
80
+ // command — and a scan after sendToHome would capture the launcher, not the app), plus
81
+ // `resetContentAndSettings` and `selectApp`, which cannot be honoured on a cloud device at
82
+ // all (a device-level reset, and multi-app selection) and so stay on DeviceDriverBase's inert
83
+ // stubs.
84
+ const A11Y_DEVICE_COMMANDS = {
85
+ launchApp: 'launchApp',
86
+ pressBack: 'pressBack',
87
+ setOrientation: 'setOrientation',
88
+ deliverPayload: 'openURL',
89
+ tap: 'tap',
90
+ longPress: 'longPress',
91
+ reloadReactNative: 'reloadReactNative'
92
+ };
93
+
94
+ class CloudRuntimeDriver extends DeviceDriverBase {
95
+ constructor(deps) {
96
+ super(deps);
97
+
98
+ this.invocationManager = deps.invocationManager;
99
+ this.instrumentation = false;
100
+ this.uiDevice = new UiDeviceProxy(this.invocationManager).getUIDevice();
101
+ // The element/web surfaces are handed an invocationManager, never a client, so the
102
+ // scan relay gets its channel from here — always constructed before any test action.
103
+ a11y.registerClient(this.client);
104
+ }
105
+
106
+ // Fires a scan after a mapped device command has completed. Awaited by design: detox
107
+ // rejects every in-flight atomic action as soon as a second is sent, so a background
108
+ // scan would fail the customer's NEXT command.
109
+ async _a11yScan(driverMethod) {
110
+ if (!a11y.enabled()) {
111
+ return;
112
+ }
113
+ const command = a11y.commandNameFor('RuntimeDevice', A11Y_DEVICE_COMMANDS[driverMethod]);
114
+ if (!command) {
115
+ return;
116
+ }
117
+ await a11y.scan(this.client, command.name, a11y.currentTestUuid());
118
+ }
119
+
120
+ getPlatform() {
121
+ return 'android';
122
+ }
123
+
124
+ getUiDevice() {
125
+ return this.uiDevice;
126
+ }
127
+
128
+ _cloud(method, extra) {
129
+ return executeCloudPlatform(this.client, method, extra);
130
+ }
131
+
132
+ // Retries the initial launch (AAP-20137: the cloud bridge occasionally rejects the
133
+ // first launchApp instantly), terminating between attempts.
134
+ async launchApp(bundleId, launchArgs, languageAndLocale) { // eslint-disable-line no-unused-vars
135
+ if (!this.instrumentation) {
136
+ let lastErr;
137
+ let launched;
138
+ for (let attempt = 1; attempt <= LAUNCH_RETRIES; attempt++) {
139
+ try {
140
+ launched = await this._cloud('launchApp', {launchArgs: launchArgs || {}});
141
+ this.instrumentation = true;
142
+ break;
143
+ } catch (err) {
144
+ lastErr = err;
145
+ try {
146
+ await this._cloud('terminateApp');
147
+ } catch (ignored) { /* best-effort reset before retry */ }
148
+ }
149
+ }
150
+ if (!this.instrumentation) {
151
+ throw lastErr;
152
+ }
153
+ // Outside the retry loop on purpose: a scan raising inside the try would be read as
154
+ // a failed launch and trigger a terminate+retry of an app that is already up.
155
+ await this._a11yScan('launchApp');
156
+
157
+ return _.get(launched, 'response.pid') || 0;
158
+ } else if (launchArgs && launchArgs.detoxURLOverride) {
159
+ const res = await this._startActivityWithUrl(launchArgs.detoxURLOverride);
160
+ await this._a11yScan('launchApp');
161
+
162
+ return res;
163
+ }
164
+
165
+ const resumed = await this._resumeMainActivity();
166
+ await this._a11yScan('launchApp');
167
+
168
+ return resumed;
169
+ }
170
+
171
+ async terminate(bundleId) { // eslint-disable-line no-unused-vars
172
+ const res = await this._cloud('terminateApp');
173
+ this.instrumentation = false;
174
+ try {
175
+ await this.client.waitUntilDisconnected();
176
+ } catch (ignored) { /* socket may already be closed */ }
177
+
178
+ return res;
179
+ }
180
+
181
+ async deliverPayload(params) {
182
+ if (params && params.delayPayload) {
183
+ return;
184
+ }
185
+ if (params && params.url) {
186
+ await this._startActivityWithUrl(params.url);
187
+ await this._a11yScan('deliverPayload');
188
+ }
189
+ }
190
+
191
+ async waitUntilReady() {
192
+ try {
193
+ await super.waitUntilReady();
194
+ } catch (err) {
195
+ try {
196
+ await this.client.waitUntilDisconnected();
197
+ } catch (ignored) { /* already disconnected */ }
198
+ throw err;
199
+ }
200
+ }
201
+
202
+ async pressBack() {
203
+ await this.uiDevice.pressBack();
204
+ await this._a11yScan('pressBack');
205
+ }
206
+
207
+ async sendToHome() {
208
+ await this.uiDevice.pressHome();
209
+ }
210
+
211
+ async enableSynchronization() {
212
+ await this.invocationManager.execute(EspressoDetoxApi.setSynchronization(true));
213
+ }
214
+
215
+ async disableSynchronization() {
216
+ await this.invocationManager.execute(EspressoDetoxApi.setSynchronization(false));
217
+ }
218
+
219
+ async setOrientation(orientation) {
220
+ await this.invocationManager.execute(EspressoDetoxApi.changeOrientation(ORIENTATION_MAP[orientation]));
221
+ await this._a11yScan('setOrientation');
222
+ }
223
+
224
+ // `device.tap()` / `device.longPress()` were SILENT NO-OPS on cloud: RuntimeDevice forwards
225
+ // both to the driver, and DeviceDriverBase's stubs just `return ''`. Stock detox's
226
+ // AndroidDriver drives them through Espresso, which works here unchanged — this driver already
227
+ // owns the same invocationManager — so these mirror it exactly, same defaults included. Fixing
228
+ // them also makes App Accessibility's served `deviceTap` / `deviceLongPress` scannable.
229
+ async tap(point, shouldIgnoreStatusBar) {
230
+ const x = orDefault(point && point.x, 100);
231
+ const y = orDefault(point && point.y, 100);
232
+ await this.invocationManager.execute(EspressoDetoxApi.tap(x, y, orDefault(shouldIgnoreStatusBar, true)));
233
+ await this._a11yScan('tap');
234
+ }
235
+
236
+ async longPress(point, duration, shouldIgnoreStatusBar) {
237
+ const x = orDefault(point && point.x, 100);
238
+ const y = orDefault(point && point.y, 100);
239
+ const ignoreStatusBar = orDefault(shouldIgnoreStatusBar, true);
240
+ // The duration-less overload is a different espresso arity, not a defaulted argument —
241
+ // passing an undefined duration through would not resolve.
242
+ await this.invocationManager.execute(duration
243
+ ? EspressoDetoxApi.longPress(x, y, duration, ignoreStatusBar)
244
+ : EspressoDetoxApi.longPress(x, y, ignoreStatusBar));
245
+ await this._a11yScan('longPress');
246
+ }
247
+
248
+ // The base implementation already works (it reloads over the WS bridge), so this exists only
249
+ // to scan afterwards — App Accessibility serves `reloadReactNative` as a command to wrap, and
250
+ // without this override it was the one served command that could never fire a scan.
251
+ async reloadReactNative() {
252
+ const result = await super.reloadReactNative();
253
+ await this._a11yScan('reloadReactNative');
254
+
255
+ return result;
256
+ }
257
+
258
+ // Detox's own AndroidDriver captures via `adb screencap` + `adb pull`, which needs a
259
+ // local device handle we do not have — the device is server-side. Instead this drives
260
+ // detox's in-app Espresso capture (TakeViewScreenshotAction draws the view onto a
261
+ // Bitmap and returns it base64-encoded over the existing invocation channel), so the
262
+ // bytes arrive in-process with no adb and no extra bridge command. Whole-screen
263
+ // capture is approximated by targeting the window root — see SCREENSHOT_ROOT_VIEWS.
264
+ //
265
+ // Returns '' when nothing could be captured: a missing screenshot must never fail a
266
+ // customer's test run.
267
+ async takeScreenshot(screenshotName) {
268
+ for (const viewClass of SCREENSHOT_ROOT_VIEWS) {
269
+ let base64Image;
270
+
271
+ try {
272
+ base64Image = await new ActionInteraction(
273
+ this.invocationManager,
274
+ new detoxMatchers.TypeMatcher(viewClass),
275
+ new detoxActions.TakeElementScreenshot(),
276
+ `take screenshot of ${viewClass}`
277
+ ).execute();
278
+ } catch (err) {
279
+ // No match, or ambiguous match, for this candidate — try the next one.
280
+ continue;
281
+ }
282
+
283
+ if (!base64Image) {
284
+ continue;
285
+ }
286
+
287
+ let filePath;
288
+ try {
289
+ // Written into the SDK-owned per-run directory when the SDK supplied one, so the
290
+ // post-run sweep can remove these files WITHOUT depending on the TRA capture
291
+ // stream — the PNG is written before the TRA gate below, so with reporting off the
292
+ // file still exists but never gets recorded anywhere.
293
+ const shotDir = process.env.BROWSERSTACK_DETOX_SCREENSHOT_DIR || os.tmpdir();
294
+ filePath = path.join(shotDir, `bstack-detox-screenshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}.png`);
295
+ fs.writeFileSync(filePath, base64Image, 'base64');
296
+ } catch (err) {
297
+ return '';
298
+ }
299
+
300
+ // Tee every capture to the TRA stream, the way the puppeteer/playwright patchers
301
+ // tee Page.screenshot. This is what makes a screenshot the CUSTOMER takes from a
302
+ // test body reach the dashboard too — not just the SDK's own failure capture —
303
+ // and it keeps the driver the single writer of screenshot records. The base64 is
304
+ // already in hand here, so nothing re-reads the file.
305
+ recordScreenshot({
306
+ base64: base64Image,
307
+ filePath,
308
+ name: screenshotName || path.basename(filePath, '.png')
309
+ });
310
+
311
+ // Registering the artifact is a courtesy to detox's own artifacts plugin, and
312
+ // must not be able to discard a screenshot we already hold: when the customer
313
+ // has no screenshot plugin configured, ArtifactsManager resolves no plugin for
314
+ // the id and throws `Cannot read properties of undefined (reading 'name')`.
315
+ // Its own failure domain, deliberately.
316
+ try {
317
+ await this.emitter.emit('createExternalArtifact', {
318
+ pluginId: 'screenshot',
319
+ artifactName: screenshotName || path.basename(filePath, '.png'),
320
+ artifactPath: filePath
321
+ });
322
+ } catch (err) { /* plugin not configured — the file on disk is what matters */ }
323
+
324
+ return filePath;
325
+ }
326
+
327
+ return '';
328
+ }
329
+
330
+ async installApp() {}
331
+
332
+ async uninstallApp() {}
333
+
334
+ async cleanup(bundleId) {
335
+ // Screenshot PNGs are deliberately NOT removed here. Device teardown runs inside the
336
+ // jest worker, before the SDK main process has read the capture stream and emitted
337
+ // TRA — and detox's own artifacts plugin may still copy the file. Their paths ride
338
+ // the capture records, and the SDK sweeps them in its post-run artifact cleanup.
339
+ await super.cleanup(bundleId);
340
+ }
341
+
342
+ _startActivityWithUrl(url) {
343
+ return this.invocationManager.execute(DetoxApi.startActivityFromUrl(url));
344
+ }
345
+
346
+ _resumeMainActivity() {
347
+ return this.invocationManager.execute(DetoxApi.launchMainActivity());
348
+ }
349
+ }
350
+
351
+ module.exports = CloudRuntimeDriver;
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ // Lightweight jest reporter — runs inside the detox jest process, NOT the SDK.
4
+ // Records each spec file's verdict + a per-session name so the SDK's detox command
5
+ // can mark each BrowserStack session individually (Detox opens one cloud session per
6
+ // spec file). Deliberately imports nothing from the SDK index (that deadlocks the
7
+ // detox worker); only fs/path. Best-effort throughout — a reporter failure must never
8
+ // affect the customer's test run.
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ const sessionNameFromPath = (testPath) => path.basename(String(testPath))
13
+ .replace(/\.(test|spec)\.[jt]sx?$/i, '')
14
+ .replace(/\.[jt]sx?$/i, '');
15
+
16
+ class BrowserStackDetoxReporter {
17
+ constructor(globalConfig, options) {
18
+ this._file = (options && options.resultsFile) || process.env.BROWSERSTACK_DETOX_TEST_RESULTS_FILE || '';
19
+ }
20
+
21
+ onTestResult(test, testResult) {
22
+ try {
23
+ if (!this._file || !test || !test.path) {
24
+ return;
25
+ }
26
+ const failed = Boolean(
27
+ (testResult && testResult.numFailingTests > 0) ||
28
+ (testResult && testResult.testExecError)
29
+ );
30
+ const record = {
31
+ path: test.path,
32
+ status: failed ? 'failed' : 'passed',
33
+ name: sessionNameFromPath(test.path)
34
+ };
35
+ fs.appendFileSync(this._file, JSON.stringify(record) + '\n');
36
+ } catch (err) { /* best-effort: never break the run */ }
37
+ }
38
+ }
39
+
40
+ module.exports = BrowserStackDetoxReporter;
41
+ module.exports.sessionNameFromPath = sessionNameFromPath;
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ // TRA capture tap — runs inside the detox jest process (Node realm), NOT the SDK.
4
+ // Same realm rules as session-reporter: node builtins only (fs/crypto), best-effort
5
+ // throughout — a capture failure must never affect the customer's test run. Records
6
+ // are appended as JSONL to the per-slot file the SDK main process created; the
7
+ // emitter consumes them as an ordered record stream, so the same contract works
8
+ // whether records arrive post-hoc (file) or live (a future streaming transport).
9
+ const fs = require('fs');
10
+ const crypto = require('crypto');
11
+
12
+ const eventsFile = () => process.env.BROWSERSTACK_DETOX_TRA_EVENTS_FILE || '';
13
+
14
+ const enabled = () => Boolean(eventsFile());
15
+
16
+ const mintUuid = () => {
17
+ try {
18
+ return crypto.randomUUID();
19
+ } catch (err) {
20
+ return `bstack-${Date.now()}-${Math.random().toString(16).slice(2)}`;
21
+ }
22
+ };
23
+
24
+ const append = (record) => {
25
+ try {
26
+ const file = eventsFile();
27
+ if (!file || !record) {
28
+ return;
29
+ }
30
+ fs.appendFileSync(file, JSON.stringify(record) + '\n');
31
+ } catch (err) { /* best-effort: never break the run */ }
32
+ };
33
+
34
+ // jest-circus errors arrive as entries that may themselves be [error, asyncError]
35
+ // pairs; flatten to printable strings.
36
+ const serializeErrors = (errors) => {
37
+ try {
38
+ if (!errors || !errors.length) {
39
+ return undefined;
40
+ }
41
+ const flat = [];
42
+ errors.forEach((entry) => {
43
+ const parts = Array.isArray(entry) ? entry : [entry];
44
+ parts.forEach((err) => {
45
+ if (err) {
46
+ flat.push(String((err && (err.stack || err.message)) || err));
47
+ }
48
+ });
49
+ });
50
+
51
+ return flat.length ? flat.slice(0, 5) : undefined;
52
+ } catch (err) {
53
+ return undefined;
54
+ }
55
+ };
56
+
57
+ // Walk a circus test/hook's describe chain to build outer-to-inner scopes,
58
+ // excluding the synthetic root block.
59
+ const scopesOf = (node) => {
60
+ const scopes = [];
61
+ try {
62
+ let parent = node && node.parent;
63
+ while (parent && parent.name && parent.name !== 'ROOT_DESCRIBE_BLOCK') {
64
+ scopes.unshift(String(parent.name));
65
+ parent = parent.parent;
66
+ }
67
+ } catch (err) { /* best-effort */ }
68
+
69
+ return scopes;
70
+ };
71
+
72
+ // console arguments can be circular or huge; never let serialisation throw.
73
+ const safeStringify = (value) => {
74
+ try {
75
+ return typeof value === 'string' ? value : JSON.stringify(value);
76
+ } catch (err) {
77
+ return String(value);
78
+ }
79
+ };
80
+
81
+ module.exports = {enabled, mintUuid, append, serializeErrors, scopesOf, safeStringify};
@@ -1 +1 @@
1
- const a123_0x30d9ba=a123_0x27d6;function a123_0x27d6(_0x3d8ffd,_0x5cef58){const _0x5a2ae4=a123_0x5a2a();return a123_0x27d6=function(_0x27d69c,_0x71641f){_0x27d69c=_0x27d69c-0x8e;let _0x53c30c=_0x5a2ae4[_0x27d69c];return _0x53c30c;},a123_0x27d6(_0x3d8ffd,_0x5cef58);}(function(_0x22ca3b,_0x3c2e6e){const _0x544b85=a123_0x27d6,_0x43743e=_0x22ca3b();while(!![]){try{const _0x361f0a=-parseInt(_0x544b85(0x147))/0x1*(parseInt(_0x544b85(0x131))/0x2)+-parseInt(_0x544b85(0xc1))/0x3+-parseInt(_0x544b85(0x99))/0x4*(-parseInt(_0x544b85(0xd7))/0x5)+-parseInt(_0x544b85(0xe3))/0x6*(parseInt(_0x544b85(0x96))/0x7)+-parseInt(_0x544b85(0x118))/0x8*(-parseInt(_0x544b85(0x12f))/0x9)+parseInt(_0x544b85(0xfd))/0xa+parseInt(_0x544b85(0xe2))/0xb*(parseInt(_0x544b85(0x154))/0xc);if(_0x361f0a===_0x3c2e6e)break;else _0x43743e['push'](_0x43743e['shift']());}catch(_0x430e1a){_0x43743e['push'](_0x43743e['shift']());}}}(a123_0x5a2a,0xea8ad));const util=require(a123_0x30d9ba(0x149)),path=require(a123_0x30d9ba(0x12d)),{v4:uuidv4}=require('uuid'),fs=require('fs'),constants=require('../bin/utils/constants'),logger=require('./logger')['winstonLogger'],fileLogger=require('./logger')[a123_0x30d9ba(0xfa)],{getLogDir}=require('./logger'),helper=require(a123_0x30d9ba(0x176)),utilities=require(a123_0x30d9ba(0xb0)),percyHelper=require(a123_0x30d9ba(0xee)),hubAllocator=require(a123_0x30d9ba(0x166)),PerformanceTester=require(a123_0x30d9ba(0xfc)),{EVENTS:PerformanceEvents,AUTOMATE_EVENTS:PerformanceAutEvents}=require('./performance/constants'),{setPercyFlag}=require(a123_0x30d9ba(0xfe)),TestHubHandler=require(a123_0x30d9ba(0x106)),BrowserstackCLI=require(a123_0x30d9ba(0x157)),LoadTestModule=require(a123_0x30d9ba(0x155)),{getEdsInstrumentationAPIUrl}=require('../bin/utils/apiUtilityMethods'),ClientTroubleShootingService=require('../bin/utils/clientTroubleshootingService');class BrowserStackSetup{constructor(_0x3c73be,_0x2d729d){const _0x468ffd=a123_0x30d9ba,_0x45e170={'kZlIF':_0x468ffd(0xe6),'paRTY':function(_0x12ce3b,_0x4fa186){return _0x12ce3b(_0x4fa186);},'NdiMv':_0x468ffd(0x11d),'ozvHt':_0x468ffd(0x16f),'ZIOxf':function(_0x101f16){return _0x101f16();}},_0x3e3cbf=_0x45e170[_0x468ffd(0x15a)][_0x468ffd(0xb3)]('|');let _0x1e2feb=0x0;while(!![]){switch(_0x3e3cbf[_0x1e2feb++]){case'0':this[_0x468ffd(0x104)]=null;continue;case'1':if(this['config'][_0x468ffd(0xe0)])throw new Error(this[_0x468ffd(0x182)][_0x468ffd(0xe0)]);continue;case'2':helper['setSmartTestSelectionFeatureBranchesConfig'](this['config'],this['cliConfig'],this[_0x468ffd(0xed)]);continue;case'3':this[_0x468ffd(0xda)]=null;continue;case'4':this[_0x468ffd(0x182)]['testContextOptions'][_0x468ffd(0xb7)]=!helper[_0x468ffd(0xb4)]()||helper[_0x468ffd(0x146)](this[_0x468ffd(0x182)][_0x468ffd(0x134)][_0x468ffd(0xb7)]);continue;case'5':this[_0x468ffd(0xed)]=helper[_0x468ffd(0x14c)]();continue;case'6':this['errorMessage']={};continue;case'7':this['config']['testContextOptions']['skipSessionStatus']=!helper[_0x468ffd(0xb4)]()||helper[_0x468ffd(0x146)](this[_0x468ffd(0x182)]['testContextOptions'][_0x468ffd(0x94)]);continue;case'8':helper[_0x468ffd(0xad)]();continue;case'9':helper[_0x468ffd(0x92)](this['config'],this[_0x468ffd(0x126)]);continue;case'10':try{_0x45e170['paRTY'](require,_0x45e170[_0x468ffd(0x174)])[_0x468ffd(0x129)](this[_0x468ffd(0x182)],logger);}catch(_0x51442e){}continue;case'11':this['framework']=_0x2d729d;continue;case'12':helper[_0x468ffd(0x9f)](this[_0x468ffd(0x182)],this['cliConfig'],this[_0x468ffd(0xed)]);continue;case'13':if(helper[_0x468ffd(0x110)](this[_0x468ffd(0x182)]))throw new Error(_0x45e170[_0x468ffd(0x9d)]);continue;case'14':this[_0x468ffd(0x182)]=helper[_0x468ffd(0x13b)](this[_0x468ffd(0x17f)]);continue;case'15':this[_0x468ffd(0x182)][_0x468ffd(0xe5)]=this[_0x468ffd(0x182)][_0x468ffd(0xe5)]||[];continue;case'16':helper[_0x468ffd(0x140)](this[_0x468ffd(0x182)],this[_0x468ffd(0x10d)]);continue;case'17':this[_0x468ffd(0xb1)]=[];continue;case'18':helper[_0x468ffd(0x150)](this[_0x468ffd(0x182)]);continue;case'19':this[_0x468ffd(0x126)]=helper[_0x468ffd(0x133)](_0x3c73be);continue;case'20':helper[_0x468ffd(0xc3)](this[_0x468ffd(0x182)]);continue;case'21':this[_0x468ffd(0x17f)]=helper['getConfigPath'](_0x3c73be);continue;case'22':this['sdkRunId']=_0x45e170[_0x468ffd(0x116)](uuidv4);continue;case'23':this['config'][_0x468ffd(0x134)]=this['config'][_0x468ffd(0x134)]||{};continue;case'24':PerformanceTester[_0x468ffd(0x151)]();continue;case'25':helper['setLogLevel'](this['config'],this[_0x468ffd(0x126)],this['envConfig']);continue;case'26':global['framework']=_0x2d729d;continue;}break;}}['preInitialize'](_0xfe3c7f){const _0x404415=a123_0x30d9ba,_0x391d5b={'sDzXD':_0x404415(0x11a),'NekTF':function(_0x4eda55,_0x1cb0a4){return _0x4eda55===_0x1cb0a4;},'SHFIm':function(_0xabfa0b,_0x28513d){return _0xabfa0b===_0x28513d;},'cLmPK':_0x404415(0xa1),'wPsTl':_0x404415(0x14a),'simzr':function(_0x5b9f05,_0x987487){return _0x5b9f05<_0x987487;},'bhGes':function(_0x5c8f79,_0x9b241a){return _0x5c8f79(_0x9b241a);},'ZCuys':_0x404415(0x145),'PRjTp':_0x404415(0x167),'rGLpC':_0x404415(0x122),'vRWVW':_0x404415(0xbf),'TMfkn':'SIGTERM','UsvKU':_0x404415(0x156),'rKyvN':'SIGHUP','gJxGM':function(_0x58606e,_0x46a3e5){return _0x58606e!==_0x46a3e5;},'hzAYJ':_0x404415(0x173),'LrekR':'SIGABRT','axzxB':_0x404415(0x142),'IAFpn':_0x404415(0xdb),'prWDj':_0x404415(0x179)},_0x287030=this[_0x404415(0x10d)];global['config']=this[_0x404415(0x182)],helper[_0x404415(0x132)](this[_0x404415(0x182)]),this[_0x404415(0x171)]=null,global['sdkRunId']=this['sdkRunId'],logger[_0x404415(0x163)](_0x404415(0xd5)+this[_0x404415(0x17e)]),!this[_0x404415(0x182)]['browserStackLocalOptions']&&(this[_0x404415(0x182)][_0x404415(0xcd)]=this['config'][_0x404415(0x95)]||{});if(helper[_0x404415(0x110)](helper[_0x404415(0xea)](this['config']))||helper[_0x404415(0x110)](helper[_0x404415(0x12a)](this[_0x404415(0x182)])))throw new Error(_0x391d5b['sDzXD']);helper[_0x404415(0x14d)](this['config'])&&helper[_0x404415(0x110)](helper[_0x404415(0x97)](this[_0x404415(0x182)]))&&(!helper[_0x404415(0x110)](this[_0x404415(0x182)][_0x404415(0xcd)])&&_0x391d5b['NekTF'](this[_0x404415(0x182)]['browserStackLocalOptions'][_0x404415(0xce)],Object)?!helper[_0x404415(0x146)](this['config']['browserStackLocalOptions']['skipBinaryInitialisation'])&&(this[_0x404415(0x182)][_0x404415(0xcd)][_0x404415(0xb9)]=helper[_0x404415(0x128)]()):this['config']['browserStackLocalOptions']={'localIdentifier':helper[_0x404415(0x128)]()});this[_0x404415(0x182)][_0x404415(0xcd)][_0x404415(0x115)]=helper[_0x404415(0x146)](this['config'][_0x404415(0xcd)][_0x404415(0x115)]),helper[_0x404415(0x98)](this[_0x404415(0x182)]);if(_0x391d5b[_0x404415(0xcb)](_0x287030,_0x391d5b['cLmPK']))return;this[_0x404415(0xd1)]();process[_0x404415(0x124)][_0x404415(0xc2)]&&(this['config']['turboScale']=helper[_0x404415(0x146)](process[_0x404415(0x124)][_0x404415(0xc2)]),this[_0x404415(0x182)][_0x404415(0xf5)]=this[_0x404415(0x182)][_0x404415(0xf5)]||{});helper[_0x404415(0x11f)](this[_0x404415(0x182)])&&(process[_0x404415(0x124)]['BROWSERSTACK_TURBOSCALE']=!![]);LoadTestModule[_0x404415(0xa3)](this['config'])&&logger['debug'](_0x404415(0xc4)+this['sdkRunId']);if(!helper[_0x404415(0xb4)]()){try{process[_0x404415(0x124)][_0x404415(0x170)]=_0x287030,utilities[_0x404415(0xf6)](_0x391d5b['wPsTl'],{},this[_0x404415(0x182)],this[_0x404415(0x10d)]);}catch(_0x22a899){logger[_0x404415(0x17a)](_0x404415(0x10e)+_0x22a899);}return;}if(helper[_0x404415(0x105)](_0x287030)){if(global[_0x404415(0x16c)]||global[_0x404415(0x138)])return;_0x391d5b[_0x404415(0x15e)](_0x391d5b[_0x404415(0xab)](parseInt,helper['getPackageVersion'](_0x391d5b[_0x404415(0xf9)])),0x3)&&(this[_0x404415(0x182)][_0x404415(0xe9)]=![]),_0x391d5b[_0x404415(0xcb)](helper[_0x404415(0x125)](helper[_0x404415(0xaa)](_0x391d5b[_0x404415(0xf9)]),_0x391d5b[_0x404415(0x158)]),0x1)&&(this[_0x404415(0x182)][_0x404415(0xe9)]=!![]);}(helper[_0x404415(0x110)](this[_0x404415(0x182)][_0x404415(0xe5)])||helper[_0x404415(0x110)](this[_0x404415(0x182)][_0x404415(0xe5)][_0x404415(0x17d)]))&&(helper[_0x404415(0x110)](this[_0x404415(0x182)][_0x404415(0xf8)])?logger[_0x404415(0x163)](_0x391d5b[_0x404415(0x15f)]):logger['warn'](_0x391d5b[_0x404415(0x164)]),this['config']['platforms']=[]);!this[_0x404415(0x182)][_0x404415(0x134)]&&(this[_0x404415(0x182)][_0x404415(0x134)]={});try{process['env'][_0x404415(0x170)]=_0xfe3c7f['_'][0x0],utilities[_0x404415(0xf6)](_0x391d5b[_0x404415(0x121)],{},this['config'],this['framework']);}catch(_0x5e5c18){logger[_0x404415(0x17a)](_0x404415(0x10e)+_0x5e5c18);}!this['config'][_0x404415(0xd9)]&&logger[_0x404415(0x163)](constants[_0x404415(0x165)]),this[_0x404415(0xa5)]=this['intExitHandler'][_0x404415(0x137)](this),process['on'](_0x391d5b['TMfkn'],this[_0x404415(0xa5)]),process['on'](_0x391d5b[_0x404415(0x10f)],this[_0x404415(0xa5)]),process['on'](_0x391d5b[_0x404415(0xa9)],this[_0x404415(0xa5)]),_0x391d5b[_0x404415(0x181)](process[_0x404415(0xc8)],_0x391d5b[_0x404415(0x143)])?(process['on'](_0x391d5b[_0x404415(0x12b)],this[_0x404415(0xa5)]),process['on'](_0x391d5b[_0x404415(0x91)],this['intExitHandler'])):process['on'](_0x391d5b['IAFpn'],this[_0x404415(0xa5)]),process['on'](_0x391d5b['prWDj'],this[_0x404415(0x130)]());}async[a123_0x30d9ba(0xb5)](_0x22f895){const _0x224aea=a123_0x30d9ba,_0x5ea278={'PDVxg':'ats-repeater','xwVik':_0x224aea(0xc6),'QttsS':_0x224aea(0xa8),'kbHHH':function(_0x4e9e74,_0x21152a){return _0x4e9e74===_0x21152a;},'iGofQ':_0x224aea(0xd3),'xGyIB':function(_0x58e4e3,_0x52fb36){return _0x58e4e3+_0x52fb36;},'AEcle':'?caps=','oIvOV':function(_0x235498,_0x1524f2){return _0x235498(_0x1524f2);},'AbLCI':_0x224aea(0xe8)};this[_0x224aea(0xb6)](_0x22f895);if(helper[_0x224aea(0x11f)](this[_0x224aea(0x182)])){const _0x1b3d71=await helper[_0x224aea(0xff)](this['config']);this['config'][_0x224aea(0xa0)]=_0x1b3d71,_0x1b3d71[_0x224aea(0x15b)]&&helper[_0x224aea(0xd4)](this[_0x224aea(0x182)][_0x224aea(0xda)])&&helper['isTrue'](this[_0x224aea(0x182)]['browserstackLocal'])&&(this[_0x224aea(0x182)][_0x224aea(0xcd)][_0x224aea(0xb9)]=_0x5ea278['PDVxg'],this[_0x224aea(0x182)][_0x224aea(0xcd)][_0x5ea278[_0x224aea(0x13c)]]=_0x1b3d71[_0x224aea(0xae)][_0x224aea(0x13a)](','),this[_0x224aea(0x182)][_0x224aea(0xcd)][_0x224aea(0x169)]=_0x5ea278[_0x224aea(0x108)]),this[_0x224aea(0x182)][_0x224aea(0xbc)]=_0x1b3d71[_0x224aea(0x11b)],this[_0x224aea(0x10d)]&&_0x5ea278['kbHHH'](this['framework'][_0x224aea(0xec)](),_0x5ea278[_0x224aea(0x14e)])?this[_0x224aea(0x182)][_0x224aea(0xbc)]=_0x5ea278[_0x224aea(0xb8)](_0x1b3d71[_0x224aea(0x172)],_0x5ea278['AEcle']):constants[_0x224aea(0xd2)]=helper[_0x224aea(0xba)](this[_0x224aea(0x182)]),logger[_0x224aea(0x17a)](_0x224aea(0xca)+constants['hubUrl']);}helper['setProxySettings'](this[_0x224aea(0x182)]),this[_0x224aea(0xac)](),_0x5ea278[_0x224aea(0xc5)](setPercyFlag,this),![_0x5ea278[_0x224aea(0xc7)],_0x5ea278['iGofQ']]['includes'](this['framework'])&&!helper['isTurboScaleSession'](this['config'])&&!helper[_0x224aea(0x14f)]()[_0x224aea(0x112)]&&await this[_0x224aea(0x90)]();}async[a123_0x30d9ba(0x178)](){const _0x52e107=a123_0x30d9ba,_0x321859={};_0x321859[_0x52e107(0x100)]=function(_0x554898,_0x5668c2){return _0x554898===_0x5668c2;},_0x321859['JWcOh']=_0x52e107(0x109),_0x321859[_0x52e107(0xbb)]=_0x52e107(0xeb),_0x321859['GxqBS']=_0x52e107(0x183),_0x321859[_0x52e107(0x180)]=_0x52e107(0xa8),_0x321859[_0x52e107(0xa2)]=_0x52e107(0x179);const _0x1774e5=_0x321859;if(helper[_0x52e107(0x146)](this[_0x52e107(0x182)]['percy'])&&(!this[_0x52e107(0x104)]||!this[_0x52e107(0x104)][_0x52e107(0xd8)]()))try{this[_0x52e107(0x104)]=await percyHelper['startPercy'](this['config']);if(!this[_0x52e107(0x104)]){process[_0x52e107(0x124)]['BROWSERSTACK_PERCY']=_0x1774e5[_0x52e107(0x11c)];throw new Error(_0x1774e5[_0x52e107(0xbb)]);}logger[_0x52e107(0x163)](_0x1774e5['GxqBS']),process[_0x52e107(0x124)][_0x52e107(0x12c)]=_0x1774e5['ZIWGV'];let _0x52d766=0x0;const _0x535530=async()=>{const _0x2d9f14=_0x52e107;_0x52d766++,_0x1774e5[_0x2d9f14(0x100)](_0x52d766,0x1)&&await this[_0x2d9f14(0x15c)]();};process['on'](_0x1774e5[_0x52e107(0xa2)],_0x535530);}catch(_0x19a4f4){process['env']['BROWSERSTACK_PERCY']=_0x1774e5['JWcOh'],logger[_0x52e107(0x17a)](_0x52e107(0xdd)+_0x19a4f4);throw new Error(_0x19a4f4[_0x52e107(0xaf)]());}}async['stopPercy'](){const _0x4860e4=a123_0x30d9ba,_0x249182={};_0x249182['uMEvP']=_0x4860e4(0x107),_0x249182[_0x4860e4(0x16d)]='Error\x20occured\x20while\x20stopping\x20percy';const _0x193ed2=_0x249182;if(this[_0x4860e4(0x104)]&&this[_0x4860e4(0x104)][_0x4860e4(0xd8)]())try{await percyHelper[_0x4860e4(0x15c)](this[_0x4860e4(0x104)]),logger[_0x4860e4(0x163)](_0x193ed2['uMEvP']);}catch(_0x17b905){logger[_0x4860e4(0xe0)](_0x193ed2[_0x4860e4(0x16d)],_0x17b905[_0x4860e4(0xbd)]);}}async[a123_0x30d9ba(0x136)](){const _0x1f7d40=a123_0x30d9ba,_0x27fb0c={};_0x27fb0c['OGFvI']=_0x1f7d40(0x8f),_0x27fb0c[_0x1f7d40(0x160)]=_0x1f7d40(0x114);const _0x249555=_0x27fb0c;if(helper['isBrowserstackInfra']()&&helper[_0x1f7d40(0x146)](this[_0x1f7d40(0x182)][_0x1f7d40(0xda)])&&(!this[_0x1f7d40(0xda)]||!this[_0x1f7d40(0xda)][_0x1f7d40(0xd8)]()))try{if(this[_0x1f7d40(0x182)][_0x1f7d40(0xcd)][_0x1f7d40(0x115)]){logger[_0x1f7d40(0x17a)](_0x249555['OGFvI']);return;}this['browserstackLocal']=await helper[_0x1f7d40(0x175)](this[_0x1f7d40(0x182)]),logger[_0x1f7d40(0x163)](_0x249555[_0x1f7d40(0x160)]);}catch(_0x2ccc78){logger[_0x1f7d40(0x17a)](_0x2ccc78);throw new Error(_0x2ccc78[_0x1f7d40(0xaf)]());}}async['stopBrowserstackLocal'](){const _0xf7cd1e=a123_0x30d9ba,_0x50c381={};_0x50c381[_0xf7cd1e(0xb2)]='Local\x20binary\x20stopped',_0x50c381['IkJvw']='Error\x20occured\x20while\x20stopping\x20local\x20binary';const _0x44c861=_0x50c381;if(this['browserstackLocal']&&this['browserstackLocal'][_0xf7cd1e(0xd8)]())try{await helper['stopLocalBinary'](this['browserstackLocal']),logger['info'](_0x44c861[_0xf7cd1e(0xb2)]);}catch(_0xcd72f1){logger['error'](_0x44c861[_0xf7cd1e(0x9a)],_0xcd72f1[_0xf7cd1e(0xbd)]);}}async[a123_0x30d9ba(0x90)](){const _0xe44abb=a123_0x30d9ba;return PerformanceTester[_0xe44abb(0x102)](PerformanceAutEvents[_0xe44abb(0xde)],async()=>{const _0xc3a7ca=_0xe44abb;await hubAllocator[_0xc3a7ca(0x159)](this['config']);})();}[a123_0x30d9ba(0xac)](){const _0x11ab8d=a123_0x30d9ba,_0x10d4fa={'tybkD':function(_0x1d5d37,_0x225638){return _0x1d5d37(_0x225638);},'QLChx':_0x11ab8d(0xf0)};_0x10d4fa[_0x11ab8d(0x13e)](require,_0x10d4fa[_0x11ab8d(0x17b)])();}['handleExceptions'](){const _0x1aa4c0=a123_0x30d9ba,_0x1bd218={};_0x1bd218[_0x1aa4c0(0x16a)]=_0x1aa4c0(0x13d),_0x1bd218[_0x1aa4c0(0xa7)]=_0x1aa4c0(0xbe),_0x1bd218['TLoeD']=_0x1aa4c0(0xcc);const _0xe6378b=_0x1bd218,_0x33c5c7=_0x1aee62=>{const _0x5f14b8=_0x1aa4c0,_0x55e5ec=_0xe6378b[_0x5f14b8(0x16a)][_0x5f14b8(0xb3)]('|');let _0x54e93e=0x0;while(!![]){switch(_0x55e5ec[_0x54e93e++]){case'0':logger[_0x5f14b8(0x17a)](util[_0x5f14b8(0x14b)](_0x1aee62));continue;case'1':PerformanceTester['captureError'](_0x1aee62);continue;case'2':ClientTroubleShootingService[_0x5f14b8(0x119)]();continue;case'3':logger[_0x5f14b8(0xe0)](_0x1aee62[_0x5f14b8(0xbd)]);continue;case'4':this[_0x5f14b8(0xb1)][_0x5f14b8(0x17c)](util[_0x5f14b8(0x14b)]('%j',_0x1aee62));continue;}break;}};process['on'](_0xe6378b[_0x1aa4c0(0xa7)],_0x33c5c7),process['on'](_0xe6378b['TLoeD'],_0x33c5c7);}async[a123_0x30d9ba(0xa5)](_0x4920cd){const _0x5a894b=a123_0x30d9ba,_0x48935c={'niFZJ':function(_0x1fecd0,_0x3346c9){return _0x1fecd0+_0x3346c9;},'XosEM':_0x5a894b(0x11e),'OLIyK':_0x5a894b(0xcf),'UxFey':function(_0xadea67,_0x2dbe3e,_0x23d605){return _0xadea67(_0x2dbe3e,_0x23d605);},'fmxcp':_0x5a894b(0x139),'GgXbl':function(_0x8c0112,_0x210535){return _0x8c0112+_0x210535;},'VOfxu':_0x5a894b(0x168),'rQWjf':function(_0x10a2f9,_0x1ddb35){return _0x10a2f9(_0x1ddb35);},'ESHLz':function(_0x3673bc,_0x264ca0){return _0x3673bc===_0x264ca0;},'jUFhW':_0x5a894b(0xe1),'kRxtR':function(_0x212f14,_0x2e02ee){return _0x212f14+_0x2e02ee;},'liKYm':function(_0x4a5dbd,_0x37e2ed){return _0x4a5dbd+_0x37e2ed;},'aHWuE':_0x5a894b(0x177),'iunAz':_0x5a894b(0xf3)};if(this[_0x48935c[_0x5a894b(0xf4)](_0x48935c[_0x5a894b(0x144)],_0x4920cd)])return;this[_0x48935c[_0x5a894b(0xf4)](_0x48935c['fmxcp'],_0x4920cd)]=!![],logger['info'](_0x48935c['GgXbl'](_0x48935c[_0x5a894b(0x152)],_0x4920cd)),this[_0x5a894b(0x171)]=_0x4920cd;const _0x53027b=0x7530;let _0x5d8869;const _0x205515=(async()=>{const _0x2216df=_0x5a894b;await ClientTroubleShootingService[_0x2216df(0xe7)](_0x4920cd),await TestHubHandler[_0x2216df(0xd0)](_0x4920cd);const _0x1129d3=BrowserstackCLI[_0x2216df(0x9e)]();await utilities['finalExecution'](this,_0x1129d3?_0x1129d3[_0x2216df(0xd8)]():![]),await ClientTroubleShootingService[_0x2216df(0x119)](),await BrowserstackCLI[_0x2216df(0x9e)]()[_0x2216df(0xd0)]();})()[_0x5a894b(0x123)](()=>_0x5a894b(0xcf))[_0x5a894b(0x9b)](_0x5b6c76=>{const _0x3d1512=_0x5a894b;return logger[_0x3d1512(0x17a)](_0x48935c['niFZJ'](_0x48935c[_0x3d1512(0x93)],util[_0x3d1512(0x14b)](_0x5b6c76))),_0x48935c[_0x3d1512(0xd6)];}),_0x11675b=new Promise(_0x49ead5=>{const _0x446459=_0x5a894b;_0x5d8869=_0x48935c['UxFey'](setTimeout,()=>_0x49ead5(_0x446459(0xe1)),_0x53027b),_0x5d8869[_0x446459(0xfb)]&&_0x5d8869['unref']();}),_0x392960=await Promise[_0x5a894b(0x10b)]([_0x205515,_0x11675b]);_0x48935c[_0x5a894b(0x101)](clearTimeout,_0x5d8869),_0x48935c[_0x5a894b(0xef)](_0x392960,_0x48935c[_0x5a894b(0x8e)])&&logger[_0x5a894b(0x162)](_0x48935c[_0x5a894b(0x117)](_0x48935c[_0x5a894b(0x161)](_0x48935c[_0x5a894b(0x16e)],_0x53027b),_0x48935c[_0x5a894b(0x184)])),process[_0x5a894b(0xc0)](process[_0x5a894b(0xdc)]||_0x48935c[_0x5a894b(0xf4)](0x80,constants['SIGNAL_EXIT_CODES'][_0x4920cd]||0x0));}[a123_0x30d9ba(0x130)](){const _0x52a7d3=a123_0x30d9ba,_0x3b4008={'cRnBt':function(_0x10cbd5,_0x4e0498){return _0x10cbd5===_0x4e0498;},'qEOWk':'Calling\x20Build\x20Stop\x20from\x20ExitHandler','LBMSI':function(_0x2a63d1,_0x44dd0b){return _0x2a63d1>_0x44dd0b;},'hTLRj':function(_0x540a2c,_0x47ebc7){return _0x540a2c(_0x47ebc7);},'OQeGS':function(_0x57c85e){return _0x57c85e();},'wvsHg':_0x52a7d3(0xf1)};let _0x2df17c=0x0;return async()=>{const _0x547a99=_0x52a7d3;_0x2df17c++;if(_0x3b4008['cRnBt'](_0x2df17c,0x1)){helper[_0x547a99(0x12e)](this['framework'])&&await this[_0x547a99(0x103)]();try{logger['debug'](_0x3b4008[_0x547a99(0x153)]),await TestHubHandler['stop'](_0x2df17c),await ClientTroubleShootingService[_0x547a99(0x119)](),await BrowserstackCLI[_0x547a99(0x9e)]()[_0x547a99(0xd0)]('1');}catch(_0x2712a8){logger['debug'](_0x547a99(0x148)+util['format'](_0x2712a8));}PerformanceTester[_0x547a99(0x9c)](PerformanceEvents['SDK_CLEANUP']);if(PerformanceTester[_0x547a99(0x135)]()){const {measures:_0x42d4f7,errors:_0x2cf308}=await PerformanceTester[_0x547a99(0x127)](),_0x465172={};if(_0x42d4f7&&_0x3b4008['LBMSI'](_0x42d4f7[_0x547a99(0x17d)],0x0)||_0x2cf308&&_0x3b4008[_0x547a99(0x15d)](_0x2cf308[_0x547a99(0x17d)],0x0)){const _0x356eaa={};_0x356eaa[_0x547a99(0xe4)]=_0x42d4f7,_0x356eaa[_0x547a99(0xa4)]=_0x2cf308,Object[_0x547a99(0xa6)](_0x465172,_0x356eaa);}try{const _0x4abd40=await helper[_0x547a99(0xf7)](_0x465172,this[_0x547a99(0x182)]);logger[_0x547a99(0x17a)](_0x547a99(0xdf)+_0x3b4008['hTLRj'](getEdsInstrumentationAPIUrl,'')+_0x547a99(0xf2)+_0x4abd40[_0x547a99(0x113)]);}catch(_0x35d49c){logger[_0x547a99(0x17a)](_0x547a99(0x16b)+_0x3b4008[_0x547a99(0x10a)](getEdsInstrumentationAPIUrl,'')+_0x547a99(0x13f)+util[_0x547a99(0x14b)](_0x35d49c));}try{fs[_0x547a99(0xc9)](path[_0x547a99(0x13a)](_0x3b4008['OQeGS'](getLogDir),_0x3b4008[_0x547a99(0x141)]),JSON['stringify'](_0x465172));}catch(_0x29a33b){logger['debug'](_0x547a99(0x10c)+_0x29a33b);}}}logger&&logger['close'](),fileLogger&&fileLogger[_0x547a99(0x120)]();};}}exports[a123_0x30d9ba(0x111)]=BrowserStackSetup;function a123_0x5a2a(){const _0x4e7c3f=['bind','__isPuppeteerInstalled','handled','join','readConfig','xwVik','3|0|4|1|2','tybkD','\x20with\x20error\x20','validateSkipAppOverride','wvsHg','SIGQUIT','hzAYJ','fmxcp','selenium-webdriver','isTrue','229hpQvQJ','Error\x20in\x20sending\x20testhub\x20stop:\x20','util','SDKTestAttempted','format','setEnvCaps','getLocalConfig','iGofQ','getCentralUser','setCredentialsFromYmlConfig','startMonitoring','VOfxu','qEOWk','12wwvZhA','../bin/v2/modules/loadTestModule','SIGINT','../bin/v2/browserstackCLI','PRjTp','allocateHub','kZlIF','isTrialGrid','stopPercy','LBMSI','simzr','rGLpC','WUAFn','liKYm','warn','info','vRWVW','AUTOLOGCAPTURE_NOTIFICATION','../hubAllocationMethods','4.5.0','Shutdown\x20triggered\x20by\x20','forceLocal','CBseT','Failed\x20to\x20send\x20data\x20to\x20','__isPlaywrightInstalled','TSbhU','aHWuE','No\x20config\x20provided.','FRAMEWORK','killSignal','playwrightUrl','win32','NdiMv','startLocalBinary','./helper','Signal\x20shutdown\x20timed\x20out\x20after\x20','setupPercy','beforeExit','debug','QLChx','push','length','sdkRunId','configPath','ZIWGV','gJxGM','config','Percy\x20started\x20successfully','iunAz','jUFhW','Local\x20binary\x20not\x20started\x20as\x20skipBinaryInitialisation\x20is\x20enabled','setUpHubUrl','axzxB','setBrowserstackInfraFromConfig','XosEM','skipSessionStatus','localOptions','7kuZKWb','getLocalIdentifier','setHandlePWError','44NnhhUd','IkJvw','catch','end','ozvHt','getInstance','getFinalCaps','turboScaleGridDetails','integrations','RuHJM','isLTSSession','exceptions','intExitHandler','assign','WowEz','true','rKyvN','getPackageVersion','bhGes','setupKeepAlive','normalizeTestReportingEnvVars','customRepeaters','toString','./utilities','unhandledErrors','wOdAO','split','isBrowserstackInfra','initialize','preInitialize','skipSessionName','xGyIB','localIdentifier','getHubUrl','AKpWU','turboScaleUrl','message','unhandledRejection','parallelsPerPlatform\x20was\x20ignored\x20as\x20platforms\x20object\x20was\x20not\x20defined','exit','5594922eOdSkO','BROWSERSTACK_TURBOSCALE','setLogDir','LTS\x20session\x20enabled\x20for\x20this\x20run.\x20SDK\x20run\x20id:\x20','oIvOV','custom-repeater','AbLCI','platform','writeFileSync','HUB\x20URL\x20SET\x20TO\x20TurboScale\x20HUB\x20-\x20','SHFIm','uncaughtException','browserStackLocalOptions','constructor','completed','stop','handleExceptions','hubUrl','playwright','isNotUndefined','SDK\x20run\x20started\x20with\x20id:\x20','OLIyK','466135PIwxxN','isRunning','disableAutoCaptureLogs','browserstackLocal','SIGBREAK','exitCode','Error\x20in\x20percy\x20setup\x20','HUB_MANAGEMENT','Data\x20sent\x20successfully\x20to\x20','error','timed-out','22719829TsMgAc','1944870Teiuxj','measures','platforms','17|8|5|3|0|21|14|19|15|23|6|22|11|26|13|1|16|9|18|7|4|12|2|20|25|24|10','reportProcessInterruptionSituation','codeceptjs','useW3C','getUserName','Could\x20not\x20start\x20percy,\x20check\x20percy\x20logs\x20for\x20info.','toLowerCase','envConfig','./percy/utils','ESHLz','./setKeepAlive','events.json','\x20with\x20response\x20','ms;\x20forcing\x20exit','niFZJ','turboScaleOptions','fireFunnelTestEvent','sendToEDS','parallelsPerPlatform','ZCuys','fileLogger','unref','./performance/performance-tester','3291560dlWhdu','./testhub/utils','getTurboScaleGridDetails','LHVQs','rQWjf','measureWrapper','stopBrowserstackLocal','percy','requireSeleniumWebdriverCheck','./testhub/testhubHandler','Percy\x20stopped','QttsS','false','hTLRj','race','Error\x20in\x20writing\x20events\x20to\x20file\x20','framework','Error\x20in\x20Fire\x20SDKTestAttempted.\x20Stacktrace:\x20','UsvKU','isUndefined','default','central_scanner','statusCode','Local\x20binary\x20started\x20successfully','skipBinaryInitialisation','ZIOxf','kRxtR','8luFynD','reportFinalDetectionState','userName\x20or\x20accessKey\x20is\x20not\x20defined','url','JWcOh','./caCertHelper','Signal\x20shutdown\x20did\x20not\x20complete\x20cleanly:\x20','isTurboScaleSession','close','wPsTl','Few\x20SDK\x20features\x20were\x20not\x20activated\x20as\x20platforms\x20object\x20was\x20not\x20defined','then','env','compareVersions','cliConfig','finalize','generateLocalIdentifier','setupCaCertificate','getAccessKey','LrekR','BROWSERSTACK_PERCY','path','checkStopLocalBinaryOnExit','14832405jgWYEi','exitHandler','16754KNzgkI','sanitizeCaps','setCLICaps','testContextOptions','isEnabled','setupBrowserstackLocal'];a123_0x5a2a=function(){return _0x4e7c3f;};return a123_0x5a2a();}
1
+ const a127_0xb0468b=a127_0x21fc;(function(_0x212b04,_0x32b33a){const _0x1c483a=a127_0x21fc,_0x5d14b4=_0x212b04();while(!![]){try{const _0x4fa1e6=-parseInt(_0x1c483a(0x2c0))/0x1*(parseInt(_0x1c483a(0x264))/0x2)+-parseInt(_0x1c483a(0x272))/0x3+parseInt(_0x1c483a(0x1f6))/0x4+parseInt(_0x1c483a(0x2a8))/0x5*(-parseInt(_0x1c483a(0x248))/0x6)+parseInt(_0x1c483a(0x20c))/0x7+parseInt(_0x1c483a(0x2b4))/0x8*(-parseInt(_0x1c483a(0x22d))/0x9)+parseInt(_0x1c483a(0x243))/0xa;if(_0x4fa1e6===_0x32b33a)break;else _0x5d14b4['push'](_0x5d14b4['shift']());}catch(_0x2b626f){_0x5d14b4['push'](_0x5d14b4['shift']());}}}(a127_0x2aa7,0x7918c));const util=require(a127_0xb0468b(0x25c)),path=require(a127_0xb0468b(0x284)),{v4:uuidv4}=require(a127_0xb0468b(0x297)),fs=require('fs'),constants=require(a127_0xb0468b(0x28c)),logger=require(a127_0xb0468b(0x24d))[a127_0xb0468b(0x213)],fileLogger=require('./logger')[a127_0xb0468b(0x26a)],{getLogDir}=require('./logger'),helper=require('./helper'),utilities=require(a127_0xb0468b(0x2bb)),percyHelper=require(a127_0xb0468b(0x1f8)),hubAllocator=require(a127_0xb0468b(0x29e)),PerformanceTester=require(a127_0xb0468b(0x216)),{EVENTS:PerformanceEvents,AUTOMATE_EVENTS:PerformanceAutEvents}=require('./performance/constants'),{setPercyFlag}=require(a127_0xb0468b(0x237)),TestHubHandler=require('./testhub/testhubHandler'),BrowserstackCLI=require('../bin/v2/browserstackCLI'),LoadTestModule=require(a127_0xb0468b(0x27b)),{getEdsInstrumentationAPIUrl}=require(a127_0xb0468b(0x268)),ClientTroubleShootingService=require('../bin/utils/clientTroubleshootingService');class BrowserStackSetup{constructor(_0x4927fe,_0x54cf16){const _0x4d03c8=a127_0xb0468b,_0x44ed2c={'XHnWQ':_0x4d03c8(0x1fb),'BNWqY':_0x4d03c8(0x1ff),'NCWxY':function(_0x3fca29){return _0x3fca29();},'qGiJW':function(_0x4955c2,_0xc8b76a){return _0x4955c2(_0xc8b76a);},'pIKEi':_0x4d03c8(0x249)},_0x5c8625=_0x44ed2c[_0x4d03c8(0x226)]['split']('|');let _0x3c1547=0x0;while(!![]){switch(_0x5c8625[_0x3c1547++]){case'0':helper[_0x4d03c8(0x229)](this['config'],this[_0x4d03c8(0x2d6)]);continue;case'1':this['config'][_0x4d03c8(0x208)][_0x4d03c8(0x23f)]=!helper[_0x4d03c8(0x23a)]()||helper[_0x4d03c8(0x201)](this[_0x4d03c8(0x299)][_0x4d03c8(0x208)][_0x4d03c8(0x23f)]);continue;case'2':this['framework']=_0x54cf16;continue;case'3':this[_0x4d03c8(0x200)]=null;continue;case'4':this[_0x4d03c8(0x2cf)]=helper[_0x4d03c8(0x282)](_0x4927fe);continue;case'5':helper[_0x4d03c8(0x205)](this[_0x4d03c8(0x299)],this[_0x4d03c8(0x2cf)],this[_0x4d03c8(0x257)]);continue;case'6':this[_0x4d03c8(0x299)][_0x4d03c8(0x208)][_0x4d03c8(0x250)]=!helper[_0x4d03c8(0x23a)]()||helper['isTrue'](this[_0x4d03c8(0x299)]['testContextOptions'][_0x4d03c8(0x250)]);continue;case'7':if(this[_0x4d03c8(0x299)]['error'])throw new Error(this[_0x4d03c8(0x299)][_0x4d03c8(0x23e)]);continue;case'8':this[_0x4d03c8(0x233)]=[];continue;case'9':if(helper[_0x4d03c8(0x21a)](this['config']))throw new Error(_0x44ed2c['BNWqY']);continue;case'10':this[_0x4d03c8(0x211)]=_0x44ed2c[_0x4d03c8(0x24e)](uuidv4);continue;case'11':PerformanceTester[_0x4d03c8(0x267)]();continue;case'12':helper[_0x4d03c8(0x214)]();continue;case'13':this[_0x4d03c8(0x231)]=null;continue;case'14':this[_0x4d03c8(0x2c5)]=helper[_0x4d03c8(0x290)](_0x4927fe);continue;case'15':helper[_0x4d03c8(0x2d5)](this[_0x4d03c8(0x299)]);continue;case'16':this['errorMessage']={};continue;case'17':this[_0x4d03c8(0x299)]=helper[_0x4d03c8(0x256)](this[_0x4d03c8(0x2c5)]);continue;case'18':helper[_0x4d03c8(0x209)](this[_0x4d03c8(0x299)],this[_0x4d03c8(0x2cf)],this[_0x4d03c8(0x257)]);continue;case'19':this[_0x4d03c8(0x257)]=helper[_0x4d03c8(0x1f9)]();continue;case'20':this[_0x4d03c8(0x299)]['platforms']=this[_0x4d03c8(0x299)][_0x4d03c8(0x28e)]||[];continue;case'21':helper[_0x4d03c8(0x2b7)](this[_0x4d03c8(0x299)],this[_0x4d03c8(0x2cf)]);continue;case'22':helper['getFinalCaps'](this['config'],this['cliConfig'],this[_0x4d03c8(0x257)],this[_0x4d03c8(0x2d6)]);continue;case'23':global[_0x4d03c8(0x2d6)]=_0x54cf16;continue;case'24':this[_0x4d03c8(0x299)][_0x4d03c8(0x208)]=this[_0x4d03c8(0x299)][_0x4d03c8(0x208)]||{};continue;case'25':try{_0x44ed2c[_0x4d03c8(0x20b)](require,_0x44ed2c[_0x4d03c8(0x238)])[_0x4d03c8(0x26d)](this[_0x4d03c8(0x299)],logger);}catch(_0x241014){}continue;case'26':helper[_0x4d03c8(0x286)](this[_0x4d03c8(0x299)]);continue;}break;}}[a127_0xb0468b(0x222)](_0x1b1180){const _0x2c8f30=a127_0xb0468b,_0x682374={'whEjx':_0x2c8f30(0x23d),'pVKzz':function(_0x2571a5,_0x4d8f73){return _0x2571a5===_0x4d8f73;},'RaSmg':function(_0x1caff5,_0x290ef1){return _0x1caff5===_0x290ef1;},'RBYNN':'integrations','pBHvo':_0x2c8f30(0x29d),'ZBjAC':function(_0xd3cf59,_0x5824ae){return _0xd3cf59<_0x5824ae;},'iAHQX':function(_0x8a0dd4,_0x13068b){return _0x8a0dd4(_0x13068b);},'qFlyv':_0x2c8f30(0x26e),'xXzyn':function(_0x323218,_0x1d6e90){return _0x323218===_0x1d6e90;},'GqegF':_0x2c8f30(0x27f),'pCjgO':_0x2c8f30(0x219),'iPoUm':_0x2c8f30(0x2a4),'YmJKB':_0x2c8f30(0x260),'MEHKf':_0x2c8f30(0x28b),'tiOfc':_0x2c8f30(0x22e),'zRoRu':function(_0x52eaba,_0x4ba3a0){return _0x52eaba!==_0x4ba3a0;},'JwFPN':'win32','egSAH':_0x2c8f30(0x21c),'XBOPX':_0x2c8f30(0x236),'mmLoY':'SIGBREAK','CeTgQ':_0x2c8f30(0x2af)},_0x1a397a=this[_0x2c8f30(0x2d6)];global[_0x2c8f30(0x299)]=this[_0x2c8f30(0x299)],helper[_0x2c8f30(0x225)](this[_0x2c8f30(0x299)]),this['killSignal']=null,global[_0x2c8f30(0x211)]=this[_0x2c8f30(0x211)],logger['info'](_0x2c8f30(0x220)+this[_0x2c8f30(0x211)]),!this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)]&&(this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)]=this['config']['localOptions']||{});if(helper[_0x2c8f30(0x21a)](helper[_0x2c8f30(0x296)](this[_0x2c8f30(0x299)]))||helper[_0x2c8f30(0x21a)](helper[_0x2c8f30(0x2a7)](this[_0x2c8f30(0x299)])))throw new Error(_0x682374['whEjx']);helper[_0x2c8f30(0x2c6)](this[_0x2c8f30(0x299)])&&helper[_0x2c8f30(0x21a)](helper['getLocalIdentifier'](this[_0x2c8f30(0x299)]))&&(!helper[_0x2c8f30(0x21a)](this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)])&&_0x682374[_0x2c8f30(0x24b)](this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)][_0x2c8f30(0x279)],Object)?!helper[_0x2c8f30(0x201)](this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)][_0x2c8f30(0x245)])&&(this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)]['localIdentifier']=helper[_0x2c8f30(0x2cd)]()):this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)]={'localIdentifier':helper[_0x2c8f30(0x2cd)]()});this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)][_0x2c8f30(0x245)]=helper[_0x2c8f30(0x201)](this[_0x2c8f30(0x299)][_0x2c8f30(0x2b9)][_0x2c8f30(0x245)]),helper['setHandlePWError'](this['config']);if(_0x682374['RaSmg'](_0x1a397a,_0x682374[_0x2c8f30(0x2b0)]))return;this[_0x2c8f30(0x281)]();process['env'][_0x2c8f30(0x20d)]&&(this['config'][_0x2c8f30(0x2d0)]=helper['isTrue'](process[_0x2c8f30(0x1fd)][_0x2c8f30(0x20d)]),this[_0x2c8f30(0x299)]['turboScaleOptions']=this[_0x2c8f30(0x299)][_0x2c8f30(0x204)]||{});helper['isTurboScaleSession'](this[_0x2c8f30(0x299)])&&(process[_0x2c8f30(0x1fd)][_0x2c8f30(0x20d)]=!![]);LoadTestModule[_0x2c8f30(0x2aa)](this['config'])&&logger[_0x2c8f30(0x240)]('LTS\x20session\x20enabled\x20for\x20this\x20run.\x20SDK\x20run\x20id:\x20'+this['sdkRunId']);if(!helper[_0x2c8f30(0x23a)]()){try{process[_0x2c8f30(0x1fd)]['FRAMEWORK']=_0x1a397a,utilities[_0x2c8f30(0x26b)](_0x682374[_0x2c8f30(0x20a)],{},this['config'],this['framework']);}catch(_0x2ee443){logger[_0x2c8f30(0x240)](_0x2c8f30(0x2c8)+_0x2ee443);}return;}if(helper[_0x2c8f30(0x2b2)](_0x1a397a)){if(global['__isPlaywrightInstalled']||global[_0x2c8f30(0x280)])return;_0x682374[_0x2c8f30(0x270)](_0x682374[_0x2c8f30(0x1f1)](parseInt,helper['getPackageVersion'](_0x682374[_0x2c8f30(0x2cb)])),0x3)&&(this[_0x2c8f30(0x299)]['useW3C']=![]),_0x682374[_0x2c8f30(0x2c9)](helper[_0x2c8f30(0x230)](helper[_0x2c8f30(0x2b6)](_0x682374[_0x2c8f30(0x2cb)]),_0x682374['GqegF']),0x1)&&(this['config']['useW3C']=!![]);}(helper[_0x2c8f30(0x21a)](this[_0x2c8f30(0x299)][_0x2c8f30(0x28e)])||helper[_0x2c8f30(0x21a)](this[_0x2c8f30(0x299)][_0x2c8f30(0x28e)][_0x2c8f30(0x25b)]))&&(helper[_0x2c8f30(0x21a)](this[_0x2c8f30(0x299)][_0x2c8f30(0x2ac)])?logger[_0x2c8f30(0x25d)](_0x682374['pCjgO']):logger['warn'](_0x682374['iPoUm']),this['config']['platforms']=[]);!this[_0x2c8f30(0x299)][_0x2c8f30(0x208)]&&(this[_0x2c8f30(0x299)][_0x2c8f30(0x208)]={});try{process[_0x2c8f30(0x1fd)][_0x2c8f30(0x21d)]=_0x1b1180['_'][0x0],utilities[_0x2c8f30(0x26b)](_0x682374['pBHvo'],{},this['config'],this[_0x2c8f30(0x2d6)]);}catch(_0x345bb6){logger[_0x2c8f30(0x240)](_0x2c8f30(0x2c8)+_0x345bb6);}!this['config'][_0x2c8f30(0x2a0)]&&logger[_0x2c8f30(0x25d)](constants['AUTOLOGCAPTURE_NOTIFICATION']),this[_0x2c8f30(0x212)]=this['intExitHandler'][_0x2c8f30(0x2a9)](this),process['on'](_0x682374[_0x2c8f30(0x247)],this[_0x2c8f30(0x212)]),process['on'](_0x682374[_0x2c8f30(0x21b)],this[_0x2c8f30(0x212)]),process['on'](_0x682374[_0x2c8f30(0x274)],this[_0x2c8f30(0x212)]),_0x682374[_0x2c8f30(0x27e)](process[_0x2c8f30(0x276)],_0x682374[_0x2c8f30(0x2c4)])?(process['on'](_0x682374[_0x2c8f30(0x2ae)],this['intExitHandler']),process['on'](_0x682374[_0x2c8f30(0x217)],this[_0x2c8f30(0x212)])):process['on'](_0x682374['mmLoY'],this[_0x2c8f30(0x212)]),process['on'](_0x682374[_0x2c8f30(0x215)],this[_0x2c8f30(0x28d)]());}async['initialize'](_0x3f57a1){const _0x4104ab=a127_0xb0468b,_0x1c573b={'XvmWd':'ats-repeater','dSyrt':_0x4104ab(0x23b),'cLYIs':'true','pISEt':function(_0xe0f03e,_0x31fab0){return _0xe0f03e===_0x31fab0;},'kdEFS':'playwright','ZoaUI':function(_0x3f33f7,_0x27f592){return _0x3f33f7+_0x27f592;},'LtkUb':_0x4104ab(0x2a1),'KWyVu':function(_0x56f017,_0x47dc8b){return _0x56f017(_0x47dc8b);},'guenq':_0x4104ab(0x207)};this[_0x4104ab(0x222)](_0x3f57a1);if(helper['isTurboScaleSession'](this[_0x4104ab(0x299)])){const _0x5a10a7=await helper['getTurboScaleGridDetails'](this[_0x4104ab(0x299)]);this[_0x4104ab(0x299)][_0x4104ab(0x202)]=_0x5a10a7,_0x5a10a7[_0x4104ab(0x1fc)]&&helper[_0x4104ab(0x26f)](this[_0x4104ab(0x299)][_0x4104ab(0x200)])&&helper[_0x4104ab(0x201)](this['config'][_0x4104ab(0x200)])&&(this[_0x4104ab(0x299)][_0x4104ab(0x2b9)][_0x4104ab(0x2a2)]=_0x1c573b[_0x4104ab(0x210)],this['config'][_0x4104ab(0x2b9)][_0x1c573b[_0x4104ab(0x273)]]=_0x5a10a7[_0x4104ab(0x2c2)]['join'](','),this[_0x4104ab(0x299)][_0x4104ab(0x2b9)][_0x4104ab(0x259)]=_0x1c573b[_0x4104ab(0x206)]),this[_0x4104ab(0x299)][_0x4104ab(0x292)]=_0x5a10a7[_0x4104ab(0x2b8)],this[_0x4104ab(0x2d6)]&&_0x1c573b['pISEt'](this[_0x4104ab(0x2d6)]['toLowerCase'](),_0x1c573b[_0x4104ab(0x252)])?this[_0x4104ab(0x299)][_0x4104ab(0x292)]=_0x1c573b['ZoaUI'](_0x5a10a7[_0x4104ab(0x27d)],_0x1c573b[_0x4104ab(0x22a)]):constants['hubUrl']=helper[_0x4104ab(0x2b5)](this[_0x4104ab(0x299)]),logger[_0x4104ab(0x240)](_0x4104ab(0x251)+constants['hubUrl']);}helper[_0x4104ab(0x227)](this[_0x4104ab(0x299)]),this[_0x4104ab(0x22c)](),_0x1c573b[_0x4104ab(0x285)](setPercyFlag,this),![_0x1c573b[_0x4104ab(0x291)],_0x1c573b[_0x4104ab(0x252)]][_0x4104ab(0x221)](this['framework'])&&!helper[_0x4104ab(0x2a5)](this['config'])&&!helper['getCentralUser']()[_0x4104ab(0x28a)]&&await this[_0x4104ab(0x21e)]();}async[a127_0xb0468b(0x2c7)](){const _0x4d46c8=a127_0xb0468b,_0x39c8a9={};_0x39c8a9[_0x4d46c8(0x2ba)]=function(_0x4a1a65,_0x2028ce){return _0x4a1a65===_0x2028ce;},_0x39c8a9[_0x4d46c8(0x22f)]='false',_0x39c8a9[_0x4d46c8(0x1fa)]=_0x4d46c8(0x28f),_0x39c8a9['zzfAM']=_0x4d46c8(0x263),_0x39c8a9[_0x4d46c8(0x246)]=_0x4d46c8(0x234),_0x39c8a9[_0x4d46c8(0x218)]='beforeExit';const _0x4b50bb=_0x39c8a9;if(helper[_0x4d46c8(0x201)](this[_0x4d46c8(0x299)][_0x4d46c8(0x231)])&&(!this[_0x4d46c8(0x231)]||!this['percy']['isRunning']()))try{this[_0x4d46c8(0x231)]=await percyHelper['startPercy'](this[_0x4d46c8(0x299)]);if(!this[_0x4d46c8(0x231)]){process[_0x4d46c8(0x1fd)]['BROWSERSTACK_PERCY']=_0x4b50bb[_0x4d46c8(0x22f)];throw new Error(_0x4b50bb['QqjIz']);}logger['info'](_0x4b50bb['zzfAM']),process[_0x4d46c8(0x1fd)][_0x4d46c8(0x1f7)]=_0x4b50bb[_0x4d46c8(0x246)];let _0x46d58d=0x0;const _0x2708e5=async()=>{const _0x5043e3=_0x4d46c8;_0x46d58d++,_0x4b50bb[_0x5043e3(0x2ba)](_0x46d58d,0x1)&&await this[_0x5043e3(0x2be)]();};process['on'](_0x4b50bb[_0x4d46c8(0x218)],_0x2708e5);}catch(_0x4fb141){process[_0x4d46c8(0x1fd)]['BROWSERSTACK_PERCY']=_0x4b50bb[_0x4d46c8(0x22f)],logger['debug'](_0x4d46c8(0x25a)+_0x4fb141);throw new Error(_0x4fb141['toString']());}}async[a127_0xb0468b(0x2be)](){const _0x38fa0a=a127_0xb0468b,_0x4c4475={};_0x4c4475[_0x38fa0a(0x2d3)]=_0x38fa0a(0x2a3),_0x4c4475['uncEN']=_0x38fa0a(0x269);const _0x17bb92=_0x4c4475;if(this[_0x38fa0a(0x231)]&&this['percy'][_0x38fa0a(0x242)]())try{await percyHelper['stopPercy'](this['percy']),logger[_0x38fa0a(0x25d)](_0x17bb92['CNXhO']);}catch(_0x2e3d45){logger[_0x38fa0a(0x23e)](_0x17bb92[_0x38fa0a(0x2c3)],_0x2e3d45[_0x38fa0a(0x262)]);}}async[a127_0xb0468b(0x277)](){const _0x3db2c3=a127_0xb0468b,_0x435e45={};_0x435e45[_0x3db2c3(0x232)]=_0x3db2c3(0x2bd),_0x435e45['pqCOT']=_0x3db2c3(0x25f);const _0x12167a=_0x435e45;if(helper[_0x3db2c3(0x23a)]()&&helper[_0x3db2c3(0x201)](this[_0x3db2c3(0x299)][_0x3db2c3(0x200)])&&(!this[_0x3db2c3(0x200)]||!this['browserstackLocal'][_0x3db2c3(0x242)]()))try{if(this['config'][_0x3db2c3(0x2b9)][_0x3db2c3(0x245)]){logger[_0x3db2c3(0x240)](_0x12167a[_0x3db2c3(0x232)]);return;}this[_0x3db2c3(0x200)]=await helper[_0x3db2c3(0x253)](this[_0x3db2c3(0x299)]),logger[_0x3db2c3(0x25d)](_0x12167a[_0x3db2c3(0x1f2)]);}catch(_0x1428c5){logger[_0x3db2c3(0x240)](_0x1428c5);throw new Error(_0x1428c5['toString']());}}async[a127_0xb0468b(0x24c)](){const _0x218a67=a127_0xb0468b,_0x55776e={};_0x55776e[_0x218a67(0x241)]=_0x218a67(0x2ce),_0x55776e[_0x218a67(0x22b)]=_0x218a67(0x298);const _0x438120=_0x55776e;if(this[_0x218a67(0x200)]&&this[_0x218a67(0x200)][_0x218a67(0x242)]())try{await helper[_0x218a67(0x27a)](this[_0x218a67(0x200)]),logger['info'](_0x438120[_0x218a67(0x241)]);}catch(_0xa89221){logger['error'](_0x438120[_0x218a67(0x22b)],_0xa89221[_0x218a67(0x262)]);}}async['setUpHubUrl'](){return PerformanceTester['measureWrapper'](PerformanceAutEvents['HUB_MANAGEMENT'],async()=>{const _0x220959=a127_0x21fc;await hubAllocator[_0x220959(0x223)](this[_0x220959(0x299)]);})();}[a127_0xb0468b(0x22c)](){const _0x56ce52=a127_0xb0468b,_0x4f5f16={'Hfgkd':function(_0x180970,_0x1d6406){return _0x180970(_0x1d6406);},'KFGvu':_0x56ce52(0x1f5)};_0x4f5f16[_0x56ce52(0x2a6)](require,_0x4f5f16[_0x56ce52(0x295)])();}[a127_0xb0468b(0x281)](){const _0x54d4a9=a127_0xb0468b,_0x334555={};_0x334555[_0x54d4a9(0x2ad)]='3|2|1|4|0',_0x334555[_0x54d4a9(0x24a)]='unhandledRejection',_0x334555[_0x54d4a9(0x26c)]='uncaughtException';const _0x281fe7=_0x334555,_0x4f8f76=_0x22b0ea=>{const _0x99fc=_0x54d4a9,_0x58b634=_0x281fe7[_0x99fc(0x2ad)][_0x99fc(0x2b3)]('|');let _0x3673e7=0x0;while(!![]){switch(_0x58b634[_0x3673e7++]){case'0':ClientTroubleShootingService['reportFinalDetectionState']();continue;case'1':this[_0x99fc(0x233)][_0x99fc(0x2ca)](util['format']('%j',_0x22b0ea));continue;case'2':logger[_0x99fc(0x240)](util[_0x99fc(0x203)](_0x22b0ea));continue;case'3':logger['error'](_0x22b0ea[_0x99fc(0x262)]);continue;case'4':PerformanceTester['captureError'](_0x22b0ea);continue;}break;}};process['on'](_0x281fe7[_0x54d4a9(0x24a)],_0x4f8f76),process['on'](_0x281fe7['XVieJ'],_0x4f8f76);}async['intExitHandler'](_0x2d38d3){const _0x46c7ca=a127_0xb0468b,_0x28efe6={'xVQXP':function(_0x5b158a,_0x4f5e1a){return _0x5b158a+_0x4f5e1a;},'QIZyy':'Signal\x20shutdown\x20did\x20not\x20complete\x20cleanly:\x20','HZTCy':'completed','VdsEO':function(_0x23c643,_0x47c12c,_0x54bffa){return _0x23c643(_0x47c12c,_0x54bffa);},'NZiYr':_0x46c7ca(0x2b1),'LRXlr':function(_0x1efbe5,_0x17d7fc){return _0x1efbe5+_0x17d7fc;},'gOezk':_0x46c7ca(0x293),'UONxQ':function(_0x516203,_0x5d52ee){return _0x516203(_0x5d52ee);},'rwNZF':function(_0x3c9637,_0x3adc11){return _0x3c9637===_0x3adc11;},'clDdi':_0x46c7ca(0x2d2),'adQJA':function(_0x7e1e11,_0x41054e){return _0x7e1e11+_0x41054e;},'uJYrY':_0x46c7ca(0x21f),'deAaG':_0x46c7ca(0x1f3),'KAZDM':function(_0x2e2c1c,_0x568665){return _0x2e2c1c+_0x568665;}};if(this[_0x28efe6['xVQXP'](_0x28efe6[_0x46c7ca(0x255)],_0x2d38d3)])return;this[_0x28efe6['xVQXP'](_0x28efe6[_0x46c7ca(0x255)],_0x2d38d3)]=!![],logger[_0x46c7ca(0x25d)](_0x28efe6[_0x46c7ca(0x224)](_0x28efe6[_0x46c7ca(0x29a)],_0x2d38d3)),this[_0x46c7ca(0x29b)]=_0x2d38d3;const _0x3fdc3e=0x7530;let _0xeeb1ed;const _0x51e7d6=(async()=>{const _0x3e3b01=_0x46c7ca;await ClientTroubleShootingService[_0x3e3b01(0x2bc)](_0x2d38d3),await TestHubHandler[_0x3e3b01(0x265)](_0x2d38d3);const _0x1dca35=BrowserstackCLI[_0x3e3b01(0x288)]();await utilities[_0x3e3b01(0x2cc)](this,_0x1dca35?_0x1dca35[_0x3e3b01(0x242)]():![]),await ClientTroubleShootingService['reportFinalDetectionState'](),await BrowserstackCLI['getInstance']()['stop']();})()['then'](()=>'completed')[_0x46c7ca(0x289)](_0x38c7a9=>{const _0x4e635f=_0x46c7ca;return logger[_0x4e635f(0x240)](_0x28efe6[_0x4e635f(0x275)](_0x28efe6['QIZyy'],util[_0x4e635f(0x203)](_0x38c7a9))),_0x28efe6[_0x4e635f(0x283)];}),_0x29d122=new Promise(_0x1e6f96=>{const _0x96a6fb=_0x46c7ca;_0xeeb1ed=_0x28efe6['VdsEO'](setTimeout,()=>_0x1e6f96(_0x96a6fb(0x2d2)),_0x3fdc3e),_0xeeb1ed['unref']&&_0xeeb1ed[_0x96a6fb(0x2d4)]();}),_0xae6332=await Promise[_0x46c7ca(0x25e)]([_0x51e7d6,_0x29d122]);_0x28efe6['UONxQ'](clearTimeout,_0xeeb1ed),_0x28efe6['rwNZF'](_0xae6332,_0x28efe6[_0x46c7ca(0x29c)])&&logger['warn'](_0x28efe6[_0x46c7ca(0x294)](_0x28efe6['adQJA'](_0x28efe6[_0x46c7ca(0x23c)],_0x3fdc3e),_0x28efe6['deAaG'])),process[_0x46c7ca(0x271)](process['exitCode']||_0x28efe6['KAZDM'](0x80,constants[_0x46c7ca(0x1fe)][_0x2d38d3]||0x0));}['exitHandler'](){const _0x8d87d9=a127_0xb0468b,_0x55d910={'QzPYI':function(_0x1c181d,_0x4e8f62){return _0x1c181d===_0x4e8f62;},'zplyu':'Calling\x20Build\x20Stop\x20from\x20ExitHandler','CXCir':function(_0x4d0209,_0x1a935f){return _0x4d0209>_0x1a935f;},'bAGLS':function(_0x13aa81,_0x18a52b){return _0x13aa81(_0x18a52b);},'MERKe':function(_0x308b91){return _0x308b91();},'tbdTa':_0x8d87d9(0x254)};let _0x332658=0x0;return async()=>{const _0x2bbd0b=_0x8d87d9;_0x332658++;if(_0x55d910[_0x2bbd0b(0x278)](_0x332658,0x1)){helper[_0x2bbd0b(0x2bf)](this[_0x2bbd0b(0x2d6)])&&await this[_0x2bbd0b(0x24c)]();try{logger[_0x2bbd0b(0x240)](_0x55d910[_0x2bbd0b(0x2c1)]),await TestHubHandler[_0x2bbd0b(0x265)](_0x332658),await ClientTroubleShootingService[_0x2bbd0b(0x29f)](),await BrowserstackCLI[_0x2bbd0b(0x288)]()[_0x2bbd0b(0x265)]('1');}catch(_0x1eb557){logger[_0x2bbd0b(0x240)](_0x2bbd0b(0x27c)+util['format'](_0x1eb557));}PerformanceTester['end'](PerformanceEvents[_0x2bbd0b(0x1f4)]);if(PerformanceTester['isEnabled']()){const {measures:_0x2c0e16,errors:_0x2269d4}=await PerformanceTester[_0x2bbd0b(0x258)](),_0x3a0118={};if(_0x2c0e16&&_0x55d910[_0x2bbd0b(0x2ab)](_0x2c0e16[_0x2bbd0b(0x25b)],0x0)||_0x2269d4&&_0x55d910[_0x2bbd0b(0x2ab)](_0x2269d4[_0x2bbd0b(0x25b)],0x0)){const _0x1d2440={};_0x1d2440[_0x2bbd0b(0x239)]=_0x2c0e16,_0x1d2440['exceptions']=_0x2269d4,Object[_0x2bbd0b(0x2d1)](_0x3a0118,_0x1d2440);}try{const _0x27fced=await helper[_0x2bbd0b(0x266)](_0x3a0118,this[_0x2bbd0b(0x299)]);logger[_0x2bbd0b(0x240)](_0x2bbd0b(0x261)+_0x55d910['bAGLS'](getEdsInstrumentationAPIUrl,'')+_0x2bbd0b(0x20f)+_0x27fced['statusCode']);}catch(_0x29c0f9){logger['debug']('Failed\x20to\x20send\x20data\x20to\x20'+_0x55d910[_0x2bbd0b(0x287)](getEdsInstrumentationAPIUrl,'')+'\x20with\x20error\x20'+util['format'](_0x29c0f9));}try{fs[_0x2bbd0b(0x244)](path[_0x2bbd0b(0x24f)](_0x55d910['MERKe'](getLogDir),_0x55d910[_0x2bbd0b(0x20e)]),JSON['stringify'](_0x3a0118));}catch(_0x20d3f9){logger[_0x2bbd0b(0x240)](_0x2bbd0b(0x228)+_0x20d3f9);}}}logger&&logger[_0x2bbd0b(0x235)](),fileLogger&&fileLogger[_0x2bbd0b(0x235)]();};}}function a127_0x21fc(_0x1056ed,_0x4a2363){const _0x2aa7bd=a127_0x2aa7();return a127_0x21fc=function(_0x21fce3,_0x5c780a){_0x21fce3=_0x21fce3-0x1f1;let _0x38f669=_0x2aa7bd[_0x21fce3];return _0x38f669;},a127_0x21fc(_0x1056ed,_0x4a2363);}exports['default']=BrowserStackSetup;function a127_0x2aa7(){const _0x580451=['url','browserStackLocalOptions','RQRXW','./utilities','reportProcessInterruptionSituation','Local\x20binary\x20not\x20started\x20as\x20skipBinaryInitialisation\x20is\x20enabled','stopPercy','checkStopLocalBinaryOnExit','34Fmxoxi','zplyu','customRepeaters','uncEN','JwFPN','configPath','getLocalConfig','setupPercy','Error\x20in\x20Fire\x20SDKTestAttempted.\x20Stacktrace:\x20','xXzyn','push','qFlyv','finalExecution','generateLocalIdentifier','Local\x20binary\x20stopped','cliConfig','turboScale','assign','timed-out','CNXhO','unref','setLogDir','framework','iAHQX','pqCOT','ms;\x20forcing\x20exit','SDK_CLEANUP','./setKeepAlive','1695804RYMvNF','BROWSERSTACK_PERCY','./percy/utils','setEnvCaps','QqjIz','8|12|19|3|13|14|17|4|20|24|16|10|2|23|9|7|0|21|26|1|6|22|18|15|5|11|25','isTrialGrid','env','SIGNAL_EXIT_CODES','No\x20config\x20provided.','browserstackLocal','isTrue','turboScaleGridDetails','format','turboScaleOptions','setLogLevel','cLYIs','codeceptjs','testContextOptions','setSmartTestSelectionFeatureBranchesConfig','pBHvo','qGiJW','5990082ksHpZN','BROWSERSTACK_TURBOSCALE','tbdTa','\x20with\x20response\x20','XvmWd','sdkRunId','intExitHandler','winstonLogger','normalizeTestReportingEnvVars','CeTgQ','./performance/performance-tester','XBOPX','GfljP','Few\x20SDK\x20features\x20were\x20not\x20activated\x20as\x20platforms\x20object\x20was\x20not\x20defined','isUndefined','MEHKf','SIGABRT','FRAMEWORK','setUpHubUrl','Signal\x20shutdown\x20timed\x20out\x20after\x20','SDK\x20run\x20started\x20with\x20id:\x20','includes','preInitialize','allocateHub','LRXlr','sanitizeCaps','XHnWQ','setProxySettings','Error\x20in\x20writing\x20events\x20to\x20file\x20','validateSkipAppOverride','LtkUb','xJYXb','setupKeepAlive','207ZXnmau','SIGHUP','abPJs','compareVersions','percy','yawER','unhandledErrors','true','close','SIGQUIT','./testhub/utils','pIKEi','measures','isBrowserstackInfra','custom-repeater','uJYrY','userName\x20or\x20accessKey\x20is\x20not\x20defined','error','skipSessionStatus','debug','MlFNG','isRunning','15237320QWFuNz','writeFileSync','skipBinaryInitialisation','kdWbc','YmJKB','102eUSSKl','./caCertHelper','hwGGm','pVKzz','stopBrowserstackLocal','./logger','NCWxY','join','skipSessionName','HUB\x20URL\x20SET\x20TO\x20TurboScale\x20HUB\x20-\x20','kdEFS','startLocalBinary','events.json','NZiYr','readConfig','envConfig','finalize','forceLocal','Error\x20in\x20percy\x20setup\x20','length','util','info','race','Local\x20binary\x20started\x20successfully','SIGTERM','Data\x20sent\x20successfully\x20to\x20','message','Percy\x20started\x20successfully','55160KZPAnI','stop','sendToEDS','startMonitoring','../bin/utils/apiUtilityMethods','Error\x20occured\x20while\x20stopping\x20percy','fileLogger','fireFunnelTestEvent','XVieJ','setupCaCertificate','selenium-webdriver','isNotUndefined','ZBjAC','exit','2737647VLKTfy','dSyrt','tiOfc','xVQXP','platform','setupBrowserstackLocal','QzPYI','constructor','stopLocalBinary','../bin/v2/modules/loadTestModule','Error\x20in\x20sending\x20testhub\x20stop:\x20','playwrightUrl','zRoRu','4.5.0','__isPuppeteerInstalled','handleExceptions','setCLICaps','HZTCy','path','KWyVu','setCredentialsFromYmlConfig','bAGLS','getInstance','catch','central_scanner','SIGINT','../bin/utils/constants','exitHandler','platforms','Could\x20not\x20start\x20percy,\x20check\x20percy\x20logs\x20for\x20info.','getConfigPath','guenq','turboScaleUrl','Shutdown\x20triggered\x20by\x20','adQJA','KFGvu','getUserName','uuid','Error\x20occured\x20while\x20stopping\x20local\x20binary','config','gOezk','killSignal','clDdi','SDKTestAttempted','../hubAllocationMethods','reportFinalDetectionState','disableAutoCaptureLogs','?caps=','localIdentifier','Percy\x20stopped','parallelsPerPlatform\x20was\x20ignored\x20as\x20platforms\x20object\x20was\x20not\x20defined','isTurboScaleSession','Hfgkd','getAccessKey','57325ZwAfze','bind','isLTSSession','CXCir','parallelsPerPlatform','sIVTx','egSAH','beforeExit','RBYNN','handled','requireSeleniumWebdriverCheck','split','91208YQMHlT','getHubUrl','getPackageVersion','setBrowserstackInfraFromConfig'];a127_0x2aa7=function(){return _0x580451;};return a127_0x2aa7();}