@browserstack/mcp-server 1.2.3 → 1.2.5
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 +96 -6
- package/dist/lib/apiClient.d.ts +7 -5
- package/dist/lib/apiClient.js +76 -15
- package/dist/lib/device-cache.d.ts +3 -1
- package/dist/lib/device-cache.js +24 -17
- package/dist/lib/inmemory-store.d.ts +1 -0
- package/dist/lib/inmemory-store.js +1 -0
- package/dist/lib/instrumentation.js +6 -3
- package/dist/lib/utils.d.ts +78 -0
- package/dist/lib/utils.js +47 -0
- package/dist/lib/version-resolver.js +26 -14
- package/dist/server-factory.js +6 -0
- package/dist/tools/add-percy-snapshots.d.ts +5 -0
- package/dist/tools/add-percy-snapshots.js +17 -0
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +7 -0
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +70 -0
- package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +23 -0
- package/dist/tools/appautomate-utils/appium-sdk/constants.js +64 -0
- package/dist/tools/appautomate-utils/appium-sdk/formatter.d.ts +8 -0
- package/dist/tools/appautomate-utils/appium-sdk/formatter.js +59 -0
- package/dist/tools/appautomate-utils/appium-sdk/handler.d.ts +3 -0
- package/dist/tools/appautomate-utils/appium-sdk/handler.js +66 -0
- package/dist/tools/appautomate-utils/appium-sdk/index.d.ts +7 -0
- package/dist/tools/appautomate-utils/appium-sdk/index.js +8 -0
- package/dist/tools/appautomate-utils/appium-sdk/instructions.d.ts +3 -0
- package/dist/tools/appautomate-utils/appium-sdk/instructions.js +47 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.d.ts +2 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/csharp.js +78 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/java.d.ts +10 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/java.js +121 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.d.ts +3 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/nodejs.js +194 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/python.d.ts +3 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/python.js +76 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.d.ts +2 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/ruby.js +85 -0
- package/dist/tools/appautomate-utils/appium-sdk/types.d.ts +58 -0
- package/dist/tools/appautomate-utils/appium-sdk/types.js +63 -0
- package/dist/tools/appautomate-utils/appium-sdk/utils.d.ts +17 -0
- package/dist/tools/appautomate-utils/appium-sdk/utils.js +64 -0
- package/dist/tools/appautomate-utils/{appautomate.d.ts → native-execution/appautomate.d.ts} +1 -1
- package/dist/tools/appautomate-utils/{appautomate.js → native-execution/appautomate.js} +2 -2
- package/dist/tools/appautomate-utils/native-execution/constants.d.ts +11 -0
- package/dist/tools/appautomate-utils/native-execution/constants.js +58 -0
- package/dist/tools/appautomate-utils/native-execution/types.d.ts +19 -0
- package/dist/tools/appautomate-utils/{types.js → native-execution/types.js} +5 -1
- package/dist/tools/appautomate.js +40 -42
- package/dist/tools/bstack-sdk.d.ts +2 -15
- package/dist/tools/bstack-sdk.js +10 -119
- package/dist/tools/build-insights.d.ts +7 -0
- package/dist/tools/build-insights.js +67 -0
- package/dist/tools/list-test-files.d.ts +2 -0
- package/dist/tools/list-test-files.js +36 -0
- package/dist/tools/percy-sdk.d.ts +4 -0
- package/dist/tools/percy-sdk.js +98 -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 +175 -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/rca-agent-utils/constants.d.ts +13 -0
- package/dist/tools/rca-agent-utils/constants.js +24 -0
- package/dist/tools/rca-agent-utils/format-rca.d.ts +1 -0
- package/dist/tools/rca-agent-utils/format-rca.js +37 -0
- package/dist/tools/rca-agent-utils/get-build-id.d.ts +1 -0
- package/dist/tools/rca-agent-utils/get-build-id.js +18 -0
- package/dist/tools/rca-agent-utils/get-failed-test-id.d.ts +2 -0
- package/dist/tools/rca-agent-utils/get-failed-test-id.js +69 -0
- package/dist/tools/rca-agent-utils/rca-data.d.ts +9 -0
- package/dist/tools/rca-agent-utils/rca-data.js +196 -0
- package/dist/tools/rca-agent-utils/types.d.ts +48 -0
- package/dist/tools/rca-agent-utils/types.js +20 -0
- package/dist/tools/rca-agent.d.ts +14 -0
- package/dist/tools/rca-agent.js +119 -0
- package/dist/tools/review-agent-utils/build-counts.d.ts +7 -0
- package/dist/tools/review-agent-utils/build-counts.js +44 -0
- package/dist/tools/review-agent-utils/percy-approve-reject.d.ts +6 -0
- package/dist/tools/review-agent-utils/percy-approve-reject.js +39 -0
- package/dist/tools/review-agent-utils/percy-diffs.d.ts +9 -0
- package/dist/tools/review-agent-utils/percy-diffs.js +35 -0
- package/dist/tools/review-agent-utils/percy-snapshots.d.ts +11 -0
- package/dist/tools/review-agent-utils/percy-snapshots.js +58 -0
- package/dist/tools/review-agent.d.ts +5 -0
- package/dist/tools/review-agent.js +56 -0
- package/dist/tools/run-percy-scan.d.ts +8 -0
- package/dist/tools/run-percy-scan.js +37 -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 +7 -0
- package/dist/tools/sdk-utils/bstack/configUtils.js +113 -0
- package/dist/tools/sdk-utils/bstack/constants.d.ts +58 -0
- package/dist/tools/sdk-utils/{constants.js → bstack/constants.js} +117 -78
- 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 +82 -0
- package/dist/tools/sdk-utils/common/constants.d.ts +11 -0
- package/dist/tools/sdk-utils/common/constants.js +87 -0
- package/dist/tools/sdk-utils/common/device-validator.d.ts +25 -0
- package/dist/tools/sdk-utils/common/device-validator.js +368 -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 +93 -0
- package/dist/tools/sdk-utils/common/schema.js +105 -0
- package/dist/tools/sdk-utils/common/types.d.ts +66 -0
- package/dist/tools/sdk-utils/{types.js → common/types.js} +15 -2
- package/dist/tools/sdk-utils/common/utils.d.ts +25 -0
- package/dist/tools/sdk-utils/common/utils.js +91 -0
- package/dist/tools/sdk-utils/handler.d.ts +5 -0
- package/dist/tools/sdk-utils/handler.js +147 -0
- package/dist/tools/sdk-utils/percy-automate/constants.d.ts +11 -0
- package/dist/tools/sdk-utils/percy-automate/constants.js +338 -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 +103 -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 +883 -0
- package/dist/tools/sdk-utils/percy-web/fetchPercyToken.d.ts +4 -0
- package/dist/tools/sdk-utils/percy-web/fetchPercyToken.js +32 -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 +29 -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/testmanagement-utils/create-testrun.d.ts +4 -4
- package/dist/tools/testmanagement-utils/update-testrun.d.ts +4 -4
- package/package.json +3 -2
- package/dist/tools/appautomate-utils/types.d.ts +0 -5
- 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/sdk-utils/types.d.ts +0 -40
- /package/dist/tools/{sdk-utils/percy → percy-snapshot-utils}/types.js +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare enum PercyIntegrationTypeEnum {
|
|
2
|
+
WEB = "web",
|
|
3
|
+
AUTOMATE = "automate"
|
|
4
|
+
}
|
|
5
|
+
export declare enum SDKSupportedLanguageEnum {
|
|
6
|
+
nodejs = "nodejs",
|
|
7
|
+
python = "python",
|
|
8
|
+
java = "java",
|
|
9
|
+
csharp = "csharp",
|
|
10
|
+
ruby = "ruby"
|
|
11
|
+
}
|
|
12
|
+
export type SDKSupportedLanguage = keyof typeof SDKSupportedLanguageEnum;
|
|
13
|
+
export declare enum SDKSupportedBrowserAutomationFrameworkEnum {
|
|
14
|
+
playwright = "playwright",
|
|
15
|
+
selenium = "selenium",
|
|
16
|
+
cypress = "cypress"
|
|
17
|
+
}
|
|
18
|
+
export type SDKSupportedBrowserAutomationFramework = keyof typeof SDKSupportedBrowserAutomationFrameworkEnum;
|
|
19
|
+
export declare enum SDKSupportedTestingFrameworkEnum {
|
|
20
|
+
jest = "jest",
|
|
21
|
+
codeceptjs = "codeceptjs",
|
|
22
|
+
playwright = "playwright",
|
|
23
|
+
pytest = "pytest",
|
|
24
|
+
robot = "robot",
|
|
25
|
+
behave = "behave",
|
|
26
|
+
cucumber = "cucumber",
|
|
27
|
+
nightwatch = "nightwatch",
|
|
28
|
+
webdriverio = "webdriverio",
|
|
29
|
+
mocha = "mocha",
|
|
30
|
+
junit4 = "junit4",
|
|
31
|
+
junit5 = "junit5",
|
|
32
|
+
testng = "testng",
|
|
33
|
+
cypress = "cypress",
|
|
34
|
+
nunit = "nunit",
|
|
35
|
+
mstest = "mstest",
|
|
36
|
+
xunit = "xunit",
|
|
37
|
+
specflow = "specflow",
|
|
38
|
+
reqnroll = "reqnroll",
|
|
39
|
+
rspec = "rspec",
|
|
40
|
+
serenity = "serenity"
|
|
41
|
+
}
|
|
42
|
+
export declare const SDKSupportedLanguages: SDKSupportedLanguageEnum[];
|
|
43
|
+
export type SDKSupportedTestingFramework = keyof typeof SDKSupportedTestingFrameworkEnum;
|
|
44
|
+
export declare const SDKSupportedTestingFrameworks: SDKSupportedTestingFrameworkEnum[];
|
|
45
|
+
export type ConfigMapping = Partial<Record<SDKSupportedLanguageEnum, Partial<Record<SDKSupportedBrowserAutomationFrameworkEnum, Partial<Record<SDKSupportedTestingFrameworkEnum, {
|
|
46
|
+
instructions: (username: string, accessKey: string) => {
|
|
47
|
+
setup: string;
|
|
48
|
+
run: string;
|
|
49
|
+
};
|
|
50
|
+
}>>>>>>;
|
|
51
|
+
export interface RunTestsStep {
|
|
52
|
+
type: "instruction" | "error" | "warning";
|
|
53
|
+
title: string;
|
|
54
|
+
content: string;
|
|
55
|
+
isError?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface RunTestsInstructionResult {
|
|
58
|
+
steps: RunTestsStep[];
|
|
59
|
+
requiresPercy: boolean;
|
|
60
|
+
missingDependencies: string[];
|
|
61
|
+
shouldSkipFormatting?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare enum PercyAutomateNotImplementedType {
|
|
64
|
+
LANGUAGE = "language",
|
|
65
|
+
FRAMEWORK = "framework"
|
|
66
|
+
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
export var PercyIntegrationTypeEnum;
|
|
2
|
+
(function (PercyIntegrationTypeEnum) {
|
|
3
|
+
PercyIntegrationTypeEnum["WEB"] = "web";
|
|
4
|
+
PercyIntegrationTypeEnum["AUTOMATE"] = "automate";
|
|
5
|
+
})(PercyIntegrationTypeEnum || (PercyIntegrationTypeEnum = {}));
|
|
1
6
|
export var SDKSupportedLanguageEnum;
|
|
2
7
|
(function (SDKSupportedLanguageEnum) {
|
|
3
8
|
SDKSupportedLanguageEnum["nodejs"] = "nodejs";
|
|
4
9
|
SDKSupportedLanguageEnum["python"] = "python";
|
|
5
10
|
SDKSupportedLanguageEnum["java"] = "java";
|
|
6
11
|
SDKSupportedLanguageEnum["csharp"] = "csharp";
|
|
12
|
+
SDKSupportedLanguageEnum["ruby"] = "ruby";
|
|
7
13
|
})(SDKSupportedLanguageEnum || (SDKSupportedLanguageEnum = {}));
|
|
8
14
|
export var SDKSupportedBrowserAutomationFrameworkEnum;
|
|
9
15
|
(function (SDKSupportedBrowserAutomationFrameworkEnum) {
|
|
10
16
|
SDKSupportedBrowserAutomationFrameworkEnum["playwright"] = "playwright";
|
|
11
17
|
SDKSupportedBrowserAutomationFrameworkEnum["selenium"] = "selenium";
|
|
12
18
|
SDKSupportedBrowserAutomationFrameworkEnum["cypress"] = "cypress";
|
|
13
|
-
SDKSupportedBrowserAutomationFrameworkEnum["webdriverio"] = "webdriverio";
|
|
14
19
|
})(SDKSupportedBrowserAutomationFrameworkEnum || (SDKSupportedBrowserAutomationFrameworkEnum = {}));
|
|
15
20
|
export var SDKSupportedTestingFrameworkEnum;
|
|
16
21
|
(function (SDKSupportedTestingFrameworkEnum) {
|
|
@@ -27,11 +32,19 @@ export var SDKSupportedTestingFrameworkEnum;
|
|
|
27
32
|
SDKSupportedTestingFrameworkEnum["junit4"] = "junit4";
|
|
28
33
|
SDKSupportedTestingFrameworkEnum["junit5"] = "junit5";
|
|
29
34
|
SDKSupportedTestingFrameworkEnum["testng"] = "testng";
|
|
30
|
-
SDKSupportedTestingFrameworkEnum["serenity"] = "serenity";
|
|
31
35
|
SDKSupportedTestingFrameworkEnum["cypress"] = "cypress";
|
|
32
36
|
SDKSupportedTestingFrameworkEnum["nunit"] = "nunit";
|
|
33
37
|
SDKSupportedTestingFrameworkEnum["mstest"] = "mstest";
|
|
34
38
|
SDKSupportedTestingFrameworkEnum["xunit"] = "xunit";
|
|
35
39
|
SDKSupportedTestingFrameworkEnum["specflow"] = "specflow";
|
|
36
40
|
SDKSupportedTestingFrameworkEnum["reqnroll"] = "reqnroll";
|
|
41
|
+
SDKSupportedTestingFrameworkEnum["rspec"] = "rspec";
|
|
42
|
+
SDKSupportedTestingFrameworkEnum["serenity"] = "serenity";
|
|
37
43
|
})(SDKSupportedTestingFrameworkEnum || (SDKSupportedTestingFrameworkEnum = {}));
|
|
44
|
+
export const SDKSupportedLanguages = Object.values(SDKSupportedLanguageEnum);
|
|
45
|
+
export const SDKSupportedTestingFrameworks = Object.values(SDKSupportedTestingFrameworkEnum);
|
|
46
|
+
export var PercyAutomateNotImplementedType;
|
|
47
|
+
(function (PercyAutomateNotImplementedType) {
|
|
48
|
+
PercyAutomateNotImplementedType["LANGUAGE"] = "language";
|
|
49
|
+
PercyAutomateNotImplementedType["FRAMEWORK"] = "framework";
|
|
50
|
+
})(PercyAutomateNotImplementedType || (PercyAutomateNotImplementedType = {}));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { PercyIntegrationTypeEnum } from "../common/types.js";
|
|
3
|
+
import { RunTestsInstructionResult, PercyAutomateNotImplementedType } from "./types.js";
|
|
4
|
+
export declare function checkPercyIntegrationSupport(input: {
|
|
5
|
+
integrationType: string;
|
|
6
|
+
detectedLanguage: string;
|
|
7
|
+
detectedTestingFramework?: string;
|
|
8
|
+
detectedBrowserAutomationFramework?: string;
|
|
9
|
+
}): {
|
|
10
|
+
supported: boolean;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function formatToolResult(resultPromise: Promise<RunTestsInstructionResult> | RunTestsInstructionResult, runType?: "percy-web" | "bstack" | "percy-bstack" | "percy-automate"): Promise<CallToolResult>;
|
|
14
|
+
export declare function getPercyAutomateNotImplementedMessage(type: PercyAutomateNotImplementedType, input: {
|
|
15
|
+
detectedLanguage: string;
|
|
16
|
+
detectedBrowserAutomationFramework: string;
|
|
17
|
+
}, supported: string[]): string;
|
|
18
|
+
export declare function getBootstrapFailedMessage(error: unknown, context: {
|
|
19
|
+
config: unknown;
|
|
20
|
+
percyMode?: string;
|
|
21
|
+
sdkVersion?: string;
|
|
22
|
+
}): string;
|
|
23
|
+
export declare function percyUnsupportedResult(integrationType: PercyIntegrationTypeEnum, supportCheck?: {
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
}): CallToolResult;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { PercyIntegrationTypeEnum } from "../common/types.js";
|
|
2
|
+
import { isPercyAutomateFrameworkSupported } from "../percy-automate/frameworks.js";
|
|
3
|
+
import { isPercyWebFrameworkSupported } from "../percy-web/frameworks.js";
|
|
4
|
+
import { formatInstructionsWithNumbers, generateVerificationMessage, } from "./formatUtils.js";
|
|
5
|
+
import { PercyAutomateNotImplementedType, } from "./types.js";
|
|
6
|
+
import { IMPORTANT_SETUP_WARNING } from "./index.js";
|
|
7
|
+
export function checkPercyIntegrationSupport(input) {
|
|
8
|
+
if (input.integrationType === PercyIntegrationTypeEnum.AUTOMATE) {
|
|
9
|
+
const isSupported = isPercyAutomateFrameworkSupported(input.detectedLanguage, input.detectedBrowserAutomationFramework || "", input.detectedTestingFramework || "");
|
|
10
|
+
if (!isSupported) {
|
|
11
|
+
return {
|
|
12
|
+
supported: false,
|
|
13
|
+
errorMessage: `Percy Automate is not supported for this configuration. Language: ${input.detectedLanguage} Testing Framework: ${input.detectedTestingFramework}`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
else if (input.integrationType === PercyIntegrationTypeEnum.WEB) {
|
|
18
|
+
const isSupported = isPercyWebFrameworkSupported(input.detectedLanguage, input.detectedBrowserAutomationFramework || "");
|
|
19
|
+
if (!isSupported) {
|
|
20
|
+
return {
|
|
21
|
+
supported: false,
|
|
22
|
+
errorMessage: `Percy Web is not supported for this configuration. Language: ${input.detectedLanguage} Browser Automation Framework: ${input.detectedBrowserAutomationFramework}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { supported: true };
|
|
27
|
+
}
|
|
28
|
+
export async function formatToolResult(resultPromise, runType) {
|
|
29
|
+
const { steps, requiresPercy, missingDependencies, shouldSkipFormatting } = await resultPromise;
|
|
30
|
+
if (shouldSkipFormatting) {
|
|
31
|
+
return {
|
|
32
|
+
content: steps.map((step) => ({
|
|
33
|
+
type: "text",
|
|
34
|
+
text: step.content,
|
|
35
|
+
})),
|
|
36
|
+
isError: steps.some((s) => s.isError),
|
|
37
|
+
steps,
|
|
38
|
+
requiresPercy,
|
|
39
|
+
missingDependencies,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const combinedInstructions = steps.map((step) => step.content).join("\n");
|
|
43
|
+
const { formattedSteps, stepCount } = formatInstructionsWithNumbers(combinedInstructions);
|
|
44
|
+
const verificationMessage = generateVerificationMessage(stepCount);
|
|
45
|
+
const finalContent = [
|
|
46
|
+
{ type: "text", text: IMPORTANT_SETUP_WARNING },
|
|
47
|
+
{ type: "text", text: formattedSteps },
|
|
48
|
+
{ type: "text", text: verificationMessage },
|
|
49
|
+
];
|
|
50
|
+
if (runType != "percy-web") {
|
|
51
|
+
finalContent.push({
|
|
52
|
+
type: "text",
|
|
53
|
+
text: "CRITICAL: After the build is run, you MUST explicitly ask the user if they want to perform RCA (Root Cause Analysis) for any failed tests. This step is mandatory and should not be skipped.",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
content: finalContent,
|
|
58
|
+
isError: steps.some((s) => s.isError),
|
|
59
|
+
requiresPercy,
|
|
60
|
+
missingDependencies,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function getPercyAutomateNotImplementedMessage(type, input, supported) {
|
|
64
|
+
if (type === PercyAutomateNotImplementedType.LANGUAGE) {
|
|
65
|
+
return `Percy Automate does not support the language: ${input.detectedLanguage}. Supported languages are: ${supported.join(", ")}.`;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return `Percy Automate does not support ${input.detectedBrowserAutomationFramework} for ${input.detectedLanguage}. Supported frameworks for ${input.detectedLanguage} are: ${supported.join(", ")}.`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function getBootstrapFailedMessage(error, context) {
|
|
72
|
+
const error_message = error instanceof Error ? error.message : "unknown error";
|
|
73
|
+
return `Failed to bootstrap project with BrowserStack SDK.
|
|
74
|
+
Error: ${error_message}
|
|
75
|
+
Percy Mode: ${context.percyMode ?? "automate"}
|
|
76
|
+
SDK Version: ${context.sdkVersion ?? "N/A"}
|
|
77
|
+
Please open an issue on GitHub if the problem persists.`;
|
|
78
|
+
}
|
|
79
|
+
export function percyUnsupportedResult(integrationType, supportCheck) {
|
|
80
|
+
const defaultMessage = `Percy ${integrationType} integration is not supported for this configuration.`;
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: "text",
|
|
85
|
+
text: supportCheck?.errorMessage || defaultMessage,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
isError: true,
|
|
89
|
+
shouldSkipFormatting: true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BrowserStackConfig } from "../../lib/types.js";
|
|
2
|
+
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
export declare function runTestsOnBrowserStackHandler(rawInput: unknown, config: BrowserStackConfig): Promise<CallToolResult>;
|
|
4
|
+
export declare function setUpPercyHandler(rawInput: unknown, config: BrowserStackConfig): Promise<CallToolResult>;
|
|
5
|
+
export declare function simulatePercyChangeHandler(rawInput: unknown, config: BrowserStackConfig): Promise<CallToolResult>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { formatToolResult } from "./common/utils.js";
|
|
2
|
+
import { PercyIntegrationTypeEnum } from "./common/types.js";
|
|
3
|
+
import { getBrowserStackAuth } from "../../lib/get-auth.js";
|
|
4
|
+
import { fetchPercyToken } from "./percy-web/fetchPercyToken.js";
|
|
5
|
+
import { runPercyWeb } from "./percy-web/handler.js";
|
|
6
|
+
import { runPercyAutomateOnly } from "./percy-automate/handler.js";
|
|
7
|
+
import { runBstackSDKOnly } from "./bstack/sdkHandler.js";
|
|
8
|
+
import { runPercyWithBrowserstackSDK } from "./percy-bstack/handler.js";
|
|
9
|
+
import { checkPercyIntegrationSupport } from "./common/utils.js";
|
|
10
|
+
import { SetUpPercySchema, RunTestsOnBrowserStackSchema, } from "./common/schema.js";
|
|
11
|
+
import { getBootstrapFailedMessage, percyUnsupportedResult, } from "./common/utils.js";
|
|
12
|
+
import { PERCY_SIMULATE_INSTRUCTION, PERCY_REPLACE_REGEX, PERCY_SIMULATION_DRIVER_INSTRUCTION, PERCY_VERIFICATION_REGEX, } from "./common/constants.js";
|
|
13
|
+
export async function runTestsOnBrowserStackHandler(rawInput, config) {
|
|
14
|
+
const input = RunTestsOnBrowserStackSchema.parse(rawInput);
|
|
15
|
+
const result = await runBstackSDKOnly(input, config);
|
|
16
|
+
return await formatToolResult(result);
|
|
17
|
+
}
|
|
18
|
+
export async function setUpPercyHandler(rawInput, config) {
|
|
19
|
+
try {
|
|
20
|
+
const input = SetUpPercySchema.parse(rawInput);
|
|
21
|
+
const authorization = getBrowserStackAuth(config);
|
|
22
|
+
const percyInput = {
|
|
23
|
+
projectName: input.projectName,
|
|
24
|
+
detectedLanguage: input.detectedLanguage,
|
|
25
|
+
detectedBrowserAutomationFramework: input.detectedBrowserAutomationFramework,
|
|
26
|
+
detectedTestingFramework: input.detectedTestingFramework,
|
|
27
|
+
integrationType: input.integrationType,
|
|
28
|
+
folderPaths: input.folderPaths || [],
|
|
29
|
+
};
|
|
30
|
+
// Check for Percy Web integration support
|
|
31
|
+
if (input.integrationType === PercyIntegrationTypeEnum.WEB) {
|
|
32
|
+
const supportCheck = checkPercyIntegrationSupport(percyInput);
|
|
33
|
+
if (!supportCheck.supported) {
|
|
34
|
+
return percyUnsupportedResult(PercyIntegrationTypeEnum.WEB, supportCheck);
|
|
35
|
+
}
|
|
36
|
+
// Fetch the Percy token
|
|
37
|
+
const percyToken = await fetchPercyToken(input.projectName, authorization, { type: PercyIntegrationTypeEnum.WEB });
|
|
38
|
+
const result = runPercyWeb(percyInput, percyToken);
|
|
39
|
+
return await formatToolResult(result, "percy-web");
|
|
40
|
+
}
|
|
41
|
+
else if (input.integrationType === PercyIntegrationTypeEnum.AUTOMATE) {
|
|
42
|
+
// First try Percy with BrowserStack SDK
|
|
43
|
+
const percyWithBrowserstackSDKResult = runPercyWithBrowserstackSDK({
|
|
44
|
+
...percyInput,
|
|
45
|
+
devices: [],
|
|
46
|
+
}, config);
|
|
47
|
+
const hasPercySDKError = percyWithBrowserstackSDKResult.steps &&
|
|
48
|
+
percyWithBrowserstackSDKResult.steps.some((step) => step.isError);
|
|
49
|
+
if (!hasPercySDKError) {
|
|
50
|
+
// Percy with SDK is supported, prepend warning and return those steps
|
|
51
|
+
if (percyWithBrowserstackSDKResult.steps) {
|
|
52
|
+
percyWithBrowserstackSDKResult.steps.unshift({
|
|
53
|
+
type: "instruction",
|
|
54
|
+
title: "Important: Existing SDK Setup",
|
|
55
|
+
content: "If you have already set up the BrowserStack SDK, do not override it unless you have explicitly decided to do so.",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return await formatToolResult(percyWithBrowserstackSDKResult);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Fallback to standalone Percy Automate if supported
|
|
62
|
+
const supportCheck = checkPercyIntegrationSupport({
|
|
63
|
+
...percyInput,
|
|
64
|
+
integrationType: PercyIntegrationTypeEnum.AUTOMATE,
|
|
65
|
+
});
|
|
66
|
+
if (!supportCheck.supported) {
|
|
67
|
+
return percyUnsupportedResult(PercyIntegrationTypeEnum.AUTOMATE, supportCheck);
|
|
68
|
+
}
|
|
69
|
+
// SDK setup instructions (for Automate, without Percy)
|
|
70
|
+
const sdkInput = {
|
|
71
|
+
projectName: input.projectName,
|
|
72
|
+
detectedLanguage: input.detectedLanguage,
|
|
73
|
+
detectedBrowserAutomationFramework: input.detectedBrowserAutomationFramework,
|
|
74
|
+
detectedTestingFramework: input.detectedTestingFramework,
|
|
75
|
+
devices: [],
|
|
76
|
+
};
|
|
77
|
+
const sdkResult = await runBstackSDKOnly(sdkInput, config, true);
|
|
78
|
+
// Percy Automate instructions
|
|
79
|
+
const percyToken = await fetchPercyToken(input.projectName, authorization, { type: PercyIntegrationTypeEnum.AUTOMATE });
|
|
80
|
+
const percyAutomateResult = runPercyAutomateOnly(percyInput, percyToken);
|
|
81
|
+
// Combine steps: warning, SDK steps, Percy Automate steps
|
|
82
|
+
const steps = [
|
|
83
|
+
{
|
|
84
|
+
type: "instruction",
|
|
85
|
+
title: "Important: Existing SDK Setup",
|
|
86
|
+
content: "If you have already set up the BrowserStack SDK, do not override it unless you have explicitly decided to do so.",
|
|
87
|
+
},
|
|
88
|
+
...(sdkResult.steps || []),
|
|
89
|
+
...(percyAutomateResult.steps || []),
|
|
90
|
+
];
|
|
91
|
+
// Combine all steps into the final result
|
|
92
|
+
return await formatToolResult({
|
|
93
|
+
...percyAutomateResult,
|
|
94
|
+
steps,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: "Unknown or unsupported Percy integration type requested.",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
isError: true,
|
|
107
|
+
shouldSkipFormatting: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
throw new Error(getBootstrapFailedMessage(error, { config }));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export async function simulatePercyChangeHandler(rawInput, config) {
|
|
116
|
+
try {
|
|
117
|
+
let percyInstruction;
|
|
118
|
+
try {
|
|
119
|
+
percyInstruction = await setUpPercyHandler(rawInput, config);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
throw new Error("Failed to set up Percy");
|
|
123
|
+
}
|
|
124
|
+
if (percyInstruction.isError) {
|
|
125
|
+
return percyInstruction;
|
|
126
|
+
}
|
|
127
|
+
if (Array.isArray(percyInstruction.content)) {
|
|
128
|
+
percyInstruction.content = percyInstruction.content.map((item) => {
|
|
129
|
+
if (typeof item.text === "string") {
|
|
130
|
+
const updatedText = item.text
|
|
131
|
+
.replace(PERCY_REPLACE_REGEX, PERCY_SIMULATE_INSTRUCTION)
|
|
132
|
+
.replace(PERCY_VERIFICATION_REGEX, "");
|
|
133
|
+
return { ...item, text: updatedText };
|
|
134
|
+
}
|
|
135
|
+
return item;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
percyInstruction.content?.push({
|
|
139
|
+
type: "text",
|
|
140
|
+
text: PERCY_SIMULATION_DRIVER_INSTRUCTION,
|
|
141
|
+
});
|
|
142
|
+
return percyInstruction;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
throw new Error(getBootstrapFailedMessage(error, { config }));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const percyAutomateReviewSnapshotsStep = "\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n";
|
|
2
|
+
export declare const pythonPytestSeleniumInstructions = "\nInstall Percy Automate dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Python SDK for Automate:\n pip install percy-selenium\n\n---STEP---\nUpdate your Pytest test script \n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory and obtain the generated UUID ---STEP---\nProcess files in STRICT sequential order using tool addPercySnapshotCommands() with below instructions:\n- Start with index 0\n- Then index 1 \n- Then index 2\n- Continue sequentially until the last index\n- DO NOT skip any index numbers\n- DO NOT jump to random indices like 10, 20, 30\n- DO NOT worry about time consuming and any constraints.\n- DO NOT STOP until you add commands in all the files or you reach end of the files.\n\n - Import the Percy snapshot helper:\n from percy import percy_screenshot\n - In your test, take snapshots at key points:\n percy_screenshot(driver, \"Your snapshot name\")\n\nExample:\n```python\nimport pytest\nfrom selenium import webdriver\nfrom percy import percy_screenshot\n\n@pytest.fixture\ndef driver():\n driver = webdriver.Chrome()\n yield driver\n driver.quit()\n\ndef test_homepage(driver):\n driver.get(\"http://localhost:8000\")\n percy_screenshot(driver, \"Home page\")\n # ... more test steps ...\n percy_screenshot(driver, \"After login\")\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- browserstack-sdk pytest').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
3
|
+
export declare const pythonPytestPlaywrightInstructions = "\nInstall Percy Automate dependencies\n - Install Percy CLI:\n npm install --save @percy/cli\n - Install Percy Playwright SDK for Automate:\n pip install percy-playwright\n\n---STEP---\nUpdate your Playwright test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory and obtain the generated UUID ---STEP---\nProcess files in STRICT sequential order using tool addPercySnapshotCommands() with below instructions:\n- Start with index 0\n- Then index 1 \n- Then index 2\n- Continue sequentially until the last index\n- DO NOT skip any index numbers\n- DO NOT jump to random indices like 10, 20, 30\n- DO NOT worry about time consuming and any constraints.\n- DO NOT STOP until you add commands in all the files or you reach end of the files.\n\n - Import the Percy screenshot helper:\n from percy import percy_screenshot\n - In your test, take snapshots at key points:\n percy_screenshot(page, name=\"Your snapshot name\")\n # You can pass `options`:\n percy_screenshot(page, name=\"Your snapshot name\", options={ \"full_page\": True })\n\nExample:\n```python\nfrom playwright.sync_api import sync_playwright\nfrom percy import percy_screenshot\n\ndef test_visual_regression():\n with sync_playwright() as p:\n browser = p.chromium.launch()\n page = browser.new_page()\n page.goto(\"http://localhost:8000\")\n percy_screenshot(page, name=\"Home page\")\n # ... more test steps ...\n percy_screenshot(page, name=\"After login\", options={ \"full_page\": True })\n browser.close()\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- <command to run the script file>').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
4
|
+
export declare const jsCypressPercyAutomateInstructions = "\nInstall Percy Automate dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Cypress SDK:\n npm install --save-dev @percy/cypress\n\n---STEP---\nUpdate your Cypress test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory and obtain the generated UUID ---STEP---\nProcess files in STRICT sequential order using tool addPercySnapshotCommands() with below instructions:\n- Start with index 0\n- Then index 1 \n- Then index 2\n- Continue sequentially until the last index\n- DO NOT skip any index numbers\n- DO NOT jump to random indices like 10, 20, 30\n- DO NOT worry about time consuming and any constraints.\n- DO NOT STOP until you add commands in all the files or you reach end of the files.\n\n - Import and initialize Percy in your cypress/support/index.js:\n import '@percy/cypress';\n - In your test, take snapshots at key points:\n cy.percySnapshot('Your snapshot name');\n\nExample:\n```javascript\ndescribe('Percy Automate Cypress Example', () => {\n it('should take Percy snapshots', () => {\n cy.visit('http://localhost:8000');\n cy.percySnapshot('Home page');\n // ... more test steps ...\n cy.percySnapshot('After login');\n });\n});\n``` \n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- cypress run').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
5
|
+
export declare const mochaPercyAutomateInstructions = "\nInstall Percy Automate dependencies\n - Install Percy CLI:\n npm install --save @percy/cli\n - Install Percy Selenium SDK:\n npm install @percy/selenium-webdriver@2.0.1\n\n---STEP---\nUpdate your Mocha Automate test script\n - Import the Percy screenshot helper:\n const { percyScreenshot } = require('@percy/selenium-webdriver');\n - Use the Percy screenshot command to take required screenshots in your Automate session:\n await percyScreenshot(driver, 'Screenshot 1');\n options = { percyCSS: 'h1{color:red;}' };\n await percyScreenshot(driver, 'Screenshot 2', options);\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- mocha').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
6
|
+
export declare const mochaPercyPlaywrightInstructions = "\nInstall Percy Automate dependencies\n - Install the latest Percy CLI:\n npm install --save @percy/cli\n - Install the Percy Playwright SDK:\n npm install @percy/playwright\n\n---STEP---\nUpdate your Mocha Playwright test script\n - Import the Percy screenshot helper:\n const { percyScreenshot } = require(\"@percy/playwright\");\n - Use the Percy screenshot command to take required screenshots in your Automate session.\n\nExample:\n```javascript\nconst { percyScreenshot } = require(\"@percy/playwright\");\nawait percyScreenshot(page, \"Screenshot 1\");\n// With options\nawait percyScreenshot(page, \"Screenshot 2\", { percyCSS: \"h1{color:green;}\" });\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- <command to run the tests>').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
7
|
+
export declare const jestPercyAutomateInstructions = "\nInstall or upgrade the BrowserStack SDK:\n - Install the SDK:\n npm i -D browserstack-node-sdk@latest\n - Run the setup:\n npx setup --username \"YOUR_USERNAME\" --key \"YOUR_ACCESS_KEY\"\n\n---STEP---\nManually capture screenshots:\n 1. Import the BrowserStack Percy SDK in your test script:\n const { percy } = require('browserstack-node-sdk');\n 2. Use `percy.screenshot(driver, name)` at desired points in your test.\n\nExample:\n```javascript\nconst { percy } = require('browserstack-node-sdk');\ndescribe(\"JestJS test\", () => {\n let driver;\n const caps = require(\"../\" + conf_file).capabilities;\n\n beforeAll(() => {\n driver = new Builder()\n .usingServer(\"http://example-servername/hub\")\n .withCapabilities(caps)\n .build();\n });\n\n test(\"my test\", async () => {\n // ...\n await percy.screenshot(driver, \"My Screenshot\");\n // ...\n });\n});\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npm run [your-test-script-name]-browserstack').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
8
|
+
export declare const webdriverioPercyAutomateInstructions = "\nInstall or upgrade BrowserStack SDK\n - Install the BrowserStack SDK:\n npm i -D @wdio/browserstack-service\n\n---STEP---\nUpdate your WebdriverIO config file\n 1. Set `percy: true`\n 2. Set a `projectName`\n 3. Set `percyCaptureMode: auto` (or another mode as needed)\n\nExample WebdriverIO config:\n```js\nexports.config = {\n user: process.env.BROWSERSTACK_USERNAME || 'YOUR_USERNAME',\n key: process.env.BROWSERSTACK_ACCESS_KEY || 'YOUR_ACCESS_KEY',\n hostname: 'hub.browserstack.com',\n services: [\n [\n 'browserstack',\n { browserstackLocal: true, opts: { forcelocal: false }, percy: true, percyCaptureMode: 'auto' }\n ],\n ],\n // add path to the test file\n}\n```\n\n---STEP---\n(Optional) Manually capture screenshots\n 1. Import the BrowserStack Percy SDK in your test script:\n const { percy } = require('browserstack-node-sdk');\n 2. Add the `await percy.screenshot(driver, name)` method at required points in your test script.\n\nExample:\n```javascript\n const { percy } = require('browserstack-node-sdk');\n 2. Add the `await percy.screenshot(driver, name)` method at required points in your test script.\n\nExample:\n```javascript\nconst { percy } = require('browserstack-node-sdk');\ndescribe(\"WebdriverIO Test\", () => {\n it(\"my test\", async () => {\n // ....\n await percy.screenshot(driver, \"My Screenshot\")\n // ....\n });\n});\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command as defined in your package.json file.\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
9
|
+
export declare const testcafePercyAutomateInstructions = "\nInstall Percy dependencies\n - Install the required dependencies:\n npm install --save-dev @percy/cli @percy/testcafe\n\n---STEP---\nUpdate your test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory and obtain the generated UUID ---STEP---\nProcess files in STRICT sequential order using tool addPercySnapshotCommands() with below instructions:\n- Start with index 0\n- Then index 1 \n- Then index 2\n- Continue sequentially until the last index\n- DO NOT skip any index numbers\n- DO NOT jump to random indices like 10, 20, 30\n- DO NOT worry about time consuming and any constraints.\n- DO NOT STOP until you add commands in all the files or you reach end of the files.\n\n - Import the Percy library and use the percySnapshot function to take screenshots.\n\nExample:\n```javascript\nimport percySnapshot from '@percy/testcafe';\nfixture('MyFixture')\n .page('https://devexpress.github.io/testcafe/example/');\ntest('Test1', async t => {\n await t.typeText('#developer-name', 'John Doe');\n await percySnapshot(t, 'TestCafe Example');\n});\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- testcafe chrome:headless tests').\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
10
|
+
export declare const javaPlaywrightJunitInstructions = "\nInstall Percy Automate dependencies\n - Install the latest Percy CLI:\n npm install --save @percy/cli\n - Add the Percy Playwright Java SDK to your pom.xml:\n```xml\n<dependency>\n <groupId>io.percy</groupId>\n <artifactId>percy-playwright-java</artifactId>\n <version>1.0.0</version>\n</dependency>\n```\n\n---STEP---\nUpdate your Automate test script\n - Import the Percy library:\n import io.percy.playwright.Percy;\n - Use the Percy screenshot command to take required screenshots in your Automate session.\n\nExample:\n```java\nPercy percy = new Percy(page);\npercy.screenshot(\"screenshot_1\");\n// With options\npercy.screenshot(\"screenshot_2\", options);\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- <command to run the automate script file>').\n\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|
|
11
|
+
export declare const csharpPlaywrightNunitInstructions = "\nInstall Percy Automate dependencies\n - Install the latest Percy CLI:\n npm install --save @percy/cli\n - Add the Percy Playwright SDK to your .csproj file:\n```xml\n<PackageReference Include=\"PercyIO.Playwright\" Version=\"1.0.0\" />\n```\n\n---STEP---\nUpdate your NUnit Playwright test script\n - Import the Percy library:\n using PercyIO.Playwright;\n - Use the Percy screenshot command to take required screenshots in your Automate session.\n\nExample:\n```csharp\nusing PercyIO.Playwright;\nPercy.Screenshot(page, \"example_screenshot_1\");\n// With options\nPercy.Screenshot(page, \"example_screenshot_2\", options);\n```\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- <command to run the automate script file>').\n\n\n---STEP---\nReview the snapshots\n - Go to your Percy project on https://percy.io to review snapshots and approve/reject any visual changes.\n\n";
|