Skip to content

Commit 4fe3a2a

Browse files
authored
Merge branch 'main' into tra-insights
2 parents d61c9a2 + 058ad08 commit 4fe3a2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+5361
-684
lines changed

README.md

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ Stay in flow—keep all project context in one place and trigger actions directl
3838
## ⚡️ One Click MCP Setup
3939

4040
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](http://mcp.browserstack.com/one-click-setup?client=vscode)   [![Install in Cursor](https://img.shields.io/badge/Cursor-Install_Server-24bfa5?style=flat-square&color=000000&logo=visualstudiocode&logoColor=white)](http://mcp.browserstack.com/one-click-setup?client=cursor)
41-
41+
#### Note : Ensure you are using Node version >= `18.0`
42+
- Check your node version using `node --version`. Recommended version: `v22.15.0` (LTS)
43+
- To Upgrade Node :
44+
- 1. On macOS `(Homebrew) - brew update && brew upgrade node or if using (nvm) - nvm install 22.15.0 && nvm use 22.15.0 && nvm alias default 22.15.0`
45+
- 2. On Windows `(nvm-windows) : nvm install 22.15.0 && nvm use 22.15.0`
46+
- 👉 <a href="https://nodejs.org/en/download" target="_blank">Or directly download the Node.js LTS Installer</a>
47+
48+
.
49+
4250
## 💡 Usage Examples
4351

4452
### 📱 Manual App Testing
@@ -142,6 +150,10 @@ Generate test cases from PRDs, convert manual tests to low-code automation, and
142150
143151
## 🛠️ Installation
144152
153+
### 📋 Prerequisites for MCP Setup
154+
#### Note : Ensure you are using Node version >= `18.0`
155+
- Check your node version using `node --version`. Recommended version: `v22.15.0` (LTS)
156+
145157
### **One Click MCP Setup**
146158
147159
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](http://mcp.browserstack.com/one-click-setup?client=vscode) &nbsp; [![Install in Cursor](https://img.shields.io/badge/Cursor-Install_Server-24bfa5?style=flat-square&color=000000&logo=visualstudiocode&logoColor=white)](http://mcp.browserstack.com/one-click-setup?client=cursor)
@@ -158,7 +170,9 @@ Generate test cases from PRDs, convert manual tests to low-code automation, and
158170
159171
- Once you have an account (and purchased appropriate plan), note down your `username` and `access_key` from [Account Settings](https://www.browserstack.com/accounts/profile/details).
160172
161-
2. Ensure you are using Node version >= `18.0`. Check your node version using `node --version`. Recommended version: `v22.15.0` (LTS)
173+
2. #### Note : Ensure you are using Node version >= `18.0`
174+
- Check your node version using `node --version`. Recommended version: `v22.15.0` (LTS)
175+
162176
163177
3. **Install the MCP Server**
164178
@@ -456,7 +470,64 @@ As of now we support 20 tools.
456470
```text
457471
Upload PRD from /Users/xyz/Desktop/login-flow.pdf and use BrowserStack AI to generate test cases
458472
```
473+
## Remote MCP Setup
459474
475+
- VSCode (Copilot - Agent Mode): `.vscode/mcp.json`:
476+
477+
- Locate or Create the Configuration File:
478+
- In the root directory of your project, look for a folder named .vscode. This folder is usually hidden so you will need to find it as mentioned in the expand.
479+
- If this folder doesn't exist, create it.
480+
- Inside the .vscode folder, create a new file named mcp.json
481+
- To setup Remote BrowserStack MCP instead of local BrowserStack MCP you can add the following JSON content :
482+
<div align="center">
483+
<img src="assets/remotemcp_json_file.png" alt="Remote MCP JSON file" height="300" width="300">
484+
</div>
485+
486+
### Alternative way to Setup Remote MCP
487+
488+
- Step 1.Click on the gear icon to Select Tools
489+
490+
<div align="center">
491+
<img src="assets/select_tools.png" alt="Select Tools" height="300" width="300">
492+
</div>
493+
494+
- Step 2. A tool menu would appear at the top-centre, scroll down on the menu at the top and then Click on Add MCP Server
495+
496+
<div align="center">
497+
<img src="assets/add_mcp_server.png" alt="Add MCP Server" height="300" width="300">
498+
</div>
499+
500+
- Step 3. Click on HTTP option
501+
<div align="center">
502+
<img src="assets/http_option.png" alt="HTTP Option" height="300" width="300">
503+
</div>
504+
505+
- Step 4. Paste Remote MCP Server URL : https://mcp.browserstack.com/mcp
506+
<div align="center">
507+
<img src="assets/server_url.png" alt="Remote MCP Server URL" height="300" width="300">
508+
</div>
509+
510+
- Step 5. Give server id as : browserstack
511+
512+
<div align="center">
513+
<img src="assets/server_id.png" alt="Remote MCP Server ID" height="300" width="300">
514+
</div>
515+
516+
- Step 6. In VSCode Click on start MCP Server and then click on "Allow"
517+
518+
<div align="center">
519+
<img src="assets/authentication1.png" alt="authentication1" height="300" width="300">
520+
</div>
521+
522+
<div align="center">
523+
<img src="assets/authentication2.png" alt="authentication2" height="300" width="300">
524+
</div>
525+
526+
<div align="center">
527+
<img src="assets/signin_success.png" alt="Sign_in_success" height="300" width="300">
528+
</div>
529+
530+
460531
461532
## 🤝 Recommended MCP Clients
462533

assets/authentication1.png

49.3 KB
Loading

assets/authentication2.png

104 KB
Loading

assets/http_option.png

154 KB
Loading

assets/remotemcp_json_file.png

85.7 KB
Loading

assets/server_id.png

97.9 KB
Loading

assets/server_url.png

110 KB
Loading

assets/signin_success.png

68.9 KB
Loading

src/lib/device-cache.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,41 @@ export async function getDevicesAndBrowsers(
3434
fs.mkdirSync(CACHE_DIR, { recursive: true });
3535
}
3636

37-
let cache: any = {};
37+
let cache: Record<string, any> = {};
3838

39+
// Load existing cache
3940
if (fs.existsSync(CACHE_FILE)) {
40-
const stats = fs.statSync(CACHE_FILE);
41-
if (Date.now() - stats.mtimeMs < TTL_MS) {
42-
try {
43-
cache = JSON.parse(fs.readFileSync(CACHE_FILE, "utf8"));
44-
if (cache[type]) {
45-
return cache[type];
46-
}
47-
} catch (error) {
48-
console.error("Error parsing cache file:", error);
49-
// Continue with fetching fresh data
50-
}
41+
try {
42+
cache = JSON.parse(fs.readFileSync(CACHE_FILE, "utf8"));
43+
} catch (err) {
44+
console.error("Error parsing cache file:", err);
45+
cache = {};
46+
}
47+
48+
// Check per-product TTL
49+
const cachedEntry = cache[type];
50+
if (cachedEntry?.timestamp && Date.now() - cachedEntry.timestamp < TTL_MS) {
51+
return cachedEntry.data;
5152
}
5253
}
5354

55+
// Fetch fresh data from BrowserStack
5456
const liveRes = await apiClient.get({ url: URLS[type], raise_error: false });
55-
5657
if (!liveRes.ok) {
5758
throw new Error(
58-
`Failed to fetch configuration from BrowserStack : ${type}=${liveRes.statusText}`,
59+
`Failed to fetch configuration from BrowserStack: ${type} = ${liveRes.statusText}`,
5960
);
6061
}
6162

62-
cache = {
63-
[type]: liveRes.data,
63+
// Save to cache with timestamp and data directly under product key
64+
cache[type] = {
65+
timestamp: Date.now(),
66+
data: liveRes.data,
6467
};
65-
fs.writeFileSync(CACHE_FILE, JSON.stringify(cache), "utf8");
6668

67-
return cache[type];
69+
fs.writeFileSync(CACHE_FILE, JSON.stringify(cache, null, 2), "utf8");
70+
71+
return liveRes.data;
6872
}
6973

7074
// Rate limiter for started event (3H)

src/lib/inmemory-store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const signedUrlMap = new Map<string, object>();
2+
export const testFilePathsMap = new Map<string, string[]>();

0 commit comments

Comments
 (0)