@browserstack/mcp-server 1.2.31 → 1.2.33-beta.1

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.
Files changed (42) hide show
  1. package/dist/tools/accessibility.js +3 -3
  2. package/dist/tools/accessiblity-utils/auth-config.d.ts +11 -0
  3. package/dist/tools/accessiblity-utils/auth-config.js +19 -2
  4. package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +1 -1
  5. package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +4 -4
  6. package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +2 -1
  7. package/dist/tools/appautomate-utils/appium-sdk/constants.js +5 -1
  8. package/dist/tools/appautomate-utils/appium-sdk/formatter.d.ts +2 -2
  9. package/dist/tools/appautomate-utils/appium-sdk/formatter.js +8 -8
  10. package/dist/tools/appautomate-utils/appium-sdk/handler.js +10 -4
  11. package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +1 -1
  12. package/dist/tools/appautomate-utils/appium-sdk/instructions.js +6 -6
  13. package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.d.ts +1 -1
  14. package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.js +5 -5
  15. package/dist/tools/appautomate-utils/appium-sdk/languages/java.d.ts +1 -1
  16. package/dist/tools/appautomate-utils/appium-sdk/languages/java.js +11 -11
  17. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +1 -1
  18. package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +23 -23
  19. package/dist/tools/appautomate-utils/appium-sdk/languages/python.d.ts +1 -1
  20. package/dist/tools/appautomate-utils/appium-sdk/languages/python.js +11 -11
  21. package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.d.ts +1 -1
  22. package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.js +7 -4
  23. package/dist/tools/sdk-utils/bstack/commands.d.ts +1 -1
  24. package/dist/tools/sdk-utils/bstack/commands.js +14 -14
  25. package/dist/tools/sdk-utils/bstack/configUtils.d.ts +1 -2
  26. package/dist/tools/sdk-utils/bstack/configUtils.js +3 -7
  27. package/dist/tools/sdk-utils/bstack/constants.d.ts +10 -10
  28. package/dist/tools/sdk-utils/bstack/constants.js +27 -27
  29. package/dist/tools/sdk-utils/bstack/sdkHandler.js +17 -9
  30. package/dist/tools/sdk-utils/common/credentials.d.ts +3 -0
  31. package/dist/tools/sdk-utils/common/credentials.js +11 -0
  32. package/dist/tools/sdk-utils/common/instructionUtils.d.ts +1 -1
  33. package/dist/tools/sdk-utils/common/instructionUtils.js +2 -2
  34. package/dist/tools/sdk-utils/common/types.d.ts +1 -1
  35. package/dist/tools/sdk-utils/handler.js +1 -1
  36. package/dist/tools/sdk-utils/percy-bstack/handler.d.ts +1 -2
  37. package/dist/tools/sdk-utils/percy-bstack/handler.js +13 -9
  38. package/dist/tools/testmanagement-utils/create-testcase.js +8 -0
  39. package/dist/tools/testmanagement-utils/rich-text.d.ts +5 -0
  40. package/dist/tools/testmanagement-utils/rich-text.js +22 -0
  41. package/dist/tools/testmanagement-utils/update-testcase.js +4 -3
  42. 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.data, null, 2)}`,
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.data, null, 2)}`,
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(`The data returned from the API is: ${JSON.stringify(data)}`);
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: ${JSON.stringify(err?.response?.data)}`);
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 ||
@@ -4,4 +4,4 @@ export declare function generateAppBrowserStackYMLInstructions(config: {
4
4
  platforms?: string[];
5
5
  testingFramework?: string;
6
6
  projectName?: string;
7
- }, username: string, accessKey: string, appPath?: string): string;
7
+ }, appPath?: string): string;
@@ -1,5 +1,5 @@
1
- import { APP_DEVICE_CONFIGS, AppSDKSupportedTestingFrameworkEnum, DEFAULT_APP_PATH, createStep, } from "./index.js";
2
- export function generateAppBrowserStackYMLInstructions(config, username, accessKey, appPath = DEFAULT_APP_PATH) {
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: ${username}
17
- accessKey: ${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 "./index.js";
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
- import { AppSDKSupportedFrameworkEnum, AppSDKSupportedTestingFrameworkEnum, AppSDKSupportedLanguageEnum, } from "./index.js";
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(username: string, accessKey: string, isWindows: boolean): string;
6
- export declare function createEnvStep(username: string, accessKey: string, isWindows: boolean, platformLabel: string, title?: string): string;
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(username, accessKey, isWindows) {
28
+ export function formatEnvCommands(isWindows) {
29
29
  if (isWindows) {
30
30
  return `\`\`\`cmd
31
- setx BROWSERSTACK_USERNAME "${username}"
32
- setx BROWSERSTACK_ACCESS_KEY "${accessKey}"
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=${username}
37
- export BROWSERSTACK_ACCESS_KEY=${accessKey}
36
+ export BROWSERSTACK_USERNAME="${USERNAME_PLACEHOLDER}"
37
+ export BROWSERSTACK_ACCESS_KEY="${ACCESS_KEY_PLACEHOLDER}"
38
38
  \`\`\``;
39
39
  }
