@@ -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' ,
@@ -70,29 +70,40 @@ exports.isAccessibilityEnabled = (user_config = null) => {
7070 if ( user_config && user_config . run_settings ) {
7171 // Check run_settings.accessibility first (explicit user setting)
7272 if ( user_config . run_settings . accessibility !== undefined && user_config . run_settings . accessibility !== null ) {
73- return user_config . run_settings . accessibility === true ;
73+ const result = user_config . run_settings . accessibility === true ;
74+ logToServer ( '[A11Y-LOG] isAccessibilityEnabled from config: ' + result + ', raw value: ' + user_config . run_settings . accessibility ) ;
75+ return result ;
7476 }
7577 }
7678
7779 // Fallback to environment variable check
7880 if ( process . env . BROWSERSTACK_TEST_ACCESSIBILITY !== undefined ) {
79- return process . env . BROWSERSTACK_TEST_ACCESSIBILITY === "true" ;
81+ const result = process . env . BROWSERSTACK_TEST_ACCESSIBILITY === "true" ;
82+ logToServer ( '[A11Y-LOG] isAccessibilityEnabled from env: ' + result + ', env value: ' + process . env . BROWSERSTACK_TEST_ACCESSIBILITY ) ;
83+ return result ;
8084 }
8185
86+ logToServer ( '[A11Y-LOG] isAccessibilityEnabled: no setting found, returning false' ) ;
8287 return false ;
8388} ;
8489
8590// Equivalent to C# SDK IsAccessibilityInResponse function
8691// Checks if server auto-enabled accessibility in the response
8792exports . isAccessibilityInResponse = ( responseData ) => {
93+ logToServer ( '[A11Y-LOG] Checking isAccessibilityInResponse with data: ' + JSON . stringify ( responseData ?. accessibility || 'No accessibility in response' , null , 2 ) ) ;
94+
8895 if ( responseData && responseData . accessibility ) {
8996 if ( responseData . accessibility && typeof responseData . accessibility === 'object' ) {
9097 const successValue = responseData . accessibility . success ;
91- return successValue === true ;
98+ const result = successValue === true ;
99+ logToServer ( '[A11Y-LOG] isAccessibilityInResponse result: ' + result + ', success value: ' + successValue ) ;
100+ return result ;
92101 }
93102 // If accessibility is null or not an object, treat as false
103+ logToServer ( '[A11Y-LOG] isAccessibilityInResponse: accessibility is null or not object, returning false' ) ;
94104 return false ;
95105 }
106+ logToServer ( '[A11Y-LOG] isAccessibilityInResponse: no accessibility in response, returning false' ) ;
96107 return false ;
97108} ;
98109
@@ -160,27 +171,35 @@ exports.handleErrorForObservability = (error = null) => {
160171} ;
161172
162173exports . setAccessibilityVariables = ( user_config , responseData ) => {
174+ logToServer ( '[A11Y-LOG] setAccessibilityVariables called with response: ' + JSON . stringify ( responseData ?. accessibility || 'No accessibility' , null , 2 ) ) ;
175+
163176 // Match C# SDK ProcessAccessibilityResponse logic
164177 if ( ! responseData . accessibility ) {
178+ logToServer ( '[A11Y-LOG] No accessibility in response, handling error' ) ;
165179 exports . handleErrorForAccessibility ( user_config ) ;
166180 return [ null , null ] ;
167181 }
168182
169183 if ( ! responseData . accessibility . success ) {
184+ logToServer ( '[A11Y-LOG] Accessibility success is false, handling error' ) ;
170185 exports . handleErrorForAccessibility ( user_config , responseData . accessibility ) ;
171186 return [ null , null ] ;
172187 }
173188
174189 // Match C# SDK: if (accessibilityResponse["success"].ToString() == "True")
175190 if ( responseData . accessibility . success === true ) {
191+ logToServer ( '[A11Y-LOG] Server auto-enabled accessibility - processing response' ) ;
176192 // Set configuration like C# SDK: isAccessibility = true;
177193 user_config . run_settings . accessibility = true ;
178194 process . env . BROWSERSTACK_TEST_ACCESSIBILITY = 'true' ;
179195
180196 if ( responseData . accessibility . options ) {
197+ logToServer ( '[A11Y-LOG] Processing accessibility options from server' ) ;
181198 logger . debug ( `BrowserStack Accessibility Automation Build Hashed ID: ${ responseData . build_hashed_id } ` ) ;
182199 setAccessibilityCypressCapabilities ( user_config , responseData ) ;
183200 helper . setBrowserstackCypressCliDependency ( user_config ) ;
201+ } else {
202+ logToServer ( '[A11Y-LOG] No accessibility options in server response' ) ;
184203 }
185204 }
186205} ;
@@ -357,21 +376,32 @@ exports.getAccessibilityOptions = (user_config) => {
357376 // Check run_settings.accessibility first (highest priority)
358377 if ( user_config . run_settings . accessibility === true ) {
359378 enabled = true ;
379+ logToServer ( '[A11Y-LOG] User explicitly enabled accessibility via run_settings' ) ;
360380 } else if ( user_config . run_settings . accessibility === false ) {
361381 enabled = false ;
382+ logToServer ( '[A11Y-LOG] User explicitly disabled accessibility via run_settings' ) ;
362383 }
363384 // Check environment variable (fallback)
364385 else if ( process . env . BROWSERSTACK_TEST_ACCESSIBILITY === 'true' ) {
365386 enabled = true ;
387+ logToServer ( '[A11Y-LOG] User enabled accessibility via environment variable' ) ;
366388 } else if ( process . env . BROWSERSTACK_TEST_ACCESSIBILITY === 'false' ) {
367389 enabled = false ;
390+ logToServer ( '[A11Y-LOG] User disabled accessibility via environment variable' ) ;
368391 }
369392 // Otherwise keep as null for server auto-enable decision
393+ else {
394+ logToServer ( '[A11Y-LOG] No explicit user setting - sending null for server auto-enable decision' ) ;
395+ }
370396
371- return {
397+ const result = {
372398 settings : settings ,
373399 enabled : enabled // Send user preference to server (null = let server decide)
374400 } ;
401+
402+ logToServer ( '[A11Y-LOG] Final accessibility options for server: ' + JSON . stringify ( result , null , 2 ) ) ;
403+
404+ return result ;
375405} ;
376406
377407exports . appendTestHubParams = ( testData , eventType , accessibilityScanInfo ) => {
0 commit comments