@@ -77,25 +77,50 @@ async function processAccessibilityReport(url) {
77
77
needsReview : needsReviewValue
78
78
} ;
79
79
80
- console . log ( 'log' , "Payload to send: for url: " , payloadToSend , url ) ;
80
+ console . log ( 'log' , "SET SCAN: Payload to send: for url: " , payloadToSend , url ) ;
81
81
try {
82
82
let setResult = await setScanConfig ( currentWindow , payloadToSend ) ;
83
- console . log ( 'SET SCAN response:' , setResult ) ;
83
+ console . log ( 'SET SCAN: response:' , setResult ) ;
84
84
} catch ( err ) {
85
- console . error ( "Error while setting scan" , err ) ;
85
+ console . error ( "SET SCAN: Error while setting scan" , err ) ;
86
+ return ;
86
87
}
87
88
88
89
let scanData ;
89
90
try {
90
91
const payload = { message : 'GET_LATEST_SCAN_DATA' } ;
91
92
scanData = await getScanData ( currentWindow , payload ) ;
92
- LambdatestLog ( "LambdaTest Accessibility: Scanning URL" ) ;
93
+ LambdatestLog ( "GET SCAN: LambdaTest Accessibility: Scanning URL" ) ;
93
94
} catch ( err ) {
94
95
console . error ( "GET SCAN:Error while setting scan" , err ) ;
96
+ return ;
95
97
}
96
98
97
99
console . log ( "Logging response before sending to API:" , scanData ) ;
98
100
101
+ try {
102
+ const response = await fetch ( "http://127.0.0.1:43000/cypress/v1/generateAccessibilityReport" , {
103
+ method : "POST" ,
104
+ headers : {
105
+ "Content-Type" : "application/json"
106
+ } ,
107
+ body : JSON . stringify ( {
108
+ url : url ,
109
+ scanData : scanData
110
+ } )
111
+ } ) ;
112
+
113
+ if ( ! response . ok ) {
114
+ console . log ( "HTTP error! Status" , response . status ) ;
115
+ return ;
116
+ }
117
+
118
+ const result = await response . json ( ) ;
119
+ console . log ( "Accessibility Report Response:" , result ) ;
120
+ } catch ( err ) {
121
+ console . error ( "Error while making api" , err ) ;
122
+ }
123
+
99
124
} catch ( error ) {
100
125
LambdatestLog ( "ERROR" , error ) ;
101
126
}
@@ -115,4 +140,9 @@ commandsToOverride.forEach((command) => {
115
140
} )
116
141
117
142
} ) ;
118
- } ) ;
143
+ } ) ;
144
+
145
+ // AI:
146
+ // mutliple it()
147
+ // make error in set scan & get scan and ensure it doesnt break flow
148
+ // virgin media repo run rishabh singh (hyperex)
0 commit comments