@nbakka/mcp-appium 2.0.86 → 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 +42 -53
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -817,21 +817,32 @@ tool(
|
|
|
817
817
|
};
|
|
818
818
|
|
|
819
819
|
testCases.forEach(tc => {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
parsedTestCases.new.push(
|
|
825
|
-
} else if (
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
820
|
+
if (!tc || tc.length < 2) return; // Skip invalid entries
|
|
821
|
+
|
|
822
|
+
if (tc.length === 2 && tc[1].toLowerCase() === 'new') {
|
|
823
|
+
// Format: [description, "New"]
|
|
824
|
+
parsedTestCases.new.push(tc[0]);
|
|
825
|
+
} else if (tc.length >= 3) {
|
|
826
|
+
const type = tc[2]?.toLowerCase();
|
|
827
|
+
if (type === 'modify' && tc.length >= 4) {
|
|
828
|
+
// Format: [originalDescription, newDescription, "Modify", testCaseId]
|
|
829
|
+
parsedTestCases.modify.push({
|
|
830
|
+
id: tc[3] || 'N/A',
|
|
831
|
+
original: tc[0], // Original description
|
|
832
|
+
modified: tc[1] // New/modified description
|
|
833
|
+
});
|
|
834
|
+
} else if (type === 'remove') {
|
|
835
|
+
// Format: [description, "Remove", testCaseId] or [description, "", "Remove", testCaseId]
|
|
836
|
+
parsedTestCases.remove.push({
|
|
837
|
+
id: tc.length >= 4 ? tc[3] : tc[1], // testCaseId could be in position 1 or 3
|
|
838
|
+
description: tc[0]
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
} else if (tc.length === 3 && tc[1].toLowerCase() === 'remove') {
|
|
842
|
+
// Handle format: [description, "Remove", testCaseId]
|
|
832
843
|
parsedTestCases.remove.push({
|
|
833
|
-
id:
|
|
834
|
-
description:
|
|
844
|
+
id: tc[2] || 'N/A',
|
|
845
|
+
description: tc[0]
|
|
835
846
|
});
|
|
836
847
|
}
|
|
837
848
|
});
|
|
@@ -871,7 +882,7 @@ tool(
|
|
|
871
882
|
const session = approvalSessions.get(sessionId);
|
|
872
883
|
if (session) {
|
|
873
884
|
session.status = 'approved';
|
|
874
|
-
session.finalTestCases = req.body;
|
|
885
|
+
session.finalTestCases = req.body;
|
|
875
886
|
approvalSessions.set(sessionId, session);
|
|
876
887
|
}
|
|
877
888
|
res.send("✓ Test cases approved successfully!");
|
|
@@ -917,20 +928,14 @@ tool(
|
|
|
917
928
|
}
|
|
918
929
|
}, 300000); // 5 minutes
|
|
919
930
|
|
|
920
|
-
return
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
browserUrl: `http://localhost:${port}`,
|
|
926
|
-
instructions: "Poll every 25 seconds using check_approval_status tool until approved or timeout (5 minutes)"
|
|
927
|
-
});
|
|
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.`;
|
|
928
936
|
|
|
929
937
|
} catch (err) {
|
|
930
|
-
return
|
|
931
|
-
status: "error",
|
|
932
|
-
message: `Error setting up review interface: ${err.message}`
|
|
933
|
-
});
|
|
938
|
+
return `❌ Error setting up review interface: ${err.message}`;
|
|
934
939
|
}
|
|
935
940
|
}
|
|
936
941
|
);
|
|
@@ -945,10 +950,7 @@ tool(
|
|
|
945
950
|
await new Promise(resolve => setTimeout(resolve, 25000));
|
|
946
951
|
const session = approvalSessions.get(sessionId);
|
|
947
952
|
if (!session) {
|
|
948
|
-
return
|
|
949
|
-
status: "error",
|
|
950
|
-
message: "Session not found. Invalid session ID."
|
|
951
|
-
});
|
|
953
|
+
return `❌ Session not found. Invalid session ID: ${sessionId}`;
|
|
952
954
|
}
|
|
953
955
|
|
|
954
956
|
const currentTime = Date.now();
|
|
@@ -963,12 +965,9 @@ tool(
|
|
|
963
965
|
}
|
|
964
966
|
approvalSessions.delete(sessionId);
|
|
965
967
|
|
|
966
|
-
return
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
approvedTestCases: approvedTestCases,
|
|
970
|
-
elapsedTime: elapsedTime
|
|
971
|
-
});
|
|
968
|
+
return `✅ Test cases approved successfully!
|
|
969
|
+
Elapsed time: ${elapsedTime} seconds
|
|
970
|
+
Approved test cases: ${JSON.stringify(approvedTestCases, null, 2)}`;
|
|
972
971
|
} else if (session.status === 'cancelled') {
|
|
973
972
|
// Clean up session and close server
|
|
974
973
|
if (session.server) {
|
|
@@ -976,11 +975,7 @@ tool(
|
|
|
976
975
|
}
|
|
977
976
|
approvalSessions.delete(sessionId);
|
|
978
977
|
|
|
979
|
-
return
|
|
980
|
-
status: "cancelled",
|
|
981
|
-
message: "Review was cancelled by the user.",
|
|
982
|
-
elapsedTime: elapsedTime
|
|
983
|
-
});
|
|
978
|
+
return `❌ Review was cancelled by the user. Elapsed time: ${elapsedTime} seconds`;
|
|
984
979
|
} else if (session.status === 'timeout' || elapsedTime > 300) { // 5 minutes
|
|
985
980
|
// Clean up session and close server
|
|
986
981
|
if (session.server) {
|
|
@@ -988,18 +983,12 @@ tool(
|
|
|
988
983
|
}
|
|
989
984
|
approvalSessions.delete(sessionId);
|
|
990
985
|
|
|
991
|
-
return
|
|
992
|
-
status: "timeout",
|
|
993
|
-
message: `Review session timed out. Elapsed time: ${elapsedTime} seconds`,
|
|
994
|
-
elapsedTime: elapsedTime
|
|
995
|
-
});
|
|
986
|
+
return `⏰ Review session timed out. Elapsed time: ${elapsedTime} seconds`;
|
|
996
987
|
} else {
|
|
997
|
-
return
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
remainingTime: Math.max(0, 300 - elapsedTime)
|
|
1002
|
-
});
|
|
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.`;
|
|
1003
992
|
}
|
|
1004
993
|
}
|
|
1005
994
|
);
|