@browserstack/mcp-server 1.2.32 → 1.2.33-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.
- package/dist/tools/accessibility.js +3 -3
- package/dist/tools/accessiblity-utils/auth-config.d.ts +11 -0
- package/dist/tools/accessiblity-utils/auth-config.js +19 -2
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +4 -4
- package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +2 -1
- package/dist/tools/appautomate-utils/appium-sdk/constants.js +5 -1
- package/dist/tools/appautomate-utils/appium-sdk/formatter.d.ts +2 -2
- package/dist/tools/appautomate-utils/appium-sdk/formatter.js +8 -8
- package/dist/tools/appautomate-utils/appium-sdk/handler.js +10 -4
- package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/instructions.js +6 -6
- package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.js +5 -5
- package/dist/tools/appautomate-utils/appium-sdk/languages/java.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/languages/java.js +11 -11
- package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +23 -23
- package/dist/tools/appautomate-utils/appium-sdk/languages/python.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/languages/python.js +11 -11
- package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.js +7 -4
- package/dist/tools/sdk-utils/bstack/commands.d.ts +1 -1
- package/dist/tools/sdk-utils/bstack/commands.js +14 -14
- package/dist/tools/sdk-utils/bstack/configUtils.d.ts +1 -2
- package/dist/tools/sdk-utils/bstack/configUtils.js +3 -7
- package/dist/tools/sdk-utils/bstack/constants.d.ts +10 -10
- package/dist/tools/sdk-utils/bstack/constants.js +27 -27
- package/dist/tools/sdk-utils/bstack/sdkHandler.js +17 -9
- package/dist/tools/sdk-utils/common/credentials.d.ts +3 -0
- package/dist/tools/sdk-utils/common/credentials.js +11 -0
- package/dist/tools/sdk-utils/common/instructionUtils.d.ts +1 -1
- package/dist/tools/sdk-utils/common/instructionUtils.js +2 -2
- package/dist/tools/sdk-utils/common/types.d.ts +1 -1
- package/dist/tools/sdk-utils/handler.js +1 -1
- package/dist/tools/sdk-utils/percy-bstack/handler.d.ts +1 -2
- package/dist/tools/sdk-utils/percy-bstack/handler.js +13 -9
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AccessibilityScanner } from "./accessiblity-utils/scanner.js";
|
|
3
3
|
import { AccessibilityReportFetcher } from "./accessiblity-utils/report-fetcher.js";
|
|
4
|
-
import { AccessibilityAuthConfig } from "./accessiblity-utils/auth-config.js";
|
|
4
|
+
import { AccessibilityAuthConfig, safeAuthConfigData, } from "./accessiblity-utils/auth-config.js";
|
|
5
5
|
import { trackMCP } from "../lib/instrumentation.js";
|
|
6
6
|
import { parseAccessibilityReportFromCSV } from "./accessiblity-utils/report-parser.js";
|
|
7
7
|
import { queryAccessibilityRAG } from "./accessiblity-utils/accessibility-rag.js";
|
|
@@ -148,7 +148,7 @@ async function executeCreateAuthConfig(args, server, config) {
|
|
|
148
148
|
const result = await createAuthConfig(args, config);
|
|
149
149
|
return createSuccessResponse([
|
|
150
150
|
`✅ Auth config "${args.name}" created successfully with ID: ${result.data?.id}`,
|
|
151
|
-
`Auth config details: ${JSON.stringify(result
|
|
151
|
+
`Auth config details: ${JSON.stringify(safeAuthConfigData(result), null, 2)}`,
|
|
152
152
|
]);
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
|
@@ -168,7 +168,7 @@ async function executeGetAuthConfig(args, server, config) {
|
|
|
168
168
|
const result = await authConfig.getAuthConfig(args.configId);
|
|
169
169
|
return createSuccessResponse([
|
|
170
170
|
`✅ Auth config retrieved successfully`,
|
|
171
|
-
`Auth config details: ${JSON.stringify(result
|
|
171
|
+
`Auth config details: ${JSON.stringify(safeAuthConfigData(result), null, 2)}`,
|
|
172
172
|
]);
|
|
173
173
|
}
|
|
174
174
|
catch (error) {
|
|
@@ -13,6 +13,17 @@ export interface AuthConfigResponse {
|
|
|
13
13
|
};
|
|
14
14
|
errors?: string[];
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Allowlist of non-sensitive fields safe to return to the LLM/tool caller.
|
|
18
|
+
* Everything else (site username/password, selectors, undeclared keys) is
|
|
19
|
+
* dropped rather than echoed — see rules/tool-design.md "never echo".
|
|
20
|
+
*/
|
|
21
|
+
export declare function safeAuthConfigData(response?: AuthConfigResponse): {
|
|
22
|
+
url?: string | undefined;
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
} | undefined;
|
|
16
27
|
export interface FormAuthData {
|
|
17
28
|
username: string;
|
|
18
29
|
usernameSelector: string;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { apiClient } from "../../lib/apiClient.js";
|
|
2
2
|
import logger from "../../logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Allowlist of non-sensitive fields safe to return to the LLM/tool caller.
|
|
5
|
+
* Everything else (site username/password, selectors, undeclared keys) is
|
|
6
|
+
* dropped rather than echoed — see rules/tool-design.md "never echo".
|
|
7
|
+
*/
|
|
8
|
+
export function safeAuthConfigData(response) {
|
|
9
|
+
const data = response?.data;
|
|
10
|
+
if (!data) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
id: data.id,
|
|
15
|
+
name: data.name,
|
|
16
|
+
type: data.type,
|
|
17
|
+
...(data.url ? { url: data.url } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
3
20
|
export class AccessibilityAuthConfig {
|
|
4
21
|
auth;
|
|
5
22
|
setAuth(auth) {
|
|
@@ -44,14 +61,14 @@ export class AccessibilityAuthConfig {
|
|
|
44
61
|
body: requestBody,
|
|
45
62
|
});
|
|
46
63
|
const data = response.data;
|
|
47
|
-
logger.info(`
|
|
64
|
+
logger.info(`Auth config API returned: ${JSON.stringify(safeAuthConfigData(data))}`);
|
|
48
65
|
if (!data.success) {
|
|
49
66
|
throw new Error(`Unable to create auth config: ${data.errors?.join(", ")}`);
|
|
50
67
|
}
|
|
51
68
|
return data;
|
|
52
69
|
}
|
|
53
70
|
catch (err) {
|
|
54
|
-
logger.error(`Error creating form auth config
|
|
71
|
+
logger.error(`Error creating form auth config (status ${err?.response?.status ?? "unknown"})`);
|
|
55
72
|
const msg = err?.response?.data?.error ||
|
|
56
73
|
err?.response?.data?.message ||
|
|
57
74
|
err?.message ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { APP_DEVICE_CONFIGS, AppSDKSupportedTestingFrameworkEnum, DEFAULT_APP_PATH, createStep, } from "./index.js";
|
|
2
|
-
export function generateAppBrowserStackYMLInstructions(config,
|
|
1
|
+
import { APP_DEVICE_CONFIGS, AppSDKSupportedTestingFrameworkEnum, DEFAULT_APP_PATH, USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, createStep, } from "./index.js";
|
|
2
|
+
export function generateAppBrowserStackYMLInstructions(config, appPath = DEFAULT_APP_PATH) {
|
|
3
3
|
if (config.testingFramework ===
|
|
4
4
|
AppSDKSupportedTestingFrameworkEnum.nightwatch ||
|
|
5
5
|
config.testingFramework ===
|
|
@@ -13,8 +13,8 @@ export function generateAppBrowserStackYMLInstructions(config, username, accessK
|
|
|
13
13
|
? `${config.projectName}-AppAutomate-Build`
|
|
14
14
|
: "bstack-demo";
|
|
15
15
|
const configContent = `\`\`\`yaml
|
|
16
|
-
userName: ${
|
|
17
|
-
accessKey: ${
|
|
16
|
+
userName: ${USERNAME_PLACEHOLDER}
|
|
17
|
+
accessKey: ${ACCESS_KEY_PLACEHOLDER}
|
|
18
18
|
app: ${appPath}
|
|
19
19
|
platforms:
|
|
20
20
|
${platformConfigs}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AppSDKSupportedFrameworkEnum, AppSDKSupportedTestingFrameworkEnum, AppSDKSupportedLanguageEnum } from "./
|
|
2
|
+
import { AppSDKSupportedFrameworkEnum, AppSDKSupportedTestingFrameworkEnum, AppSDKSupportedLanguageEnum } from "./types.js";
|
|
3
3
|
export declare const APP_DEVICE_CONFIGS: {
|
|
4
4
|
android: {
|
|
5
5
|
deviceName: string;
|
|
@@ -11,6 +11,7 @@ export declare const APP_DEVICE_CONFIGS: {
|
|
|
11
11
|
}[];
|
|
12
12
|
};
|
|
13
13
|
export declare const STEP_DELIMITER = "---STEP---";
|
|
14
|
+
export { USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, } from "../../sdk-utils/common/credentials.js";
|
|
14
15
|
export declare const DEFAULT_APP_PATH = "bs://sample.app";
|
|
15
16
|
export declare const MobileDeviceSchema: z.ZodObject<{
|
|
16
17
|
platform: z.ZodEnum<{
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// Import enums directly from types.js (not the index barrel) so this module has
|
|
3
|
+
// no cycle back through index → instructions → languages/*, letting other
|
|
4
|
+
// modules safely read the placeholder constants below at module scope.
|
|
5
|
+
import { AppSDKSupportedFrameworkEnum, AppSDKSupportedTestingFrameworkEnum, AppSDKSupportedLanguageEnum, } from "./types.js";
|
|
3
6
|
// App Automate specific device configurations
|
|
4
7
|
export const APP_DEVICE_CONFIGS = {
|
|
5
8
|
android: [
|
|
@@ -15,6 +18,7 @@ export const APP_DEVICE_CONFIGS = {
|
|
|
15
18
|
};
|
|
16
19
|
// Step delimiter for parsing instructions
|
|
17
20
|
export const STEP_DELIMITER = "---STEP---";
|
|
21
|
+
export { USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, } from "../../sdk-utils/common/credentials.js";
|
|
18
22
|
// Default app path for examples
|
|
19
23
|
export const DEFAULT_APP_PATH = "bs://sample.app";
|
|
20
24
|
export const MobileDeviceSchema = z.object({
|
|
@@ -2,7 +2,7 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
|
2
2
|
export declare function formatFinalAppInstructions(formattedInstructions: string): CallToolResult;
|
|
3
3
|
export declare function createStep(title: string, content: string): string;
|
|
4
4
|
export declare function combineInstructions(...instructionParts: string[]): string;
|
|
5
|
-
export declare function formatEnvCommands(
|
|
6
|
-
export declare function createEnvStep(
|
|
5
|
+
export declare function formatEnvCommands(isWindows: boolean): string;
|
|
6
|
+
export declare function createEnvStep(isWindows: boolean, platformLabel: string, title?: string): string;
|
|
7
7
|
export declare function formatMultiLineCommand(command: string, isWindows?: boolean): string;
|
|
8
8
|
export declare function formatAppInstructionsWithNumbers(instructions: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { STEP_DELIMITER } from "./constants.js";
|
|
1
|
+
import { STEP_DELIMITER, USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, } from "./constants.js";
|
|
2
2
|
export function formatFinalAppInstructions(formattedInstructions) {
|
|
3
3
|
const fullInstructions = `
|
|
4
4
|
⚠️ IMPORTANT: DO NOT SKIP ANY STEP
|
|
@@ -25,21 +25,21 @@ ${content}`;
|
|
|
25
25
|
export function combineInstructions(...instructionParts) {
|
|
26
26
|
return instructionParts.filter(Boolean).join("\n\n");
|
|
27
27
|
}
|
|
28
|
-
export function formatEnvCommands(
|
|
28
|
+
export function formatEnvCommands(isWindows) {
|
|
29
29
|
if (isWindows) {
|
|
30
30
|
return `\`\`\`cmd
|
|
31
|
-
setx BROWSERSTACK_USERNAME "${
|
|
32
|
-
setx BROWSERSTACK_ACCESS_KEY "${
|
|
31
|
+
setx BROWSERSTACK_USERNAME "${USERNAME_PLACEHOLDER}"
|
|
32
|
+
setx BROWSERSTACK_ACCESS_KEY "${ACCESS_KEY_PLACEHOLDER}"
|
|
33
33
|
\`\`\``;
|
|
34
34
|
}
|
|
35
35
|
return `\`\`\`bash
|
|
36
|
-
export BROWSERSTACK_USERNAME
|
|
37
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
36
|
+
export BROWSERSTACK_USERNAME="${USERNAME_PLACEHOLDER}"
|
|
37
|
+
export BROWSERSTACK_ACCESS_KEY="${ACCESS_KEY_PLACEHOLDER}"
|
|
38
38
|
\`\`\``;
|
|
39
39
|
}
|
|
40
|
-
export function createEnvStep(
|
|
40
|
+
export function createEnvStep(isWindows, platformLabel, title = "Set BrowserStack credentials as environment variables:") {
|
|
41
41
|
return createStep(title, `**${platformLabel}:**
|
|
42
|
-
${formatEnvCommands(
|
|
42
|
+
${formatEnvCommands(isWindows)}`);
|
|
43
43
|
}
|
|
44
44
|
export function formatMultiLineCommand(command, isWindows = process.platform === "win32") {
|
|
45
45
|
if (isWindows) {
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getBrowserStackAuth } from "../../../lib/get-auth.js";
|
|
3
3
|
import { validateAppAutomateDevices } from "../../sdk-utils/common/device-validator.js";
|
|
4
|
+
import { CREDENTIALS_SUBSTITUTION_NOTE } from "../../sdk-utils/common/credentials.js";
|
|
4
5
|
import { getAppUploadInstruction, validateSupportforAppAutomate, } from "./utils.js";
|
|
5
6
|
import { getAppSDKPrefixCommand, generateAppBrowserStackYMLInstructions, } from "./index.js";
|
|
6
|
-
import { formatAppInstructionsWithNumbers, getAppInstructionsForProjectConfiguration, SETUP_APP_AUTOMATE_SCHEMA, } from "./index.js";
|
|
7
|
+
import { createStep, formatAppInstructionsWithNumbers, getAppInstructionsForProjectConfiguration, SETUP_APP_AUTOMATE_SCHEMA, } from "./index.js";
|
|
7
8
|
export async function setupAppAutomateHandler(rawInput, config) {
|
|
8
9
|
const input = z.object(SETUP_APP_AUTOMATE_SCHEMA).parse(rawInput);
|
|
9
10
|
const auth = getBrowserStackAuth(config);
|
|
10
11
|
const [username, accessKey] = auth.split(":");
|
|
11
|
-
const instructions = [
|
|
12
|
+
const instructions = [
|
|
13
|
+
{
|
|
14
|
+
content: createStep("BrowserStack credentials", CREDENTIALS_SUBSTITUTION_NOTE),
|
|
15
|
+
type: "setup",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
12
18
|
// Use variables for all major input properties
|
|
13
19
|
const testingFramework = input.detectedTestingFramework;
|
|
14
20
|
const language = input.detectedLanguage;
|
|
@@ -30,7 +36,7 @@ export async function setupAppAutomateHandler(rawInput, config) {
|
|
|
30
36
|
// Extract platforms for backward compatibility (if needed)
|
|
31
37
|
const platforms = validatedEnvironments.map((env) => env.platform);
|
|
32
38
|
// Step 1: Generate SDK setup command
|
|
33
|
-
const sdkCommand = getAppSDKPrefixCommand(language, testingFramework,
|
|
39
|
+
const sdkCommand = getAppSDKPrefixCommand(language, testingFramework, appPath);
|
|
34
40
|
if (sdkCommand) {
|
|
35
41
|
instructions.push({ content: sdkCommand, type: "setup" });
|
|
36
42
|
}
|
|
@@ -40,7 +46,7 @@ export async function setupAppAutomateHandler(rawInput, config) {
|
|
|
40
46
|
platforms,
|
|
41
47
|
testingFramework,
|
|
42
48
|
projectName: input.project,
|
|
43
|
-
},
|
|
49
|
+
}, appPath);
|
|
44
50
|
if (configInstructions) {
|
|
45
51
|
instructions.push({ content: configInstructions, type: "config" });
|
|
46
52
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AppSDKSupportedLanguage, AppSDKSupportedTestingFramework } from "./index.js";
|
|
2
2
|
export declare function getAppInstructionsForProjectConfiguration(framework: string, testingFramework: AppSDKSupportedTestingFramework, language: AppSDKSupportedLanguage): string;
|
|
3
|
-
export declare function getAppSDKPrefixCommand(language: AppSDKSupportedLanguage, testingFramework: string,
|
|
3
|
+
export declare function getAppSDKPrefixCommand(language: AppSDKSupportedLanguage, testingFramework: string, appPath?: string): string;
|
|
@@ -29,18 +29,18 @@ export function getAppInstructionsForProjectConfiguration(framework, testingFram
|
|
|
29
29
|
return "";
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
export function getAppSDKPrefixCommand(language, testingFramework,
|
|
32
|
+
export function getAppSDKPrefixCommand(language, testingFramework, appPath) {
|
|
33
33
|
switch (language) {
|
|
34
34
|
case "csharp":
|
|
35
|
-
return getCSharpSDKCommand(
|
|
35
|
+
return getCSharpSDKCommand();
|
|
36
36
|
case "java":
|
|
37
|
-
return getJavaSDKCommand(testingFramework,
|
|
37
|
+
return getJavaSDKCommand(testingFramework, appPath);
|
|
38
38
|
case "nodejs":
|
|
39
|
-
return getNodejsSDKCommand(testingFramework
|
|
39
|
+
return getNodejsSDKCommand(testingFramework);
|
|
40
40
|
case "python":
|
|
41
|
-
return getPythonSDKCommand(testingFramework
|
|
41
|
+
return getPythonSDKCommand(testingFramework);
|
|
42
42
|
case "ruby":
|
|
43
|
-
return getRubySDKCommand(
|
|
43
|
+
return getRubySDKCommand();
|
|
44
44
|
default:
|
|
45
45
|
return "";
|
|
46
46
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function getCSharpAppInstructions(): string;
|
|
2
|
-
export declare function getCSharpSDKCommand(
|
|
2
|
+
export declare function getCSharpSDKCommand(): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// C# instructions and commands for App SDK utilities
|
|
2
|
-
import { PLATFORM_UTILS, createStep, createEnvStep, combineInstructions, } from "../index.js";
|
|
2
|
+
import { PLATFORM_UTILS, createStep, createEnvStep, combineInstructions, USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, } from "../index.js";
|
|
3
3
|
export function getCSharpAppInstructions() {
|
|
4
4
|
const { isWindows, isAppleSilicon, getPlatformLabel } = PLATFORM_UTILS;
|
|
5
5
|
let runCommand = "";
|
|
@@ -37,22 +37,22 @@ __Resolution:__
|
|
|
37
37
|
- Remove or comment out any code or configuration in your test setup (e.g., step definitions, runners, or capabilities setup) that sets the app path directly.`);
|
|
38
38
|
return runStep;
|
|
39
39
|
}
|
|
40
|
-
export function getCSharpSDKCommand(
|
|
40
|
+
export function getCSharpSDKCommand() {
|
|
41
41
|
const { isWindows = false, isAppleSilicon = false, getPlatformLabel = () => "Unknown", } = PLATFORM_UTILS || {};
|
|
42
42
|
if (!PLATFORM_UTILS) {
|
|
43
43
|
console.warn("PLATFORM_UTILS is undefined. Defaulting platform values.");
|
|
44
44
|
}
|
|
45
|
-
const envStep = createEnvStep(
|
|
45
|
+
const envStep = createEnvStep(isWindows, getPlatformLabel());
|
|
46
46
|
const installCommands = isWindows
|
|
47
47
|
? `\`\`\`cmd
|
|
48
48
|
dotnet add package BrowserStack.TestAdapter
|
|
49
49
|
dotnet build
|
|
50
|
-
dotnet browserstack-sdk setup --userName "${
|
|
50
|
+
dotnet browserstack-sdk setup --userName "${USERNAME_PLACEHOLDER}" --accessKey "${ACCESS_KEY_PLACEHOLDER}"
|
|
51
51
|
\`\`\``
|
|
52
52
|
: `\`\`\`bash
|
|
53
53
|
dotnet add package BrowserStack.TestAdapter
|
|
54
54
|
dotnet build
|
|
55
|
-
dotnet browserstack-sdk setup --userName "${
|
|
55
|
+
dotnet browserstack-sdk setup --userName "${USERNAME_PLACEHOLDER}" --accessKey "${ACCESS_KEY_PLACEHOLDER}"
|
|
56
56
|
\`\`\``;
|
|
57
57
|
const installStep = createStep("Install BrowserStack SDK", `Run the following command to install the BrowserStack SDK and create a browserstack.yml file in the root directory of your project:
|
|
58
58
|
|
|
@@ -7,4 +7,4 @@ export declare const GRADLE_APP_SETUP_INSTRUCTIONS = "\n**For Gradle setup:**\n1
|
|
|
7
7
|
export declare function getJavaAppInstructions(): string;
|
|
8
8
|
export declare function getJavaAppFrameworkForMaven(framework: string): string;
|
|
9
9
|
export declare function getJavaAppFrameworkVersion(framework: string): string;
|
|
10
|
-
export declare function getJavaSDKCommand(framework: string,
|
|
10
|
+
export declare function getJavaSDKCommand(framework: string, appPath?: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Java instructions and commands for App SDK utilities
|
|
2
|
-
import { createStep, combineInstructions, createEnvStep, PLATFORM_UTILS, } from "../index.js";
|
|
2
|
+
import { createStep, combineInstructions, createEnvStep, PLATFORM_UTILS, USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, } from "../index.js";
|
|
3
3
|
// Java-specific constants and mappings
|
|
4
4
|
export const MAVEN_ARCHETYPE_GROUP_ID = "com.browserstack";
|
|
5
5
|
export const MAVEN_ARCHETYPE_ARTIFACT_ID = "junit-archetype-integrate";
|
|
@@ -54,7 +54,7 @@ export function getJavaAppFrameworkForMaven(framework) {
|
|
|
54
54
|
export function getJavaAppFrameworkVersion(framework) {
|
|
55
55
|
return JAVA_APP_FRAMEWORK_VERSION_MAP[framework] || MAVEN_ARCHETYPE_VERSION;
|
|
56
56
|
}
|
|
57
|
-
function getMavenCommandForWindows(framework, mavenFramework, version,
|
|
57
|
+
function getMavenCommandForWindows(framework, mavenFramework, version, appPath) {
|
|
58
58
|
let command = `mvn archetype:generate -B ` +
|
|
59
59
|
`-DarchetypeGroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
60
60
|
`-DarchetypeArtifactId="${mavenFramework}" ` +
|
|
@@ -62,8 +62,8 @@ function getMavenCommandForWindows(framework, mavenFramework, version, username,
|
|
|
62
62
|
`-DgroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
63
63
|
`-DartifactId="${mavenFramework}" ` +
|
|
64
64
|
`-Dversion="${version}" ` +
|
|
65
|
-
`-DBROWSERSTACK_USERNAME="${
|
|
66
|
-
`-DBROWSERSTACK_ACCESS_KEY="${
|
|
65
|
+
`-DBROWSERSTACK_USERNAME="${USERNAME_PLACEHOLDER}" ` +
|
|
66
|
+
`-DBROWSERSTACK_ACCESS_KEY="${ACCESS_KEY_PLACEHOLDER}"`;
|
|
67
67
|
// Add framework parameter for browserstack-sdk-archetype-integrate
|
|
68
68
|
if (mavenFramework === "browserstack-sdk-archetype-integrate") {
|
|
69
69
|
command += ` -DBROWSERSTACK_FRAMEWORK="${framework}"`;
|
|
@@ -74,7 +74,7 @@ function getMavenCommandForWindows(framework, mavenFramework, version, username,
|
|
|
74
74
|
}
|
|
75
75
|
return command;
|
|
76
76
|
}
|
|
77
|
-
function getMavenCommandForUnix(framework, mavenFramework, version,
|
|
77
|
+
function getMavenCommandForUnix(framework, mavenFramework, version, appPath) {
|
|
78
78
|
let command = `mvn archetype:generate -B ` +
|
|
79
79
|
`-DarchetypeGroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
80
80
|
`-DarchetypeArtifactId="${mavenFramework}" ` +
|
|
@@ -82,8 +82,8 @@ function getMavenCommandForUnix(framework, mavenFramework, version, username, ac
|
|
|
82
82
|
`-DgroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
83
83
|
`-DartifactId="${mavenFramework}" ` +
|
|
84
84
|
`-Dversion="${version}" ` +
|
|
85
|
-
`-DBROWSERSTACK_USERNAME="${
|
|
86
|
-
`-DBROWSERSTACK_ACCESS_KEY="${
|
|
85
|
+
`-DBROWSERSTACK_USERNAME="${USERNAME_PLACEHOLDER}" ` +
|
|
86
|
+
`-DBROWSERSTACK_ACCESS_KEY="${ACCESS_KEY_PLACEHOLDER}"`;
|
|
87
87
|
// Add framework parameter for browserstack-sdk-archetype-integrate
|
|
88
88
|
if (mavenFramework === "browserstack-sdk-archetype-integrate") {
|
|
89
89
|
command += ` -DBROWSERSTACK_FRAMEWORK="${framework}"`;
|
|
@@ -94,18 +94,18 @@ function getMavenCommandForUnix(framework, mavenFramework, version, username, ac
|
|
|
94
94
|
}
|
|
95
95
|
return command;
|
|
96
96
|
}
|
|
97
|
-
export function getJavaSDKCommand(framework,
|
|
97
|
+
export function getJavaSDKCommand(framework, appPath) {
|
|
98
98
|
const { isWindows = false, getPlatformLabel } = PLATFORM_UTILS || {};
|
|
99
99
|
const mavenFramework = getJavaAppFrameworkForMaven(framework);
|
|
100
100
|
const version = getJavaAppFrameworkVersion(framework);
|
|
101
101
|
let mavenCommand;
|
|
102
102
|
if (isWindows) {
|
|
103
|
-
mavenCommand = getMavenCommandForWindows(framework, mavenFramework, version,
|
|
103
|
+
mavenCommand = getMavenCommandForWindows(framework, mavenFramework, version, appPath);
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
mavenCommand = getMavenCommandForUnix(framework, mavenFramework, version,
|
|
106
|
+
mavenCommand = getMavenCommandForUnix(framework, mavenFramework, version, appPath);
|
|
107
107
|
}
|
|
108
|
-
const envStep = createEnvStep(
|
|
108
|
+
const envStep = createEnvStep(isWindows, getPlatformLabel());
|
|
109
109
|
const mavenStep = createStep("Install BrowserStack SDK using Maven Archetype for App Automate", `Maven command for ${framework} (${getPlatformLabel()}):
|
|
110
110
|
\`\`\`bash
|
|
111
111
|
${mavenCommand}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AppSDKSupportedTestingFramework } from "../index.js";
|
|
2
|
-
export declare function getNodejsSDKCommand(testingFramework: string
|
|
2
|
+
export declare function getNodejsSDKCommand(testingFramework: string): string;
|
|
3
3
|
export declare function getNodejsAppInstructions(testingFramework: AppSDKSupportedTestingFramework): string;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Node.js instructions and commands for App SDK utilities
|
|
2
2
|
import { AppSDKSupportedTestingFrameworkEnum, createStep, combineInstructions, } from "../index.js";
|
|
3
|
-
export function getNodejsSDKCommand(testingFramework
|
|
3
|
+
export function getNodejsSDKCommand(testingFramework) {
|
|
4
4
|
switch (testingFramework) {
|
|
5
5
|
case "webdriverio":
|
|
6
|
-
return getWebDriverIOCommand(
|
|
6
|
+
return getWebDriverIOCommand();
|
|
7
7
|
case "nightwatch":
|
|
8
|
-
return getNightwatchCommand(
|
|
8
|
+
return getNightwatchCommand();
|
|
9
9
|
case "jest":
|
|
10
|
-
return getJestCommand(
|
|
10
|
+
return getJestCommand();
|
|
11
11
|
case "mocha":
|
|
12
|
-
return getMochaCommand(
|
|
12
|
+
return getMochaCommand();
|
|
13
13
|
case "cucumberJs":
|
|
14
|
-
return getCucumberJSCommand(
|
|
14
|
+
return getCucumberJSCommand();
|
|
15
15
|
default:
|
|
16
16
|
return "";
|
|
17
17
|
}
|
|
@@ -39,22 +39,22 @@ export function getNodejsAppInstructions(testingFramework) {
|
|
|
39
39
|
return "";
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function getWebDriverIOCommand(
|
|
42
|
+
function getWebDriverIOCommand() {
|
|
43
43
|
const prerequisiteStep = createStep("Prerequisite Setup:", `a. Ensure you do not modify or replace any existing local driver code,
|
|
44
44
|
as it will be automatically managed and overwritten by the BrowserStack SDK/Driver.
|
|
45
45
|
b. Do not create any YML file in this integration as it is not required.
|
|
46
46
|
c. Ensure you create the WDIO config file as per the instructions below.`);
|
|
47
47
|
const envStep = createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
|
|
48
|
-
export BROWSERSTACK_USERNAME
|
|
49
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
48
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
49
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
50
50
|
\`\`\``);
|
|
51
51
|
const installStep = createStep("Install BrowserStack WDIO service:", `\`\`\`bash
|
|
52
52
|
npm install @wdio/browserstack-service@^7 --save-dev
|
|
53
53
|
\`\`\``);
|
|
54
54
|
const configStep = createStep("Update your WebdriverIO config file (e.g., \\`wdio.conf.js\\`) to add the BrowserStack service and capabilities:", `\`\`\`js
|
|
55
55
|
exports.config = {
|
|
56
|
-
user: process.env.BROWSERSTACK_USERNAME || '
|
|
57
|
-
key: process.env.BROWSERSTACK_ACCESS_KEY || '
|
|
56
|
+
user: process.env.BROWSERSTACK_USERNAME || '<your_browserstack_username>',
|
|
57
|
+
key: process.env.BROWSERSTACK_ACCESS_KEY || '<your_browserstack_access_key>',
|
|
58
58
|
hostname: 'hub.browserstack.com',
|
|
59
59
|
services: [
|
|
60
60
|
[
|
|
@@ -92,14 +92,14 @@ exports.config = {
|
|
|
92
92
|
\`\`\``);
|
|
93
93
|
return combineInstructions(prerequisiteStep, envStep, installStep, configStep);
|
|
94
94
|
}
|
|
95
|
-
function getNightwatchCommand(
|
|
95
|
+
function getNightwatchCommand() {
|
|
96
96
|
const prerequisiteStep = createStep("Prerequisite Setup:", ` a. Ensure you do not modify or replace any existing local driver code,
|
|
97
97
|
as it will be automatically managed and overwritten by the BrowserStack SDK/Driver.
|
|
98
98
|
b. Do not create any YML file in this integration as it is not required.
|
|
99
99
|
c. Ensure you create the WDIO config file as per the instructions below.`);
|
|
100
100
|
const envStep = createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
|
|
101
|
-
export BROWSERSTACK_USERNAME
|
|
102
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
101
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
102
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
103
103
|
\`\`\``);
|
|
104
104
|
const installStep = createStep("Install Nightwatch and BrowserStack integration:", `\`\`\`bash
|
|
105
105
|
npm install --save-dev @nightwatch/browserstack
|
|
@@ -166,29 +166,29 @@ npm install --save-dev @nightwatch/browserstack
|
|
|
166
166
|
\`\`\``);
|
|
167
167
|
return combineInstructions(prerequisiteStep, envStep, installStep, configStep);
|
|
168
168
|
}
|
|
169
|
-
function getJestCommand(
|
|
169
|
+
function getJestCommand() {
|
|
170
170
|
const envStep = createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
|
|
171
|
-
export BROWSERSTACK_USERNAME
|
|
172
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
171
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
172
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
173
173
|
\`\`\``);
|
|
174
174
|
const installStep = createStep("Install Jest and BrowserStack SDK:", `\`\`\`bash
|
|
175
175
|
npm install --save-dev browserstack-node-sdk
|
|
176
176
|
\`\`\``);
|
|
177
177
|
return combineInstructions(envStep, installStep);
|
|
178
178
|
}
|
|
179
|
-
function getMochaCommand(
|
|
179
|
+
function getMochaCommand() {
|
|
180
180
|
const envStep = createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
|
|
181
|
-
export BROWSERSTACK_USERNAME
|
|
182
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
181
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
182
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
183
183
|
\`\`\``);
|
|
184
184
|
const installStep = createStep("Install Mocha and BrowserStack SDK:", `\`\`\`bash
|
|
185
185
|
npm install --save-dev browserstack-node-sdk
|
|
186
186
|
\`\`\``);
|
|
187
187
|
return combineInstructions(envStep, installStep);
|
|
188
188
|
}
|
|
189
|
-
function getCucumberJSCommand(
|
|
189
|
+
function getCucumberJSCommand() {
|
|
190
190
|
return createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
|
|
191
|
-
export BROWSERSTACK_USERNAME
|
|
192
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
191
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
192
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
193
193
|
\`\`\``);
|
|
194
194
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AppSDKSupportedTestingFramework } from "../index.js";
|
|
2
2
|
export declare function getPythonAppInstructions(testingFramework: AppSDKSupportedTestingFramework): string;
|
|
3
|
-
export declare function getPythonSDKCommand(framework: string
|
|
3
|
+
export declare function getPythonSDKCommand(framework: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Python instructions and commands for App SDK utilities
|
|
2
|
-
import { AppSDKSupportedTestingFrameworkEnum, createStep, createEnvStep, combineInstructions, PLATFORM_UTILS, } from "../index.js";
|
|
2
|
+
import { AppSDKSupportedTestingFrameworkEnum, createStep, createEnvStep, combineInstructions, PLATFORM_UTILS, USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER, } from "../index.js";
|
|
3
3
|
export function getPythonAppInstructions(testingFramework) {
|
|
4
4
|
switch (testingFramework) {
|
|
5
5
|
case AppSDKSupportedTestingFrameworkEnum.robot:
|
|
@@ -23,37 +23,37 @@ paver run first_test
|
|
|
23
23
|
return "";
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
export function getPythonSDKCommand(framework
|
|
26
|
+
export function getPythonSDKCommand(framework) {
|
|
27
27
|
const { isWindows, getPlatformLabel } = PLATFORM_UTILS;
|
|
28
28
|
switch (framework) {
|
|
29
29
|
case "robot":
|
|
30
30
|
case "pytest":
|
|
31
31
|
case "behave":
|
|
32
|
-
return getPythonCommonSDKCommand(
|
|
32
|
+
return getPythonCommonSDKCommand(isWindows, getPlatformLabel());
|
|
33
33
|
case "lettuce":
|
|
34
|
-
return getLettuceCommand(
|
|
34
|
+
return getLettuceCommand(isWindows, getPlatformLabel());
|
|
35
35
|
default:
|
|
36
36
|
return "";
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function getPythonCommonSDKCommand(
|
|
40
|
-
const envStep = createEnvStep(
|
|
39
|
+
function getPythonCommonSDKCommand(isWindows, platformLabel) {
|
|
40
|
+
const envStep = createEnvStep(isWindows, platformLabel, "Set your BrowserStack credentials as environment variables:");
|
|
41
41
|
const installStep = createStep("Install BrowserStack Python SDK:", `\`\`\`bash
|
|
42
42
|
python3 -m pip install browserstack-sdk
|
|
43
43
|
\`\`\``);
|
|
44
44
|
const setupStep = createStep("Set up BrowserStack SDK:", `\`\`\`bash
|
|
45
|
-
browserstack-sdk setup --username "${
|
|
45
|
+
browserstack-sdk setup --username "${USERNAME_PLACEHOLDER}" --key "${ACCESS_KEY_PLACEHOLDER}"
|
|
46
46
|
\`\`\``);
|
|
47
47
|
return combineInstructions(envStep, installStep, setupStep);
|
|
48
48
|
}
|
|
49
|
-
function getLettuceCommand(
|
|
50
|
-
const envStep = createEnvStep(
|
|
49
|
+
function getLettuceCommand(isWindows, platformLabel) {
|
|
50
|
+
const envStep = createEnvStep(isWindows, platformLabel, "Set your BrowserStack credentials as environment variables:");
|
|
51
51
|
const configStep = createStep("Configure Appium's desired capabilities in config.json:", `**Android example:**
|
|
52
52
|
\`\`\`json
|
|
53
53
|
{
|
|
54
54
|
"capabilities": {
|
|
55
|
-
"browserstack.user" : "${
|
|
56
|
-
"browserstack.key" : "${
|
|
55
|
+
"browserstack.user" : "${USERNAME_PLACEHOLDER}",
|
|
56
|
+
"browserstack.key" : "${ACCESS_KEY_PLACEHOLDER}",
|
|
57
57
|
"project": "First Lettuce Android Project",
|
|
58
58
|
"build": "Lettuce Android",
|
|
59
59
|
"name": "first_test",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function getRubyAppInstructions(): string;
|
|
2
|
-
export declare function getRubySDKCommand(
|
|
2
|
+
export declare function getRubySDKCommand(): string;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Ruby instructions and commands for App SDK utilities
|
|
2
2
|
import { createStep, combineInstructions, createEnvStep, PLATFORM_UTILS, } from "../index.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// Import placeholders straight from constants.js (not the index barrel) so these
|
|
4
|
+
// module-scope constants have no circular dependency on the barrel.
|
|
5
|
+
import { USERNAME_PLACEHOLDER, ACCESS_KEY_PLACEHOLDER } from "../constants.js";
|
|
6
|
+
const username = USERNAME_PLACEHOLDER;
|
|
7
|
+
const accessKey = ACCESS_KEY_PLACEHOLDER;
|
|
5
8
|
export function getRubyAppInstructions() {
|
|
6
9
|
const configStep = createStep("Create/Update the config file (config.yml) as follows:", `\`\`\`yaml
|
|
7
10
|
server: "hub-cloud.browserstack.com"
|
|
@@ -56,9 +59,9 @@ bundle exec cucumber
|
|
|
56
59
|
\`\`\``);
|
|
57
60
|
return combineInstructions(configStep, envStep, runStep);
|
|
58
61
|
}
|
|
59
|
-
export function getRubySDKCommand(
|
|
62
|
+
export function getRubySDKCommand() {
|
|
60
63
|
const { isWindows, getPlatformLabel } = PLATFORM_UTILS;
|
|
61
|
-
const envStep = createEnvStep(
|
|
64
|
+
const envStep = createEnvStep(isWindows, getPlatformLabel(), "Set your BrowserStack credentials as environment variables:");
|
|
62
65
|
const installStep = createStep("Install required Ruby gems:", `\`\`\`bash
|
|
63
66
|
# Install Bundler if not already installed
|
|
64
67
|
gem install bundler
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SDKSupportedLanguage } from "../common/types.js";
|
|
2
|
-
export declare function getSDKPrefixCommand(language: SDKSupportedLanguage, framework: string
|
|
2
|
+
export declare function getSDKPrefixCommand(language: SDKSupportedLanguage, framework: string): string;
|
|
3
3
|
export declare function getJavaFrameworkForMaven(framework: string): string;
|
|
@@ -10,7 +10,7 @@ const JAVA_FRAMEWORK_MAP = {
|
|
|
10
10
|
cucumber: "cucumber-testng",
|
|
11
11
|
};
|
|
12
12
|
// Template for Node.js SDK setup instructions
|
|
13
|
-
const NODEJS_SDK_INSTRUCTIONS = (
|
|
13
|
+
const NODEJS_SDK_INSTRUCTIONS = () => `---STEP---
|
|
14
14
|
Install BrowserStack Node SDK using command:
|
|
15
15
|
\`\`\`bash
|
|
16
16
|
npm i -D browserstack-node-sdk@latest
|
|
@@ -18,7 +18,7 @@ npm i -D browserstack-node-sdk@latest
|
|
|
18
18
|
---STEP---
|
|
19
19
|
Run the following command to setup browserstack sdk:
|
|
20
20
|
\`\`\`bash
|
|
21
|
-
npx browserstack-node-sdk setup --username
|
|
21
|
+
npx browserstack-node-sdk setup --username "<your_browserstack_username>" --key "<your_browserstack_access_key>"
|
|
22
22
|
\`\`\``;
|
|
23
23
|
// Template for Gradle setup instructions (platform-independent)
|
|
24
24
|
const GRADLE_SETUP_INSTRUCTIONS = `
|
|
@@ -33,7 +33,7 @@ const GRADLE_SETUP_INSTRUCTIONS = `
|
|
|
33
33
|
jvmArgs "-javaagent:\${browserstackSDKArtifact.file}"
|
|
34
34
|
`;
|
|
35
35
|
// Generates Maven archetype command for Windows platform
|
|
36
|
-
function getMavenCommandForWindows(
|
|
36
|
+
function getMavenCommandForWindows(mavenFramework) {
|
|
37
37
|
return (`mvn archetype:generate -B ` +
|
|
38
38
|
`-DarchetypeGroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
39
39
|
`-DarchetypeArtifactId="${MAVEN_ARCHETYPE_ARTIFACT_ID}" ` +
|
|
@@ -41,27 +41,27 @@ function getMavenCommandForWindows(username, accessKey, mavenFramework) {
|
|
|
41
41
|
`-DgroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
42
42
|
`-DartifactId="${MAVEN_ARCHETYPE_ARTIFACT_ID}" ` +
|
|
43
43
|
`-Dversion="${MAVEN_ARCHETYPE_VERSION}" ` +
|
|
44
|
-
`-DBROWSERSTACK_USERNAME="
|
|
45
|
-
`-DBROWSERSTACK_ACCESS_KEY="
|
|
44
|
+
`-DBROWSERSTACK_USERNAME="<your_browserstack_username>" ` +
|
|
45
|
+
`-DBROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>" ` +
|
|
46
46
|
`-DBROWSERSTACK_FRAMEWORK="${mavenFramework}"`);
|
|
47
47
|
}
|
|
48
48
|
// Generates Maven archetype command for Unix-like platforms (macOS/Linux)
|
|
49
|
-
function getMavenCommandForUnix(
|
|
49
|
+
function getMavenCommandForUnix(mavenFramework) {
|
|
50
50
|
return `mvn archetype:generate -B -DarchetypeGroupId=${MAVEN_ARCHETYPE_GROUP_ID} \\
|
|
51
51
|
-DarchetypeArtifactId=${MAVEN_ARCHETYPE_ARTIFACT_ID} -DarchetypeVersion=${MAVEN_ARCHETYPE_VERSION} \\
|
|
52
52
|
-DgroupId=${MAVEN_ARCHETYPE_GROUP_ID} -DartifactId=${MAVEN_ARCHETYPE_ARTIFACT_ID} -Dversion=${MAVEN_ARCHETYPE_VERSION} \\
|
|
53
|
-
-DBROWSERSTACK_USERNAME="
|
|
54
|
-
-DBROWSERSTACK_ACCESS_KEY="
|
|
53
|
+
-DBROWSERSTACK_USERNAME="<your_browserstack_username>" \\
|
|
54
|
+
-DBROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>" \\
|
|
55
55
|
-DBROWSERSTACK_FRAMEWORK="${mavenFramework}"`;
|
|
56
56
|
}
|
|
57
57
|
// Generates Java SDK setup instructions with Maven/Gradle options
|
|
58
|
-
function getJavaSDKInstructions(framework
|
|
58
|
+
function getJavaSDKInstructions(framework) {
|
|
59
59
|
const mavenFramework = getJavaFrameworkForMaven(framework);
|
|
60
60
|
const isWindows = process.platform === "win32";
|
|
61
61
|
const platformLabel = isWindows ? "Windows" : "macOS/Linux";
|
|
62
62
|
const mavenCommand = isWindows
|
|
63
|
-
? getMavenCommandForWindows(
|
|
64
|
-
: getMavenCommandForUnix(
|
|
63
|
+
? getMavenCommandForWindows(mavenFramework)
|
|
64
|
+
: getMavenCommandForUnix(mavenFramework);
|
|
65
65
|
return `---STEP---
|
|
66
66
|
Install BrowserStack Java SDK
|
|
67
67
|
|
|
@@ -73,12 +73,12 @@ Alternative setup for Gradle users:
|
|
|
73
73
|
${GRADLE_SETUP_INSTRUCTIONS}`;
|
|
74
74
|
}
|
|
75
75
|
// Main function to get SDK setup commands based on language and framework
|
|
76
|
-
export function getSDKPrefixCommand(language, framework
|
|
76
|
+
export function getSDKPrefixCommand(language, framework) {
|
|
77
77
|
switch (language) {
|
|
78
78
|
case "nodejs":
|
|
79
|
-
return NODEJS_SDK_INSTRUCTIONS(
|
|
79
|
+
return NODEJS_SDK_INSTRUCTIONS();
|
|
80
80
|
case "java":
|
|
81
|
-
return getJavaSDKInstructions(framework
|
|
81
|
+
return getJavaSDKInstructions(framework);
|
|
82
82
|
default:
|
|
83
83
|
return "";
|
|
84
84
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ValidatedEnvironment } from "../common/device-validator.js";
|
|
2
|
-
import { BrowserStackConfig } from "../../../lib/types.js";
|
|
3
2
|
export declare function generateBrowserStackYMLInstructions(config: {
|
|
4
3
|
validatedEnvironments?: ValidatedEnvironment[];
|
|
5
4
|
platforms?: string[];
|
|
6
5
|
enablePercy?: boolean;
|
|
7
6
|
projectName: string;
|
|
8
|
-
}
|
|
7
|
+
}): string;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export function generateBrowserStackYMLInstructions(config, browserStackConfig) {
|
|
1
|
+
export function generateBrowserStackYMLInstructions(config) {
|
|
3
2
|
const enablePercy = config.enablePercy || false;
|
|
4
3
|
const projectName = config.projectName || "BrowserStack Automate Build";
|
|
5
|
-
// Get credentials from config
|
|
6
|
-
const authString = getBrowserStackAuth(browserStackConfig);
|
|
7
|
-
const [username, accessKey] = authString.split(":");
|
|
8
4
|
// Generate platform configurations using the utility function
|
|
9
5
|
const platformConfigs = generatePlatformConfigs(config);
|
|
10
6
|
const stepTitle = "Create a browserstack.yml file in the project root with your validated device configurations:If already exists, update it with the following content for devices and project details.";
|
|
@@ -14,8 +10,8 @@ export function generateBrowserStackYMLInstructions(config, browserStackConfig)
|
|
|
14
10
|
# BrowserStack Reporting
|
|
15
11
|
# ======================
|
|
16
12
|
|
|
17
|
-
userName:
|
|
18
|
-
accessKey:
|
|
13
|
+
userName: <your_browserstack_username>
|
|
14
|
+
accessKey: <your_browserstack_access_key>
|
|
19
15
|
|
|
20
16
|
# TODO: Replace these sample values with your actual project details
|
|
21
17
|
projectName: ${projectName}
|
|
@@ -6,52 +6,52 @@ export declare const pythonInstructions: () => {
|
|
|
6
6
|
setup: string;
|
|
7
7
|
run: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const generatePythonFrameworkInstructions: (framework: string) => (
|
|
9
|
+
export declare const generatePythonFrameworkInstructions: (framework: string) => () => {
|
|
10
10
|
setup: string;
|
|
11
11
|
run: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const robotInstructions: (
|
|
13
|
+
export declare const robotInstructions: () => {
|
|
14
14
|
setup: string;
|
|
15
15
|
run: string;
|
|
16
16
|
};
|
|
17
|
-
export declare const behaveInstructions: (
|
|
17
|
+
export declare const behaveInstructions: () => {
|
|
18
18
|
setup: string;
|
|
19
19
|
run: string;
|
|
20
20
|
};
|
|
21
|
-
export declare const pytestInstructions: (
|
|
21
|
+
export declare const pytestInstructions: () => {
|
|
22
22
|
setup: string;
|
|
23
23
|
run: string;
|
|
24
24
|
};
|
|
25
|
-
export declare const javaInstructions: (
|
|
25
|
+
export declare const javaInstructions: () => {
|
|
26
26
|
setup: string;
|
|
27
27
|
run: string;
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* ---------- CSharp INSTRUCTIONS ----------
|
|
31
31
|
*/
|
|
32
|
-
export declare const csharpCommonInstructions: (
|
|
32
|
+
export declare const csharpCommonInstructions: () => {
|
|
33
33
|
setup: string;
|
|
34
34
|
run: string;
|
|
35
35
|
};
|
|
36
|
-
export declare const csharpPlaywrightCommonInstructions: (
|
|
36
|
+
export declare const csharpPlaywrightCommonInstructions: () => {
|
|
37
37
|
setup: string;
|
|
38
38
|
run: string;
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
* ---------- NODEJS INSTRUCTIONS ----------
|
|
42
42
|
*/
|
|
43
|
-
export declare const nodejsInstructions: (
|
|
43
|
+
export declare const nodejsInstructions: () => {
|
|
44
44
|
setup: string;
|
|
45
45
|
run: string;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
48
|
* ---------- EXPORT CONFIG ----------
|
|
49
49
|
*/
|
|
50
|
-
export declare const webdriverioInstructions: (
|
|
50
|
+
export declare const webdriverioInstructions: () => {
|
|
51
51
|
setup: string;
|
|
52
52
|
run: string;
|
|
53
53
|
};
|
|
54
|
-
export declare const cypressInstructions: (
|
|
54
|
+
export declare const cypressInstructions: () => {
|
|
55
55
|
setup: string;
|
|
56
56
|
run: string;
|
|
57
57
|
};
|
|
@@ -25,7 +25,7 @@ browserstack-sdk pytest <path-to-test-directory>
|
|
|
25
25
|
`;
|
|
26
26
|
return { setup, run };
|
|
27
27
|
};
|
|
28
|
-
export const generatePythonFrameworkInstructions = (framework) => (
|
|
28
|
+
export const generatePythonFrameworkInstructions = (framework) => () => {
|
|
29
29
|
const setup = `
|
|
30
30
|
---STEP---
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ python3 -m pip install browserstack-sdk
|
|
|
39
39
|
|
|
40
40
|
Setup the BrowserStack SDK with framework-specific configuration:
|
|
41
41
|
\`\`\`bash
|
|
42
|
-
browserstack-sdk setup --framework "${framework}" --username "
|
|
42
|
+
browserstack-sdk setup --framework "${framework}" --username "<your_browserstack_username>" --key "<your_browserstack_access_key>"
|
|
43
43
|
\`\`\`
|
|
44
44
|
`;
|
|
45
45
|
const run = `
|
|
@@ -59,7 +59,7 @@ export const pytestInstructions = generatePythonFrameworkInstructions("pytest");
|
|
|
59
59
|
* ---------- JAVA INSTRUCTIONS ----------
|
|
60
60
|
*/
|
|
61
61
|
const argsInstruction = '<argLine>-javaagent:"${com.browserstack:browserstack-java-sdk:jar}"</argLine>';
|
|
62
|
-
export const javaInstructions = (
|
|
62
|
+
export const javaInstructions = () => {
|
|
63
63
|
const setup = `
|
|
64
64
|
---STEP---
|
|
65
65
|
|
|
@@ -86,8 +86,8 @@ dependencies {
|
|
|
86
86
|
|
|
87
87
|
Export your BrowserStack credentials as environment variables:
|
|
88
88
|
\`\`\`bash
|
|
89
|
-
export BROWSERSTACK_USERNAME
|
|
90
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
89
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
90
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
91
91
|
\`\`\`
|
|
92
92
|
`;
|
|
93
93
|
const run = `
|
|
@@ -108,7 +108,7 @@ gradle clean test
|
|
|
108
108
|
/**
|
|
109
109
|
* ---------- CSharp INSTRUCTIONS ----------
|
|
110
110
|
*/
|
|
111
|
-
export const csharpCommonInstructions = (
|
|
111
|
+
export const csharpCommonInstructions = () => {
|
|
112
112
|
const setup = `
|
|
113
113
|
---STEP---
|
|
114
114
|
|
|
@@ -128,7 +128,7 @@ dotnet build
|
|
|
128
128
|
|
|
129
129
|
Set up BrowserStack SDK with your credentials:
|
|
130
130
|
\`\`\`bash
|
|
131
|
-
dotnet browserstack-sdk setup --userName
|
|
131
|
+
dotnet browserstack-sdk setup --userName "<your_browserstack_username>" --accessKey "<your_browserstack_access_key>"
|
|
132
132
|
\`\`\`
|
|
133
133
|
|
|
134
134
|
---STEP---
|
|
@@ -174,7 +174,7 @@ Run the tests:
|
|
|
174
174
|
`;
|
|
175
175
|
return { setup, run };
|
|
176
176
|
};
|
|
177
|
-
export const csharpPlaywrightCommonInstructions = (
|
|
177
|
+
export const csharpPlaywrightCommonInstructions = () => {
|
|
178
178
|
const setup = `
|
|
179
179
|
---STEP---
|
|
180
180
|
|
|
@@ -194,7 +194,7 @@ dotnet build
|
|
|
194
194
|
|
|
195
195
|
Set up BrowserStack SDK with your credentials:
|
|
196
196
|
\`\`\`bash
|
|
197
|
-
dotnet browserstack-sdk setup --userName
|
|
197
|
+
dotnet browserstack-sdk setup --userName "<your_browserstack_username>" --accessKey "<your_browserstack_access_key>"
|
|
198
198
|
\`\`\`
|
|
199
199
|
|
|
200
200
|
---STEP---
|
|
@@ -256,7 +256,7 @@ Run the tests:
|
|
|
256
256
|
/**
|
|
257
257
|
* ---------- NODEJS INSTRUCTIONS ----------
|
|
258
258
|
*/
|
|
259
|
-
export const nodejsInstructions = (
|
|
259
|
+
export const nodejsInstructions = () => {
|
|
260
260
|
const setup = `
|
|
261
261
|
---STEP---
|
|
262
262
|
|
|
@@ -285,8 +285,8 @@ Example :
|
|
|
285
285
|
Export BrowserStack credentials as environment variables:
|
|
286
286
|
Set the following environment variables before running tests.
|
|
287
287
|
\`\`\`bash
|
|
288
|
-
export BROWSERSTACK_USERNAME
|
|
289
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
288
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
289
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
290
290
|
\`\`\`
|
|
291
291
|
|
|
292
292
|
---STEP---
|
|
@@ -306,7 +306,7 @@ npm run test:browserstack
|
|
|
306
306
|
/**
|
|
307
307
|
* ---------- EXPORT CONFIG ----------
|
|
308
308
|
*/
|
|
309
|
-
export const webdriverioInstructions = (
|
|
309
|
+
export const webdriverioInstructions = () => {
|
|
310
310
|
const setup = `
|
|
311
311
|
---STEP---
|
|
312
312
|
|
|
@@ -315,14 +315,14 @@ Export your BrowserStack username and access key as environment variables.
|
|
|
315
315
|
|
|
316
316
|
For macOS/Linux:
|
|
317
317
|
\`\`\`bash
|
|
318
|
-
export BROWSERSTACK_USERNAME
|
|
319
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
318
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
319
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
320
320
|
\`\`\`
|
|
321
321
|
|
|
322
322
|
For Windows PowerShell:
|
|
323
323
|
\`\`\`powershell
|
|
324
|
-
$env:BROWSERSTACK_USERNAME
|
|
325
|
-
$env:BROWSERSTACK_ACCESS_KEY
|
|
324
|
+
$env:BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
325
|
+
$env:BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
326
326
|
\`\`\`
|
|
327
327
|
|
|
328
328
|
---STEP---
|
|
@@ -415,7 +415,7 @@ You can now run your tests on BrowserStack using your standard WebdriverIO comma
|
|
|
415
415
|
`;
|
|
416
416
|
return { setup, run };
|
|
417
417
|
};
|
|
418
|
-
export const cypressInstructions = (
|
|
418
|
+
export const cypressInstructions = () => {
|
|
419
419
|
const setup = `
|
|
420
420
|
---STEP---
|
|
421
421
|
|
|
@@ -445,8 +445,8 @@ Open the generated \`browserstack.json\` file and update it with your BrowserSta
|
|
|
445
445
|
\`\`\`json
|
|
446
446
|
{
|
|
447
447
|
"auth": {
|
|
448
|
-
"username": "
|
|
449
|
-
"access_key": "
|
|
448
|
+
"username": "<your_browserstack_username>",
|
|
449
|
+
"access_key": "<your_browserstack_access_key>"
|
|
450
450
|
},
|
|
451
451
|
"browsers": [
|
|
452
452
|
{
|
|
@@ -490,21 +490,21 @@ npx browserstack-cypress run --sync
|
|
|
490
490
|
After the tests complete, you can view the results on your [BrowserStack Automate Dashboard](https://automate.browserstack.com/dashboard/).`;
|
|
491
491
|
return { setup, run };
|
|
492
492
|
};
|
|
493
|
-
const serenityInstructions = (
|
|
493
|
+
const serenityInstructions = () => {
|
|
494
494
|
const setup = `
|
|
495
495
|
---STEP---
|
|
496
496
|
|
|
497
497
|
Set BrowserStack credentials as environment variables:
|
|
498
498
|
For macOS/Linux:
|
|
499
499
|
\`\`\`bash
|
|
500
|
-
export BROWSERSTACK_USERNAME
|
|
501
|
-
export BROWSERSTACK_ACCESS_KEY
|
|
500
|
+
export BROWSERSTACK_USERNAME="<your_browserstack_username>"
|
|
501
|
+
export BROWSERSTACK_ACCESS_KEY="<your_browserstack_access_key>"
|
|
502
502
|
\`\`\`
|
|
503
503
|
|
|
504
504
|
For Windows Command Prompt:
|
|
505
505
|
\`\`\`cmd
|
|
506
|
-
set BROWSERSTACK_USERNAME
|
|
507
|
-
set BROWSERSTACK_ACCESS_KEY
|
|
506
|
+
set "BROWSERSTACK_USERNAME=<your_browserstack_username>"
|
|
507
|
+
set "BROWSERSTACK_ACCESS_KEY=<your_browserstack_access_key>"
|
|
508
508
|
\`\`\`
|
|
509
509
|
|
|
510
510
|
---STEP---
|
|
@@ -528,8 +528,8 @@ webdriver {
|
|
|
528
528
|
driver = remote
|
|
529
529
|
remote.url = "https://hub.browserstack.com/wd/hub"
|
|
530
530
|
}
|
|
531
|
-
browserstack.user="
|
|
532
|
-
browserstack.key="
|
|
531
|
+
browserstack.user="<your_browserstack_username>"
|
|
532
|
+
browserstack.key="<your_browserstack_access_key>"
|
|
533
533
|
\`\`\`
|
|
534
534
|
`;
|
|
535
535
|
const run = `
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { getBrowserStackAuth } from "../../../lib/get-auth.js";
|
|
2
1
|
import { getSDKPrefixCommand } from "./commands.js";
|
|
3
2
|
import { generateBrowserStackYMLInstructions } from "./configUtils.js";
|
|
4
3
|
import { getInstructionsForProjectConfiguration } from "../common/instructionUtils.js";
|
|
4
|
+
import { CREDENTIALS_SUBSTITUTION_NOTE } from "../common/credentials.js";
|
|
5
5
|
import { validateDevices } from "../common/device-validator.js";
|
|
6
|
-
export async function runBstackSDKOnly(input,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export async function runBstackSDKOnly(input,
|
|
7
|
+
// Retained for tool-handler signature stability (callers pass the per-request
|
|
8
|
+
// config); setup instructions no longer embed credentials, so it is unused here.
|
|
9
|
+
config, isPercyAutomate = false) {
|
|
10
|
+
void config;
|
|
11
|
+
const steps = [
|
|
12
|
+
{
|
|
13
|
+
type: "instruction",
|
|
14
|
+
title: "Set your BrowserStack credentials",
|
|
15
|
+
content: CREDENTIALS_SUBSTITUTION_NOTE,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
10
18
|
const tupleTargets = input.devices?.map((device) => {
|
|
11
19
|
const platform = device.platform.toLowerCase();
|
|
12
20
|
if (platform === "windows" || platform === "macos") {
|
|
@@ -32,7 +40,7 @@ export async function runBstackSDKOnly(input, config, isPercyAutomate = false) {
|
|
|
32
40
|
// Handle frameworks with unique setup instructions that don't use browserstack.yml
|
|
33
41
|
if (input.detectedBrowserAutomationFramework === "cypress" ||
|
|
34
42
|
input.detectedBrowserAutomationFramework === "webdriverio") {
|
|
35
|
-
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage
|
|
43
|
+
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage);
|
|
36
44
|
if (frameworkInstructions) {
|
|
37
45
|
if (frameworkInstructions.setup) {
|
|
38
46
|
steps.push({
|
|
@@ -56,7 +64,7 @@ export async function runBstackSDKOnly(input, config, isPercyAutomate = false) {
|
|
|
56
64
|
};
|
|
57
65
|
}
|
|
58
66
|
// Default flow using browserstack.yml
|
|
59
|
-
const sdkSetupCommand = getSDKPrefixCommand(input.detectedLanguage, input.detectedTestingFramework
|
|
67
|
+
const sdkSetupCommand = getSDKPrefixCommand(input.detectedLanguage, input.detectedTestingFramework);
|
|
60
68
|
if (sdkSetupCommand) {
|
|
61
69
|
steps.push({
|
|
62
70
|
type: "instruction",
|
|
@@ -64,7 +72,7 @@ export async function runBstackSDKOnly(input, config, isPercyAutomate = false) {
|
|
|
64
72
|
content: sdkSetupCommand,
|
|
65
73
|
});
|
|
66
74
|
}
|
|
67
|
-
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage
|
|
75
|
+
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage);
|
|
68
76
|
if (frameworkInstructions) {
|
|
69
77
|
if (frameworkInstructions.setup) {
|
|
70
78
|
steps.push({
|
|
@@ -78,7 +86,7 @@ export async function runBstackSDKOnly(input, config, isPercyAutomate = false) {
|
|
|
78
86
|
validatedEnvironments,
|
|
79
87
|
enablePercy: false,
|
|
80
88
|
projectName: input.projectName,
|
|
81
|
-
}
|
|
89
|
+
});
|
|
82
90
|
if (ymlInstructions) {
|
|
83
91
|
steps.push({
|
|
84
92
|
type: "instruction",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Single source of truth for the credential placeholders emitted in generated
|
|
2
|
+
// SDK setup instructions, so the web (sdk-utils) and App Automate (appium-sdk)
|
|
3
|
+
// trees cannot drift apart. Real credentials are never embedded — see
|
|
4
|
+
// rules/security.md.
|
|
5
|
+
export const USERNAME_PLACEHOLDER = "<your_browserstack_username>";
|
|
6
|
+
export const ACCESS_KEY_PLACEHOLDER = "<your_browserstack_access_key>";
|
|
7
|
+
// Tells the reader (often a coding agent that runs steps verbatim) to swap the
|
|
8
|
+
// placeholders for real values, so they are not baked into browserstack.yml.
|
|
9
|
+
export const CREDENTIALS_SUBSTITUTION_NOTE = `Replace ${USERNAME_PLACEHOLDER} and ${ACCESS_KEY_PLACEHOLDER} in the steps below ` +
|
|
10
|
+
`with your BrowserStack credentials from https://www.browserstack.com/accounts/profile/details ` +
|
|
11
|
+
`(or export them as BROWSERSTACK_USERNAME / BROWSERSTACK_ACCESS_KEY). Do not commit real credentials.`;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Core instruction configuration utilities for runTestsOnBrowserStack tool.
|
|
3
3
|
*/
|
|
4
4
|
import { SDKSupportedLanguage, SDKSupportedBrowserAutomationFramework, SDKSupportedTestingFramework } from "./types.js";
|
|
5
|
-
export declare const getInstructionsForProjectConfiguration: (detectedBrowserAutomationFramework: SDKSupportedBrowserAutomationFramework, detectedTestingFramework: SDKSupportedTestingFramework, detectedLanguage: SDKSupportedLanguage
|
|
5
|
+
export declare const getInstructionsForProjectConfiguration: (detectedBrowserAutomationFramework: SDKSupportedBrowserAutomationFramework, detectedTestingFramework: SDKSupportedTestingFramework, detectedLanguage: SDKSupportedLanguage) => {
|
|
6
6
|
setup: string;
|
|
7
7
|
run: string;
|
|
8
8
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { SUPPORTED_CONFIGURATIONS } from "../bstack/frameworks.js";
|
|
5
5
|
const errorMessageSuffix = "Please open an issue at our Github repo: https://github.com/browserstack/browserstack-mcp-server/issues to request support for your project configuration";
|
|
6
|
-
export const getInstructionsForProjectConfiguration = (detectedBrowserAutomationFramework, detectedTestingFramework, detectedLanguage
|
|
6
|
+
export const getInstructionsForProjectConfiguration = (detectedBrowserAutomationFramework, detectedTestingFramework, detectedLanguage) => {
|
|
7
7
|
const configuration = SUPPORTED_CONFIGURATIONS[detectedLanguage];
|
|
8
8
|
if (!configuration) {
|
|
9
9
|
throw new Error(`BrowserStack MCP Server currently does not support ${detectedLanguage}, ${errorMessageSuffix}`);
|
|
@@ -16,5 +16,5 @@ export const getInstructionsForProjectConfiguration = (detectedBrowserAutomation
|
|
|
16
16
|
}
|
|
17
17
|
const instructionFunction = configuration[detectedBrowserAutomationFramework][detectedTestingFramework]
|
|
18
18
|
.instructions;
|
|
19
|
-
return instructionFunction(
|
|
19
|
+
return instructionFunction();
|
|
20
20
|
};
|
|
@@ -43,7 +43,7 @@ export declare const SDKSupportedLanguages: SDKSupportedLanguageEnum[];
|
|
|
43
43
|
export type SDKSupportedTestingFramework = keyof typeof SDKSupportedTestingFrameworkEnum;
|
|
44
44
|
export declare const SDKSupportedTestingFrameworks: SDKSupportedTestingFrameworkEnum[];
|
|
45
45
|
export type ConfigMapping = Partial<Record<SDKSupportedLanguageEnum, Partial<Record<SDKSupportedBrowserAutomationFrameworkEnum, Partial<Record<SDKSupportedTestingFrameworkEnum, {
|
|
46
|
-
instructions: (
|
|
46
|
+
instructions: () => {
|
|
47
47
|
setup: string;
|
|
48
48
|
run: string;
|
|
49
49
|
};
|
|
@@ -55,7 +55,7 @@ export async function setUpPercyHandler(rawInput, config) {
|
|
|
55
55
|
const percyWithBrowserstackSDKResult = runPercyWithBrowserstackSDK({
|
|
56
56
|
...percyInput,
|
|
57
57
|
devices: [],
|
|
58
|
-
}
|
|
58
|
+
});
|
|
59
59
|
const hasPercySDKError = percyWithBrowserstackSDKResult.steps &&
|
|
60
60
|
percyWithBrowserstackSDKResult.steps.some((step) => step.isError);
|
|
61
61
|
if (!hasPercySDKError) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { RunTestsInstructionResult } from "../common/types.js";
|
|
2
2
|
import { RunTestsOnBrowserStackInput } from "../common/schema.js";
|
|
3
|
-
|
|
4
|
-
export declare function runPercyWithBrowserstackSDK(input: RunTestsOnBrowserStackInput, config: BrowserStackConfig): RunTestsInstructionResult;
|
|
3
|
+
export declare function runPercyWithBrowserstackSDK(input: RunTestsOnBrowserStackInput): RunTestsInstructionResult;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { getBrowserStackAuth } from "../../../lib/get-auth.js";
|
|
2
1
|
import { getSDKPrefixCommand } from "../bstack/commands.js";
|
|
3
2
|
import { generateBrowserStackYMLInstructions } from "../bstack/configUtils.js";
|
|
4
3
|
import { getInstructionsForProjectConfiguration } from "../common/instructionUtils.js";
|
|
4
|
+
import { CREDENTIALS_SUBSTITUTION_NOTE } from "../common/credentials.js";
|
|
5
5
|
import { formatPercyInstructions, getPercyInstructions, } from "./instructions.js";
|
|
6
|
-
export function runPercyWithBrowserstackSDK(input
|
|
7
|
-
const steps = [
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export function runPercyWithBrowserstackSDK(input) {
|
|
7
|
+
const steps = [
|
|
8
|
+
{
|
|
9
|
+
type: "instruction",
|
|
10
|
+
title: "Set your BrowserStack credentials",
|
|
11
|
+
content: CREDENTIALS_SUBSTITUTION_NOTE,
|
|
12
|
+
},
|
|
13
|
+
];
|
|
10
14
|
// Check if Percy is supported for this configuration
|
|
11
15
|
const percyResult = getPercyInstructions(input.detectedLanguage, input.detectedBrowserAutomationFramework, input.detectedTestingFramework);
|
|
12
16
|
if (!percyResult) {
|
|
@@ -28,7 +32,7 @@ export function runPercyWithBrowserstackSDK(input, config) {
|
|
|
28
32
|
// Handle frameworks with unique setup instructions that don't use browserstack.yml
|
|
29
33
|
if (input.detectedBrowserAutomationFramework === "cypress" ||
|
|
30
34
|
input.detectedBrowserAutomationFramework === "webdriverio") {
|
|
31
|
-
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage
|
|
35
|
+
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage);
|
|
32
36
|
if (frameworkInstructions && frameworkInstructions.setup) {
|
|
33
37
|
steps.push({
|
|
34
38
|
type: "instruction",
|
|
@@ -55,7 +59,7 @@ export function runPercyWithBrowserstackSDK(input, config) {
|
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
61
|
// Default flow using browserstack.yml with Percy
|
|
58
|
-
const sdkSetupCommand = getSDKPrefixCommand(input.detectedLanguage, input.detectedTestingFramework
|
|
62
|
+
const sdkSetupCommand = getSDKPrefixCommand(input.detectedLanguage, input.detectedTestingFramework);
|
|
59
63
|
if (sdkSetupCommand) {
|
|
60
64
|
steps.push({
|
|
61
65
|
type: "instruction",
|
|
@@ -67,7 +71,7 @@ export function runPercyWithBrowserstackSDK(input, config) {
|
|
|
67
71
|
platforms: input.devices?.map((t) => t.join(" ")) || [],
|
|
68
72
|
enablePercy: true,
|
|
69
73
|
projectName: input.projectName,
|
|
70
|
-
}
|
|
74
|
+
});
|
|
71
75
|
if (ymlInstructions) {
|
|
72
76
|
steps.push({
|
|
73
77
|
type: "instruction",
|
|
@@ -75,7 +79,7 @@ export function runPercyWithBrowserstackSDK(input, config) {
|
|
|
75
79
|
content: ymlInstructions,
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
|
-
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage
|
|
82
|
+
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage);
|
|
79
83
|
if (frameworkInstructions && frameworkInstructions.setup) {
|
|
80
84
|
steps.push({
|
|
81
85
|
type: "instruction",
|