@nbakka/mcp-appium 2.0.66 → 2.0.67
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 +45 -13
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -662,19 +662,29 @@ tool(
|
|
|
662
662
|
})).describe("Array of test cases to review")
|
|
663
663
|
},
|
|
664
664
|
async ({ testCases }) => {
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
try {
|
|
666
|
+
const express = require('express');
|
|
667
|
+
const open = require('open');
|
|
667
668
|
|
|
668
|
-
|
|
669
|
-
try {
|
|
669
|
+
return new Promise((resolve, reject) => {
|
|
670
670
|
const app = express();
|
|
671
671
|
const port = 3001;
|
|
672
|
+
let server;
|
|
672
673
|
|
|
673
674
|
// Serve a simple HTML page with test cases
|
|
674
675
|
app.get("/", (req, res) => {
|
|
675
676
|
let html = `
|
|
676
677
|
<html>
|
|
677
|
-
<head
|
|
678
|
+
<head>
|
|
679
|
+
<title>Test Case Approval</title>
|
|
680
|
+
<style>
|
|
681
|
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
682
|
+
h1 { color: #333; }
|
|
683
|
+
li { margin: 10px 0; padding: 10px; border: 1px solid #ddd; border-radius: 5px; }
|
|
684
|
+
button { padding: 10px 20px; background: #007cba; color: white; border: none; border-radius: 5px; cursor: pointer; }
|
|
685
|
+
button:hover { background: #005a87; }
|
|
686
|
+
</style>
|
|
687
|
+
</head>
|
|
678
688
|
<body>
|
|
679
689
|
<h1>Review Test Cases</h1>
|
|
680
690
|
<ul>
|
|
@@ -696,18 +706,40 @@ tool(
|
|
|
696
706
|
// Approval endpoint
|
|
697
707
|
app.get("/approve", (req, res) => {
|
|
698
708
|
res.send("Approved!");
|
|
699
|
-
server
|
|
700
|
-
|
|
709
|
+
if (server) {
|
|
710
|
+
server.close();
|
|
711
|
+
}
|
|
712
|
+
resolve("Test cases approved by user");
|
|
701
713
|
});
|
|
702
714
|
|
|
703
|
-
|
|
704
|
-
|
|
715
|
+
// Start server and open browser
|
|
716
|
+
server = app.listen(port, async () => {
|
|
717
|
+
try {
|
|
718
|
+
await open(`http://localhost:${port}`);
|
|
719
|
+
} catch (openError) {
|
|
720
|
+
console.error('Failed to open browser:', openError);
|
|
721
|
+
// Fallback: just provide the URL
|
|
722
|
+
resolve(`Test cases review page available at: http://localhost:${port}`);
|
|
723
|
+
}
|
|
705
724
|
});
|
|
706
725
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
726
|
+
// Handle server errors
|
|
727
|
+
server.on('error', (err) => {
|
|
728
|
+
reject(`Server error: ${err.message}`);
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// Timeout after 5 minutes
|
|
732
|
+
setTimeout(() => {
|
|
733
|
+
if (server) {
|
|
734
|
+
server.close();
|
|
735
|
+
}
|
|
736
|
+
reject("Review session timed out after 5 minutes");
|
|
737
|
+
}, 300000);
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
} catch (err) {
|
|
741
|
+
return `Error setting up review interface: ${err.message}`;
|
|
742
|
+
}
|
|
711
743
|
}
|
|
712
744
|
);
|
|
713
745
|
|