@browserstack/mcp-server 1.1.6 → 1.1.7
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.
package/dist/config.js
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
|
+
// List of supported BrowserStack Local option names (as per SDK)
|
|
2
|
+
const BROWSERSTACK_LOCAL_OPTION_KEYS = [
|
|
3
|
+
"proxyHost",
|
|
4
|
+
"proxyPort",
|
|
5
|
+
"proxyUser",
|
|
6
|
+
"proxyPass",
|
|
7
|
+
"useCaCertificate",
|
|
8
|
+
"localProxyHost",
|
|
9
|
+
"localProxyPort",
|
|
10
|
+
"localProxyUser",
|
|
11
|
+
"localProxyPass",
|
|
12
|
+
"pacFile",
|
|
13
|
+
"force",
|
|
14
|
+
"forceLocal",
|
|
15
|
+
"onlyAutomate",
|
|
16
|
+
"verbose",
|
|
17
|
+
"logFile",
|
|
18
|
+
"binarypath",
|
|
19
|
+
"f",
|
|
20
|
+
"excludeHosts",
|
|
21
|
+
];
|
|
22
|
+
// Build browserstackLocalOptions from individual env vars
|
|
23
|
+
const browserstackLocalOptions = {};
|
|
24
|
+
for (const key of BROWSERSTACK_LOCAL_OPTION_KEYS) {
|
|
25
|
+
// Env var name: BROWSERSTACK_LOCAL_OPTION_<UPPERCASE_KEY>
|
|
26
|
+
const envVar = process.env[`BROWSERSTACK_LOCAL_OPTION_${key.toUpperCase()}`];
|
|
27
|
+
if (envVar !== undefined) {
|
|
28
|
+
browserstackLocalOptions[key] = envVar;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
1
31
|
export class Config {
|
|
2
32
|
browserstackUsername;
|
|
3
33
|
browserstackAccessKey;
|
|
4
34
|
DEV_MODE;
|
|
5
|
-
|
|
35
|
+
browserstackLocalOptions;
|
|
36
|
+
constructor(browserstackUsername, browserstackAccessKey, DEV_MODE, browserstackLocalOptions) {
|
|
6
37
|
this.browserstackUsername = browserstackUsername;
|
|
7
38
|
this.browserstackAccessKey = browserstackAccessKey;
|
|
8
39
|
this.DEV_MODE = DEV_MODE;
|
|
40
|
+
this.browserstackLocalOptions = browserstackLocalOptions;
|
|
9
41
|
}
|
|
10
42
|
}
|
|
11
|
-
const config = new Config(process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY, process.env.DEV_MODE === "true");
|
|
43
|
+
const config = new Config(process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY, process.env.DEV_MODE === "true", browserstackLocalOptions);
|
|
12
44
|
export default config;
|
package/dist/lib/local.js
CHANGED
|
@@ -69,15 +69,17 @@ export async function ensureLocalBinarySetup(localIdentifier) {
|
|
|
69
69
|
logger.info("Ensuring local binary setup as it is required for private URLs...");
|
|
70
70
|
const localBinary = new Local();
|
|
71
71
|
await killExistingBrowserStackLocalProcesses();
|
|
72
|
-
|
|
72
|
+
// Use a single options object from config and extend with required fields
|
|
73
|
+
const bsLocalArgs = {
|
|
74
|
+
...(config.browserstackLocalOptions || {}),
|
|
73
75
|
key: config.browserstackAccessKey,
|
|
74
76
|
username: config.browserstackUsername,
|
|
75
77
|
};
|
|
76
78
|
if (localIdentifier) {
|
|
77
|
-
|
|
79
|
+
bsLocalArgs.localIdentifier = localIdentifier;
|
|
78
80
|
}
|
|
79
81
|
return await new Promise((resolve, reject) => {
|
|
80
|
-
localBinary.start(
|
|
82
|
+
localBinary.start(bsLocalArgs, (error) => {
|
|
81
83
|
if (error) {
|
|
82
84
|
logger.error(`Unable to start BrowserStack Local... please check your credentials and try again. Error: ${error}`);
|
|
83
85
|
reject(new Error(`Unable to configure local tunnel binary, please check your credentials and try again. Error: ${error}`));
|
|
@@ -56,6 +56,9 @@ export class AccessibilityScanner {
|
|
|
56
56
|
}
|
|
57
57
|
catch (err) {
|
|
58
58
|
if (axios.isAxiosError(err) && err.response?.data) {
|
|
59
|
+
if (err.response.status === 422) {
|
|
60
|
+
throw new Error("A scan with this name already exists. please update the name and run again.");
|
|
61
|
+
}
|
|
59
62
|
const msg = err.response.data.error ||
|
|
60
63
|
err.response.data.message ||
|
|
61
64
|
err.message;
|
|
@@ -47,13 +47,19 @@ async function takeAppScreenshot(args) {
|
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
logger.info("Starting WebDriver session on BrowserStack...");
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
try {
|
|
51
|
+
driver = await remote({
|
|
52
|
+
protocol: "https",
|
|
53
|
+
hostname: "hub.browserstack.com",
|
|
54
|
+
port: 443,
|
|
55
|
+
path: "/wd/hub",
|
|
56
|
+
capabilities,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger.error("Error initializing WebDriver:", error);
|
|
61
|
+
throw new Error("Failed to initialize the WebDriver or a timeout occurred. Please try again.");
|
|
62
|
+
}
|
|
57
63
|
const screenshotBase64 = await driver.takeScreenshot();
|
|
58
64
|
const compressed = await maybeCompressBase64(screenshotBase64);
|
|
59
65
|
return {
|
|
@@ -38,6 +38,9 @@ export async function startSession(args) {
|
|
|
38
38
|
// 6) Upload app
|
|
39
39
|
const { app_url } = await uploadApp(appPath);
|
|
40
40
|
logger.info(`App uploaded: ${app_url}`);
|
|
41
|
+
if (!app_url) {
|
|
42
|
+
throw new Error("Failed to upload app. Please try again.");
|
|
43
|
+
}
|
|
41
44
|
// 7) Build URL & open
|
|
42
45
|
const deviceParam = sanitizeUrlParam(selected.display_name.replace(/\s+/g, "+"));
|
|
43
46
|
const params = new URLSearchParams({
|
|
@@ -29,6 +29,43 @@ In order to run tests on BrowserStack, run the following command:
|
|
|
29
29
|
browserstack-sdk python <path-to-test-file>
|
|
30
30
|
\`\`\`
|
|
31
31
|
`;
|
|
32
|
+
const argsInstruction = '<argLine>-javaagent:"${com.browserstack:browserstack-java-sdk:jar}"</argLine>';
|
|
33
|
+
const javaInstructions = `
|
|
34
|
+
Strictly Add the following dependencies to your \`pom.xml\`:
|
|
35
|
+
\`\`\`xml
|
|
36
|
+
<dependency>
|
|
37
|
+
<groupId>com.browserstack</groupId>
|
|
38
|
+
<artifactId>browserstack-java-sdk</artifactId>
|
|
39
|
+
<version>LATEST</version>
|
|
40
|
+
<scope>compile</scope>
|
|
41
|
+
</dependency>
|
|
42
|
+
|
|
43
|
+
${argsInstruction}
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
For Gradle projects, add to \`build.gradle\`:
|
|
47
|
+
\`\`\`groovy
|
|
48
|
+
dependencies {
|
|
49
|
+
implementation 'com.browserstack:browserstack-java-sdk:LATEST'
|
|
50
|
+
}
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
Inform user to export:
|
|
54
|
+
\`\`\`bash
|
|
55
|
+
export BROWSERSTACK_USERNAME=${config.browserstackUsername}
|
|
56
|
+
export BROWSERSTACK_ACCESS_KEY=${config.browserstackAccessKey}
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
Run tests using:
|
|
60
|
+
\`\`\`bash
|
|
61
|
+
mvn clean test
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
Or for Gradle:
|
|
65
|
+
\`\`\`bash
|
|
66
|
+
gradle clean test
|
|
67
|
+
\`\`\`
|
|
68
|
+
`;
|
|
32
69
|
export const SUPPORTED_CONFIGURATIONS = {
|
|
33
70
|
nodejs: {
|
|
34
71
|
playwright: {
|
|
@@ -55,4 +92,12 @@ export const SUPPORTED_CONFIGURATIONS = {
|
|
|
55
92
|
behave: { instructions: pythonInstructions },
|
|
56
93
|
},
|
|
57
94
|
},
|
|
95
|
+
java: {
|
|
96
|
+
playwright: {},
|
|
97
|
+
selenium: {
|
|
98
|
+
testng: { instructions: javaInstructions },
|
|
99
|
+
cucumber: { instructions: javaInstructions },
|
|
100
|
+
junit: { instructions: javaInstructions },
|
|
101
|
+
},
|
|
102
|
+
},
|
|
58
103
|
};
|