@@ -20,31 +20,27 @@ const browserStackLog = (message) => {
20
20
exports . checkAccessibilityPlatform = ( user_config ) => {
21
21
let accessibility = false ;
22
22
try {
23
- console . debug ( '[A11Y][helper] Checking accessibility platform. Browsers:' , user_config . browsers ) ;
23
+
24
24
user_config . browsers . forEach ( browser => {
25
25
if ( browser . accessibility ) {
26
26
accessibility = true ;
27
- console . debug ( `[A11Y][helper] Accessibility enabled for browser:` , browser ) ;
28
27
}
29
28
} )
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
+
34
31
return accessibility ;
35
32
}
36
33
37
34
exports . setAccessibilityCypressCapabilities = async ( user_config , accessibilityResponse ) => {
38
35
if ( utils . isUndefined ( user_config . run_settings . accessibilityOptions ) ) {
39
36
user_config . run_settings . accessibilityOptions = { }
40
37
}
41
- console . debug ( '[A11Y][helper] Setting Cypress capabilities for accessibility:' , accessibilityResponse . data ) ;
42
38
user_config . run_settings . accessibilityOptions [ "authToken" ] = accessibilityResponse . data . accessibilityToken ;
43
39
user_config . run_settings . accessibilityOptions [ "auth" ] = accessibilityResponse . data . accessibilityToken ;
44
40
user_config . run_settings . accessibilityOptions [ "scannerVersion" ] = accessibilityResponse . data . scannerVersion ;
45
41
user_config . run_settings . system_env_vars . push ( `ACCESSIBILITY_AUTH=${ accessibilityResponse . data . accessibilityToken } ` )
46
42
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
+
48
44
}
49
45
50
46
exports . isAccessibilitySupportedCypressVersion = ( cypress_config_filename ) => {
@@ -55,9 +51,9 @@ exports.isAccessibilitySupportedCypressVersion = (cypress_config_filename) => {
55
51
exports . createAccessibilityTestRun = async ( user_config , framework ) => {
56
52
57
53
try {
58
- console . debug ( '[A11Y][helper] Starting createAccessibilityTestRun' ) ;
54
+
59
55
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.` )
61
57
process . env . BROWSERSTACK_TEST_ACCESSIBILITY = 'false' ;
62
58
user_config . run_settings . accessibility = false ;
63
59
return ;
@@ -71,7 +67,6 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
71
67
projectName,
72
68
buildDescription
73
69
} = helper . getBuildDetails ( user_config ) ;
74
- console . debug ( '[A11Y][helper] Build details:' , { buildName, projectName, buildDescription } ) ;
75
70
76
71
const data = {
77
72
'projectName' : projectName ,
@@ -98,7 +93,6 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
98
93
} ,
99
94
'browserstackAutomation' : process . env . BROWSERSTACK_AUTOMATION === 'true'
100
95
} ;
101
- console . debug ( '[A11Y][helper] Test run payload:' , data ) ;
102
96
103
97
const config = {
104
98
auth : {
@@ -109,40 +103,36 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
109
103
'Content-Type' : 'application/json'
110
104
}
111
105
} ;
112
- console . debug ( '[A11Y][helper] Test run config:' , config ) ;
113
106
114
107
const response = await nodeRequest (
115
108
'POST' , 'v2/test_runs' , data , config , API_URL
116
109
) ;
117
- console . debug ( '[A11Y][helper] Test run response:' , response . data ) ;
110
+
118
111
if ( ! utils . isUndefined ( response . data ) ) {
119
112
process . env . BS_A11Y_JWT = response . data . data . accessibilityToken ;
120
113
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 } ` ) ;
122
114
}
123
115
if ( process . env . BS_A11Y_JWT ) {
124
116
process . env . BROWSERSTACK_TEST_ACCESSIBILITY = 'true' ;
125
- console . debug ( '[A11Y][helper] Accessibility session enabled' ) ;
126
117
}
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 } ` ) ;
128
119
129
120
this . setAccessibilityCypressCapabilities ( user_config , response . data ) ;
130
121
helper . setBrowserstackCypressCliDependency ( user_config ) ;
131
122
132
123
} catch ( error ) {
133
- console . debug ( '[A11Y][helper] Error in createAccessibilityTestRun:' , error ) ;
134
124
if ( error . response ) {
135
125
logger . error ( "Incorrect Cred" )
136
126
logger . error (
137
- `[A11Y][helper] Exception while creating test run for BrowserStack Accessibility Automation: ${
127
+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
138
128
error . response . status
139
129
} ${ error . response . statusText } ${ JSON . stringify ( error . response . data ) } `
140
130
) ;
141
131
} else {
142
132
if ( error . message === 'Invalid configuration passed.' ) {
143
133
logger . error ( "Invalid configuration passed." )
144
134
logger . error (
145
- `[A11Y][helper] Exception while creating test run for BrowserStack Accessibility Automation: ${
135
+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
146
136
error . message || error . stack
147
137
} `
148
138
) ;
@@ -152,7 +142,7 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
152
142
153
143
} else {
154
144
logger . error (
155
- `[A11Y][helper] Exception while creating test run for BrowserStack Accessibility Automation: ${
145
+ `Exception while creating test run for BrowserStack Accessibility Automation: ${
156
146
error . message || error . stack
157
147
} `
158
148
) ;
@@ -260,8 +250,6 @@ exports.setAccessibilityEventListeners = (bsConfig) => {
260
250
files . forEach ( file => {
261
251
try {
262
252
const fileName = path . basename ( file ) ;
263
- console . log ( `Adding accessibility event listeners to ${ fileName } ` ) ;
264
- browserStackLog ( `Adding accessibility event listeners to ${ fileName } ` ) ;
265
253
if ( ( file . includes ( 'e2e.js' ) || file . includes ( 'e2e.ts' ) || file . includes ( 'component.ts' ) || file . includes ( 'component.js' ) ) ) {
266
254
console . log ( `Adding accessibility event listeners to ${ file } ` ) ;
267
255
browserStackLog ( `Adding accessibility event listeners to ${ file } ` ) ;
0 commit comments