@nbakka/mcp-appium 2.0.91 → 2.0.93

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.
@@ -235,11 +235,13 @@
235
235
  const container = document.getElementById('new-cases');
236
236
  if (testCases.new && testCases.new.length > 0) {
237
237
  container.innerHTML = testCases.new.map((tc, index) => `
238
- <div class="test-case">
238
+ <div class="test-case" id="new-case-${index}">
239
239
  <div class="test-case-header">
240
240
  <span class="test-case-id">ID: ${tc.id}</span>
241
- <button class="edit-btn" onclick="toggleEdit('new', ${index})">Edit</button>
242
- <button class="delete-btn" onclick="deleteTestCase('new', ${index})">Delete</button>
241
+ <div>
242
+ <button class="edit-btn" onclick="toggleEdit('new', ${index})">Edit</button>
243
+ <button class="delete-btn" onclick="deleteTestCase('new', ${index})">Delete</button>
244
+ </div>
243
245
  </div>
244
246
  <div id="new-${index}-display" style="display: block;">
245
247
  <strong>Description:</strong> ${tc.description}
@@ -263,11 +265,13 @@
263
265
  const container = document.getElementById('modify-cases');
264
266
  if (testCases.modify && testCases.modify.length > 0) {
265
267
  container.innerHTML = testCases.modify.map((tc, index) => `
266
- <div class="test-case">
268
+ <div class="test-case" id="modify-case-${index}">
267
269
  <div class="test-case-header">
268
270
  <span class="test-case-id">ID: ${tc.id}</span>
269
- <button class="edit-btn" onclick="toggleEdit('modify', ${index})">Edit</button>
270
- <button class="delete-btn" onclick="deleteTestCase('modify', ${index})">Delete</button>
271
+ <div>
272
+ <button class="edit-btn" onclick="toggleEdit('modify', ${index})">Edit</button>
273
+ <button class="delete-btn" onclick="deleteTestCase('modify', ${index})">Delete</button>
274
+ </div>
271
275
  </div>
272
276
  <div id="modify-${index}-display" style="display: block;">
273
277
  <div class="original-text"><strong>Original:</strong> ${tc.original}</div>
@@ -406,35 +410,36 @@
406
410
  }
407
411
  }
408
412
 
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
- });
413
+ async function deleteTestCase(type, index) {
414
+ const confirmation = confirm("Are you sure you want to delete this test case?");
415
+ if (!confirmation) return;
420
416
 
421
- if (!response.ok) {
422
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
423
- }
417
+ try {
418
+ showStatus('Deleting test case...', 'info');
419
+ const response = await fetch(`/delete/${sessionId}`, {
420
+ method: 'POST',
421
+ headers: { 'Content-Type': 'application/json' },
422
+ body: JSON.stringify({ type, index })
423
+ });
424
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
- }
425
+ if (!response.ok) {
426
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
427
+ }
431
428
 
432
- renderTestCases();
433
- showStatus('Test case deleted successfully!', 'success');
434
- } catch (error) {
435
- showStatus(`Error deleting test case: ${error.message}`, 'error');
429
+ // Remove the deleted test case from the local state first
430
+ if (type === 'new') {
431
+ testCases.new.splice(index, 1);
432
+ } else if (type === 'modify') {
433
+ testCases.modify.splice(index, 1);
436
434
  }
435
+
436
+ // Re-render the UI to update indexes and remove the element
437
+ renderTestCases();
438
+ showStatus('Test case deleted successfully!', 'success');
439
+ } catch (error) {
440
+ showStatus(`Error deleting test case: ${error.message}`, 'error');
437
441
  }
442
+ }
438
443
 
439
444
  // Load test cases when page loads
440
445
  window.onload = loadTestCases;
package/lib/server.js CHANGED
@@ -903,7 +903,7 @@ tool(
903
903
  }
904
904
 
905
905
  const { type, index } = req.body;
