@browserstack/mcp-server 1.2.1 → 1.2.2-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.
- package/README.md +227 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/device-cache.d.ts +1 -0
- package/dist/lib/device-cache.js +28 -0
- package/dist/lib/inmemory-store.d.ts +1 -0
- package/dist/lib/inmemory-store.js +1 -0
- package/dist/lib/instrumentation.js +2 -0
- package/dist/oninitialized.js +4 -1
- package/dist/server-factory.js +3 -1
- package/dist/tools/accessibility.js +238 -78
- package/dist/tools/accessiblity-utils/auth-config.d.ts +39 -0
- package/dist/tools/accessiblity-utils/auth-config.js +125 -0
- package/dist/tools/accessiblity-utils/scanner.d.ts +1 -1
- package/dist/tools/accessiblity-utils/scanner.js +2 -1
- package/dist/tools/add-percy-snapshots.d.ts +5 -0
- package/dist/tools/add-percy-snapshots.js +17 -0
- package/dist/tools/appautomate-utils/appautomate.d.ts +2 -1
- package/dist/tools/appautomate-utils/appautomate.js +12 -9
- package/dist/tools/appautomate.js +56 -7
- package/dist/tools/applive-utils/start-session.d.ts +2 -1
- package/dist/tools/applive-utils/start-session.js +17 -6
- package/dist/tools/applive.d.ts +2 -1
- package/dist/tools/applive.js +21 -17
- package/dist/tools/bstack-sdk.d.ts +2 -15
- package/dist/tools/bstack-sdk.js +7 -124
- package/dist/tools/list-test-files.d.ts +2 -0
- package/dist/tools/list-test-files.js +33 -0
- package/dist/tools/percy-sdk.d.ts +4 -0
- package/dist/tools/percy-sdk.js +88 -0
- package/dist/tools/percy-snapshot-utils/constants.d.ts +16 -0
- package/dist/tools/percy-snapshot-utils/constants.js +500 -0
- package/dist/tools/percy-snapshot-utils/detect-test-files.d.ts +10 -0
- package/dist/tools/percy-snapshot-utils/detect-test-files.js +194 -0
- package/dist/tools/percy-snapshot-utils/types.d.ts +15 -0
- package/dist/tools/percy-snapshot-utils/utils.d.ts +4 -0
- package/dist/tools/percy-snapshot-utils/utils.js +30 -0
- package/dist/tools/sdk-utils/{commands.d.ts → bstack/commands.d.ts} +1 -1
- package/dist/tools/sdk-utils/bstack/commands.js +88 -0
- package/dist/tools/sdk-utils/bstack/configUtils.d.ts +4 -0
- package/dist/tools/sdk-utils/bstack/configUtils.js +66 -0
- package/dist/tools/sdk-utils/bstack/constants.d.ts +58 -0
- package/dist/tools/sdk-utils/{constants.js → bstack/constants.js} +128 -76
- package/dist/tools/sdk-utils/{constants.d.ts → bstack/frameworks.d.ts} +1 -1
- package/dist/tools/sdk-utils/bstack/frameworks.js +57 -0
- package/dist/tools/sdk-utils/bstack/index.d.ts +4 -0
- package/dist/tools/sdk-utils/bstack/index.js +5 -0
- package/dist/tools/sdk-utils/bstack/sdkHandler.d.ts +4 -0
- package/dist/tools/sdk-utils/bstack/sdkHandler.js +74 -0
- package/dist/tools/sdk-utils/common/constants.d.ts +10 -0
- package/dist/tools/sdk-utils/common/constants.js +86 -0
- package/dist/tools/sdk-utils/common/formatUtils.d.ts +5 -0
- package/dist/tools/sdk-utils/common/formatUtils.js +27 -0
- package/dist/tools/sdk-utils/common/index.d.ts +3 -0
- package/dist/tools/sdk-utils/common/index.js +4 -0
- package/dist/tools/sdk-utils/common/instructionUtils.d.ts +8 -0
- package/dist/tools/sdk-utils/common/instructionUtils.js +20 -0
- package/dist/tools/sdk-utils/common/schema.d.ts +61 -0
- package/dist/tools/sdk-utils/common/schema.js +28 -0
- package/dist/tools/sdk-utils/common/types.d.ts +66 -0
- package/dist/tools/sdk-utils/common/types.js +50 -0
- package/dist/tools/sdk-utils/common/utils.d.ts +25 -0
- package/dist/tools/sdk-utils/common/utils.js +84 -0
- package/dist/tools/sdk-utils/handler.d.ts +5 -0
- package/dist/tools/sdk-utils/handler.js +144 -0
- package/dist/tools/sdk-utils/percy-automate/constants.d.ts +11 -0
- package/dist/tools/sdk-utils/percy-automate/constants.js +365 -0
- package/dist/tools/sdk-utils/percy-automate/frameworks.d.ts +8 -0
- package/dist/tools/sdk-utils/percy-automate/frameworks.js +50 -0
- package/dist/tools/sdk-utils/percy-automate/handler.d.ts +3 -0
- package/dist/tools/sdk-utils/percy-automate/handler.js +30 -0
- package/dist/tools/sdk-utils/percy-automate/index.d.ts +1 -0
- package/dist/tools/sdk-utils/percy-automate/index.js +2 -0
- package/dist/tools/sdk-utils/percy-automate/types.d.ts +13 -0
- package/dist/tools/sdk-utils/percy-automate/types.js +1 -0
- package/dist/tools/sdk-utils/percy-bstack/constants.d.ts +4 -0
- package/dist/tools/sdk-utils/{percy → percy-bstack}/constants.js +13 -39
- package/dist/tools/sdk-utils/percy-bstack/frameworks.d.ts +2 -0
- package/dist/tools/sdk-utils/percy-bstack/frameworks.js +27 -0
- package/dist/tools/sdk-utils/percy-bstack/handler.d.ts +4 -0
- package/dist/tools/sdk-utils/percy-bstack/handler.js +99 -0
- package/dist/tools/sdk-utils/percy-bstack/index.d.ts +4 -0
- package/dist/tools/sdk-utils/percy-bstack/index.js +4 -0
- package/dist/tools/sdk-utils/percy-bstack/instructions.d.ts +7 -0
- package/dist/tools/sdk-utils/{percy → percy-bstack}/instructions.js +5 -9
- package/dist/tools/sdk-utils/percy-bstack/types.d.ts +13 -0
- package/dist/tools/sdk-utils/percy-bstack/types.js +5 -0
- package/dist/tools/sdk-utils/percy-web/constants.d.ts +41 -0
- package/dist/tools/sdk-utils/percy-web/constants.js +941 -0
- package/dist/tools/sdk-utils/percy-web/fetchPercyToken.d.ts +4 -0
- package/dist/tools/sdk-utils/percy-web/fetchPercyToken.js +28 -0
- package/dist/tools/sdk-utils/percy-web/frameworks.d.ts +7 -0
- package/dist/tools/sdk-utils/percy-web/frameworks.js +103 -0
- package/dist/tools/sdk-utils/percy-web/handler.d.ts +4 -0
- package/dist/tools/sdk-utils/percy-web/handler.js +27 -0
- package/dist/tools/sdk-utils/percy-web/index.d.ts +4 -0
- package/dist/tools/sdk-utils/percy-web/index.js +4 -0
- package/dist/tools/sdk-utils/percy-web/types.d.ts +12 -0
- package/dist/tools/sdk-utils/percy-web/types.js +1 -0
- package/dist/tools/sdk-utils/types.d.ts +2 -1
- package/dist/tools/sdk-utils/types.js +1 -0
- package/dist/tools/testmanagement-utils/create-testcase.d.ts +4 -0
- package/dist/tools/testmanagement-utils/create-testcase.js +6 -0
- package/package.json +1 -1
- package/dist/tools/sdk-utils/commands.js +0 -65
- package/dist/tools/sdk-utils/instructions.d.ts +0 -6
- package/dist/tools/sdk-utils/instructions.js +0 -99
- package/dist/tools/sdk-utils/percy/constants.d.ts +0 -3
- package/dist/tools/sdk-utils/percy/instructions.d.ts +0 -10
- package/dist/tools/sdk-utils/percy/types.d.ts +0 -5
- /package/dist/tools/{getFailureLogs.d.ts → get-failure-logs.d.ts} +0 -0
- /package/dist/tools/{getFailureLogs.js → get-failure-logs.js} +0 -0
- /package/dist/tools/{sdk-utils/percy → percy-snapshot-utils}/types.js +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SDKSupportedTestingFrameworkEnum, SDKSupportedLanguageEnum } from "../sdk-utils/common/types.js";
|
|
2
|
+
export type ListTestFilesParams = {
|
|
3
|
+
dirs: string[];
|
|
4
|
+
language: SDKSupportedLanguageEnum;
|
|
5
|
+
framework?: SDKSupportedTestingFrameworkEnum;
|
|
6
|
+
};
|
|
7
|
+
export interface DetectionConfig {
|
|
8
|
+
extensions: string[];
|
|
9
|
+
namePatterns: RegExp[];
|
|
10
|
+
contentRegex: RegExp[];
|
|
11
|
+
uiDriverRegex: RegExp[];
|
|
12
|
+
uiIndicatorRegex: RegExp[];
|
|
13
|
+
backendRegex: RegExp[];
|
|
14
|
+
excludeRegex?: RegExp[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const content = [];
|
|
2
|
+
export async function updateFileAndStep(file, idx, total, instruction) {
|
|
3
|
+
content.length = 0;
|
|
4
|
+
const nextIndex = idx + 1;
|
|
5
|
+
content.push({
|
|
6
|
+
type: "text",
|
|
7
|
+
text: `Complete all steps in order. If a tool call is requested, update the file first, then call the tool. Follow instructions exactly— do not skip any steps to ensure all files are updated.`,
|
|
8
|
+
});
|
|
9
|
+
content.push({
|
|
10
|
+
type: "text",
|
|
11
|
+
text: `Step 1 : You need to add percy snapshot commands in some key test cases in the file ${file} use the following instructions: \n${instruction}`,
|
|
12
|
+
});
|
|
13
|
+
content.push({
|
|
14
|
+
type: "text",
|
|
15
|
+
text: `Step 2 : Confirm that Percy snapshot commands have been added at all key points of visual change in the file ${file}.`,
|
|
16
|
+
});
|
|
17
|
+
if (nextIndex < total) {
|
|
18
|
+
content.push({
|
|
19
|
+
type: "text",
|
|
20
|
+
text: `Step 3 : Call the tool updateTestFileWithInstructions with index as ${nextIndex} out of ${total}`,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (nextIndex === total) {
|
|
24
|
+
content.push({
|
|
25
|
+
type: "text",
|
|
26
|
+
text: `Step 4: Percy snapshot commands have been added to all files. You can now run the Percy build using the above command.`,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return content;
|
|
30
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SDKSupportedLanguage } from "
|
|
1
|
+
import { SDKSupportedLanguage } from "../common/types.js";
|
|
2
2
|
export declare function getSDKPrefixCommand(language: SDKSupportedLanguage, framework: string, username: string, accessKey: string): string;
|
|
3
3
|
export declare function getJavaFrameworkForMaven(framework: string): string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Constants
|
|
2
|
+
const MAVEN_ARCHETYPE_GROUP_ID = "com.browserstack";
|
|
3
|
+
const MAVEN_ARCHETYPE_ARTIFACT_ID = "browserstack-sdk-archetype-integrate";
|
|
4
|
+
const MAVEN_ARCHETYPE_VERSION = "1.0";
|
|
5
|
+
// Mapping of test frameworks to their corresponding Maven archetype framework names
|
|
6
|
+
const JAVA_FRAMEWORK_MAP = {
|
|
7
|
+
testng: "testng",
|
|
8
|
+
junit5: "junit5",
|
|
9
|
+
junit4: "junit4",
|
|
10
|
+
cucumber: "cucumber-testng",
|
|
11
|
+
};
|
|
12
|
+
// Template for Node.js SDK setup instructions
|
|
13
|
+
const NODEJS_SDK_INSTRUCTIONS = (username, accessKey) => `---STEP---
|
|
14
|
+
Install BrowserStack Node SDK using command:
|
|
15
|
+
\`\`\`bash
|
|
16
|
+
npm i -D browserstack-node-sdk@latest
|
|
17
|
+
\`\`\`
|
|
18
|
+
---STEP---
|
|
19
|
+
Run the following command to setup browserstack sdk:
|
|
20
|
+
\`\`\`bash
|
|
21
|
+
npx setup --username ${username} --key ${accessKey}
|
|
22
|
+
\`\`\``;
|
|
23
|
+
// Template for Gradle setup instructions (platform-independent)
|
|
24
|
+
const GRADLE_SETUP_INSTRUCTIONS = `
|
|
25
|
+
**For Gradle setup:**
|
|
26
|
+
1. Add browserstack-java-sdk to dependencies:
|
|
27
|
+
compileOnly 'com.browserstack:browserstack-java-sdk:latest.release'
|
|
28
|
+
|
|
29
|
+
2. Add browserstackSDK path variable:
|
|
30
|
+
def browserstackSDKArtifact = configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.find { it.name == 'browserstack-java-sdk' }
|
|
31
|
+
|
|
32
|
+
3. Add javaagent to gradle tasks:
|
|
33
|
+
jvmArgs "-javaagent:\${browserstackSDKArtifact.file}"
|
|
34
|
+
`;
|
|
35
|
+
// Generates Maven archetype command for Windows platform
|
|
36
|
+
function getMavenCommandForWindows(framework, mavenFramework) {
|
|
37
|
+
return (`mvn archetype:generate -B ` +
|
|
38
|
+
`-DarchetypeGroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
39
|
+
`-DarchetypeArtifactId="${MAVEN_ARCHETYPE_ARTIFACT_ID}" ` +
|
|
40
|
+
`-DarchetypeVersion="${MAVEN_ARCHETYPE_VERSION}" ` +
|
|
41
|
+
`-DgroupId="${MAVEN_ARCHETYPE_GROUP_ID}" ` +
|
|
42
|
+
`-DartifactId="${MAVEN_ARCHETYPE_ARTIFACT_ID}" ` +
|
|
43
|
+
`-Dversion="${MAVEN_ARCHETYPE_VERSION}" ` +
|
|
44
|
+
`-DBROWSERSTACK_USERNAME="${process.env.BROWSERSTACK_USERNAME}" ` +
|
|
45
|
+
`-DBROWSERSTACK_ACCESS_KEY="${process.env.BROWSERSTACK_ACCESS_KEY}" ` +
|
|
46
|
+
`-DBROWSERSTACK_FRAMEWORK="${mavenFramework}"`);
|
|
47
|
+
}
|
|
48
|
+
// Generates Maven archetype command for Unix-like platforms (macOS/Linux)
|
|
49
|
+
function getMavenCommandForUnix(username, accessKey, mavenFramework) {
|
|
50
|
+
return `mvn archetype:generate -B -DarchetypeGroupId=${MAVEN_ARCHETYPE_GROUP_ID} \\
|
|
51
|
+
-DarchetypeArtifactId=${MAVEN_ARCHETYPE_ARTIFACT_ID} -DarchetypeVersion=${MAVEN_ARCHETYPE_VERSION} \\
|
|
52
|
+
-DgroupId=${MAVEN_ARCHETYPE_GROUP_ID} -DartifactId=${MAVEN_ARCHETYPE_ARTIFACT_ID} -Dversion=${MAVEN_ARCHETYPE_VERSION} \\
|
|
53
|
+
-DBROWSERSTACK_USERNAME="${username}" \\
|
|
54
|
+
-DBROWSERSTACK_ACCESS_KEY="${accessKey}" \\
|
|
55
|
+
-DBROWSERSTACK_FRAMEWORK="${mavenFramework}"`;
|
|
56
|
+
}
|
|
57
|
+
// Generates Java SDK setup instructions with Maven/Gradle options
|
|
58
|
+
function getJavaSDKInstructions(framework, username, accessKey) {
|
|
59
|
+
const mavenFramework = getJavaFrameworkForMaven(framework);
|
|
60
|
+
const isWindows = process.platform === "win32";
|
|
61
|
+
const platformLabel = isWindows ? "Windows" : "macOS/Linux";
|
|
62
|
+
const mavenCommand = isWindows
|
|
63
|
+
? getMavenCommandForWindows(framework, mavenFramework)
|
|
64
|
+
: getMavenCommandForUnix(username, accessKey, mavenFramework);
|
|
65
|
+
return `---STEP---
|
|
66
|
+
Install BrowserStack Java SDK
|
|
67
|
+
|
|
68
|
+
**Maven command for ${framework} (${platformLabel}):**
|
|
69
|
+
Run the command, it is required to generate the browserstack-sdk-archetype-integrate project:
|
|
70
|
+
${mavenCommand}
|
|
71
|
+
|
|
72
|
+
Alternative setup for Gradle users:
|
|
73
|
+
${GRADLE_SETUP_INSTRUCTIONS}`;
|
|
74
|
+
}
|
|
75
|
+
// Main function to get SDK setup commands based on language and framework
|
|
76
|
+
export function getSDKPrefixCommand(language, framework, username, accessKey) {
|
|
77
|
+
switch (language) {
|
|
78
|
+
case "nodejs":
|
|
79
|
+
return NODEJS_SDK_INSTRUCTIONS(username, accessKey);
|
|
80
|
+
case "java":
|
|
81
|
+
return getJavaSDKInstructions(framework, username, accessKey);
|
|
82
|
+
default:
|
|
83
|
+
return "";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function getJavaFrameworkForMaven(framework) {
|
|
87
|
+
return JAVA_FRAMEWORK_MAP[framework] || framework;
|
|
88
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for generating BrowserStack configuration files.
|
|
3
|
+
*/
|
|
4
|
+
export function generateBrowserStackYMLInstructions(desiredPlatforms, enablePercy = false, projectName) {
|
|
5
|
+
let ymlContent = `
|
|
6
|
+
# ======================
|
|
7
|
+
# BrowserStack Reporting
|
|
8
|
+
# ======================
|
|
9
|
+
# A single name for your project to organize all your tests. This is required for Percy.
|
|
10
|
+
projectName: ${projectName}
|
|
11
|
+
# TODO: Replace these sample values with your actual project details
|
|
12
|
+
buildName: Sample-Build
|
|
13
|
+
|
|
14
|
+
# =======================================
|
|
15
|
+
# Platforms (Browsers / Devices to test)
|
|
16
|
+
# =======================================
|
|
17
|
+
# Platforms object contains all the browser / device combinations you want to test on.
|
|
18
|
+
# Generate this on the basis of the following platforms requested by the user:
|
|
19
|
+
# Requested platforms: ${desiredPlatforms}
|
|
20
|
+
platforms:
|
|
21
|
+
- os: Windows
|
|
22
|
+
osVersion: 11
|
|
23
|
+
browserName: chrome
|
|
24
|
+
browserVersion: latest
|
|
25
|
+
|
|
26
|
+
# =======================
|
|
27
|
+
# Parallels per Platform
|
|
28
|
+
# =======================
|
|
29
|
+
# The number of parallel threads to be used for each platform set.
|
|
30
|
+
# BrowserStack's SDK runner will select the best strategy based on the configured value
|
|
31
|
+
#
|
|
32
|
+
# Example 1 - If you have configured 3 platforms and set \`parallelsPerPlatform\` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
|
|
33
|
+
#
|
|
34
|
+
# Example 2 - If you have configured 1 platform and set \`parallelsPerPlatform\` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
|
|
35
|
+
parallelsPerPlatform: 1
|
|
36
|
+
|
|
37
|
+
# =================
|
|
38
|
+
# Local Testing
|
|
39
|
+
# =================
|
|
40
|
+
# Set to true to test local
|
|
41
|
+
browserstackLocal: true
|
|
42
|
+
|
|
43
|
+
# ===================
|
|
44
|
+
# Debugging features
|
|
45
|
+
# ===================
|
|
46
|
+
debug: true # Visual logs, text logs, etc.
|
|
47
|
+
testObservability: true # For Test Observability`;
|
|
48
|
+
if (enablePercy) {
|
|
49
|
+
ymlContent += `
|
|
50
|
+
|
|
51
|
+
# =====================
|
|
52
|
+
# Percy Visual Testing
|
|
53
|
+
# =====================
|
|
54
|
+
# Set percy to true to enable visual testing.
|
|
55
|
+
# Set percyCaptureMode to 'manual' to control when screenshots are taken.
|
|
56
|
+
percy: true
|
|
57
|
+
percyCaptureMode: manual`;
|
|
58
|
+
}
|
|
59
|
+
return `
|
|
60
|
+
---STEP---
|
|
61
|
+
Create a browserstack.yml file in the project root. The file should be in the following format:
|
|
62
|
+
|
|
63
|
+
\`\`\`yaml${ymlContent}
|
|
64
|
+
\`\`\`
|
|
65
|
+
\n`;
|
|
66
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ConfigMapping } from "../common/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* ---------- PYTHON INSTRUCTIONS ----------
|
|
4
|
+
*/
|
|
5
|
+
export declare const pythonInstructions: (username: string, accessKey: string) => {
|
|
6
|
+
setup: string;
|
|
7
|
+
run: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const generatePythonFrameworkInstructions: (framework: string) => (username: string, accessKey: string) => {
|
|
10
|
+
setup: string;
|
|
11
|
+
run: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const robotInstructions: (username: string, accessKey: string) => {
|
|
14
|
+
setup: string;
|
|
15
|
+
run: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const behaveInstructions: (username: string, accessKey: string) => {
|
|
18
|
+
setup: string;
|
|
19
|
+
run: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const pytestInstructions: (username: string, accessKey: string) => {
|
|
22
|
+
setup: string;
|
|
23
|
+
run: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const javaInstructions: (username: string, accessKey: string) => {
|
|
26
|
+
setup: string;
|
|
27
|
+
run: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* ---------- CSharp INSTRUCTIONS ----------
|
|
31
|
+
*/
|
|
32
|
+
export declare const csharpCommonInstructions: (username: string, accessKey: string) => {
|
|
33
|
+
setup: string;
|
|
34
|
+
run: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const csharpPlaywrightCommonInstructions: (username: string, accessKey: string) => {
|
|
37
|
+
setup: string;
|
|
38
|
+
run: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* ---------- NODEJS INSTRUCTIONS ----------
|
|
42
|
+
*/
|
|
43
|
+
export declare const nodejsInstructions: (username: string, accessKey: string) => {
|
|
44
|
+
setup: string;
|
|
45
|
+
run: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* ---------- EXPORT CONFIG ----------
|
|
49
|
+
*/
|
|
50
|
+
export declare const webdriverioInstructions: (username: string, accessKey: string) => {
|
|
51
|
+
setup: string;
|
|
52
|
+
run: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const cypressInstructions: (username: string, accessKey: string) => {
|
|
55
|
+
setup: string;
|
|
56
|
+
run: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const SUPPORTED_CONFIGURATIONS: ConfigMapping;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ---------- PYTHON INSTRUCTIONS ----------
|
|
3
3
|
*/
|
|
4
|
-
const pythonInstructions = (username, accessKey) =>
|
|
4
|
+
export const pythonInstructions = (username, accessKey) => {
|
|
5
|
+
const setup = `
|
|
5
6
|
---STEP---
|
|
6
7
|
|
|
7
8
|
Install the BrowserStack SDK:
|
|
@@ -15,7 +16,8 @@ Setup the BrowserStack SDK with your credentials:
|
|
|
15
16
|
\`\`\`bash
|
|
16
17
|
browserstack-sdk setup --username "${username}" --key "${accessKey}"
|
|
17
18
|
\`\`\`
|
|
18
|
-
|
|
19
|
+
`;
|
|
20
|
+
const run = `
|
|
19
21
|
---STEP---
|
|
20
22
|
|
|
21
23
|
Run your tests on BrowserStack:
|
|
@@ -23,7 +25,10 @@ Run your tests on BrowserStack:
|
|
|
23
25
|
browserstack-sdk python <path-to-test-file>
|
|
24
26
|
\`\`\`
|
|
25
27
|
`;
|
|
26
|
-
|
|
28
|
+
return { setup, run };
|
|
29
|
+
};
|
|
30
|
+
export const generatePythonFrameworkInstructions = (framework) => (username, accessKey) => {
|
|
31
|
+
const setup = `
|
|
27
32
|
---STEP---
|
|
28
33
|
|
|
29
34
|
Install the BrowserStack SDK:
|
|
@@ -38,7 +43,8 @@ Setup the BrowserStack SDK with framework-specific configuration:
|
|
|
38
43
|
\`\`\`bash
|
|
39
44
|
browserstack-sdk setup --framework "${framework}" --username "${username}" --key "${accessKey}"
|
|
40
45
|
\`\`\`
|
|
41
|
-
|
|
46
|
+
`;
|
|
47
|
+
const run = `
|
|
42
48
|
---STEP---
|
|
43
49
|
|
|
44
50
|
Run your ${framework} tests on BrowserStack:
|
|
@@ -46,14 +52,17 @@ Run your ${framework} tests on BrowserStack:
|
|
|
46
52
|
browserstack-sdk ${framework} <path-to-test-files>
|
|
47
53
|
\`\`\`
|
|
48
54
|
`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
55
|
+
return { setup, run };
|
|
56
|
+
};
|
|
57
|
+
export const robotInstructions = generatePythonFrameworkInstructions("robot");
|
|
58
|
+
export const behaveInstructions = generatePythonFrameworkInstructions("behave");
|
|
59
|
+
export const pytestInstructions = generatePythonFrameworkInstructions("pytest");
|
|
52
60
|
/**
|
|
53
61
|
* ---------- JAVA INSTRUCTIONS ----------
|
|
54
62
|
*/
|
|
55
63
|
const argsInstruction = '<argLine>-javaagent:"${com.browserstack:browserstack-java-sdk:jar}"</argLine>';
|
|
56
|
-
const javaInstructions = (username, accessKey) =>
|
|
64
|
+
export const javaInstructions = (username, accessKey) => {
|
|
65
|
+
const setup = `
|
|
57
66
|
---STEP---
|
|
58
67
|
|
|
59
68
|
Add the BrowserStack Java SDK dependency to your \`pom.xml\`:
|
|
@@ -82,7 +91,8 @@ Export your BrowserStack credentials as environment variables:
|
|
|
82
91
|
export BROWSERSTACK_USERNAME=${username}
|
|
83
92
|
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
84
93
|
\`\`\`
|
|
85
|
-
|
|
94
|
+
`;
|
|
95
|
+
const run = `
|
|
86
96
|
---STEP---
|
|
87
97
|
|
|
88
98
|
Run your tests using Maven:
|
|
@@ -95,66 +105,13 @@ Or for Gradle:
|
|
|
95
105
|
gradle clean test
|
|
96
106
|
\`\`\`
|
|
97
107
|
`;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Set BrowserStack credentials as environment variables:
|
|
102
|
-
For macOS/Linux:
|
|
103
|
-
\`\`\`bash
|
|
104
|
-
export BROWSERSTACK_USERNAME=${username}
|
|
105
|
-
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
106
|
-
\`\`\`
|
|
107
|
-
|
|
108
|
-
For Windows Command Prompt:
|
|
109
|
-
\`\`\`cmd
|
|
110
|
-
set BROWSERSTACK_USERNAME=${username}
|
|
111
|
-
set BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
112
|
-
\`\`\`
|
|
113
|
-
|
|
114
|
-
---STEP---
|
|
115
|
-
|
|
116
|
-
Add serenity-browserstack dependency in pom.xml:
|
|
117
|
-
Add the following dependency to your pom.xml file and save it:
|
|
118
|
-
\`\`\`xml
|
|
119
|
-
<dependency>
|
|
120
|
-
<groupId>net.serenity-bdd</groupId>
|
|
121
|
-
<artifactId>serenity-browserstack</artifactId>
|
|
122
|
-
<version>3.3.4</version>
|
|
123
|
-
</dependency>
|
|
124
|
-
\`\`\`
|
|
125
|
-
|
|
126
|
-
---STEP---
|
|
127
|
-
|
|
128
|
-
Set up serenity.conf file:
|
|
129
|
-
Create or update your serenity.conf file in the project root with the following configuration:
|
|
130
|
-
\`\`\`
|
|
131
|
-
webdriver {
|
|
132
|
-
driver = remote
|
|
133
|
-
remote.url = "https://hub.browserstack.com/wd/hub"
|
|
134
|
-
}
|
|
135
|
-
browserstack.user="${username}"
|
|
136
|
-
browserstack.key="${accessKey}"
|
|
137
|
-
\`\`\`
|
|
138
|
-
|
|
139
|
-
---STEP---
|
|
140
|
-
|
|
141
|
-
Run your Serenity tests:
|
|
142
|
-
You can continue running your tests as you normally would. For example:
|
|
143
|
-
|
|
144
|
-
Using Maven:
|
|
145
|
-
\`\`\`bash
|
|
146
|
-
mvn clean verify
|
|
147
|
-
\`\`\`
|
|
148
|
-
|
|
149
|
-
Using Gradle:
|
|
150
|
-
\`\`\`bash
|
|
151
|
-
gradle clean test
|
|
152
|
-
\`\`\`
|
|
153
|
-
`;
|
|
108
|
+
return { setup, run };
|
|
109
|
+
};
|
|
154
110
|
/**
|
|
155
111
|
* ---------- CSharp INSTRUCTIONS ----------
|
|
156
112
|
*/
|
|
157
|
-
const csharpCommonInstructions = (username, accessKey) =>
|
|
113
|
+
export const csharpCommonInstructions = (username, accessKey) => {
|
|
114
|
+
const setup = `
|
|
158
115
|
---STEP---
|
|
159
116
|
|
|
160
117
|
Install BrowserStack TestAdapter NuGet package:
|
|
@@ -203,7 +160,8 @@ Install the x64 version of .NET for BrowserStack compatibility.
|
|
|
203
160
|
sudo dotnet browserstack-sdk setup-dotnet --dotnet-path "<your-chosen-path>" --dotnet-version "<your-dotnet-version>"
|
|
204
161
|
\`\`\`
|
|
205
162
|
Common paths: /usr/local/share/dotnet, ~/dotnet-x64, or /opt/dotnet-x64
|
|
206
|
-
|
|
163
|
+
`;
|
|
164
|
+
const run = `
|
|
207
165
|
---STEP---
|
|
208
166
|
|
|
209
167
|
Run the tests:
|
|
@@ -216,7 +174,10 @@ Run the tests:
|
|
|
216
174
|
dotnet test
|
|
217
175
|
\`\`\`
|
|
218
176
|
`;
|
|
219
|
-
|
|
177
|
+
return { setup, run };
|
|
178
|
+
};
|
|
179
|
+
export const csharpPlaywrightCommonInstructions = (username, accessKey) => {
|
|
180
|
+
const setup = `
|
|
220
181
|
---STEP---
|
|
221
182
|
|
|
222
183
|
Install BrowserStack TestAdapter NuGet package:
|
|
@@ -278,7 +239,8 @@ Fix for Playwright architecture (macOS only):
|
|
|
278
239
|
If the folder exists:
|
|
279
240
|
\`<project-folder>/bin/Debug/net8.0/.playwright/node/darwin-arm64\`
|
|
280
241
|
Rename \`darwin-arm64\` to \`darwin-x64\`
|
|
281
|
-
|
|
242
|
+
`;
|
|
243
|
+
const run = `
|
|
282
244
|
---STEP---
|
|
283
245
|
|
|
284
246
|
Run the tests:
|
|
@@ -291,10 +253,13 @@ Run the tests:
|
|
|
291
253
|
dotnet test
|
|
292
254
|
\`\`\`
|
|
293
255
|
`;
|
|
256
|
+
return { setup, run };
|
|
257
|
+
};
|
|
294
258
|
/**
|
|
295
259
|
* ---------- NODEJS INSTRUCTIONS ----------
|
|
296
260
|
*/
|
|
297
|
-
const nodejsInstructions = (username, accessKey) =>
|
|
261
|
+
export const nodejsInstructions = (username, accessKey) => {
|
|
262
|
+
const setup = `
|
|
298
263
|
---STEP---
|
|
299
264
|
|
|
300
265
|
Ensure \`browserstack-node-sdk\` is present in package.json with the latest version:
|
|
@@ -311,6 +276,12 @@ Add new scripts to package.json for running tests on BrowserStack:
|
|
|
311
276
|
}
|
|
312
277
|
\`\`\`
|
|
313
278
|
|
|
279
|
+
Example :
|
|
280
|
+
\`\`\`json
|
|
281
|
+
"scripts": {
|
|
282
|
+
"test:browserstack": "npx browserstack-node-sdk playwright test"
|
|
283
|
+
}
|
|
284
|
+
\`\`\`
|
|
314
285
|
---STEP---
|
|
315
286
|
|
|
316
287
|
Export BrowserStack credentials as environment variables:
|
|
@@ -319,11 +290,26 @@ Set the following environment variables before running tests.
|
|
|
319
290
|
export BROWSERSTACK_USERNAME=${username}
|
|
320
291
|
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
321
292
|
\`\`\`
|
|
293
|
+
|
|
294
|
+
---STEP---
|
|
295
|
+
Run your tests:
|
|
296
|
+
You can now run your tests on BrowserStack using your standard command or Use the commands defined in your package.json file to run the tests.
|
|
297
|
+
`;
|
|
298
|
+
const run = `
|
|
299
|
+
---STEP---
|
|
300
|
+
|
|
301
|
+
Run your tests on BrowserStack:
|
|
302
|
+
\`\`\`bash
|
|
303
|
+
npm run test:browserstack
|
|
304
|
+
\`\`\`
|
|
322
305
|
`;
|
|
306
|
+
return { setup, run };
|
|
307
|
+
};
|
|
323
308
|
/**
|
|
324
309
|
* ---------- EXPORT CONFIG ----------
|
|
325
310
|
*/
|
|
326
|
-
const webdriverioInstructions = (username, accessKey) =>
|
|
311
|
+
export const webdriverioInstructions = (username, accessKey) => {
|
|
312
|
+
const setup = `
|
|
327
313
|
---STEP---
|
|
328
314
|
|
|
329
315
|
Set BrowserStack Credentials:
|
|
@@ -422,13 +408,17 @@ exports.config.capabilities.forEach(function (caps) {
|
|
|
422
408
|
caps[i] = { ...caps[i], ...exports.config.commonCapabilities[i]};
|
|
423
409
|
});
|
|
424
410
|
\`\`\`
|
|
425
|
-
|
|
411
|
+
`;
|
|
412
|
+
const run = `
|
|
426
413
|
---STEP---
|
|
427
414
|
|
|
428
415
|
Run your tests:
|
|
429
|
-
You can now run your tests on BrowserStack using your standard WebdriverIO command.
|
|
416
|
+
You can now run your tests on BrowserStack using your standard WebdriverIO command or Use the commands defined in your package.json file to run the tests.
|
|
430
417
|
`;
|
|
431
|
-
|
|
418
|
+
return { setup, run };
|
|
419
|
+
};
|
|
420
|
+
export const cypressInstructions = (username, accessKey) => {
|
|
421
|
+
const setup = `
|
|
432
422
|
---STEP---
|
|
433
423
|
|
|
434
424
|
Install the BrowserStack Cypress CLI:
|
|
@@ -489,7 +479,8 @@ Open the generated \`browserstack.json\` file and update it with your BrowserSta
|
|
|
489
479
|
\`\`\`
|
|
490
480
|
|
|
491
481
|
**Note:** For Cypress v9 or lower, use \`"cypress_config_file": "./cypress.json"\`. The \`testObservability: true\` flag enables the [Test Reporting & Analytics dashboard](https://www.browserstack.com/docs/test-management/test-reporting-and-analytics) for deeper insights into your test runs.
|
|
492
|
-
|
|
482
|
+
`;
|
|
483
|
+
const run = `
|
|
493
484
|
---STEP---
|
|
494
485
|
|
|
495
486
|
Run Your Tests on BrowserStack:
|
|
@@ -498,8 +489,69 @@ Execute your tests on BrowserStack using the following command:
|
|
|
498
489
|
npx browserstack-cypress run --sync
|
|
499
490
|
\`\`\`
|
|
500
491
|
|
|
501
|
-
After the tests complete, you can view the results on your [BrowserStack Automate Dashboard](https://automate.browserstack.com/dashboard/)
|
|
492
|
+
After the tests complete, you can view the results on your [BrowserStack Automate Dashboard](https://automate.browserstack.com/dashboard/).`;
|
|
493
|
+
return { setup, run };
|
|
494
|
+
};
|
|
495
|
+
const serenityInstructions = (username, accessKey) => {
|
|
496
|
+
const setup = `
|
|
497
|
+
---STEP---
|
|
498
|
+
|
|
499
|
+
Set BrowserStack credentials as environment variables:
|
|
500
|
+
For macOS/Linux:
|
|
501
|
+
\`\`\`bash
|
|
502
|
+
export BROWSERSTACK_USERNAME=${username}
|
|
503
|
+
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
504
|
+
\`\`\`
|
|
505
|
+
|
|
506
|
+
For Windows Command Prompt:
|
|
507
|
+
\`\`\`cmd
|
|
508
|
+
set BROWSERSTACK_USERNAME=${username}
|
|
509
|
+
set BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
510
|
+
\`\`\`
|
|
511
|
+
|
|
512
|
+
---STEP---
|
|
513
|
+
|
|
514
|
+
Add serenity-browserstack dependency in pom.xml:
|
|
515
|
+
Add the following dependency to your pom.xml file and save it:
|
|
516
|
+
\`\`\`xml
|
|
517
|
+
<dependency>
|
|
518
|
+
<groupId>net.serenity-bdd</groupId>
|
|
519
|
+
<artifactId>serenity-browserstack</artifactId>
|
|
520
|
+
<version>3.3.4</version>
|
|
521
|
+
</dependency>
|
|
522
|
+
\`\`\`
|
|
523
|
+
|
|
524
|
+
---STEP---
|
|
525
|
+
|
|
526
|
+
Set up serenity.conf file:
|
|
527
|
+
Create or update your serenity.conf file in the project root with the following configuration:
|
|
528
|
+
\`\`\`
|
|
529
|
+
webdriver {
|
|
530
|
+
driver = remote
|
|
531
|
+
remote.url = "https://hub.browserstack.com/wd/hub"
|
|
532
|
+
}
|
|
533
|
+
browserstack.user="${username}"
|
|
534
|
+
browserstack.key="${accessKey}"
|
|
535
|
+
\`\`\`
|
|
536
|
+
`;
|
|
537
|
+
const run = `
|
|
538
|
+
---STEP---
|
|
539
|
+
|
|
540
|
+
Run your Serenity tests:
|
|
541
|
+
You can continue running your tests as you normally would. For example:
|
|
542
|
+
|
|
543
|
+
Using Maven:
|
|
544
|
+
\`\`\`bash
|
|
545
|
+
mvn clean verify
|
|
546
|
+
\`\`\`
|
|
547
|
+
|
|
548
|
+
Using Gradle:
|
|
549
|
+
\`\`\`bash
|
|
550
|
+
gradle clean test
|
|
551
|
+
\`\`\`
|
|
502
552
|
`;
|
|
553
|
+
return { setup, run };
|
|
554
|
+
};
|
|
503
555
|
export const SUPPORTED_CONFIGURATIONS = {
|
|
504
556
|
python: {
|
|
505
557
|
playwright: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ConfigMapping } from "
|
|
1
|
+
import { ConfigMapping } from "../common/types.js";
|
|
2
2
|
export declare const SUPPORTED_CONFIGURATIONS: ConfigMapping;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as constants from "./constants.js";
|
|
2
|
+
export const SUPPORTED_CONFIGURATIONS = {
|
|
3
|
+
python: {
|
|
4
|
+
playwright: {
|
|
5
|
+
pytest: { instructions: constants.pythonInstructions },
|
|
6
|
+
},
|
|
7
|
+
selenium: {
|
|
8
|
+
pytest: { instructions: constants.pytestInstructions },
|
|
9
|
+
robot: { instructions: constants.robotInstructions },
|
|
10
|
+
behave: { instructions: constants.behaveInstructions },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
java: {
|
|
14
|
+
playwright: {
|
|
15
|
+
junit4: { instructions: constants.javaInstructions },
|
|
16
|
+
junit5: { instructions: constants.javaInstructions },
|
|
17
|
+
testng: { instructions: constants.javaInstructions },
|
|
18
|
+
},
|
|
19
|
+
selenium: {
|
|
20
|
+
testng: { instructions: constants.javaInstructions },
|
|
21
|
+
cucumber: { instructions: constants.javaInstructions },
|
|
22
|
+
junit4: { instructions: constants.javaInstructions },
|
|
23
|
+
junit5: { instructions: constants.javaInstructions },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
csharp: {
|
|
27
|
+
playwright: {
|
|
28
|
+
nunit: { instructions: constants.csharpPlaywrightCommonInstructions },
|
|
29
|
+
mstest: { instructions: constants.csharpPlaywrightCommonInstructions },
|
|
30
|
+
},
|
|
31
|
+
selenium: {
|
|
32
|
+
xunit: { instructions: constants.csharpCommonInstructions },
|
|
33
|
+
nunit: { instructions: constants.csharpCommonInstructions },
|
|
34
|
+
mstest: { instructions: constants.csharpCommonInstructions },
|
|
35
|
+
specflow: { instructions: constants.csharpCommonInstructions },
|
|
36
|
+
reqnroll: { instructions: constants.csharpCommonInstructions },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
nodejs: {
|
|
40
|
+
playwright: {
|
|
41
|
+
jest: { instructions: constants.nodejsInstructions },
|
|
42
|
+
codeceptjs: { instructions: constants.nodejsInstructions },
|
|
43
|
+
playwright: { instructions: constants.nodejsInstructions },
|
|
44
|
+
},
|
|
45
|
+
selenium: {
|
|
46
|
+
jest: { instructions: constants.nodejsInstructions },
|
|
47
|
+
webdriverio: { instructions: constants.webdriverioInstructions },
|
|
48
|
+
mocha: { instructions: constants.nodejsInstructions },
|
|
49
|
+
cucumber: { instructions: constants.nodejsInstructions },
|
|
50
|
+
nightwatch: { instructions: constants.nodejsInstructions },
|
|
51
|
+
codeceptjs: { instructions: constants.nodejsInstructions },
|
|
52
|
+
},
|
|
53
|
+
cypress: {
|
|
54
|
+
cypress: { instructions: constants.cypressInstructions },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// BrowserStack SDK utilities
|
|
2
|
+
export { runBstackSDKOnly } from "./sdkHandler.js";
|
|
3
|
+
export { getSDKPrefixCommand, getJavaFrameworkForMaven } from "./commands.js";
|
|
4
|
+
export { generateBrowserStackYMLInstructions } from "./configUtils.js";
|
|
5
|
+
export { SUPPORTED_CONFIGURATIONS } from "./frameworks.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RunTestsInstructionResult } from "../common/types.js";
|
|
2
|
+
import { RunTestsOnBrowserStackInput } from "../common/schema.js";
|
|
3
|
+
import { BrowserStackConfig } from "../../../lib/types.js";
|
|
4
|
+
export declare function runBstackSDKOnly(input: RunTestsOnBrowserStackInput, config: BrowserStackConfig, isPercyAutomate?: boolean): RunTestsInstructionResult;
|