40
- export function createEnvStep(username, accessKey, isWindows, platformLabel, title = "Set BrowserStack credentials as environment variables:") {
40
+ export function createEnvStep(isWindows, platformLabel, title = "Set BrowserStack credentials as environment variables:") {
41
41
  return createStep(title, `**${platformLabel}:**
42
- ${formatEnvCommands(username, accessKey, isWindows)}`);
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, username, accessKey, appPath);
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
- }, username, accessKey, appPath);
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, username: string, accessKey: string, appPath?: string): 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, username, accessKey, appPath) {
32
+ export function getAppSDKPrefixCommand(language, testingFramework, appPath) {
33
33
  switch (language) {
34
34
  case "csharp":
35
- return getCSharpSDKCommand(username, accessKey);
35
+ return getCSharpSDKCommand();
36
36
  case "java":
37
- return getJavaSDKCommand(testingFramework, username, accessKey, appPath);
37
+ return getJavaSDKCommand(testingFramework, appPath);
38
38
  case "nodejs":
39
- return getNodejsSDKCommand(testingFramework, username, accessKey);
39
+ return getNodejsSDKCommand(testingFramework);
40
40
  case "python":
41
- return getPythonSDKCommand(testingFramework, username, accessKey);
41
+ return getPythonSDKCommand(testingFramework);
42
42
  case "ruby":
43
- return getRubySDKCommand(testingFramework, username, accessKey);
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(username: string, accessKey: string): string;
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(username, accessKey) {
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(username, accessKey, isWindows, getPlatformLabel());
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 "${username}" --accessKey "${accessKey}"
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 "${username}" --accessKey "${accessKey}"
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, username: string, accessKey: string, appPath?: string): 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, username, accessKey, appPath) {
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="${username}" ` +
66
- `-DBROWSERSTACK_ACCESS_KEY="${accessKey}"`;
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, username, accessKey, appPath) {
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="${username}" ` +
86
- `-DBROWSERSTACK_ACCESS_KEY="${accessKey}"`;
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, username, accessKey, appPath) {
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, username, accessKey, appPath);
103
+ mavenCommand = getMavenCommandForWindows(framework, mavenFramework, version, appPath);
104
104
  }
105
105
  else {
106
- mavenCommand = getMavenCommandForUnix(framework, mavenFramework, version, username, accessKey, appPath);
106
+ mavenCommand = getMavenCommandForUnix(framework, mavenFramework, version, appPath);
107
107
  }
108
- const envStep = createEnvStep(username, accessKey, isWindows, getPlatformLabel());
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, username: string, accessKey: string): 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, username, accessKey) {
3
+ export function getNodejsSDKCommand(testingFramework) {
4
4
  switch (testingFramework) {
5
5
  case "webdriverio":
6
- return getWebDriverIOCommand(username, accessKey);
6
+ return getWebDriverIOCommand();
7
7
  case "nightwatch":
8
- return getNightwatchCommand(username, accessKey);
8
+ return getNightwatchCommand();
9
9
  case "jest":
10
- return getJestCommand(username, accessKey);
10
+ return getJestCommand();
11
11
  case "mocha":
12
- return getMochaCommand(username, accessKey);
12
+ return getMochaCommand();
13
13
  case "cucumberJs":
14
- return getCucumberJSCommand(username, accessKey);
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(username, accessKey) {
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=${username}
49
- export BROWSERSTACK_ACCESS_KEY=${accessKey}
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 || '${username}',
57
- key: process.env.BROWSERSTACK_ACCESS_KEY || '${accessKey}',
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(username, accessKey) {
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=${username}
102
- export BROWSERSTACK_ACCESS_KEY=${accessKey}
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(username, accessKey) {
169
+ function getJestCommand() {
170
170
  const envStep = createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
171
- export BROWSERSTACK_USERNAME=${username}
172
- export BROWSERSTACK_ACCESS_KEY=${accessKey}
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(username, accessKey) {
179
+ function getMochaCommand() {
180
180
  const envStep = createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
181
- export BROWSERSTACK_USERNAME=${username}
182
- export BROWSERSTACK_ACCESS_KEY=${accessKey}
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(username, accessKey) {
189
+ function getCucumberJSCommand() {
190
190
  return createStep("Set your BrowserStack credentials as environment variables:", `\`\`\`bash
191
- export BROWSERSTACK_USERNAME=${username}
192
- export BROWSERSTACK_ACCESS_KEY=${accessKey}
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, username: string, accessKey: string): 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, username, accessKey) {
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(username, accessKey, isWindows, getPlatformLabel());
32
+ return getPythonCommonSDKCommand(isWindows, getPlatformLabel());
33
33
  case "lettuce":
34
- return getLettuceCommand(username, accessKey, isWindows, getPlatformLabel());
34
+ return getLettuceCommand(isWindows, getPlatformLabel());
35
35
  default:
36
36
  return "";
37
37
  }
38
38
  }
39
- function getPythonCommonSDKCommand(username, accessKey, isWindows, platformLabel) {
40
- const envStep = createEnvStep(username, accessKey, isWindows, platformLabel, "Set your BrowserStack credentials as environment variables:");
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 "${username}" --key "${accessKey}"
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(username, accessKey, isWindows, platformLabel) {
50
- const envStep = createEnvStep(username, accessKey, isWindows, platformLabel, "Set your BrowserStack credentials as environment variables:");
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" : "${username}",
56
- "browserstack.key" : "${accessKey}",
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(framework: string, username: string, accessKey: string): string;
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
- const username = "${process.env.BROWSERSTACK_USERNAME}";
4
- const accessKey = "${process.env.BROWSERSTACK_ACCESS_KEY}";
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(framework, username, accessKey) {
62
+ export function getRubySDKCommand() {
60
63
  const { isWindows, getPlatformLabel } = PLATFORM_UTILS;
61
- const envStep = createEnvStep(username, accessKey, isWindows, getPlatformLabel(), "Set your BrowserStack credentials as environment variables:");
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, username: string, accessKey: string): string;
2
+ export declare function getSDKPrefixCommand(language: SDKSupportedLanguage, framework: string): string;
3
3
  export declare function getJavaFrameworkForMaven(framework: string): string;