@@ -66,39 +66,6 @@ const getScanData = (win, payload) =>
66
66
67
67
} )
68
68
69
- const shouldScanForAccessibility = ( attributes ) => {
70
- if ( Cypress . env ( "IS_ACCESSIBILITY_EXTENSION_LOADED" ) !== "true" ) return false ;
71
-
72
- const extensionPath = Cypress . env ( "ACCESSIBILITY_EXTENSION_PATH" ) ;
73
- const isHeaded = Cypress . browser . isHeaded ;
74
-
75
- if ( ! isHeaded || ( extensionPath === undefined ) ) return false ;
76
-
77
- let shouldScanTestForAccessibility = true ;
78
-
79
- if ( Cypress . env ( "INCLUDE_TAGS_FOR_ACCESSIBILITY" ) || Cypress . env ( "EXCLUDE_TAGS_FOR_ACCESSIBILITY" ) ) {
80
- try {
81
- let includeTagArray = [ ] ;
82
- let excludeTagArray = [ ] ;
83
- if ( Cypress . env ( "INCLUDE_TAGS_FOR_ACCESSIBILITY" ) ) {
84
- includeTagArray = Cypress . env ( "INCLUDE_TAGS_FOR_ACCESSIBILITY" ) . split ( ";" )
85
- }
86
- if ( Cypress . env ( "EXCLUDE_TAGS_FOR_ACCESSIBILITY" ) ) {
87
- excludeTagArray = Cypress . env ( "EXCLUDE_TAGS_FOR_ACCESSIBILITY" ) . split ( ";" )
88
- }
89
-
90
- const fullTestName = attributes . title ;
91
- const excluded = excludeTagArray . some ( ( exclude ) => fullTestName . includes ( exclude ) ) ;
92
- const included = includeTagArray . length === 0 || includeTags . some ( ( include ) => fullTestName . includes ( include ) ) ;
93
- shouldScanTestForAccessibility = ! excluded && included ;
94
- } catch ( error ) {
95
- LambdatestLog ( "Error while validating test case for accessibility before scanning. Error : " , error ) ;
96
- }
97
- }
98
-
99
- return shouldScanTestForAccessibility ;
100
- }
101
-
102
69
Cypress . on ( 'command:start' , async ( command ) => {
103
70
if ( ! command || ! command . attributes ) return ;
104
71
if ( command . attributes . name == 'window' || command . attributes . name == 'then' || command . attributes . name == 'wrap' || command . attributes . name == 'wait' ) {
@@ -112,14 +79,9 @@ Cypress.on('command:start', async (command) => {
112
79
return ;
113
80
}
114
81
115
- // const attributes = Cypress.mocha.getRunner().suite.ctx.currentTest || Cypress.mocha.getRunner().suite.ctx._runnable;
116
82
117
- // let shouldScanTestForAccessibility = shouldScanForAccessibility(attributes);
118
- // if (!shouldScanTestForAccessibility) return;
119
- // console.log('log', "debugging scan form command " + command.attributes.name);
120
83
console . log ( 'log' , "debugging scan form command " + command . attributes . name ) ;
121
84
cy . window ( ) . then ( ( win ) => {
122
- // LambdatestLog('Performing scan form command ' + command.attributes.name);
123
85
let wcagCriteriaValue = Cypress . env ( "WCAG_CRITERIA" ) || "wcag21a" ;
124
86
let bestPracticeValue = Cypress . env ( "BEST_PRACTICE" ) || false ;
125
87
let needsReviewValue = Cypress . env ( "NEEDS_REVIEW" ) || true ;
@@ -131,23 +93,22 @@ cy.window().then((win) => {
131
93
needsReview : needsReviewValue
132
94
}
133
95
let testId = Cypress . env ( "TEST_ID" ) || ""
134
- // const filePath = 'cypress/reports/accessibilityReport_' + testId + '.json';
96
+
135
97
const filePath = Cypress . env ( "ACCESSIBILITY_REPORT_PATH" ) || 'cypress/results/accessibilityReport_' + testId + '.json' ;
136
98
137
99
cy . wrap ( setScanConfig ( win , payloadToSend ) , { timeout : 30000 } ) . then ( ( res ) => {
138
- // LambdatestLog('log', "logging report **************")
139
100
console . log ( 'logging config reponse' , res ) ;
140
101
141
102
const payload = {
142
103
message : 'GET_LATEST_SCAN_DATA' ,
143
104
}
144
- // cy.wait(5000);
145
- cy . wrap ( getScanData ( win , payload ) , { timeout : 30000 } ) . then ( ( res ) => {
146
- LambdatestLog ( 'log' , "logging report **************" )
105
+
106
+ cy . wrap ( getScanData ( win , payload ) , { timeout : 45000 } ) . then ( ( res ) => {
107
+ LambdatestLog ( 'log' , "scanning data " ) ;
147
108
148
109
149
110
cy . task ( 'initializeFile' , filePath ) . then ( ( filePath ) => {
150
- cy . readFile ( filePath , { log : true , timeout : 30000 } ) . then ( ( fileContent ) => {
111
+ cy . readFile ( filePath , { log : true , timeout : 45000 } ) . then ( ( fileContent ) => {
151
112
let resultsArray = [ { } ] ;
152
113
console . log ( 'logging report' , res ) ;
153
114
// If the file is not empty, parse the existing content
@@ -160,15 +121,15 @@ cy.window().then((win) => {
160
121
return ;
161
122
}
162
123
}
163
- console . log ( 'debugging res ' , res . message ) ;
124
+ console . log ( 'scanned data recieved is ' , res . message ) ;
164
125
if ( res . message == "GET_LATEST_SCAN_DATA" ) {
165
126
// Append the new result
166
127
resultsArray . push ( res ) ;
167
128
console . log ( 'resultsarray logging' , resultsArray ) ;
168
129
}
169
130
170
131
// Write the updated content back to the file
171
- cy . writeFile ( filePath , resultsArray , { log : true , timeout : 30000 } ) ;
132
+ cy . writeFile ( filePath , resultsArray , { log : true , timeout : 45000 } ) ;
172
133
} ) ;
173
134
} ) ;
174
135
} ) ;
0 commit comments