@nbakka/mcp-appium 2.0.90 → 2.0.91

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.
@@ -67,7 +67,7 @@
67
67
  color: #666;
68
68
  font-size: 0.9em;
69
69
  }
70
- .edit-btn, .save-btn, .cancel-btn-inline {
70
+ .edit-btn, .save-btn, .cancel-btn-inline, .delete-btn {
71
71
  padding: 6px 12px;
72
72
  border: none;
73
73
  border-radius: 4px;
@@ -87,6 +87,13 @@
87
87
  background-color: #757575;
88
88
  color: white;
89
89
  }
90
+ .delete-btn {
91
+ background-color: #f44336;
92
+ color: white;
93
+ }
94
+ .delete-btn:hover {
95
+ background-color: #d32f2f;
96
+ }
90
97
  .original-text {
91
98
  color: #999;
92
99
  text-decoration: line-through;
@@ -232,6 +239,7 @@
232
239
  <div class="test-case-header">
233
240
  <span class="test-case-id">ID: ${tc.id}</span>
234
241
  <button class="edit-btn" onclick="toggleEdit('new', ${index})">Edit</button>
242
+ <button class="delete-btn" onclick="deleteTestCase('new', ${index})">Delete</button>
235
243
  </div>
236
244
  <div id="new-${index}-display" style="display: block;">
237
245
  <strong>Description:</strong> ${tc.description}
@@ -259,6 +267,7 @@
259
267
  <div class="test-case-header">
260
268
  <span class="test-case-id">ID: ${tc.id}</span>
261
269
  <button class="edit-btn" onclick="toggleEdit('modify', ${index})">Edit</button>
270
+ <button class="delete-btn" onclick="deleteTestCase('modify', ${index})">Delete</button>
262
271
  </div>
263
272
  <div id="modify-${index}-display" style="display: block;">
264
273
  <div class="original-text"><strong>Original:</strong> ${tc.original}</div>
@@ -397,6 +406,36 @@
397
406
  }
398
407
  }
399
408
 
409
+ async function deleteTestCase(type, index) {
410
+ const confirmation = confirm("Are you sure you want to delete this test case?");
411
+ if (!confirmation) return;
412
+
413
+ try {
414
+ showStatus('Deleting test case...', 'info');
415
+ const response = await fetch(`/delete/${sessionId}`, {
416
+ method: 'POST',
417
+ headers: { 'Content-Type': 'application/json' },
418
+ body: JSON.stringify({ type, index })
419
+ });
420
+
421
+ if (!response.ok) {
422
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
423
+ }
424
+
425
+ // Remove the deleted test case from the local state
426
+ if (type === 'new') {
427
+ testCases.new.splice(index, 1);
428
+ } else if (type === 'modify') {
429
+ testCases.modify.splice(index, 1);
430
+ }
431
+
432
+ renderTestCases();
433
+ showStatus('Test case deleted successfully!', 'success');
434
+ } catch (error) {
435
+ showStatus(`Error deleting test case: ${error.message}`, 'error');
436
+ }
437
+ }
438
+
400
439
  // Load test cases when page loads
401
440
  window.onload = loadTestCases;
402
441
  </script>
package/lib/server.js CHANGED
@@ -896,6 +896,30 @@ tool(
896
896
  res.json({ status: 'cancelled', message: 'Review cancelled' });
897
897
  });
898
898
 
899
+ app.post(`/delete/${sessionId}`, (req, res) => {
900
+ const session = approvalSessions.get(sessionId);
901
+ if (!session) {
902
+ return res.status(404).json({ error: 'Session not found' });
903
+ }
904
+
905
+ const { type, index } = req.body;
906
+
907
+ try {
908
+ if (type === 'new' && session.testCases.new && index < session.testCases.new.length) {
909
+ session.testCases.new.splice(index, 1);
910
+ } else if (type === 'modify' && session.testCases.modify && index < session.testCases.modify.length) {
911
+ session.testCases.modify.splice(index, 1);
912
+ } else {
913
+ return res.status(400).json({ error: 'Invalid type or index' });
914
+ }
915
+
916
+ approvalSessions.set(sessionId, session);
917
+ res.json({ status: 'deleted', message: 'Test case deleted successfully' });
918
+ } catch (error) {
919
+ res.status(500).json({ error: 'Failed to delete test case' });
920
+ }
921
+ });
922
+
899
923
  const server = app.listen(port, async () => {
900
924
  // Remove console.log to prevent JSON parsing errors
901
925
  try {
@@ -951,10 +975,10 @@ tool(
951
975
 
952
976
  const session = approvalSessions.get(sessionId);
953
977
  if (!session) {
954
- return JSON.stringify({
978
+ return {
955
979
  status: "error",
956
980
  message: `Session not found. Invalid session ID: ${sessionId}`
957
- });
981
+ };
958
982
  }
959
983
 
960
984
  const currentTime = Date.now();
@@ -968,41 +992,41 @@ tool(
968
992
  }
969
993
  approvalSessions.delete(sessionId);
970
994
 
971
- return JSON.stringify({
995
+ return {
972
996
  status: "approved",
973
997
  message: "Test cases approved successfully!",
974
998
  elapsedTime: elapsedTime,
975
999
  approvedTestCases: approvedTestCases
976
- });
1000
+ };
977
1001
  } else if (session.status === 'cancelled') {
978
1002
  if (session.server) {
979
1003
  session.server.close();
980
1004
  }
981
1005
  approvalSessions.delete(sessionId);
982
1006
 
983
- return JSON.stringify({
1007
+ return {
984
1008
  status: "cancelled",
985
1009
  message: "Review was cancelled by the user",
986
1010
  elapsedTime: elapsedTime
987
- });
1011
+ };
988
1012
  } else if (session.status === 'timeout' || elapsedTime > 300) {
989
1013
  if (session.server) {
990
1014
  session.server.close();
991
1015
  }
992
1016
  approvalSessions.delete(sessionId);
993
1017
 
994
- return JSON.stringify({
1018
+ return {
995
1019
  status: "timeout",
996
1020
  message: "Review session timed out",
997
1021
  elapsedTime: elapsedTime
998
- });
1022
+ };
999
1023
  } else {
1000
- return JSON.stringify({
1024
+ return {
1001
1025
  status: "pending",
1002
1026
  message: "Test cases are still pending approval",
1003
1027
  elapsedTime: elapsedTime,
1004
1028
  remainingTime: Math.max(0, 300 - elapsedTime)
1005
- });
1029
+ };
1006
1030
  }
1007
1031
  }
1008
1032
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "2.0.90",
3
+ "version": "2.0.91",
4
4
  "description": "Appium MCP",
5
5
  "engines": {
6
6
  "node": ">=18"