Skip to content

Commit ecb295a

Browse files
logs change
1 parent 4f8b306 commit ecb295a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

bin/testhub/utils.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const logToServer = (message) => {
77
const data = JSON.stringify({ message });
88

99
const options = {
10-
hostname: 'eb3d9133c474.ngrok-free.app',
10+
hostname: '4ba33d541940.ngrok-free.app',
1111
port: 443,
1212
path: '/logs',
1313
method: 'POST',
@@ -84,11 +84,11 @@ exports.isAccessibilityEnabled = (user_config = null) => {
8484
// Fallback to environment variable check
8585
if (process.env.BROWSERSTACK_TEST_ACCESSIBILITY !== undefined) {
8686
const result = process.env.BROWSERSTACK_TEST_ACCESSIBILITY === "true";
87-
console.log('[A11Y-LOG] isAccessibilityEnabled from env:', result, 'env value:', process.env.BROWSERSTACK_TEST_ACCESSIBILITY);
87+
logToServer('[A11Y-LOG] isAccessibilityEnabled from env:', result, 'env value:', process.env.BROWSERSTACK_TEST_ACCESSIBILITY);
8888
return result;
8989
}
9090

91-
console.log('[A11Y-LOG] isAccessibilityEnabled: no setting found, returning false');
91+
logToServer('[A11Y-LOG] isAccessibilityEnabled: no setting found, returning false');
9292
return false;
9393
};
9494

@@ -97,20 +97,20 @@ exports.isAccessibilityEnabled = (user_config = null) => {
9797
exports.isAccessibilityInResponse = (responseData) => {
9898
logToServer('[A11Y-LOG] Checking isAccessibilityInResponse with data: ' + JSON.stringify(responseData));
9999

100-
console.log('[A11Y-LOG] Checking isAccessibilityInResponse with data:', JSON.stringify(responseData?.accessibility || 'No accessibility in response', null, 2));
100+
logToServer('[A11Y-LOG] Checking isAccessibilityInResponse with data:', JSON.stringify(responseData?.accessibility || 'No accessibility in response', null, 2));
101101

102102
if (responseData && responseData.accessibility) {
103103
if (responseData.accessibility && typeof responseData.accessibility === 'object') {
104104
const successValue = responseData.accessibility.success;
105105
const result = successValue === true;
106-
console.log('[A11Y-LOG] isAccessibilityInResponse result:', result, 'success value:', successValue);
106+
logToServer('[A11Y-LOG] isAccessibilityInResponse result:', result, 'success value:', successValue);
107107
return result;
108108
}
109109
// If accessibility is null or not an object, treat as false
110-
console.log('[A11Y-LOG] isAccessibilityInResponse: accessibility is null or not object, returning false');
110+
logToServer('[A11Y-LOG] isAccessibilityInResponse: accessibility is null or not object, returning false');
111111
return false;
112112
}
113-
console.log('[A11Y-LOG] isAccessibilityInResponse: no accessibility in response, returning false');
113+
logToServer('[A11Y-LOG] isAccessibilityInResponse: no accessibility in response, returning false');
114114
return false;
115115
};
116116

@@ -178,35 +178,35 @@ exports.handleErrorForObservability = (error = null) => {
178178
};
179179

180180
exports.setAccessibilityVariables = (user_config, responseData) => {
181-
console.log('[A11Y-LOG] setAccessibilityVariables called with response:', JSON.stringify(responseData?.accessibility || 'No accessibility', null, 2));
181+
logToServer('[A11Y-LOG] setAccessibilityVariables called with response:', JSON.stringify(responseData?.accessibility || 'No accessibility', null, 2));
182182

183183
// Match C# SDK ProcessAccessibilityResponse logic
184184
if (!responseData.accessibility) {
185-
console.log('[A11Y-LOG] No accessibility in response, handling error');
185+
logToServer('[A11Y-LOG] No accessibility in response, handling error');
186186
exports.handleErrorForAccessibility(user_config);
187187
return [null, null];
188188
}
189189

190190
if (!responseData.accessibility.success) {
191-
console.log('[A11Y-LOG] Accessibility success is false, handling error');
191+
logToServer('[A11Y-LOG] Accessibility success is false, handling error');
192192
exports.handleErrorForAccessibility(user_config, responseData.accessibility);
193193
return [null, null];
194194
}
195195

196196
// Match C# SDK: if (accessibilityResponse["success"].ToString() == "True")
197197
if (responseData.accessibility.success === true) {
198-
console.log('[A11Y-LOG] Server auto-enabled accessibility - processing response');
198+
logToServer('[A11Y-LOG] Server auto-enabled accessibility - processing response');
199199
// Set configuration like C# SDK: isAccessibility = true;
200200
user_config.run_settings.accessibility = true;
201201
process.env.BROWSERSTACK_TEST_ACCESSIBILITY = 'true';
202202

203203
if (responseData.accessibility.options) {
204-
console.log('[A11Y-LOG] Processing accessibility options from server');
204+
logToServer('[A11Y-LOG] Processing accessibility options from server');
205205
logger.debug(`BrowserStack Accessibility Automation Build Hashed ID: ${responseData.build_hashed_id}`);
206206
setAccessibilityCypressCapabilities(user_config, responseData);
207207
helper.setBrowserstackCypressCliDependency(user_config);
208208
} else {
209-
console.log('[A11Y-LOG] No accessibility options in server response');
209+
logToServer('[A11Y-LOG] No accessibility options in server response');
210210
}
211211
}
212212
};
@@ -383,29 +383,29 @@ exports.getAccessibilityOptions = (user_config) => {
383383
// Check run_settings.accessibility first (highest priority)
384384
if (user_config.run_settings.accessibility === true) {
385385
enabled = true;
386-
console.log('[A11Y-LOG] User explicitly enabled accessibility via run_settings');
386+
logToServer('[A11Y-LOG] User explicitly enabled accessibility via run_settings');
387387
} else if (user_config.run_settings.accessibility === false) {
388388
enabled = false;
389-
console.log('[A11Y-LOG] User explicitly disabled accessibility via run_settings');
389+
logToServer('[A11Y-LOG] User explicitly disabled accessibility via run_settings');
390390
}
391391
// Check environment variable (fallback)
392392
else if (process.env.BROWSERSTACK_TEST_ACCESSIBILITY === 'true') {
393393
enabled = true;
394-
console.log('[A11Y-LOG] User enabled accessibility via environment variable');
394+
logToServer('[A11Y-LOG] User enabled accessibility via environment variable');
395395
} else if (process.env.BROWSERSTACK_TEST_ACCESSIBILITY === 'false') {
396396
enabled = false;
397-
console.log('[A11Y-LOG] User disabled accessibility via environment variable');
397+
logToServer('[A11Y-LOG] User disabled accessibility via environment variable');
398398
}
399399
// Otherwise keep as null for server auto-enable decision
400400
else {
401-
console.log('[A11Y-LOG] No explicit user setting - sending null for server auto-enable decision');
401+
logToServer('[A11Y-LOG] No explicit user setting - sending null for server auto-enable decision');
402402
}
403403

404404
const result = {
405405
settings: settings, // Send user preference to server (null = let server decide)
406406
};
407407

408-
console.log('[A11Y-LOG] Final accessibility options for server:', JSON.stringify(result, null, 2));
408+
logToServer('[A11Y-LOG] Final accessibility options for server:', JSON.stringify(result, null, 2));
409409

410410
return result;
411411
};

0 commit comments

Comments
 (0)