@nbakka/mcp-appium 2.0.87 → 2.0.88
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 +26 -42
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -822,9 +822,9 @@ tool(
|
|
|
822
822
|
if (tc.length === 2 && tc[1].toLowerCase() === 'new') {
|
|
823
823
|
// Format: [description, "New"]
|
|
824
824
|
parsedTestCases.new.push(tc[0]);
|
|
825
|
-
} else if (tc.length
|
|
825
|
+
} else if (tc.length >= 3) {
|
|
826
826
|
const type = tc[2]?.toLowerCase();
|
|
827
|
-
if (type === 'modify') {
|
|
827
|
+
if (type === 'modify' && tc.length >= 4) {
|
|
828
828
|
// Format: [originalDescription, newDescription, "Modify", testCaseId]
|
|
829
829
|
parsedTestCases.modify.push({
|
|
830
830
|
id: tc[3] || 'N/A',
|
|
@@ -832,12 +832,18 @@ tool(
|
|
|
832
832
|
modified: tc[1] // New/modified description
|
|
833
833
|
});
|
|
834
834
|
} else if (type === 'remove') {
|
|
835
|
-
// Format: [description, "", "Remove", testCaseId]
|
|
835
|
+
// Format: [description, "Remove", testCaseId] or [description, "", "Remove", testCaseId]
|
|
836
836
|
parsedTestCases.remove.push({
|
|
837
|
-
id: tc[3]
|
|
837
|
+
id: tc.length >= 4 ? tc[3] : tc[1], // testCaseId could be in position 1 or 3
|
|
838
838
|
description: tc[0]
|
|
839
839
|
});
|
|
840
840
|
}
|
|
841
|
+
} else if (tc.length === 3 && tc[1].toLowerCase() === 'remove') {
|
|
842
|
+
// Handle format: [description, "Remove", testCaseId]
|
|
843
|
+
parsedTestCases.remove.push({
|
|
844
|
+
id: tc[2] || 'N/A',
|
|
845
|
+
description: tc[0]
|
|
846
|
+
});
|
|
841
847
|
}
|
|
842
848
|
});
|
|
843
849
|
|
|
@@ -922,20 +928,14 @@ tool(
|
|
|
922
928
|
}
|
|
923
929
|
}, 300000); // 5 minutes
|
|
924
930
|
|
|
925
|
-
return
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
browserUrl: `http://localhost:${port}`,
|
|
931
|
-
instructions: "Poll every 25 seconds using check_approval_status tool until approved or timeout (5 minutes)"
|
|
932
|
-
});
|
|
931
|
+
return `✅ Test case review interface opened in browser.
|
|
932
|
+
Session ID: ${sessionId}
|
|
933
|
+
Test Cases Count: ${testCases.length}
|
|
934
|
+
Browser URL: http://localhost:${port}
|
|
935
|
+
Instructions: Use check_approval_status tool to poll for approval every 25 seconds.`;
|
|
933
936
|
|
|
934
937
|
} catch (err) {
|
|
935
|
-
return
|
|
936
|
-
status: "error",
|
|
937
|
-
message: `Error setting up review interface: ${err.message}`
|
|
938
|
-
});
|
|
938
|
+
return `❌ Error setting up review interface: ${err.message}`;
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
);
|
|
@@ -950,10 +950,7 @@ tool(
|
|
|
950
950
|
await new Promise(resolve => setTimeout(resolve, 25000));
|
|
951
951
|
const session = approvalSessions.get(sessionId);
|
|
952
952
|
if (!session) {
|
|
953
|
-
return
|
|
954
|
-
status: "error",
|
|
955
|
-
message: "Session not found. Invalid session ID."
|
|
956
|
-
});
|
|
953
|
+
return `❌ Session not found. Invalid session ID: ${sessionId}`;
|
|
957
954
|
}
|
|
958
955
|
|
|
959
956
|
const currentTime = Date.now();
|
|
@@ -968,12 +965,9 @@ tool(
|
|
|
968
965
|
}
|
|
969
966
|
approvalSessions.delete(sessionId);
|
|
970
967
|
|
|
971
|
-
return
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
approvedTestCases: approvedTestCases,
|
|
975
|
-
elapsedTime: elapsedTime
|
|
976
|
-
});
|
|
968
|
+
return `✅ Test cases approved successfully!
|
|
969
|
+
Elapsed time: ${elapsedTime} seconds
|
|
970
|
+
Approved test cases: ${JSON.stringify(approvedTestCases, null, 2)}`;
|
|
977
971
|
} else if (session.status === 'cancelled') {
|
|
978
972
|
// Clean up session and close server
|
|
979
973
|
if (session.server) {
|
|
@@ -981,11 +975,7 @@ tool(
|
|
|
981
975
|
}
|
|
982
976
|
approvalSessions.delete(sessionId);
|
|
983
977
|
|
|
984
|
-
return
|
|
985
|
-
status: "cancelled",
|
|
986
|
-
message: "Review was cancelled by the user.",
|
|
987
|
-
elapsedTime: elapsedTime
|
|
988
|
-
});
|
|
978
|
+
return `❌ Review was cancelled by the user. Elapsed time: ${elapsedTime} seconds`;
|
|
989
979
|
} else if (session.status === 'timeout' || elapsedTime > 300) { // 5 minutes
|
|
990
980
|
// Clean up session and close server
|
|
991
981
|
if (session.server) {
|
|
@@ -993,18 +983,12 @@ tool(
|
|
|
993
983
|
}
|
|
994
984
|
approvalSessions.delete(sessionId);
|
|
995
985
|
|
|
996
|
-
return
|
|
997
|
-
status: "timeout",
|
|
998
|
-
message: `Review session timed out. Elapsed time: ${elapsedTime} seconds`,
|
|
999
|
-
elapsedTime: elapsedTime
|
|
1000
|
-
});
|
|
986
|
+
return `⏰ Review session timed out. Elapsed time: ${elapsedTime} seconds`;
|
|
1001
987
|
} else {
|
|
1002
|
-
return
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
remainingTime: Math.max(0, 300 - elapsedTime)
|
|
1007
|
-
});
|
|
988
|
+
return `⏳ Test cases are still pending approval.
|
|
989
|
+
Elapsed time: ${elapsedTime} seconds
|
|
990
|
+
Remaining time: ${Math.max(0, 300 - elapsedTime)} seconds
|
|
991
|
+
Continue polling with check_approval_status tool.`;
|
|
1008
992
|
}
|
|
1009
993
|
}
|
|
1010
994
|
);
|