@@ -20,31 +20,27 @@ const browserStackLog = (message) => {
2020exports . checkAccessibilityPlatform = ( user_config ) => {
2121 let accessibility = false ;
2222 try {
23- console . debug ( '[A11Y][helper] Checking accessibility platform. Browsers:' , user_config . browsers ) ;
23+
2424 user_config . browsers . forEach ( browser => {
2525 if ( browser . accessibility ) {
2626 accessibility = true ;
27- console . debug ( `[A11Y][helper] Accessibility enabled for browser:` , browser ) ;
2827 }
2928 } )
30- } catch ( err ) {
31- console . debug ( '[A11Y][helper] Error checking accessibility platform:' , err ) ;
32- }
33- console . debug ( `[A11Y][helper] Accessibility platform result: ${ accessibility } ` ) ;
29+ } catch { }
30+
3431 return accessibility ;
3532}
3633
3734exports . setAccessibilityCypressCapabilities = async ( user_config , accessibilityResponse ) => {
3835 if ( utils . isUndefined ( user_config . run_settings . accessibilityOptions ) ) {
3936 user_config . run_settings . accessibilityOptions = { }
4037 }
41- console . debug ( '[A11Y][helper] Setting Cypress capabilities for accessibility:' , accessibilityResponse . data ) ;
4238 user_config . run_settings . accessibilityOptions [ "authToken" ] = accessibilityResponse . data . accessibilityToken ;
4339 user_config . run_settings . accessibilityOptions [ "auth" ] = accessibilityResponse . data . accessibilityToken ;
4440 user_config . run_settings . accessibilityOptions [ "scannerVersion" ] = accessibilityResponse . data . scannerVersion ;
4541 user_config . run_settings . system_env_vars . push ( `ACCESSIBILITY_AUTH=${ accessibilityResponse . data . accessibilityToken } ` )
4642 user_config . run_settings . system_env_vars . push ( `ACCESSIBILITY_SCANNERVERSION=${ accessibilityResponse . data . scannerVersion } ` )
47- console . debug ( '[A11Y][helper] Updated user_config.run_settings:' , user_config . run_settings ) ;
43+
4844}
4945
5046exports . isAccessibilitySupportedCypressVersion = ( cypress_config_filename ) => {
@@ -55,9 +51,9 @@ exports.isAccessibilitySupportedCypressVersion = (cypress_config_filename) => {
5551exports . createAccessibilityTestRun = async ( user_config , framework ) => {
5652
5753 try {
58- console . debug ( '[A11Y][helper] Starting createAccessibilityTestRun' ) ;
54+
5955 if ( ! this . isAccessibilitySupportedCypressVersion ( user_config . run_settings . cypress_config_file ) ) {
60- logger . warn ( `[A11Y][helper] Accessibility Testing is not supported on Cypress version 9 and below.` )
56+ logger . warn ( `Accessibility Testing is not supported on Cypress version 9 and below.` )
6157 process . env . BROWSERSTACK_TEST_ACCESSIBILITY = 'false' ;
6258 user_config . run_settings . accessibility = false ;
6359 return ;
@@ -71,7 +67,6 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
7167 projectName,
7268 buildDescription
7369 } = helper . getBuildDetails ( user_config ) ;
74- console . debug ( '[A11Y][helper] Build details:' , { buildName, projectName, buildDescription } ) ;
7570
7671 const data = {
7772 'projectName' : projectName ,
@@ -98,7 +93,6 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
9893 } ,
9994 'browserstackAutomation' : process . env . BROWSERSTACK_AUTOMATION === 'true'
10095 } ;
101- console . debug ( '[A11Y][helper] Test run payload:' , data ) ;
10296
10397 const config = {
10498 auth : {
@@ -109,40 +103,36 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
109103 'Content-Type' : 'application/json'
110104 }
111105 } ;
112- console . debug ( '[A11Y][helper] Test run config:' , config ) ;
113106
114107 const response = await nodeRequest (
115108 'POST' , 'v2/test_runs' , data , config , API_URL
116109 ) ;
117- console . debug ( '[A11Y][helper] Test run response:' , response . data ) ;
110+
118111 if ( ! utils . isUndefined ( response . data ) ) {
119112 process . env . BS_A11Y_JWT = response . data . data . accessibilityToken ;
120113 process . env . BS_A11Y_TEST_RUN_ID = response . data . data . id ;
121- console . debug ( `[A11Y][helper] Set BS_A11Y_JWT: ${ process . env . BS_A11Y_JWT } , BS_A11Y_TEST_RUN_ID: ${ process . env . BS_A11Y_TEST_RUN_ID } ` ) ;
122114 }
123115 if ( process . env . BS_A11Y_JWT ) {
124116 process . env . BROWSERSTACK_TEST_ACCESSIBILITY = 'true' ;
125- console . debug ( '[A11Y][helper] Accessibility session enabled' ) ;
126117 }
127- logger . debug ( `[A11Y][helper] BrowserStack Accessibility Automation Test Run ID: ${ response . data . data . id } ` ) ;
118+ logger . debug ( `BrowserStack Accessibility Automation Test Run ID: ${ response . data . data . id } ` ) ;
128119
129120 this . setAccessibilityCypressCapabilities ( user_config , response . data ) ;
130121 helper . setBrowserstackCypressCliDependency ( user_config ) ;
131122
132123 } catch ( error ) {
133- console . debug ( '[A11Y][helper] Error in createAccessibilityTestRun:' , error ) ;
134124 if ( error . response ) {
135125 logger . error ( "Incorrect Cred" )
136126 logger . error (
137- `[A11Y][helper] Exception while creating test run for BrowserStack Accessibility Automation: ${
127+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
138128 error . response . status
139129 } ${ error . response . statusText } ${ JSON . stringify ( error . response . data ) } `
140130 ) ;
141131 } else {
142132 if ( error . message === 'Invalid configuration passed.' ) {
143133 logger . error ( "Invalid configuration passed." )
144134 logger . error (
145- `[A11Y][helper] Exception while creating test run for BrowserStack Accessibility Automation: ${
135+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
146136 error . message || error . stack
147137 } `
148138 ) ;
@@ -152,7 +142,7 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
152142
153143 } else {
154144 logger . error (
155- `[A11Y][helper] Exception while creating test run for BrowserStack Accessibility Automation: ${
145+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
156146 error . message || error . stack
157147 } `
158148 ) ;
@@ -260,8 +250,6 @@ exports.setAccessibilityEventListeners = (bsConfig) => {
260250 files . forEach ( file => {
261251 try {
262252 const fileName = path . basename ( file ) ;
263- console . log ( `Adding accessibility event listeners to ${ fileName } ` ) ;
264- browserStackLog ( `Adding accessibility event listeners to ${ fileName } ` ) ;
265253 if ( ( file . includes ( 'e2e.js' ) || file . includes ( 'e2e.ts' ) || file . includes ( 'component.ts' ) || file . includes ( 'component.js' ) ) ) {
266254 console . log ( `Adding accessibility event listeners to ${ file } ` ) ;
267255 browserStackLog ( `Adding accessibility event listeners to ${ file } ` ) ;
0 commit comments