@nbakka/mcp-appium 3.0.2 → 3.0.4
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/lib/server.js +15 -9
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -18,7 +18,9 @@ const { google } = require('googleapis');
|
|
|
18
18
|
const axios = require('axios');
|
|
19
19
|
const OpenAI = require("openai");
|
|
20
20
|
const express = require('express');
|
|
21
|
-
|
|
21
|
+
// Fixed: support ESM default export of 'open'
|
|
22
|
+
const openImport = require('open');
|
|
23
|
+
const openBrowser = openImport.default || openImport;
|
|
22
24
|
const getAgentVersion = () => {
|
|
23
25
|
const json = require("../package.json");
|
|
24
26
|
return json.version;
|
|
@@ -1235,7 +1237,7 @@ tool(
|
|
|
1235
1237
|
if (data.success) {
|
|
1236
1238
|
showNotification('Test cases approved successfully!');
|
|
1237
1239
|
setTimeout(() => {
|
|
1238
|
-
|
|
1240
|
+
window.close();
|
|
1239
1241
|
}, 2000);
|
|
1240
1242
|
} else {
|
|
1241
1243
|
showNotification('Error approving test cases', 'error');
|
|
@@ -1310,17 +1312,23 @@ tool(
|
|
|
1310
1312
|
const newPort = port + Math.floor(Math.random() * 100);
|
|
1311
1313
|
return app.listen(newPort, () => {
|
|
1312
1314
|
console.log(`Test case review server running at http://localhost:${newPort}`);
|
|
1313
|
-
|
|
1315
|
+
try {
|
|
1316
|
+
openBrowser(`http://localhost:${newPort}`).catch(err => console.error('Failed to open browser:', err));
|
|
1317
|
+
} catch (e) {
|
|
1318
|
+
console.error('Failed to open browser automatically:', e.message);
|
|
1319
|
+
}
|
|
1314
1320
|
});
|
|
1315
1321
|
}
|
|
1316
1322
|
throw error;
|
|
1317
1323
|
});
|
|
1318
1324
|
|
|
1319
1325
|
// Open browser with proper error handling
|
|
1326
|
+
let openAttemptFailed = false;
|
|
1320
1327
|
try {
|
|
1321
|
-
await
|
|
1322
|
-
} catch (
|
|
1323
|
-
|
|
1328
|
+
await openBrowser(`http://localhost:${port}`);
|
|
1329
|
+
} catch (err) {
|
|
1330
|
+
openAttemptFailed = true;
|
|
1331
|
+
console.error('Failed to open browser automatically:', err.message);
|
|
1324
1332
|
// Continue without opening browser - user can manually navigate to the URL
|
|
1325
1333
|
}
|
|
1326
1334
|
|
|
@@ -1332,9 +1340,7 @@ tool(
|
|
|
1332
1340
|
timestamp: Date.now()
|
|
1333
1341
|
};
|
|
1334
1342
|
|
|
1335
|
-
return `✅ Test case review session started. Session ID: ${sessionId}.
|
|
1336
|
-
Server running at http://localhost:${port}
|
|
1337
|
-
${openError ? 'Please manually open the URL in your browser.' : 'Browser should open automatically.'}`;
|
|
1343
|
+
return `✅ Test case review session started. Session ID: ${sessionId}.\nServer running at http://localhost:${port}\n${openAttemptFailed ? 'Please manually open the URL in your browser.' : 'Browser should open automatically.'}`;
|
|
1338
1344
|
|
|
1339
1345
|
} catch (err) {
|
|
1340
1346
|
console.error('Review tool error:', err);
|