906
-
906
+
907
907
  try {
908
908
  if (type === 'new' && session.testCases.new && index < session.testCases.new.length) {
909
909
  session.testCases.new.splice(index, 1);
@@ -952,7 +952,7 @@ tool(
952
952
  message: "Test case review interface opened in browser. Use check_approval_status tool to poll for approval.",
953
953
  testCasesCount: testCases.length,
954
954
  browserUrl: `http://localhost:${port}`,
955
- instructions: "Poll every 25 seconds using check_approval_status tool until approved or timeout (5 minutes)"
955
+ instructions: "Poll using check_approval_status tool continuously for max 10 times"
956
956
  });
957
957
 
958
958
  } catch (err) {
@@ -975,10 +975,7 @@ tool(
975
975
 
976
976
  const session = approvalSessions.get(sessionId);
977
977
  if (!session) {
978
- return {
979
- status: "error",
980
- message: `Session not found. Invalid session ID: ${sessionId}`
981
- };
978
+ return `❌ Session not found. Invalid session ID: ${sessionId}`;
982
979
  }
983
980
 
984
981
  const currentTime = Date.now();
@@ -992,41 +989,24 @@ tool(
992
989
  }
993
990
  approvalSessions.delete(sessionId);
994
991
 
995
- return {
996
- status: "approved",
997
- message: "Test cases approved successfully!",
998
- elapsedTime: elapsedTime,
999
- approvedTestCases: approvedTestCases
1000
- };
992
+ return `✅ Test cases approved successfully! Elapsed time: ${elapsedTime}s\n\nApproved test cases:\n${JSON.stringify(approvedTestCases, null, 2)}`;
1001
993
  } else if (session.status === 'cancelled') {
1002
994
  if (session.server) {
1003
995
  session.server.close();
1004
996
  }
1005
997
  approvalSessions.delete(sessionId);
1006
998
 
1007
- return {
1008
- status: "cancelled",
1009
- message: "Review was cancelled by the user",
1010
- elapsedTime: elapsedTime
1011
- };
999
+ return `❌ Review was cancelled by the user. Elapsed time: ${elapsedTime}s`;
1012
1000
  } else if (session.status === 'timeout' || elapsedTime > 300) {
1013
1001
  if (session.server) {
1014
1002
  session.server.close();
1015
1003
  }
1016
1004
  approvalSessions.delete(sessionId);
1017
1005
 
1018
- return {
1019
- status: "timeout",
1020
- message: "Review session timed out",
1021
- elapsedTime: elapsedTime
1022
- };
1006
+ return `⏰ Review session timed out. Elapsed time: ${elapsedTime}s`;
1023
1007
  } else {
1024
- return {
1025
- status: "pending",
1026
- message: "Test cases are still pending approval",
1027
- elapsedTime: elapsedTime,
1028
- remainingTime: Math.max(0, 300 - elapsedTime)
1029
- };
1008
+ const remainingTime = Math.max(0, 300 - elapsedTime);
1009
+ return `⏳ Test cases are still pending approval. Elapsed: ${elapsedTime}s, Remaining: ${remainingTime}s`;
1030
1010
  }
1031
1011
  }
1032
1012
  );
@@ -19,4 +19,6 @@ if any new test case is to be created then don't mention any id against it
19
19
  for review_testcases test cases tool data should be in this format, strictly follow this format espcially for Modify test cases
20
20
  {"testCases":[["Verify that brochure section is visible under overview tab","Verify brochure section is removed from property tour tab","Modify","SCRUM-TC-1"],
21
21
  ["Verify similar properties section is visible under over tab in pdp section","Remove","SCRUM-TC-2"],
22
- ["Verify Project Brochure section appears above the 'Explore on map' section in Overview tab","New"]]}
22
+ ["Verify Project Brochure section appears above the 'Explore on map' section in Overview tab","New"]]}
23
+
24
+ NOTE: keep polling continously for 10 times max till the test cases are approved by user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "2.0.91",
3
+ "version": "2.0.93",
4
4
  "description": "Appium MCP",
5
5
  "engines": {
6
6
  "node": ">=18"