@browserstack/mcp-server 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,17 +22,27 @@ export class AccessibilityReportFetcher {
|
|
|
22
22
|
throw new Error(`Failed to initiate report: ${initData.error || initData.data.message}`);
|
|
23
23
|
}
|
|
24
24
|
const taskId = initData.data.task_id;
|
|
25
|
-
//
|
|
25
|
+
// Poll for the generated CSV link (task is async, may take a few seconds)
|
|
26
26
|
const reportUrl = `https://api-accessibility.browserstack.com/api/website-scanner/v1/scans/${scanId}/scan_runs/issues?task_id=${encodeURIComponent(taskId)}`;
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const maxAttempts = 3;
|
|
28
|
+
const pollIntervalMs = 2000;
|
|
29
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
30
|
+
const reportResp = await apiClient.get({
|
|
31
|
+
url: reportUrl,
|
|
32
|
+
headers: basicAuthHeader
|
|
33
|
+
? { Authorization: basicAuthHeader }
|
|
34
|
+
: undefined,
|
|
35
|
+
});
|
|
36
|
+
const reportData = reportResp.data;
|
|
37
|
+
if (!reportData.success) {
|
|
38
|
+
throw new Error(`Failed to fetch report: ${reportData.error}`);
|
|
39
|
+
}
|
|
40
|
+
const link = reportData.data?.reportLink;
|
|
41
|
+
if (link) {
|
|
42
|
+
return link;
|
|
43
|
+
}
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
35
45
|
}
|
|
36
|
-
|
|
46
|
+
throw new Error(`Report link was not available after ${maxAttempts} attempts. The CSV generation may still be in progress.`);
|
|
37
47
|
}
|
|
38
48
|
}
|