Skip to content

Commit 2c94ef0

Browse files
authored
Merge pull request #357 from abhishek-lambda/AT-281
2 parents b4a242f + 35769d3 commit 2c94ef0

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

accessibility/scanner/index.js

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,50 @@ async function processAccessibilityReport(url) {
7777
needsReview: needsReviewValue
7878
};
7979

80-
console.log('log', "Payload to send: for url: ", payloadToSend,url);
80+
console.log('log', "SET SCAN: Payload to send: for url: ", payloadToSend,url);
8181
try {
8282
let setResult = await setScanConfig(currentWindow, payloadToSend);
83-
console.log('SET SCAN response:', setResult);
83+
console.log('SET SCAN: response:', setResult);
8484
} catch (err) {
85-
console.error("Error while setting scan", err);
85+
console.error("SET SCAN: Error while setting scan", err);
86+
return ;
8687
}
8788

8889
let scanData;
8990
try {
9091
const payload = {message: 'GET_LATEST_SCAN_DATA'};
9192
scanData = await getScanData(currentWindow, payload);
92-
LambdatestLog("LambdaTest Accessibility: Scanning URL");
93+
LambdatestLog("GET SCAN:LambdaTest Accessibility: Scanning URL");
9394
} catch (err) {
9495
console.error("GET SCAN:Error while setting scan", err);
96+
return ;
9597
}
9698

9799
console.log("Logging response before sending to API:", scanData);
98100

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+
99124
} catch (error) {
100125
LambdatestLog("ERROR", error);
101126
}
@@ -115,4 +140,9 @@ commandsToOverride.forEach((command) => {
115140
})
116141

117142
});
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

Comments
 (0)