@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ---------- PYTHON INSTRUCTIONS ----------
|
|
3
3
|
*/
|
|
4
|
-
const pythonInstructions = (username, accessKey) =>
|
|
4
|
+
export const pythonInstructions = (username, accessKey) => {
|
|
5
|
+
const setup = `
|
|
5
6
|
---STEP---
|
|
6
7
|
|
|
7
8
|
Install the BrowserStack SDK:
|
|
@@ -15,7 +16,8 @@ Setup the BrowserStack SDK with your credentials:
|
|
|
15
16
|
\`\`\`bash
|
|
16
17
|
browserstack-sdk setup --username "${username}" --key "${accessKey}"
|
|
17
18
|
\`\`\`
|
|
18
|
-
|
|
19
|
+
`;
|
|
20
|
+
const run = `
|
|
19
21
|
---STEP---
|
|
20
22
|
|
|
21
23
|
Run your tests on BrowserStack:
|
|
@@ -23,7 +25,10 @@ Run your tests on BrowserStack:
|
|
|
23
25
|
browserstack-sdk python <path-to-test-file>
|
|
24
26
|
\`\`\`
|
|
25
27
|
`;
|
|
26
|
-
|
|
28
|
+
return { setup, run };
|
|
29
|
+
};
|
|
30
|
+
export const generatePythonFrameworkInstructions = (framework) => (username, accessKey) => {
|
|
31
|
+
const setup = `
|
|
27
32
|
---STEP---
|
|
28
33
|
|
|
29
34
|
Install the BrowserStack SDK:
|
|
@@ -38,7 +43,8 @@ Setup the BrowserStack SDK with framework-specific configuration:
|
|
|
38
43
|
\`\`\`bash
|
|
39
44
|
browserstack-sdk setup --framework "${framework}" --username "${username}" --key "${accessKey}"
|
|
40
45
|
\`\`\`
|
|
41
|
-
|
|
46
|
+
`;
|
|
47
|
+
const run = `
|
|
42
48
|
---STEP---
|
|
43
49
|
|
|
44
50
|
Run your ${framework} tests on BrowserStack:
|
|
@@ -46,14 +52,17 @@ Run your ${framework} tests on BrowserStack:
|
|
|
46
52
|
browserstack-sdk ${framework} <path-to-test-files>
|
|
47
53
|
\`\`\`
|
|
48
54
|
`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
55
|
+
return { setup, run };
|
|
56
|
+
};
|
|
57
|
+
export const robotInstructions = generatePythonFrameworkInstructions("robot");
|
|
58
|
+
export const behaveInstructions = generatePythonFrameworkInstructions("behave");
|
|
59
|
+
export const pytestInstructions = generatePythonFrameworkInstructions("pytest");
|
|
52
60
|
/**
|
|
53
61
|
* ---------- JAVA INSTRUCTIONS ----------
|
|
54
62
|
*/
|
|
55
63
|
const argsInstruction = '<argLine>-javaagent:"${com.browserstack:browserstack-java-sdk:jar}"</argLine>';
|
|
56
|
-
const javaInstructions = (username, accessKey) =>
|
|
64
|
+
export const javaInstructions = (username, accessKey) => {
|
|
65
|
+
const setup = `
|
|
57
66
|
---STEP---
|
|
58
67
|
|
|
59
68
|
Add the BrowserStack Java SDK dependency to your \`pom.xml\`:
|
|
@@ -82,7 +91,8 @@ Export your BrowserStack credentials as environment variables:
|
|
|
82
91
|
export BROWSERSTACK_USERNAME=${username}
|
|
83
92
|
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
84
93
|
\`\`\`
|
|
85
|
-
|
|
94
|
+
`;
|
|
95
|
+
const run = `
|
|
86
96
|
---STEP---
|
|
87
97
|
|
|
88
98
|
Run your tests using Maven:
|
|
@@ -95,66 +105,13 @@ Or for Gradle:
|
|
|
95
105
|
gradle clean test
|
|
96
106
|
\`\`\`
|
|
97
107
|
`;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Set BrowserStack credentials as environment variables:
|
|
102
|
-
For macOS/Linux:
|
|
103
|
-
\`\`\`bash
|
|
104
|
-
export BROWSERSTACK_USERNAME=${username}
|
|
105
|
-
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
106
|
-
\`\`\`
|
|
107
|
-
|
|
108
|
-
For Windows Command Prompt:
|
|
109
|
-
\`\`\`cmd
|
|
110
|
-
set BROWSERSTACK_USERNAME=${username}
|
|
111
|
-
set BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
112
|
-
\`\`\`
|
|
113
|
-
|
|
114
|
-
---STEP---
|
|
115
|
-
|
|
116
|
-
Add serenity-browserstack dependency in pom.xml:
|
|
117
|
-
Add the following dependency to your pom.xml file and save it:
|
|
118
|
-
\`\`\`xml
|
|
119
|
-
<dependency>
|
|
120
|
-
<groupId>net.serenity-bdd</groupId>
|
|
121
|
-
<artifactId>serenity-browserstack</artifactId>
|
|
122
|
-
<version>3.3.4</version>
|
|
123
|
-
</dependency>
|
|
124
|
-
\`\`\`
|
|
125
|
-
|
|
126
|
-
---STEP---
|
|
127
|
-
|
|
128
|
-
Set up serenity.conf file:
|
|
129
|
-
Create or update your serenity.conf file in the project root with the following configuration:
|
|
130
|
-
\`\`\`
|
|
131
|
-
webdriver {
|
|
132
|
-
driver = remote
|
|
133
|
-
remote.url = "https://hub.browserstack.com/wd/hub"
|
|
134
|
-
}
|
|
135
|
-
browserstack.user="${username}"
|
|
136
|
-
browserstack.key="${accessKey}"
|
|
137
|
-
\`\`\`
|
|
138
|
-
|
|
139
|
-
---STEP---
|
|
140
|
-
|
|
141
|
-
Run your Serenity tests:
|
|
142
|
-
You can continue running your tests as you normally would. For example:
|
|
143
|
-
|
|
144
|
-
Using Maven:
|
|
145
|
-
\`\`\`bash
|
|
146
|
-
mvn clean verify
|
|
147
|
-
\`\`\`
|
|
148
|
-
|
|
149
|
-
Using Gradle:
|
|
150
|
-
\`\`\`bash
|
|
151
|
-
gradle clean test
|
|
152
|
-
\`\`\`
|
|
153
|
-
`;
|
|
108
|
+
return { setup, run };
|
|
109
|
+
};
|
|
154
110
|
/**
|
|
155
111
|
* ---------- CSharp INSTRUCTIONS ----------
|
|
156
112
|
*/
|
|
157
|
-
const csharpCommonInstructions = (username, accessKey) =>
|
|
113
|
+
export const csharpCommonInstructions = (username, accessKey) => {
|
|
114
|
+
const setup = `
|
|
158
115
|
---STEP---
|
|
159
116
|
|
|
160
117
|
Install BrowserStack TestAdapter NuGet package:
|
|
@@ -203,7 +160,8 @@ Install the x64 version of .NET for BrowserStack compatibility.
|
|
|
203
160
|
sudo dotnet browserstack-sdk setup-dotnet --dotnet-path "<your-chosen-path>" --dotnet-version "<your-dotnet-version>"
|
|
204
161
|
\`\`\`
|
|
205
162
|
Common paths: /usr/local/share/dotnet, ~/dotnet-x64, or /opt/dotnet-x64
|
|
206
|
-
|
|
163
|
+
`;
|
|
164
|
+
const run = `
|
|
207
165
|
---STEP---
|
|
208
166
|
|
|
209
167
|
Run the tests:
|
|
@@ -216,7 +174,10 @@ Run the tests:
|
|
|
216
174
|
dotnet test
|
|
217
175
|
\`\`\`
|
|
218
176
|
`;
|
|
219
|
-
|
|
177
|
+
return { setup, run };
|
|
178
|
+
};
|
|
179
|
+
export const csharpPlaywrightCommonInstructions = (username, accessKey) => {
|
|
180
|
+
const setup = `
|
|
220
181
|
---STEP---
|
|
221
182
|
|
|
222
183
|
Install BrowserStack TestAdapter NuGet package:
|
|
@@ -278,7 +239,8 @@ Fix for Playwright architecture (macOS only):
|
|
|
278
239
|
If the folder exists:
|
|
279
240
|
\`<project-folder>/bin/Debug/net8.0/.playwright/node/darwin-arm64\`
|
|
280
241
|
Rename \`darwin-arm64\` to \`darwin-x64\`
|
|
281
|
-
|
|
242
|
+
`;
|
|
243
|
+
const run = `
|
|
282
244
|
---STEP---
|
|
283
245
|
|
|
284
246
|
Run the tests:
|
|
@@ -291,10 +253,13 @@ Run the tests:
|
|
|
291
253
|
dotnet test
|
|
292
254
|
\`\`\`
|
|
293
255
|
`;
|
|
256
|
+
return { setup, run };
|
|
257
|
+
};
|
|
294
258
|
/**
|
|
295
259
|
* ---------- NODEJS INSTRUCTIONS ----------
|
|
296
260
|
*/
|
|
297
|
-
const nodejsInstructions = (username, accessKey) =>
|
|
261
|
+
export const nodejsInstructions = (username, accessKey) => {
|
|
262
|
+
const setup = `
|
|
298
263
|
---STEP---
|
|
299
264
|
|
|
300
265
|
Ensure \`browserstack-node-sdk\` is present in package.json with the latest version:
|
|
@@ -330,10 +295,21 @@ export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
|
330
295
|
Run your tests:
|
|
331
296
|
You can now run your tests on BrowserStack using your standard command or Use the commands defined in your package.json file to run the tests.
|
|
332
297
|
`;
|
|
298
|
+
const run = `
|
|
299
|
+
---STEP---
|
|
300
|
+
|
|
301
|
+
Run your tests on BrowserStack:
|
|
302
|
+
\`\`\`bash
|
|
303
|
+
npm run test:browserstack
|
|
304
|
+
\`\`\`
|
|
305
|
+
`;
|
|
306
|
+
return { setup, run };
|
|
307
|
+
};
|
|
333
308
|
/**
|
|
334
309
|
* ---------- EXPORT CONFIG ----------
|
|
335
310
|
*/
|
|
336
|
-
const webdriverioInstructions = (username, accessKey) =>
|
|
311
|
+
export const webdriverioInstructions = (username, accessKey) => {
|
|
312
|
+
const setup = `
|
|
337
313
|
---STEP---
|
|
338
314
|
|
|
339
315
|
Set BrowserStack Credentials:
|
|
@@ -432,13 +408,17 @@ exports.config.capabilities.forEach(function (caps) {
|
|
|
432
408
|
caps[i] = { ...caps[i], ...exports.config.commonCapabilities[i]};
|
|
433
409
|
});
|
|
434
410
|
\`\`\`
|
|
435
|
-
|
|
411
|
+
`;
|
|
412
|
+
const run = `
|
|
436
413
|
---STEP---
|
|
437
414
|
|
|
438
415
|
Run your tests:
|
|
439
416
|
You can now run your tests on BrowserStack using your standard WebdriverIO command or Use the commands defined in your package.json file to run the tests.
|
|
440
417
|
`;
|
|
441
|
-
|
|
418
|
+
return { setup, run };
|
|
419
|
+
};
|
|
420
|
+
export const cypressInstructions = (username, accessKey) => {
|
|
421
|
+
const setup = `
|
|
442
422
|
---STEP---
|
|
443
423
|
|
|
444
424
|
Install the BrowserStack Cypress CLI:
|
|
@@ -499,7 +479,8 @@ Open the generated \`browserstack.json\` file and update it with your BrowserSta
|
|
|
499
479
|
\`\`\`
|
|
500
480
|
|
|
501
481
|
**Note:** For Cypress v9 or lower, use \`"cypress_config_file": "./cypress.json"\`. The \`testObservability: true\` flag enables the [Test Reporting & Analytics dashboard](https://www.browserstack.com/docs/test-management/test-reporting-and-analytics) for deeper insights into your test runs.
|
|
502
|
-
|
|
482
|
+
`;
|
|
483
|
+
const run = `
|
|
503
484
|
---STEP---
|
|
504
485
|
|
|
505
486
|
Run Your Tests on BrowserStack:
|
|
@@ -508,8 +489,69 @@ Execute your tests on BrowserStack using the following command:
|
|
|
508
489
|
npx browserstack-cypress run --sync
|
|
509
490
|
\`\`\`
|
|
510
491
|
|
|
511
|
-
After the tests complete, you can view the results on your [BrowserStack Automate Dashboard](https://automate.browserstack.com/dashboard/)
|
|
492
|
+
After the tests complete, you can view the results on your [BrowserStack Automate Dashboard](https://automate.browserstack.com/dashboard/).`;
|
|
493
|
+
return { setup, run };
|
|
494
|
+
};
|
|
495
|
+
const serenityInstructions = (username, accessKey) => {
|
|
496
|
+
const setup = `
|
|
497
|
+
---STEP---
|
|
498
|
+
|
|
499
|
+
Set BrowserStack credentials as environment variables:
|
|
500
|
+
For macOS/Linux:
|
|
501
|
+
\`\`\`bash
|
|
502
|
+
export BROWSERSTACK_USERNAME=${username}
|
|
503
|
+
export BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
504
|
+
\`\`\`
|
|
505
|
+
|
|
506
|
+
For Windows Command Prompt:
|
|
507
|
+
\`\`\`cmd
|
|
508
|
+
set BROWSERSTACK_USERNAME=${username}
|
|
509
|
+
set BROWSERSTACK_ACCESS_KEY=${accessKey}
|
|
510
|
+
\`\`\`
|
|
511
|
+
|
|
512
|
+
---STEP---
|
|
513
|
+
|
|
514
|
+
Add serenity-browserstack dependency in pom.xml:
|
|
515
|
+
Add the following dependency to your pom.xml file and save it:
|
|
516
|
+
\`\`\`xml
|
|
517
|
+
<dependency>
|
|
518
|
+
<groupId>net.serenity-bdd</groupId>
|
|
519
|
+
<artifactId>serenity-browserstack</artifactId>
|
|
520
|
+
<version>3.3.4</version>
|
|
521
|
+
</dependency>
|
|
522
|
+
\`\`\`
|
|
523
|
+
|
|
524
|
+
---STEP---
|
|
525
|
+
|
|
526
|
+
Set up serenity.conf file:
|
|
527
|
+
Create or update your serenity.conf file in the project root with the following configuration:
|
|
528
|
+
\`\`\`
|
|
529
|
+
webdriver {
|
|
530
|
+
driver = remote
|
|
531
|
+
remote.url = "https://hub.browserstack.com/wd/hub"
|
|
532
|
+
}
|
|
533
|
+
browserstack.user="${username}"
|
|
534
|
+
browserstack.key="${accessKey}"
|
|
535
|
+
\`\`\`
|
|
512
536
|
`;
|
|
537
|
+
const run = `
|
|
538
|
+
---STEP---
|
|
539
|
+
|
|
540
|
+
Run your Serenity tests:
|
|
541
|
+
You can continue running your tests as you normally would. For example:
|
|
542
|
+
|
|
543
|
+
Using Maven:
|
|
544
|
+
\`\`\`bash
|
|
545
|
+
mvn clean verify
|
|
546
|
+
\`\`\`
|
|
547
|
+
|
|
548
|
+
Using Gradle:
|
|
549
|
+
\`\`\`bash
|
|
550
|
+
gradle clean test
|
|
551
|
+
\`\`\`
|
|
552
|
+
`;
|
|
553
|
+
return { setup, run };
|
|
554
|
+
};
|
|
513
555
|
export const SUPPORTED_CONFIGURATIONS = {
|
|
514
556
|
python: {
|
|
515
557
|
playwright: {
|
|
@@ -565,8 +607,5 @@ export const SUPPORTED_CONFIGURATIONS = {
|
|
|
565
607
|
cypress: {
|
|
566
608
|
cypress: { instructions: cypressInstructions },
|
|
567
609
|
},
|
|
568
|
-
webdriverio: {
|
|
569
|
-
mocha: { instructions: webdriverioInstructions },
|
|
570
|
-
},
|
|
571
610
|
},
|
|
572
611
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ConfigMapping } from "
|
|
1
|
+
import { ConfigMapping } from "../common/types.js";
|
|
2
2
|
export declare const SUPPORTED_CONFIGURATIONS: ConfigMapping;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as constants from "./constants.js";
|
|
2
|
+
export const SUPPORTED_CONFIGURATIONS = {
|
|
3
|
+
python: {
|
|
4
|
+
playwright: {
|
|
5
|
+
pytest: { instructions: constants.pythonInstructions },
|
|
6
|
+
},
|
|
7
|
+
selenium: {
|
|
8
|
+
pytest: { instructions: constants.pytestInstructions },
|
|
9
|
+
robot: { instructions: constants.robotInstructions },
|
|
10
|
+
behave: { instructions: constants.behaveInstructions },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
java: {
|
|
14
|
+
playwright: {
|
|
15
|
+
junit4: { instructions: constants.javaInstructions },
|
|
16
|
+
junit5: { instructions: constants.javaInstructions },
|
|
17
|
+
testng: { instructions: constants.javaInstructions },
|
|
18
|
+
},
|
|
19
|
+
selenium: {
|
|
20
|
+
testng: { instructions: constants.javaInstructions },
|
|
21
|
+
cucumber: { instructions: constants.javaInstructions },
|
|
22
|
+
junit4: { instructions: constants.javaInstructions },
|
|
23
|
+
junit5: { instructions: constants.javaInstructions },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
csharp: {
|
|
27
|
+
playwright: {
|
|
28
|
+
nunit: { instructions: constants.csharpPlaywrightCommonInstructions },
|
|
29
|
+
mstest: { instructions: constants.csharpPlaywrightCommonInstructions },
|
|
30
|
+
},
|
|
31
|
+
selenium: {
|
|
32
|
+
xunit: { instructions: constants.csharpCommonInstructions },
|
|
33
|
+
nunit: { instructions: constants.csharpCommonInstructions },
|
|
34
|
+
mstest: { instructions: constants.csharpCommonInstructions },
|
|
35
|
+
specflow: { instructions: constants.csharpCommonInstructions },
|
|
36
|
+
reqnroll: { instructions: constants.csharpCommonInstructions },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
nodejs: {
|
|
40
|
+
playwright: {
|
|
41
|
+
jest: { instructions: constants.nodejsInstructions },
|
|
42
|
+
codeceptjs: { instructions: constants.nodejsInstructions },
|
|
43
|
+
playwright: { instructions: constants.nodejsInstructions },
|
|
44
|
+
},
|
|
45
|
+
selenium: {
|
|
46
|
+
jest: { instructions: constants.nodejsInstructions },
|
|
47
|
+
webdriverio: { instructions: constants.webdriverioInstructions },
|
|
48
|
+
mocha: { instructions: constants.nodejsInstructions },
|
|
49
|
+
cucumber: { instructions: constants.nodejsInstructions },
|
|
50
|
+
nightwatch: { instructions: constants.nodejsInstructions },
|
|
51
|
+
codeceptjs: { instructions: constants.nodejsInstructions },
|
|
52
|
+
},
|
|
53
|
+
cypress: {
|
|
54
|
+
cypress: { instructions: constants.cypressInstructions },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// BrowserStack SDK utilities
|
|
2
|
+
export { runBstackSDKOnly } from "./sdkHandler.js";
|
|
3
|
+
export { getSDKPrefixCommand, getJavaFrameworkForMaven } from "./commands.js";
|
|
4
|
+
export { generateBrowserStackYMLInstructions } from "./configUtils.js";
|
|
5
|
+
export { SUPPORTED_CONFIGURATIONS } from "./frameworks.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RunTestsInstructionResult } from "../common/types.js";
|
|
2
|
+
import { RunTestsOnBrowserStackInput } from "../common/schema.js";
|
|
3
|
+
import { BrowserStackConfig } from "../../../lib/types.js";
|
|
4
|
+
export declare function runBstackSDKOnly(input: RunTestsOnBrowserStackInput, config: BrowserStackConfig, isPercyAutomate?: boolean): Promise<RunTestsInstructionResult>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getBrowserStackAuth } from "../../../lib/get-auth.js";
|
|
2
|
+
import { getSDKPrefixCommand } from "./commands.js";
|
|
3
|
+
import { generateBrowserStackYMLInstructions } from "./configUtils.js";
|
|
4
|
+
import { getInstructionsForProjectConfiguration } from "../common/instructionUtils.js";
|
|
5
|
+
import { validateDevices } from "../common/device-validator.js";
|
|
6
|
+
export async function runBstackSDKOnly(input, config, isPercyAutomate = false) {
|
|
7
|
+
const steps = [];
|
|
8
|
+
const authString = getBrowserStackAuth(config);
|
|
9
|
+
const [username, accessKey] = authString.split(":");
|
|
10
|
+
// Validate devices against real BrowserStack device data
|
|
11
|
+
const tupleTargets = input.devices;
|
|
12
|
+
const validatedEnvironments = await validateDevices(tupleTargets || [], input.detectedBrowserAutomationFramework);
|
|
13
|
+
// Handle frameworks with unique setup instructions that don't use browserstack.yml
|
|
14
|
+
if (input.detectedBrowserAutomationFramework === "cypress" ||
|
|
15
|
+
input.detectedTestingFramework === "webdriverio") {
|
|
16
|
+
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage, username, accessKey);
|
|
17
|
+
if (frameworkInstructions) {
|
|
18
|
+
if (frameworkInstructions.setup) {
|
|
19
|
+
steps.push({
|
|
20
|
+
type: "instruction",
|
|
21
|
+
title: "Framework-Specific Setup",
|
|
22
|
+
content: frameworkInstructions.setup,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (frameworkInstructions.run && !isPercyAutomate) {
|
|
26
|
+
steps.push({
|
|
27
|
+
type: "instruction",
|
|
28
|
+
title: "Run the tests",
|
|
29
|
+
content: frameworkInstructions.run,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
steps,
|
|
35
|
+
requiresPercy: false,
|
|
36
|
+
missingDependencies: [],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Default flow using browserstack.yml
|
|
40
|
+
const sdkSetupCommand = getSDKPrefixCommand(input.detectedLanguage, input.detectedTestingFramework, username, accessKey);
|
|
41
|
+
if (sdkSetupCommand) {
|
|
42
|
+
steps.push({
|
|
43
|
+
type: "instruction",
|
|
44
|
+
title: "Install BrowserStack SDK",
|
|
45
|
+
content: sdkSetupCommand,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const ymlInstructions = generateBrowserStackYMLInstructions({
|
|
49
|
+
validatedEnvironments,
|
|
50
|
+
enablePercy: false,
|
|
51
|
+
projectName: input.projectName,
|
|
52
|
+
});
|
|
53
|
+
if (ymlInstructions) {
|
|
54
|
+
steps.push({
|
|
55
|
+
type: "instruction",
|
|
56
|
+
title: "Configure browserstack.yml",
|
|
57
|
+
content: ymlInstructions,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const frameworkInstructions = getInstructionsForProjectConfiguration(input.detectedBrowserAutomationFramework, input.detectedTestingFramework, input.detectedLanguage, username, accessKey);
|
|
61
|
+
if (frameworkInstructions) {
|
|
62
|
+
if (frameworkInstructions.setup) {
|
|
63
|
+
steps.push({
|
|
64
|
+
type: "instruction",
|
|
65
|
+
title: "Framework-Specific Setup",
|
|
66
|
+
content: frameworkInstructions.setup,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (frameworkInstructions.run && !isPercyAutomate) {
|
|
70
|
+
steps.push({
|
|
71
|
+
type: "instruction",
|
|
72
|
+
title: "Run the tests",
|
|
73
|
+
content: frameworkInstructions.run,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
steps,
|
|
79
|
+
requiresPercy: false,
|
|
80
|
+
missingDependencies: [],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const IMPORTANT_SETUP_WARNING = "IMPORTANT: DO NOT SKIP ANY STEP. All the setup steps described below MUST be executed regardless of any existing configuration or setup. This ensures proper BrowserStack SDK setup.";
|
|
2
|
+
export declare const SETUP_PERCY_DESCRIPTION = "Set up or expand Percy visual testing configuration with comprehensive coverage for existing projects that might have Percy integrated. This supports both Percy Web Standalone and Percy Automate. Example prompts: Expand percy coverage for this project {project_name}";
|
|
3
|
+
export declare const LIST_TEST_FILES_DESCRIPTION = "Lists all test files for a given set of directories.";
|
|
4
|
+
export declare const PERCY_SNAPSHOT_COMMANDS_DESCRIPTION = "Adds Percy snapshot commands to the specified test files.";
|
|
5
|
+
export declare const RUN_ON_BROWSERSTACK_DESCRIPTION = "Set up and run automated web-based tests on BrowserStack using the BrowserStack SDK. Use this tool for functional or integration test setup on BrowserStack only. For any visual testing or Percy integration, use the dedicated Percy setup tool. Example prompts: run this test on browserstack; set up this project for browserstack.";
|
|
6
|
+
export declare const SIMULATE_PERCY_CHANGE_DESCRIPTION = "Integrate Percy visual testing into new projects and demonstrate visual change detection through a step-by-step simulation. This tool handles initial Percy integration, setup, and creates a working demonstration for new users. Primary tool for prompts like: \"Integrate percy for this project\", \"Integrate percy in this project {project_name}\"";
|
|
7
|
+
export declare const PERCY_REPLACE_REGEX: RegExp;
|
|
8
|
+
export declare const PERCY_SNAPSHOT_INSTRUCTION = "\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";
|
|
9
|
+
export declare const PERCY_SIMULATE_INSTRUCTION = "\nMANDATORY: Aggressive, Accurate Percy Snapshots Integration\n\nPrerequisite: Before making any code changes in the user's repository, create and switch to a new branch named browserstack-simulation. Stage all changes but do not commit them. If the repository has not been initialized yet, run git init first.\n\nYou MUST follow these steps with NO EXCEPTIONS:\n1. Identify 4-5 key test files in the project that are critical for visual testing.\n2. For EACH identified test file, analyze the code to find EVERY location where a Percy snapshot should be called (e.g., after each navigation, UI change, or significant state in tests).\n3. Insert snapshot calls at ALL such points, not just the first or most obvious one.\n\nIteratively update every selected test file with percy snapshot calls at all identified points, ensuring comprehensive coverage of visual changes.";
|
|
10
|
+
export declare const PERCY_SIMULATION_DRIVER_INSTRUCTION = "\nMANDATORY: Step-by-Step Percy Visual Change Simulation\nYou MUST follow these steps with NO EXCEPTIONS:\n\nSTEP 1: At this case we have added Percy snapshot commands to the test files at the appropriate locations (e.g., after navigation, UI change, or significant state). \n- Use ONLY existing snapshot names.\n- Do NOT add any popup injection or visual changes yet.\n- Do NOT run any Percy builds at this stage.\n\nSTEP 2: Run ONE comprehensive baseline Percy build that executes ALL tests containing Percy snapshots in a SINGLE build. This creates one baseline build with all snapshots for comparison. Use a command like: npx percy exec --label=mcp -- python -m pytest tests/ -k 'test_name1 or test_name2 or test_name3' -v to run multiple specific tests in one build.\"\n\nSTEP 3: Modify your test to inject a visible UI change (such as a popup) IMMEDIATELY BEFORE an EXISTING snapshot command (e.g., before percy_snapshot(self.driver, \"screenshot name\")).\n- Do NOT add a new snapshot name for the popup.\n- The popup must appear in an existing snapshot, not a new one.\n- Add this popup code in some test files before the percy_snapshot command you've added, to display the visual changes.\n\n```Javascript\npopup_script = `\nvar popup = document.createElement('div');\npopup.id = 'percy-test-popup';\npopup.style.cssText = popup.style.cssText = `\n /* TODO: Add styles to make the popup large, centered, and visually noticeable.\n Suggested properties: position: fixed; top/left; transform; background; color; font-size; padding; z-index; animation, etc. */\n`;\npopup.innerHTML = 'PERCY TEST<br>VISUAL CHANGE<br>DETECTED!';\ndocument.body.appendChild(popup);\n`;\n\n# Insert this just before the EXISTING snapshot command:\ndriver.execute_script(popup_script)\npercy_snapshot(self.driver, \"Before Adding to Cart\") # (Do NOT change the snapshot name, keep existing one)\n```\n\nSTEP 4: Run a second Percy build with same label and same test command as the baseline.\n- The snapshot names must remain the same as in the baseline.\n- The visual change should now appear in the same snapshot as before.\n- Use the same build command you ran for the baseline.\n\nSTEP 5: Compare the two Percy builds to see the detected visual difference.\n\nSTEP 6: Now ask user if they want to expand percy for other testcases? If yes, call the \"expandPercyVisualTesting\" tool to enable complete coverage for the entire project.\n\nCONSTRAINTS:\n- Do NOT run any builds until explicitly instructed in the steps.\n- Do NOT add new snapshot names\u2014only use existing ones.\n- Do NOT add popup injection until the baseline is established.\n- Visual changes must appear in EXISTING snapshots, not new ones.\n\nVALIDATION CHECKPOINTS (before proceeding to the next step):\n- Are you adding only snapshot commands (not running builds)?\n- Are you reusing existing snapshot names (not creating new ones)?\n- Have you established the baseline first (before adding visual changes)\n\nCRITICAL: \nDo NOT run tests separately or create multiple builds during baseline establishment. The goal is to have exactly TWO builds total: (1) baseline build with all original snapshots, (2) modified build with the same tests but visual changes injected.\n";
|
|
11
|
+
export declare const PERCY_VERIFICATION_REGEX: RegExp;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export const IMPORTANT_SETUP_WARNING = "IMPORTANT: DO NOT SKIP ANY STEP. All the setup steps described below MUST be executed regardless of any existing configuration or setup. This ensures proper BrowserStack SDK setup.";
|
|
2
|
+
export const SETUP_PERCY_DESCRIPTION = "Set up or expand Percy visual testing configuration with comprehensive coverage for existing projects that might have Percy integrated. This supports both Percy Web Standalone and Percy Automate. Example prompts: Expand percy coverage for this project {project_name}";
|
|
3
|
+
export const LIST_TEST_FILES_DESCRIPTION = "Lists all test files for a given set of directories.";
|
|
4
|
+
export const PERCY_SNAPSHOT_COMMANDS_DESCRIPTION = "Adds Percy snapshot commands to the specified test files.";
|
|
5
|
+
export const RUN_ON_BROWSERSTACK_DESCRIPTION = "Set up and run automated web-based tests on BrowserStack using the BrowserStack SDK. Use this tool for functional or integration test setup on BrowserStack only. For any visual testing or Percy integration, use the dedicated Percy setup tool. Example prompts: run this test on browserstack; set up this project for browserstack.";
|
|
6
|
+
export const SIMULATE_PERCY_CHANGE_DESCRIPTION = `Integrate Percy visual testing into new projects and demonstrate visual change detection through a step-by-step simulation. This tool handles initial Percy integration, setup, and creates a working demonstration for new users. Primary tool for prompts like: "Integrate percy for this project", "Integrate percy in this project {project_name}"`;
|
|
7
|
+
export const PERCY_REPLACE_REGEX = /Invoke listTestFiles\(\) with the provided directories[\s\S]*?- DO NOT STOP until you add commands in all the files or you reach end of the files\./;
|
|
8
|
+
export const PERCY_SNAPSHOT_INSTRUCTION = `
|
|
9
|
+
Invoke listTestFiles() with the provided directories from user to gather all test files in memory and obtain the generated UUID ---STEP---
|
|
10
|
+
Process files in STRICT sequential order using tool addPercySnapshotCommands() with below instructions:
|
|
11
|
+
- Start with index 0
|
|
12
|
+
- Then index 1
|
|
13
|
+
- Then index 2
|
|
14
|
+
- Continue sequentially until the last index
|
|
15
|
+
- DO NOT skip any index numbers
|
|
16
|
+
- DO NOT jump to random indices like 10, 20, 30
|
|
17
|
+
- DO NOT worry about time consuming and any constraints.
|
|
18
|
+
- DO NOT STOP until you add commands in all the files or you reach end of the files.
|
|
19
|
+
`;
|
|
20
|
+
export const PERCY_SIMULATE_INSTRUCTION = `
|
|
21
|
+
MANDATORY: Aggressive, Accurate Percy Snapshots Integration
|
|
22
|
+
|
|
23
|
+
Prerequisite: Before making any code changes in the user's repository, create and switch to a new branch named browserstack-simulation. Stage all changes but do not commit them. If the repository has not been initialized yet, run git init first.
|
|
24
|
+
|
|
25
|
+
You MUST follow these steps with NO EXCEPTIONS:
|
|
26
|
+
1. Identify 4-5 key test files in the project that are critical for visual testing.
|
|
27
|
+
2. For EACH identified test file, analyze the code to find EVERY location where a Percy snapshot should be called (e.g., after each navigation, UI change, or significant state in tests).
|
|
28
|
+
3. Insert snapshot calls at ALL such points, not just the first or most obvious one.
|
|
29
|
+
|
|
30
|
+
Iteratively update every selected test file with percy snapshot calls at all identified points, ensuring comprehensive coverage of visual changes.`;
|
|
31
|
+
export const PERCY_SIMULATION_DRIVER_INSTRUCTION = `
|
|
32
|
+
MANDATORY: Step-by-Step Percy Visual Change Simulation
|
|
33
|
+
You MUST follow these steps with NO EXCEPTIONS:
|
|
34
|
+
|
|
35
|
+
STEP 1: At this case we have added Percy snapshot commands to the test files at the appropriate locations (e.g., after navigation, UI change, or significant state).
|
|
36
|
+
- Use ONLY existing snapshot names.
|
|
37
|
+
- Do NOT add any popup injection or visual changes yet.
|
|
38
|
+
- Do NOT run any Percy builds at this stage.
|
|
39
|
+
|
|
40
|
+
STEP 2: Run ONE comprehensive baseline Percy build that executes ALL tests containing Percy snapshots in a SINGLE build. This creates one baseline build with all snapshots for comparison. Use a command like: npx percy exec --label=mcp -- python -m pytest tests/ -k 'test_name1 or test_name2 or test_name3' -v to run multiple specific tests in one build."
|
|
41
|
+
|
|
42
|
+
STEP 3: Modify your test to inject a visible UI change (such as a popup) IMMEDIATELY BEFORE an EXISTING snapshot command (e.g., before percy_snapshot(self.driver, "screenshot name")).
|
|
43
|
+
- Do NOT add a new snapshot name for the popup.
|
|
44
|
+
- The popup must appear in an existing snapshot, not a new one.
|
|
45
|
+
- Add this popup code in some test files before the percy_snapshot command you've added, to display the visual changes.
|
|
46
|
+
|
|
47
|
+
\`\`\`Javascript
|
|
48
|
+
popup_script = \`
|
|
49
|
+
var popup = document.createElement('div');
|
|
50
|
+
popup.id = 'percy-test-popup';
|
|
51
|
+
popup.style.cssText = popup.style.cssText = \`
|
|
52
|
+
/* TODO: Add styles to make the popup large, centered, and visually noticeable.
|
|
53
|
+
Suggested properties: position: fixed; top/left; transform; background; color; font-size; padding; z-index; animation, etc. */
|
|
54
|
+
\`;
|
|
55
|
+
popup.innerHTML = 'PERCY TEST<br>VISUAL CHANGE<br>DETECTED!';
|
|
56
|
+
document.body.appendChild(popup);
|
|
57
|
+
\`;
|
|
58
|
+
|
|
59
|
+
# Insert this just before the EXISTING snapshot command:
|
|
60
|
+
driver.execute_script(popup_script)
|
|
61
|
+
percy_snapshot(self.driver, "Before Adding to Cart") # (Do NOT change the snapshot name, keep existing one)
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
STEP 4: Run a second Percy build with same label and same test command as the baseline.
|
|
65
|
+
- The snapshot names must remain the same as in the baseline.
|
|
66
|
+
- The visual change should now appear in the same snapshot as before.
|
|
67
|
+
- Use the same build command you ran for the baseline.
|
|
68
|
+
|
|
69
|
+
STEP 5: Compare the two Percy builds to see the detected visual difference.
|
|
70
|
+
|
|
71
|
+
STEP 6: Now ask user if they want to expand percy for other testcases? If yes, call the "expandPercyVisualTesting" tool to enable complete coverage for the entire project.
|
|
72
|
+
|
|
73
|
+
CONSTRAINTS:
|
|
74
|
+
- Do NOT run any builds until explicitly instructed in the steps.
|
|
75
|
+
- Do NOT add new snapshot names—only use existing ones.
|
|
76
|
+
- Do NOT add popup injection until the baseline is established.
|
|
77
|
+
- Visual changes must appear in EXISTING snapshots, not new ones.
|
|
78
|
+
|
|
79
|
+
VALIDATION CHECKPOINTS (before proceeding to the next step):
|
|
80
|
+
- Are you adding only snapshot commands (not running builds)?
|
|
81
|
+
- Are you reusing existing snapshot names (not creating new ones)?
|
|
82
|
+
- Have you established the baseline first (before adding visual changes)
|
|
83
|
+
|
|
84
|
+
CRITICAL:
|
|
85
|
+
Do NOT run tests separately or create multiple builds during baseline establishment. The goal is to have exactly TWO builds total: (1) baseline build with all original snapshots, (2) modified build with the same tests but visual changes injected.
|
|
86
|
+
`;
|
|
87
|
+
export const PERCY_VERIFICATION_REGEX = /\*\*✅ Verification:\*\*\nPlease verify that you have completed all[\s\S]*?double-check each step and ensure all commands executed successfully\./s;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface DesktopBrowserEntry {
|
|
2
|
+
os: string;
|
|
3
|
+
os_version: string;
|
|
4
|
+
browser: string;
|
|
5
|
+
browser_version: string;
|
|
6
|
+
}
|
|
7
|
+
export interface MobileDeviceEntry {
|
|
8
|
+
os: "android" | "ios";
|
|
9
|
+
os_version: string;
|
|
10
|
+
display_name: string;
|
|
11
|
+
browsers?: Array<{
|
|
12
|
+
browser: string;
|
|
13
|
+
display_name?: string;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export interface ValidatedEnvironment {
|
|
17
|
+
platform: string;
|
|
18
|
+
osVersion: string;
|
|
19
|
+
browser?: string;
|
|
20
|
+
browserVersion?: string;
|
|
21
|
+
deviceName?: string;
|
|
22
|
+
notes?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function validateDevices(devices: Array<Array<string>>, framework?: string): Promise<ValidatedEnvironment[]>;
|
|
25
|
+
export declare function validateAppAutomateDevices(devices: Array<Array<string>>): Promise<ValidatedEnvironment[]>;
|