@browserstack/mcp-server 1.2.10 → 1.2.11-beta.2

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
- // Fetch the generated CSV link
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
- // Use apiClient for the report link request as well
28
- const reportResp = await apiClient.get({
29
- url: reportUrl,
30
- headers: basicAuthHeader ? { Authorization: basicAuthHeader } : undefined,
31
- });
32
- const reportData = reportResp.data;
33
- if (!reportData.success) {
34
- throw new Error(`Failed to fetch report: ${reportData.error}`);
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
- return reportData.data.reportLink;
46
+ throw new Error(`Report link was not available after ${maxAttempts} attempts. The CSV generation may still be in progress.`);
37
47
  }
38
48
  }
@@ -596,7 +596,6 @@ export const SUPPORTED_CONFIGURATIONS = {
596
596
  },
597
597
  selenium: {
598
598
  jest: { instructions: nodejsInstructions },
599
- webdriverio: { instructions: webdriverioInstructions },
600
599
  mocha: { instructions: nodejsInstructions },
601
600
  cucumber: { instructions: nodejsInstructions },
602
601
  nightwatch: { instructions: nodejsInstructions },
@@ -605,5 +604,9 @@ export const SUPPORTED_CONFIGURATIONS = {
605
604
  cypress: {
606
605
  cypress: { instructions: cypressInstructions },
607
606
  },
607
+ webdriverio: {
608
+ mocha: { instructions: webdriverioInstructions },
609
+ cucumber: { instructions: webdriverioInstructions },
610
+ },
608
611
  },
609
612
  };
@@ -44,7 +44,6 @@ export const SUPPORTED_CONFIGURATIONS = {
44
44
  },
45
45
  selenium: {
46
46
  jest: { instructions: constants.nodejsInstructions },
47
- webdriverio: { instructions: constants.webdriverioInstructions },
48
47
  mocha: { instructions: constants.nodejsInstructions },
49
48
  cucumber: { instructions: constants.nodejsInstructions },
50
49
  nightwatch: { instructions: constants.nodejsInstructions },
@@ -53,5 +52,9 @@ export const SUPPORTED_CONFIGURATIONS = {
53
52
  cypress: {
54
53
  cypress: { instructions: constants.cypressInstructions },
55
54
  },
55
+ webdriverio: {
56
+ mocha: { instructions: constants.webdriverioInstructions },
57
+ cucumber: { instructions: constants.webdriverioInstructions },
58
+ },
56
59
  },
57
60
  };
@@ -31,7 +31,7 @@ export async function runBstackSDKOnly(input, config, isPercyAutomate = false) {
31
31
  const validatedEnvironments = await validateDevices(tupleTargets, input.detectedBrowserAutomationFramework);
32
32
  // Handle frameworks with unique setup instructions that don't use browserstack.yml
33
33
  if (input.detectedBrowserAutomationFramework === "cypress" ||
34
- input.detectedTestingFramework === "webdriverio") {
34
+ input.detectedBrowserAutomationFramework === "webdriverio") {
35
35
  const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage, username, accessKey);
36
36
  if (frameworkInstructions) {
37
37
  if (frameworkInstructions.setup) {
@@ -13,7 +13,8 @@ export type SDKSupportedLanguage = keyof typeof SDKSupportedLanguageEnum;
13
13
  export declare enum SDKSupportedBrowserAutomationFrameworkEnum {
14
14
  playwright = "playwright",
15
15
  selenium = "selenium",
16
- cypress = "cypress"
16
+ cypress = "cypress",
17
+ webdriverio = "webdriverio"
17
18
  }
18
19
  export type SDKSupportedBrowserAutomationFramework = keyof typeof SDKSupportedBrowserAutomationFrameworkEnum;
19
20
  export declare enum SDKSupportedTestingFrameworkEnum {
@@ -25,7 +26,6 @@ export declare enum SDKSupportedTestingFrameworkEnum {
25
26
  behave = "behave",
26
27
  cucumber = "cucumber",
27
28
  nightwatch = "nightwatch",
28
- webdriverio = "webdriverio",
29
29
  mocha = "mocha",
30
30
  junit4 = "junit4",
31
31
  junit5 = "junit5",
@@ -16,6 +16,7 @@ export var SDKSupportedBrowserAutomationFrameworkEnum;
16
16
  SDKSupportedBrowserAutomationFrameworkEnum["playwright"] = "playwright";
17
17
  SDKSupportedBrowserAutomationFrameworkEnum["selenium"] = "selenium";
18
18
  SDKSupportedBrowserAutomationFrameworkEnum["cypress"] = "cypress";
19
+ SDKSupportedBrowserAutomationFrameworkEnum["webdriverio"] = "webdriverio";
19
20
  })(SDKSupportedBrowserAutomationFrameworkEnum || (SDKSupportedBrowserAutomationFrameworkEnum = {}));
20
21
  export var SDKSupportedTestingFrameworkEnum;
21
22
  (function (SDKSupportedTestingFrameworkEnum) {
@@ -27,7 +28,6 @@ export var SDKSupportedTestingFrameworkEnum;
27
28
  SDKSupportedTestingFrameworkEnum["behave"] = "behave";
28
29
  SDKSupportedTestingFrameworkEnum["cucumber"] = "cucumber";
29
30
  SDKSupportedTestingFrameworkEnum["nightwatch"] = "nightwatch";
30
- SDKSupportedTestingFrameworkEnum["webdriverio"] = "webdriverio";
31
31
  SDKSupportedTestingFrameworkEnum["mocha"] = "mocha";
32
32
  SDKSupportedTestingFrameworkEnum["junit4"] = "junit4";
33
33
  SDKSupportedTestingFrameworkEnum["junit5"] = "junit5";
@@ -51,7 +51,7 @@ export async function formatToolResult(resultPromise, runType) {
51
51
  if (runType != "percy-web") {
52
52
  finalContent.push({
53
53
  type: "text",
54
- text: "CRITICAL: After the build is run, you MUST explicitly ask the user if they want to perform RCA (Root Cause Analysis) for any failed tests. This step is mandatory and should not be skipped.",
54
+ text: "CRITICAL: After the build is run, you MUST explicitly ask the user if they want to perform RCA (Root Cause Analysis) for any failed tests using the RCA tool. This step is mandatory and should not be skipped.",
55
55
  });
56
56
  }
57
57
  return {
@@ -27,7 +27,7 @@ export function runPercyWithBrowserstackSDK(input, config) {
27
27
  }
28
28
  // Handle frameworks with unique setup instructions that don't use browserstack.yml
29
29
  if (input.detectedBrowserAutomationFramework === "cypress" ||
30
- input.detectedTestingFramework === "webdriverio") {
30
+ input.detectedBrowserAutomationFramework === "webdriverio") {
31
31
  const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage, username, accessKey);
32
32
  if (frameworkInstructions && frameworkInstructions.setup) {
33
33
  steps.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserstack/mcp-server",
3
- "version": "1.2.10",
3
+ "version": "1.2.11-beta.2",
4
4
  "description": "BrowserStack's Official MCP Server",
5
5
  "mcpName": "io.github.browserstack/mcp-server",
6
6
  "main": "dist/index.js",