@browserstack/mcp-server 1.2.4 → 1.2.6
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 +9 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/apiClient.d.ts +8 -5
- package/dist/lib/apiClient.js +77 -15
- package/dist/lib/device-cache.d.ts +3 -1
- package/dist/lib/device-cache.js +4 -0
- package/dist/lib/inmemory-store.d.ts +5 -1
- package/dist/lib/inmemory-store.js +10 -1
- package/dist/lib/instrumentation.js +6 -3
- package/dist/lib/utils.d.ts +75 -2
- package/dist/lib/utils.js +20 -0
- package/dist/lib/version-resolver.js +30 -14
- package/dist/tools/add-percy-snapshots.d.ts +0 -1
- package/dist/tools/add-percy-snapshots.js +11 -6
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.d.ts +7 -1
- package/dist/tools/appautomate-utils/appium-sdk/config-generator.js +46 -26
- package/dist/tools/appautomate-utils/appium-sdk/constants.d.ts +1 -1
- package/dist/tools/appautomate-utils/appium-sdk/constants.js +24 -3
- package/dist/tools/appautomate-utils/appium-sdk/handler.js +16 -2
- package/dist/tools/appautomate-utils/appium-sdk/languages/java.d.ts +2 -0
- package/dist/tools/appautomate-utils/appium-sdk/languages/java.js +63 -29
- package/dist/tools/appautomate-utils/appium-sdk/types.d.ts +2 -1
- package/dist/tools/appautomate-utils/appium-sdk/types.js +10 -1
- package/dist/tools/appautomate-utils/native-execution/constants.d.ts +2 -1
- package/dist/tools/appautomate-utils/native-execution/constants.js +24 -2
- package/dist/tools/appautomate.js +15 -2
- package/dist/tools/automate-utils/fetch-screenshots.js +4 -1
- package/dist/tools/list-test-files.d.ts +1 -1
- package/dist/tools/list-test-files.js +43 -19
- package/dist/tools/percy-sdk.js +33 -6
- package/dist/tools/percy-snapshot-utils/constants.d.ts +0 -6
- package/dist/tools/percy-snapshot-utils/constants.js +0 -15
- package/dist/tools/rca-agent-utils/constants.d.ts +1 -1
- package/dist/tools/rca-agent-utils/constants.js +2 -2
- package/dist/tools/rca-agent-utils/rca-data.d.ts +1 -1
- package/dist/tools/rca-agent-utils/rca-data.js +2 -2
- package/dist/tools/rca-agent-utils/types.d.ts +3 -3
- package/dist/tools/rca-agent.d.ts +1 -1
- package/dist/tools/run-percy-scan.js +51 -10
- package/dist/tools/sdk-utils/bstack/configUtils.d.ts +8 -4
- package/dist/tools/sdk-utils/bstack/configUtils.js +74 -20
- package/dist/tools/sdk-utils/bstack/constants.d.ts +1 -1
- package/dist/tools/sdk-utils/bstack/constants.js +7 -9
- package/dist/tools/sdk-utils/bstack/sdkHandler.d.ts +1 -1
- package/dist/tools/sdk-utils/bstack/sdkHandler.js +19 -9
- package/dist/tools/sdk-utils/common/constants.d.ts +6 -5
- package/dist/tools/sdk-utils/common/constants.js +8 -7
- package/dist/tools/sdk-utils/common/device-validator.d.ts +25 -0
- package/dist/tools/sdk-utils/common/device-validator.js +375 -0
- package/dist/tools/sdk-utils/common/schema.d.ts +32 -8
- package/dist/tools/sdk-utils/common/schema.js +62 -3
- package/dist/tools/sdk-utils/common/utils.d.ts +1 -1
- package/dist/tools/sdk-utils/common/utils.js +14 -2
- package/dist/tools/sdk-utils/handler.d.ts +1 -0
- package/dist/tools/sdk-utils/handler.js +59 -14
- package/dist/tools/sdk-utils/percy-automate/constants.d.ts +4 -4
- package/dist/tools/sdk-utils/percy-bstack/constants.d.ts +4 -4
- package/dist/tools/sdk-utils/percy-bstack/handler.js +5 -1
- package/dist/tools/sdk-utils/percy-web/constants.d.ts +22 -20
- package/dist/tools/sdk-utils/percy-web/constants.js +39 -0
- package/dist/tools/sdk-utils/percy-web/handler.js +3 -1
- package/package.json +2 -2
|
@@ -6,31 +6,43 @@ import { runPercyWeb } from "./percy-web/handler.js";
|
|
|
6
6
|
import { runPercyAutomateOnly } from "./percy-automate/handler.js";
|
|
7
7
|
import { runBstackSDKOnly } from "./bstack/sdkHandler.js";
|
|
8
8
|
import { runPercyWithBrowserstackSDK } from "./percy-bstack/handler.js";
|
|
9
|
-
import { checkPercyIntegrationSupport } from "./common/utils.js";
|
|
9
|
+
import { checkPercyIntegrationSupport, validatePercyPathandFolders, } from "./common/utils.js";
|
|
10
10
|
import { SetUpPercySchema, RunTestsOnBrowserStackSchema, } from "./common/schema.js";
|
|
11
|
+
import { storedPercyResults } from "../../lib/inmemory-store.js";
|
|
11
12
|
import { getBootstrapFailedMessage, percyUnsupportedResult, } from "./common/utils.js";
|
|
13
|
+
import { PERCY_SIMULATE_INSTRUCTION, PERCY_REPLACE_REGEX, PERCY_SIMULATION_DRIVER_INSTRUCTION, PERCY_VERIFICATION_REGEX, } from "./common/constants.js";
|
|
12
14
|
export async function runTestsOnBrowserStackHandler(rawInput, config) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const result = runBstackSDKOnly(input, config);
|
|
17
|
-
return await formatToolResult(result);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw new Error(getBootstrapFailedMessage(error, { config }));
|
|
21
|
-
}
|
|
15
|
+
const input = RunTestsOnBrowserStackSchema.parse(rawInput);
|
|
16
|
+
const result = await runBstackSDKOnly(input, config);
|
|
17
|
+
return await formatToolResult(result);
|
|
22
18
|
}
|
|
23
19
|
export async function setUpPercyHandler(rawInput, config) {
|
|
24
20
|
try {
|
|
25
21
|
const input = SetUpPercySchema.parse(rawInput);
|
|
22
|
+
validatePercyPathandFolders(input);
|
|
23
|
+
// Clear any previous Percy results for a fresh start
|
|
24
|
+
storedPercyResults.clear();
|
|
25
|
+
storedPercyResults.set({
|
|
26
|
+
projectName: input.projectName,
|
|
27
|
+
detectedLanguage: input.detectedLanguage,
|
|
28
|
+
detectedBrowserAutomationFramework: input.detectedBrowserAutomationFramework,
|
|
29
|
+
detectedTestingFramework: input.detectedTestingFramework,
|
|
30
|
+
integrationType: input.integrationType,
|
|
31
|
+
folderPaths: input.folderPaths || [],
|
|
32
|
+
filePaths: input.filePaths || [],
|
|
33
|
+
testFiles: {},
|
|
34
|
+
});
|
|
26
35
|
const authorization = getBrowserStackAuth(config);
|
|
36
|
+
const folderPaths = input.folderPaths || [];
|
|
37
|
+
const filePaths = input.filePaths || [];
|
|
27
38
|
const percyInput = {
|
|
28
39
|
projectName: input.projectName,
|
|
29
40
|
detectedLanguage: input.detectedLanguage,
|
|
30
41
|
detectedBrowserAutomationFramework: input.detectedBrowserAutomationFramework,
|
|
31
42
|
detectedTestingFramework: input.detectedTestingFramework,
|
|
32
43
|
integrationType: input.integrationType,
|
|
33
|
-
folderPaths
|
|
44
|
+
folderPaths,
|
|
45
|
+
filePaths,
|
|
34
46
|
};
|
|
35
47
|
// Check for Percy Web integration support
|
|
36
48
|
if (input.integrationType === PercyIntegrationTypeEnum.WEB) {
|
|
@@ -47,7 +59,7 @@ export async function setUpPercyHandler(rawInput, config) {
|
|
|
47
59
|
// First try Percy with BrowserStack SDK
|
|
48
60
|
const percyWithBrowserstackSDKResult = runPercyWithBrowserstackSDK({
|
|
49
61
|
...percyInput,
|
|
50
|
-
|
|
62
|
+
devices: [],
|
|
51
63
|
}, config);
|
|
52
64
|
const hasPercySDKError = percyWithBrowserstackSDKResult.steps &&
|
|
53
65
|
percyWithBrowserstackSDKResult.steps.some((step) => step.isError);
|
|
@@ -77,9 +89,9 @@ export async function setUpPercyHandler(rawInput, config) {
|
|
|
77
89
|
detectedLanguage: input.detectedLanguage,
|
|
78
90
|
detectedBrowserAutomationFramework: input.detectedBrowserAutomationFramework,
|
|
79
91
|
detectedTestingFramework: input.detectedTestingFramework,
|
|
80
|
-
|
|
92
|
+
devices: [],
|
|
81
93
|
};
|
|
82
|
-
const sdkResult = runBstackSDKOnly(sdkInput, config, true);
|
|
94
|
+
const sdkResult = await runBstackSDKOnly(sdkInput, config, true);
|
|
83
95
|
// Percy Automate instructions
|
|
84
96
|
const percyToken = await fetchPercyToken(input.projectName, authorization, { type: PercyIntegrationTypeEnum.AUTOMATE });
|
|
85
97
|
const percyAutomateResult = runPercyAutomateOnly(percyInput, percyToken);
|
|
@@ -117,3 +129,36 @@ export async function setUpPercyHandler(rawInput, config) {
|
|
|
117
129
|
throw new Error(getBootstrapFailedMessage(error, { config }));
|
|
118
130
|
}
|
|
119
131
|
}
|
|
132
|
+
export async function simulatePercyChangeHandler(rawInput, config) {
|
|
133
|
+
try {
|
|
134
|
+
let percyInstruction;
|
|
135
|
+
try {
|
|
136
|
+
percyInstruction = await setUpPercyHandler(rawInput, config);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
throw new Error("Failed to set up Percy");
|
|
140
|
+
}
|
|
141
|
+
if (percyInstruction.isError) {
|
|
142
|
+
return percyInstruction;
|
|
143
|
+
}
|
|
144
|
+
if (Array.isArray(percyInstruction.content)) {
|
|
145
|
+
percyInstruction.content = percyInstruction.content.map((item) => {
|
|
146
|
+
if (typeof item.text === "string") {
|
|
147
|
+
const updatedText = item.text
|
|
148
|
+
.replace(PERCY_REPLACE_REGEX, PERCY_SIMULATE_INSTRUCTION)
|
|
149
|
+
.replace(PERCY_VERIFICATION_REGEX, "");
|
|
150
|
+
return { ...item, text: updatedText };
|
|
151
|
+
}
|
|
152
|
+
return item;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
percyInstruction.content?.push({
|
|
156
|
+
type: "text",
|
|
157
|
+
text: PERCY_SIMULATION_DRIVER_INSTRUCTION,
|
|
158
|
+
});
|
|
159
|
+
return percyInstruction;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
throw new Error(getBootstrapFailedMessage(error, { config }));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
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
|
|
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
|
|
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
|
|
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 ---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 ---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 ---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
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
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
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
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
|
|
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 ---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
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
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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const javaSeleniumInstructions = "\nImport the BrowserStack Percy SDK in your test script:\nAdd the Percy import to your test file.\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
2
|
-
export declare const nodejsSeleniumInstructions = "\nImport the BrowserStack Percy SDK in your test script:\nAdd the Percy import to your test file.\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
3
|
-
export declare const webdriverioPercyInstructions = "\nEnable Percy in `wdio.conf.js`:\nIn your WebdriverIO configuration file, modify the 'browserstack' service options to enable Percy.\n\n- Set `percy: true`.\n- Set a `projectName`. This is required and will be used for both your Automate and Percy projects.\n- Set `percyCaptureMode`. The default `manual` as we are adding screenshot commands manually.\n\nHere's how to modify the service configuration:\n```javascript\n// in wdio.conf.js\n\nexports.config = {\n // ... other configs\n services: [\n [\n 'browserstack',\n { \n // ... other service options\n percy: true,\n percyCaptureMode: 'manual' // or 'auto', etc.\n },\n ],\n ],\n\n commonCapabilities: {\n 'bstack:options': {\n projectName: \"My Percy Project\", // This is required for Percy\n // ... other common capabilities\n }\n },\n // ... rest of your config\n};\n```\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
4
|
-
export declare const csharpSeleniumInstructions = "\nImport the BrowserStack Percy SDK in your test script:\nAdd the Percy import to your test file.\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
1
|
+
export declare const javaSeleniumInstructions = "\nImport the BrowserStack Percy SDK in your test script:\nAdd the Percy import to your test file.\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\nAdd screenshot capture method at required points:\nUse the `PercySDK.screenshot(driver, name)` method at points in your test script where you want to capture screenshots.\n\nHere's an example:\n\n```java\n// ...imports\nimport com.browserstack.PercySDK;\n\npublic class YourTestClass extends YourBaseTest {\n @Test\n public void test() throws Exception {\n // your test logic\n // ...\n \n // Capture a Percy screenshot\n PercySDK.screenshot(driver, \"My Screenshot Name\");\n \n // ...\n // more test logic\n }\n}\n```\n";
|
|
2
|
+
export declare const nodejsSeleniumInstructions = "\nImport the BrowserStack Percy SDK in your test script:\nAdd the Percy import to your test file.\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n---STEP---\n\nAdd screenshot capture method at required points:\nUse the `percy.snapshot(driver, name)` method at points in your test script where you want to capture screenshots.\n\n```javascript\nconst { percy } = require('browserstack-node-sdk');\ndescribe(\"sample Test\", () => {\n // ... other imports and setup\n \n test(\"my test\", async () => {\n // ....\n await percy.screenshot(driver, \"My Snapshot\")\n // ....\n });\n})\n```\n";
|
|
3
|
+
export declare const webdriverioPercyInstructions = "\nEnable Percy in `wdio.conf.js`:\nIn your WebdriverIO configuration file, modify the 'browserstack' service options to enable Percy.\n\n- Set `percy: true`.\n- Set a `projectName`. This is required and will be used for both your Automate and Percy projects.\n- Set `percyCaptureMode`. The default `manual` as we are adding screenshot commands manually.\n\nHere's how to modify the service configuration:\n```javascript\n// in wdio.conf.js\n\nexports.config = {\n // ... other configs\n services: [\n [\n 'browserstack',\n { \n // ... other service options\n percy: true,\n percyCaptureMode: 'manual' // or 'auto', etc.\n },\n ],\n ],\n\n commonCapabilities: {\n 'bstack:options': {\n projectName: \"My Percy Project\", // This is required for Percy\n // ... other common capabilities\n }\n },\n // ... rest of your config\n};\n```\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n---STEP---\n\nManually Capturing Screenshots (Optional):\nIf you set `percyCaptureMode: 'manual'` or want to take extra screenshots in `auto` mode, you need to add screenshot commands to your tests.\n\nFirst, install `browserstack-node-sdk`:\n```bash\nnpm install browserstack-node-sdk\n```\n\nThen, in your test script, import `percy` and use it to take a snapshot:\n```javascript\n// your_test_file.js\nconst { percy } = require('browserstack-node-sdk');\n\ndescribe(\"My WebdriverIO Test\", () => {\n it(\"should take a percy snapshot\", async () => {\n // ... your test logic (e.g., browser.url('https://example.com'))\n \n // Capture a Percy screenshot\n await percy.screenshot(driver, \"My Snapshot Name\");\n \n // ... more test logic\n });\n});\n```\n";
|
|
4
|
+
export declare const csharpSeleniumInstructions = "\nImport the BrowserStack Percy SDK in your test script:\nAdd the Percy import to your test file.\n\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\nAdd screenshot capture method at required points:\nUse the `PercySDK.Screenshot(driver, name)` method at points in your test script where you want to capture screenshots.\n\nHere's an example:\n\n```csharp\nusing BrowserStackSDK.Percy;\nnamespace Tests;\n\npublic class MyTest\n{\n [Test]\n public void SampleTest()\n {\n // your test logic\n // ...\n \n // Capture a Percy screenshot\n PercySDK.Screenshot(driver, \"Screenshot name\");\n \n // ...\n // more test logic\n }\n}\n```\n";
|
|
@@ -63,7 +63,11 @@ export function runPercyWithBrowserstackSDK(input, config) {
|
|
|
63
63
|
content: sdkSetupCommand,
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
const ymlInstructions = generateBrowserStackYMLInstructions(
|
|
66
|
+
const ymlInstructions = generateBrowserStackYMLInstructions({
|
|
67
|
+
platforms: input.devices?.map((t) => t.join(" ")) || [],
|
|
68
|
+
enablePercy: true,
|
|
69
|
+
projectName: input.projectName,
|
|
70
|
+
}, config);
|
|
67
71
|
if (ymlInstructions) {
|
|
68
72
|
steps.push({
|
|
69
73
|
type: "instruction",
|
|
@@ -19,23 +19,25 @@ export declare const nodejsGatsbyInstructionsSnapshot = "\n - Add the Percy plu
|
|
|
19
19
|
export declare const nodejsStorybookInstructionsSnapshot = "\n - Add Percy parameters to your stories to customize snapshots:\n```js\nMyStory.parameters = {\n percy: {\n name: 'My snapshot',\n additionalSnapshots: [\n { prefix: '[Dark mode] ', args: { colorScheme: 'dark' } },\n { suffix: ' with globals', globals: { textDirection: 'rtl' } },\n { name: 'Search snapshot', queryParams: { search: 'foobar' } }\n ]\n }\n};\n```\n - Use argument names and values defined in your codebase.\n";
|
|
20
20
|
export declare const pythonPlaywrightInstructionsSnapshot = "\n - Import the Percy snapshot helper and use the snapshot method:\n percy_snapshot(page, name=\"Your snapshot name\")\n - You can also use:\n percy_screenshot(page, name=\"Your snapshot name\", options={})\n\nExample:\n```python\nfrom playwright.sync_api import sync_playwright\nfrom percy import percy_snapshot\n\nwith sync_playwright() as p:\n browser = p.chromium.launch()\n page = browser.new_page()\n page.goto(\"http://localhost:8000\")\n percy_snapshot(page, name=\"Home page\")\n\n # ... more test steps ...\n percy_snapshot(page, name=\"After login\")\n\n browser.close()\n```\n";
|
|
21
21
|
export declare const csharpPlaywrightInstructionsSnapshot = "\n - Import the Percy snapshot helper and use the snapshot method:\n Percy.Snapshot(page, \"Your snapshot name\");\n - You can also pass options:\n Percy.Snapshot(page, \"Your snapshot name\", options);\n\nExample:\n```csharp\nusing Microsoft.Playwright;\nusing PercyIO.Playwright;\n\nclass PercyPlaywrightExample\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n await page.GotoAsync(\"http://localhost:8000\");\n Percy.Snapshot(page, \"Home page\");\n\n // ... more test steps ...\n Percy.Snapshot(page, \"After login\");\n\n await browser.CloseAsync();\n }\n}\n```\n";
|
|
22
|
-
export declare const pythonInstructions = "\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Selenium Python package:\n pip install percy-selenium\nIf faced any issue create a virtual environment and proceed.\nUpdate your Python Selenium script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
23
|
-
export declare const nodejsInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy SDK for Node.js:\n npm install @percy/selenium-webdriver\n---STEP---\nUpdate your Node.js Selenium script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
24
|
-
export declare const javaInstructions = "\n---STEP---\nAdd Percy dependencies to your project\n - For Maven, add to your pom.xml:\n <dependency>\n <groupId>io.percy</groupId>\n <artifactId>percy-java-selenium</artifactId>\n <version>1.0.0</version>\n </dependency>\n - For Gradle, add to your build.gradle:\n implementation 'io.percy:percy-java-selenium:1.0.0'\n - For CLI usage, install Percy CLI:\n npm install --save-dev @percy/cli\n\n---STEP---\nUpdate your Java Selenium test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
25
|
-
export declare const rubyInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Ruby Selenium gem:\n gem install percy-selenium\n\n---STEP---\nUpdate your Ruby Selenium test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
26
|
-
export declare const rubyCapybaraInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Capybara gem:\n gem install percy-capybara\n\n---STEP---\nUpdate your Capybara or Rails test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
27
|
-
export declare const csharpInstructions = "\nInstall Percy CLI by running the following command:\nnpm install --save-dev @percy/cli\n\n---STEP---\nAdd Percy dependencies to your project\n - Add the Percy .NET Selenium NuGet package:\n dotnet add package PercyIO.Selenium\n\n---STEP---\nUpdate your C# Selenium test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
28
|
-
export declare const javaPlaywrightInstructions = "\nInstall Percy dependencies\n - For Maven, add to your pom.xml:\n <dependency>\n <groupId>io.percy</groupId>\n <artifactId>percy-playwright-java</artifactId>\n <version>1.0.0</version>\n </dependency>\n\n---STEP---\nUpdate your Java Playwright test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
29
|
-
export declare const nodejsPlaywrightInstructions = "\nInstall Percy dependencies\n - Install Percy Playwright SDK:\n npm install @percy/playwright\n\n---STEP---\nUpdate your Playwright JavaScript test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
30
|
-
export declare const nodejsWebdriverioInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Selenium Webdriver package:\n npm install --save-dev @percy/selenium-webdriver\n\n---STEP---\nUpdate your WebdriverIO test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
31
|
-
export declare const nodejsEmberInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Ember SDK:\n npm install --save-dev @percy/cli @percy/ember\n\n---STEP---\nUpdate your Ember test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
32
|
-
export declare const nodejsCypressInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Cypress SDK:\n npm install --save-dev @percy/cli @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
|
|
33
|
-
export declare const nodejsPuppeteerInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Puppeteer SDK:\n npm install --save-dev @percy/cli @percy/puppeteer\n\n---STEP---\nUpdate your Puppeteer test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
34
|
-
export declare const nodejsNightmareInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Nightmare SDK:\n npm install --save-dev @percy/cli @percy/nightmare\n\n---STEP---\nUpdate your Nightmare test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
35
|
-
export declare const nodejsNightwatchInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Nightwatch SDK:\n npm install --save-dev @percy/cli @percy/nightwatch\n\n---STEP---\nUpdate your Nightwatch configuration and test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
36
|
-
export declare const nodejsProtractorInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Protractor SDK:\n npm install --save-dev @percy/cli @percy/protractor\n\n---STEP---\nUpdate your Protractor test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
37
|
-
export declare const nodejsTestcafeInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and TestCafe SDK:\n npm install --save-dev @percy/cli @percy/testcafe\n\n---STEP---\nUpdate your TestCafe test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
38
|
-
export declare const nodejsGatsbyInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Gatsby plugin:\n npm install --save @percy/cli gatsby-plugin-percy\n\n---STEP---\nUpdate your Gatsby configuration\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
39
|
-
export declare const nodejsStorybookInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Storybook SDK:\n npm install --save-dev @percy/cli @percy/storybook\n\n---STEP---\nUpdate your Storybook stories\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
40
|
-
export declare const pythonPlaywrightInstructions = "\n---STEP---\nCreate a Percy project\n - Sign in to Percy and create a project of type \"Web\". Name the project and note the generated token.\n\n---STEP---\nSet the project token as an environment variable\n - On macOS/Linux:\n export PERCY_TOKEN=\"<your token here>\"\n - On Windows PowerShell:\n $env:PERCY_TOKEN=\"<your token here>\"\n - On Windows CMD:\n set PERCY_TOKEN=<your token here>\n\n---STEP---\nInstall Percy dependencies\n - Install Percy Playwright SDK:\n pip install percy-playwright\n\n---STEP---\nUpdate your Playwright Python test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
41
|
-
export declare const csharpPlaywrightInstructions = "\nInstall Percy dependencies\n - Add the Percy Playwright NuGet package:\n <PackageReference Include=\"PercyIO.Playwright\" Version=\"1.0.0\" />\n\n---STEP---\nUpdate your Playwright .NET test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory
|
|
22
|
+
export declare const pythonInstructions = "\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Selenium Python package:\n pip install percy-selenium\nIf faced any issue create a virtual environment and proceed.\nUpdate your Python Selenium script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\nExample:\n```python\n- Import the Percy snapshot helper:\nfrom selenium import webdriver\nfrom percy import percy_snapshot\n\ndriver = webdriver.Chrome()\ndriver.get('http://localhost:8000')\npercy_snapshot(driver, 'Home page')\n# ... more test steps ...\npercy_snapshot(driver, 'After login')\n```\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- python tests.py').\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";
|
|
23
|
+
export declare const nodejsInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy SDK for Node.js:\n npm install @percy/selenium-webdriver\n---STEP---\nUpdate your Node.js Selenium script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n- Import the Percy snapshot helper:\n const { percySnapshot } = require('@percy/selenium-js');\n - In your test, take snapshots like this:\n await percySnapshot(driver, \"Your snapshot name\");\n\nExample:\n```javascript\nconst { Builder } = require('selenium-webdriver');\nconst percySnapshot = require('@percy/selenium-webdriver');\n\nconst driver = await new Builder().forBrowser('chrome').build();\nawait driver.get('http://localhost:8000');\nawait percySnapshot(driver, 'Home page');\n```\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- node script.js').\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";
|
|
24
|
+
export declare const javaInstructions = "\n---STEP---\nAdd Percy dependencies to your project\n - For Maven, add to your pom.xml:\n <dependency>\n <groupId>io.percy</groupId>\n <artifactId>percy-java-selenium</artifactId>\n <version>1.0.0</version>\n </dependency>\n - For Gradle, add to your build.gradle:\n implementation 'io.percy:percy-java-selenium:1.0.0'\n - For CLI usage, install Percy CLI:\n npm install --save-dev @percy/cli\n\n---STEP---\nUpdate your Java Selenium test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n import io.percy.selenium.Percy;\n - In your test, take snapshots like this:\n Percy percy = new Percy(driver);\n percy.snapshot(\"Your snapshot name\");\n Example:\n```java\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.chrome.ChromeDriver;\nimport io.percy.selenium.Percy;\n\npublic class PercyExample {\n public static void main(String[] args) {\n WebDriver driver = new ChromeDriver();\n driver.get(\"http://localhost:8000\");\n Percy percy = new Percy(driver);\n percy.snapshot(\"Home page\");\n driver.quit();\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 -- mvn test').\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";
|
|
25
|
+
export declare const rubyInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Ruby Selenium gem:\n gem install percy-selenium\n\n---STEP---\nUpdate your Ruby Selenium test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Require the Percy snapshot helper:\n require 'percy'\n - In your test, take snapshots like this:\n Percy.snapshot(page, 'Your snapshot name')\n\nExample:\n```ruby\nrequire 'selenium-webdriver'\nrequire 'percy'\n\ndriver = Selenium::WebDriver.for :chrome\ndriver.get('http://localhost:8000')\nPercy.snapshot(driver, 'Your snapshot name')\ndriver.quit\n```\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- bundle exec rspec').\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";
|
|
26
|
+
export declare const rubyCapybaraInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Capybara gem:\n gem install percy-capybara\n\n---STEP---\nUpdate your Capybara or Rails test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - In your test setup file, require percy/capybara:\n require 'percy/capybara'\n - In your test, take snapshots like this:\n page.percy_snapshot('Capybara snapshot')\n\nExample:\n```ruby\nrequire 'percy/capybara'\n\ndescribe 'my feature', type: :feature do\n it 'renders the page' do\n visit 'https://example.com'\n page.percy_snapshot('Capybara snapshot')\n end\nend\n```\n\n - The snapshot method arguments are:\n page.percy_snapshot(name[, options])\n name - The snapshot name; must be unique to each snapshot; defaults to the test title\n options - See per-snapshot configuration options\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- bundle exec rspec').\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";
|
|
27
|
+
export declare const csharpInstructions = "\nInstall Percy CLI by running the following command:\nnpm install --save-dev @percy/cli\n\n---STEP---\nAdd Percy dependencies to your project\n - Add the Percy .NET Selenium NuGet package:\n dotnet add package PercyIO.Selenium\n\n---STEP---\nUpdate your C# Selenium test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n using PercyIO.Selenium;\n - In your test, take snapshots like this:\n Percy.Snapshot(driver,\"Your snapshot name\");\n\nExample:\n```csharp\nusing OpenQA.Selenium;\nusing OpenQA.Selenium.Chrome;\nusing PercyIO.Selenium;\n\nclass PercyExample\n{\n static void Main()\n {\n IWebDriver driver = new ChromeDriver();\n driver.Navigate().GoToUrl(\"http://localhost:8000\");\n Percy.Snapshot(driver,\"Empty Todo State\");\n driver.Quit();\n }\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 -- dotnet test').\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";
|
|
28
|
+
export declare const javaPlaywrightInstructions = "\nInstall Percy dependencies\n - For Maven, add to your pom.xml:\n <dependency>\n <groupId>io.percy</groupId>\n <artifactId>percy-playwright-java</artifactId>\n <version>1.0.0</version>\n </dependency>\n\n---STEP---\nUpdate your Java Playwright test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy library and use the snapshot method:\n percy.snapshot(\"snapshot_1\");\n - You can also pass options:\n Map<String, Object> options = new HashMap<>();\n options.put(\"testCase\", \"Should add product to cart\");\n percy.snapshot(\"snapshot_2\", options);\n\nExample:\n```java\nimport com.microsoft.playwright.*;\nimport io.percy.playwright.*;\n\npublic class PercyPlaywrightExample {\n public static void main(String[] args) {\n try (Playwright playwright = Playwright.create()) {\n Browser browser = playwright.chromium().launch();\n Page page = browser.newPage();\n Percy percy = new Percy(page);\n\n page.navigate(\"http://localhost:8000\");\n percy.snapshot(\"Home page\");\n\n // ... more test steps ...\n percy.snapshot(\"After login\");\n\n browser.close();\n }\n }\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 -- <command to run the test 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";
|
|
29
|
+
export declare const nodejsPlaywrightInstructions = "\nInstall Percy dependencies\n - Install Percy Playwright SDK:\n npm install @percy/playwright\n\n---STEP---\nUpdate your Playwright JavaScript test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n const percySnapshot = require('@percy/playwright');\n - In your test, take snapshots like this:\n await percySnapshot(page, \"Your snapshot name\");\n\nExample:\n```javascript\nconst { chromium } = require('playwright');\nconst percySnapshot = require('@percy/playwright');\n\n(async () => {\n const browser = await chromium.launch();\n const page = await browser.newPage();\n await page.goto('http://example.com/', { waitUntil: 'networkidle' });\n await percySnapshot(page, 'Example Site');\n await browser.close();\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 -- <command to run the test 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";
|
|
30
|
+
export declare const nodejsWebdriverioInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI:\n npm install --save-dev @percy/cli\n - Install Percy Selenium Webdriver package:\n npm install --save-dev @percy/selenium-webdriver\n\n---STEP---\nUpdate your WebdriverIO test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n const percySnapshot = require('@percy/selenium-webdriver');\n - In your test, take snapshots like this:\n await percySnapshot(driver, \"Your snapshot name\");\n\nExample:\n```javascript\nconst { remote } = require('webdriverio');\nconst percySnapshot = require('@percy/selenium-webdriver');\n\n(async () => {\n const browser = await remote({\n logLevel: 'error',\n capabilities: { browserName: 'chrome' }\n });\n\n await browser.url('https://example.com');\n await percySnapshot(browser, 'WebdriverIO example');\n await browser.deleteSession();\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 -- wdio run wdio.conf.js').\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";
|
|
31
|
+
export declare const nodejsEmberInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Ember SDK:\n npm install --save-dev @percy/cli @percy/ember\n\n---STEP---\nUpdate your Ember test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n import percySnapshot from '@percy/ember';\n - In your test, take snapshots like this:\n await percySnapshot('My Snapshot');\n\nExample:\n```javascript\nimport percySnapshot from '@percy/ember';\ndescribe('My ppp', () => {\n // ...app setup\n it('about page should look good', async () => {\n await visit('/about');\n await percySnapshot('My Snapshot');\n });\n});\n```\n\n - The snapshot method arguments are:\n percySnapshot(name[, options])\n name - The snapshot name; must be unique to each snapshot; defaults to the test title\n options - See per-snapshot configuration options\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- ember test').\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";
|
|
32
|
+
export declare const nodejsCypressInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Cypress SDK:\n npm install --save-dev @percy/cli @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 ---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\n - Import the Percy snapshot helper in your cypress/support/e2e.js file:\n import '@percy/cypress';\n - If you\u2019re using TypeScript, include \"types\": [\"cypress\", \"@percy/cypress\"] in your tsconfig.json file.\n - In your test, take snapshots like this:\n cy.percySnapshot();\n\nExample:\n```javascript\nimport '@percy/cypress';\n\ndescribe('Integration test with visual testing', function() {\n it('Loads the homepage', function() {\n // Load the page or perform any other interactions with the app.\n cy.visit('<URL under test>');\n // Take a snapshot for visual diffing\n cy.percySnapshot();\n });\n});\n```\n\n - The snapshot method arguments are:\n cy.percySnapshot([name][, options])\n name - The snapshot name; must be unique to each snapshot; defaults to the test title\n options - See per-snapshot configuration options\n\n - For example:\n cy.percySnapshot();\n cy.percySnapshot('Homepage test');\n cy.percySnapshot('Homepage responsive test', { widths: [768, 992, 1200] });\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\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";
|
|
33
|
+
export declare const nodejsPuppeteerInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Puppeteer SDK:\n npm install --save-dev @percy/cli @percy/puppeteer\n\n---STEP---\nUpdate your Puppeteer test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n const percySnapshot = require('@percy/puppeteer');\n - In your test, take snapshots like this:\n await percySnapshot(page, 'Snapshot name');\n\nExample:\n```javascript\nconst puppeteer = require('puppeteer');\nconst percySnapshot = require('@percy/puppeteer');\n\ndescribe('Integration test with visual testing', function() {\n it('Loads the homepage', async function() {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await percySnapshot(page, this.test.fullTitle());\n await browser.close();\n });\n});\n```\n\n - The snapshot method arguments are:\n percySnapshot(page, name[, options])\n page (required) - A puppeteer page instance\n name (required) - The snapshot name; must be unique to each snapshot\n options - See per-snapshot configuration options\n\n - For example:\n percySnapshot(page, 'Homepage test');\n percySnapshot(page, 'Homepage responsive test', { widths: [768, 992, 1200] });\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 test 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";
|
|
34
|
+
export declare const nodejsNightmareInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Nightmare SDK:\n npm install --save-dev @percy/cli @percy/nightmare\n\n---STEP---\nUpdate your Nightmare test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n const Nightmare = require('nightmare');\n const percySnapshot = require('@percy/nightmare');\n - In your test, take snapshots like this:\n .use(percySnapshot('Snapshot name'))\n\nExample:\n```javascript\nconst Nightmare = require('nightmare');\nconst percySnapshot = require('@percy/nightmare');\n\nNightmare()\n .goto('http://example.com')\n // ... other actions ...\n .use(percySnapshot('Example Snapshot'))\n // ... more actions ...\n .end()\n .then(() => {\n // ...\n });\n```\n\n - The snapshot method arguments are:\n percySnapshot(name[, options])\n name (required) - The snapshot name; must be unique to each snapshot\n options - See per-snapshot configuration options\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- node script.js').\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";
|
|
35
|
+
export declare const nodejsNightwatchInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Nightwatch SDK:\n npm install --save-dev @percy/cli @percy/nightwatch\n\n---STEP---\nUpdate your Nightwatch configuration and test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy library and add the path exported by @percy/nightwatch to your Nightwatch configuration\u2019s custom_commands_path property:\n const percy = require('@percy/nightwatch');\n module.exports = {\n // ...\n custom_commands_path: [percy.path],\n // ...\n };\n - In your test, take snapshots like this:\n browser.percySnapshot('Snapshot name');\n\nExample:\n```javascript\nconst percy = require('@percy/nightwatch');\nmodule.exports = {\n // ...\n custom_commands_path: [percy.path],\n // ...\n};\n\n// Example test\nmodule.exports = {\n 'Snapshots pages': function(browser) {\n browser\n .url('http://example.com')\n .assert.containsText('h1', 'Example Domain')\n .percySnapshot('Example snapshot');\n browser\n .url('http://google.com')\n .assert.elementPresent('img[alt=\"Google\"]')\n .percySnapshot('Google homepage');\n browser.end();\n }\n};\n```\n\n - The snapshot method arguments are:\n percySnapshot([name][, options])\n name (required) - The snapshot name; must be unique to each snapshot\n options - See per-snapshot configuration options\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- nightwatch').\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";
|
|
36
|
+
export declare const nodejsProtractorInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Protractor SDK:\n npm install --save-dev @percy/cli @percy/protractor\n\n---STEP---\nUpdate your Protractor test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n import percySnapshot from '@percy/protractor';\n - In your test, take snapshots like this:\n await percySnapshot('Snapshot name');\n // or\n await percySnapshot(browser, 'Snapshot name');\n\nExample:\n```javascript\nimport percySnapshot from '@percy/protractor';\ndescribe('angularjs homepage', function() {\n it('should greet the named user', async function() {\n await browser.get('https://www.angularjs.org');\n await percySnapshot('AngularJS homepage');\n await element(by.model('yourName')).sendKeys('Percy');\n var greeting = element(by.binding('yourName'));\n expect(await greeting.getText()).toEqual('Hello Percy!');\n await percySnapshot('AngularJS homepage greeting');\n });\n});\n```\n\n - The snapshot method arguments are:\n percySnapshot(name[, options])\n Standalone mode:\n percySnapshot(browser, name[, options])\n browser (required) - The Protractor browser object\n name (required) - The snapshot name; must be unique to each snapshot\n options - See per-snapshot configuration options\n\n\n---STEP---\nTo run the Percy build, call the tool runPercyScan with the appropriate test command (e.g., 'npx percy exec -- protractor conf.js').\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";
|
|
37
|
+
export declare const nodejsTestcafeInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and TestCafe SDK:\n npm install --save-dev @percy/cli @percy/testcafe\n\n---STEP---\nUpdate your TestCafe test script\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper:\n import percySnapshot from '@percy/testcafe';\n - In your test, take snapshots like this:\n await percySnapshot(t, 'Snapshot name');\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 - The snapshot method arguments are:\n percySnapshot(t, name[, options])\n t (required) - The test controller instance passed from test\n name (required) - The snapshot name; must be unique to each snapshot\n options - See per-snapshot configuration options\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";
|
|
38
|
+
export declare const nodejsGatsbyInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Gatsby plugin:\n npm install --save @percy/cli gatsby-plugin-percy\n\n---STEP---\nUpdate your Gatsby configuration\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Add the Percy plugin to your gatsby-config.js file:\n module.exports = {\n plugins: [`gatsby-plugin-percy`]\n }\n\n - The plugin will take snapshots of discovered pages during the build process.\n\n - Example gatsby-config.js with options:\n```javascript\nmodule.exports = {\n plugins: [{\n resolve: `gatsby-plugin-percy`,\n options: {\n // gatsby specific options\n query: `{\n allSitePage { nodes { path } }\n allOtherPage { nodes { path } }\n }`,\n resolvePages: ({\n allSitePage: { nodes: allPages },\n allOtherPage: { nodes: otherPages }\n }) => {\n return [...allPages, ...otherPages]\n .map(({ path }) => path);\n },\n // percy static snapshot options\n exclude: [\n '/dev-404-page/',\n '/offline-plugin-app-shell-fallback/'\n ],\n overrides: [{\n include: '/foobar/',\n waitForSelector: '.done-loading',\n additionalSnapshots: [{\n suffix: ' - after btn click',\n execute: () => document.querySelector('.btn').click()\n }]\n }]\n }\n }]\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 -- gatsby build').\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";
|
|
39
|
+
export declare const nodejsStorybookInstructions = "\n---STEP---\nInstall Percy dependencies\n - Install Percy CLI and Storybook SDK:\n npm install --save-dev @percy/cli @percy/storybook\n\n---STEP---\nUpdate your Storybook stories\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Add Percy parameters to your stories to customize snapshots:\n```js\nMyStory.parameters = {\n percy: {\n name: 'My snapshot',\n additionalSnapshots: [\n { prefix: '[Dark mode] ', args: { colorScheme: 'dark' } },\n { suffix: ' with globals', globals: { textDirection: 'rtl' } },\n { name: 'Search snapshot', queryParams: { search: 'foobar' } }\n ]\n }\n};\n```\n - Use argument names and values defined in your codebase.\n\n\n---STEP---\nRun Percy with your Storybook\n - With a static Storybook build:\n percy storybook ./storybook-build\n - With a local or live Storybook URL:\n percy storybook http://localhost:9009\n percy storybook https://storybook.foobar.com\n - Automatically run start-storybook:\n Run this scan using tool runPercyScan with 'npx percy exec -- percy storybook:start --port=9009'.\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";
|
|
40
|
+
export declare const pythonPlaywrightInstructions = "\n---STEP---\nCreate a Percy project\n - Sign in to Percy and create a project of type \"Web\". Name the project and note the generated token.\n\n---STEP---\nSet the project token as an environment variable\n - On macOS/Linux:\n export PERCY_TOKEN=\"<your token here>\"\n - On Windows PowerShell:\n $env:PERCY_TOKEN=\"<your token here>\"\n - On Windows CMD:\n set PERCY_TOKEN=<your token here>\n\n---STEP---\nInstall Percy dependencies\n - Install Percy Playwright SDK:\n pip install percy-playwright\n\n---STEP---\nUpdate your Playwright Python test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper and use the snapshot method:\n percy_snapshot(page, name=\"Your snapshot name\")\n - You can also use:\n percy_screenshot(page, name=\"Your snapshot name\", options={})\n\nExample:\n```python\nfrom playwright.sync_api import sync_playwright\nfrom percy import percy_snapshot\n\nwith sync_playwright() as p:\n browser = p.chromium.launch()\n page = browser.new_page()\n page.goto(\"http://localhost:8000\")\n percy_snapshot(page, name=\"Home page\")\n\n # ... more test steps ...\n percy_snapshot(page, name=\"After login\")\n\n browser.close()\n```\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 test 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";
|
|
41
|
+
export declare const csharpPlaywrightInstructions = "\nInstall Percy dependencies\n - Add the Percy Playwright NuGet package:\n <PackageReference Include=\"PercyIO.Playwright\" Version=\"1.0.0\" />\n\n---STEP---\nUpdate your Playwright .NET test\n\nInvoke listTestFiles() with the provided directories from user to gather all test files in memory ---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\n - Import the Percy snapshot helper and use the snapshot method:\n Percy.Snapshot(page, \"Your snapshot name\");\n - You can also pass options:\n Percy.Snapshot(page, \"Your snapshot name\", options);\n\nExample:\n```csharp\nusing Microsoft.Playwright;\nusing PercyIO.Playwright;\n\nclass PercyPlaywrightExample\n{\n public static async Task Main()\n {\n using var playwright = await Playwright.CreateAsync();\n var browser = await playwright.Chromium.LaunchAsync();\n var page = await browser.NewPageAsync();\n\n await page.GotoAsync(\"http://localhost:8000\");\n Percy.Snapshot(page, \"Home page\");\n\n // ... more test steps ...\n Percy.Snapshot(page, \"After login\");\n\n await browser.CloseAsync();\n }\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 -- <command to run the test 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";
|
|
42
|
+
export declare function getFrameworkTestCommand(language: string, framework: string): string;
|
|
43
|
+
export declare const PERCY_FALLBACK_STEPS: string[];
|
|
@@ -881,3 +881,42 @@ ${csharpPlaywrightInstructionsSnapshot}
|
|
|
881
881
|
To run the Percy build, call the tool runPercyScan with the appropriate test command (e.g. npx percy exec -- <command to run the test script file>).
|
|
882
882
|
${percyReviewSnapshotsStep}
|
|
883
883
|
`;
|
|
884
|
+
export function getFrameworkTestCommand(language, framework) {
|
|
885
|
+
const percyPrefix = "npx percy exec --labels=mcp --";
|
|
886
|
+
const nodeCommands = {
|
|
887
|
+
cypress: "cypress run",
|
|
888
|
+
playwright: "playwright test",
|
|
889
|
+
webdriverio: "wdio",
|
|
890
|
+
puppeteer: "node",
|
|
891
|
+
testcafe: "testcafe",
|
|
892
|
+
nightwatch: "nightwatch",
|
|
893
|
+
protractor: "protractor",
|
|
894
|
+
gatsby: "gatsby build",
|
|
895
|
+
storybook: "storybook build",
|
|
896
|
+
ember: "ember test",
|
|
897
|
+
default: "npm test",
|
|
898
|
+
};
|
|
899
|
+
const languageMap = {
|
|
900
|
+
python: "python -m pytest",
|
|
901
|
+
java: "mvn test",
|
|
902
|
+
ruby: "bundle exec rspec",
|
|
903
|
+
csharp: "dotnet test",
|
|
904
|
+
};
|
|
905
|
+
if (language === "nodejs") {
|
|
906
|
+
const cmd = nodeCommands[framework] ?? nodeCommands.default;
|
|
907
|
+
return `${percyPrefix} ${cmd}`;
|
|
908
|
+
}
|
|
909
|
+
const cmd = languageMap[language];
|
|
910
|
+
return cmd ? `${percyPrefix} ${cmd}` : `${percyPrefix} <test-runner>`;
|
|
911
|
+
}
|
|
912
|
+
export const PERCY_FALLBACK_STEPS = [
|
|
913
|
+
`Attempt to infer the project's test command from context (high confidence commands first):
|
|
914
|
+
- Node.js: npm test, cypress run, npx playwright test, npx wdio, npx testcafe, npx nightwatch, npx protractor, ember test, npx gatsby build, npx storybook build
|
|
915
|
+
- Python: python -m pytest
|
|
916
|
+
- Java: mvn test
|
|
917
|
+
- Ruby: bundle exec rspec
|
|
918
|
+
- C#: dotnet test
|
|
919
|
+
or from package.json scripts`,
|
|
920
|
+
`Wrap the inferred command with Percy along with label: \nnpx percy exec --labels=mcp -- <test command>`,
|
|
921
|
+
`If the test command cannot be inferred confidently, ask the user directly for the correct test command.`,
|
|
922
|
+
];
|
|
@@ -12,7 +12,9 @@ export function runPercyWeb(input, percyToken) {
|
|
|
12
12
|
steps.push({
|
|
13
13
|
type: "instruction",
|
|
14
14
|
title: "Set Percy Token in Environment",
|
|
15
|
-
content: `
|
|
15
|
+
content: `Set the environment variable for your project:
|
|
16
|
+
export PERCY_TOKEN="${percyToken}"
|
|
17
|
+
(For Windows: use 'setx PERCY_TOKEN "${percyToken}"' or 'set PERCY_TOKEN=${percyToken}' as appropriate.)`,
|
|
16
18
|
});
|
|
17
19
|
steps.push({
|
|
18
20
|
type: "instruction",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserstack/mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "BrowserStack's Official MCP Server",
|
|
5
5
|
"mcpName": "io.github.browserstack/mcp-server",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"author": "",
|
|
36
36
|
"license": "ISC",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.18.1",
|
|
39
39
|
"@types/form-data": "^2.5.2",
|
|
40
40
|
"axios": "^1.8.4",
|
|
41
41
|
"browserstack-local": "^1.5.6",
|