@nbakka/mcp-appium 3.0.9 → 3.0.11

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.
Files changed (2) hide show
  1. package/lib/server.js +100 -30
  2. package/package.json +2 -2
package/lib/server.js CHANGED
@@ -837,22 +837,46 @@ tool(
837
837
 
838
838
  // Process test cases - handle the specific format properly
839
839
  const processedTestCases = testCases.map((testCase, index) => {
840
- // Each testCase is an array like ["title", "description", "status", "originalCase"]
841
840
  if (Array.isArray(testCase)) {
842
- return {
843
- title: testCase[0] || `Test Case ${index + 1}`,
844
- description: testCase[1] || '',
845
- status: testCase[2] || 'New',
846
- originalCase: testCase[3] || '',
847
- index: index
848
- };
841
+ const arrayLength = testCase.length;
842
+
843
+ if (arrayLength === 4) {
844
+ // Modify case: ["original title", "new description", "Modify", "SCRUM-TC-1"]
845
+ return {
846
+ originalTitle: testCase[0] || `Test Case ${index + 1}`,
847
+ newDescription: testCase[1] || '',
848
+ status: testCase[2] || 'Modify',
849
+ testId: testCase[3] || '',
850
+ index: index
851
+ };
852
+ } else if (arrayLength === 3) {
853
+ // Remove case: ["title", "Remove", "SCRUM-TC-2"]
854
+ return {
855
+ title: testCase[0] || `Test Case ${index + 1}`,
856
+ status: testCase[1] || 'Remove',
857
+ testId: testCase[2] || '',
858
+ index: index
859
+ };
860
+ } else if (arrayLength === 2) {
861
+ // New case: ["title", "New"]
862
+ return {
863
+ title: testCase[0] || `Test Case ${index + 1}`,
864
+ status: testCase[1] || 'New',
865
+ index: index
866
+ };
867
+ } else {
868
+ // Fallback for unexpected format
869
+ return {
870
+ title: testCase[0] || `Test Case ${index + 1}`,
871
+ status: 'New',
872
+ index: index
873
+ };
874
+ }
849
875
  } else {
850
- // Fallback for unexpected format
876
+ // Fallback for non-array format
851
877
  return {
852
878
  title: String(testCase) || `Test Case ${index + 1}`,
853
- description: '',
854
879
  status: 'New',
855
- originalCase: '',
856
880
  index: index
857
881
  };
858
882
  }
@@ -864,12 +888,12 @@ tool(
864
888
 
865
889
  if (status === 'modify') {
866
890
  // For modify cases, show original → changed format
867
- return `${testCase.title}\n\nOriginal: ${testCase.originalCase || 'Not specified'}\nChanged to: ${testCase.description || 'Not specified'}`;
891
+ return `Original: ${testCase.originalTitle}\nChanged to: ${testCase.newDescription}`;
868
892
  } else if (status === 'remove') {
869
- // For remove cases, just show the title
893
+ // For remove cases, show the title
870
894
  return testCase.title;
871
895
  } else {
872
- // For new cases, just show the title
896
+ // For new cases, show the title
873
897
  return testCase.title;
874
898
  }
875
899
  };
@@ -1176,10 +1200,10 @@ tool(
1176
1200
 
1177
1201
  // Create proper label and test ID display for modify/remove cases
1178
1202
  let labelAndIdDisplay = '';
1179
- if (testCase.status.toLowerCase() === 'modify' && testCase.originalCase) {
1180
- labelAndIdDisplay = `<div style="margin-bottom: 8px; font-weight: 600; color: #856404; font-size: 13px;">Modify - ${testCase.originalCase}</div>`;
1181
- } else if (testCase.status.toLowerCase() === 'remove' && testCase.originalCase) {
1182
- labelAndIdDisplay = `<div style="margin-bottom: 8px; font-weight: 600; color: #721c24; font-size: 13px;">Remove - ${testCase.originalCase}</div>`;
1203
+ if (testCase.status.toLowerCase() === 'modify' && testCase.testId) {
1204
+ labelAndIdDisplay = `<div style="margin-bottom: 8px; font-weight: 600; color: #856404; font-size: 13px;">Modify - ${testCase.testId}</div>`;
1205
+ } else if (testCase.status.toLowerCase() === 'remove' && testCase.testId) {
1206
+ labelAndIdDisplay = `<div style="margin-bottom: 8px; font-weight: 600; color: #721c24; font-size: 13px;">Remove - ${testCase.testId}</div>`;
1183
1207
  }
1184
1208
 
1185
1209
  return `
@@ -1245,7 +1269,9 @@ tool(
1245
1269
  const status = originalTestCase.status.toLowerCase();
1246
1270
 
1247
1271
  if (status === 'modify') {
1248
- resetValue = originalTestCase.title + '\\n\\nOriginal: ' + (originalTestCase.originalCase || 'Not specified') + '\\nChanged to: ' + (originalTestCase.description || 'Not specified');
1272
+ resetValue = 'Original: ' + originalTestCase.originalTitle + '\\nChanged to: ' + originalTestCase.newDescription;
1273
+ } else if (status === 'remove') {
1274
+ resetValue = originalTestCase.title;
1249
1275
  } else {
1250
1276
  resetValue = originalTestCase.title;
1251
1277
  }
@@ -1275,13 +1301,32 @@ tool(
1275
1301
  const textarea = el.querySelector('textarea');
1276
1302
  const originalTestCase = testCases[index];
1277
1303
 
1278
- // Create the updated test case array in the original format
1279
- const updatedCase = [
1280
- textarea.value.trim(), // Updated title/content
1281
- originalTestCase.description, // Keep original description
1282
- originalTestCase.status, // Keep original status
1283
- originalTestCase.originalCase // Keep original case reference
1284
- ];
1304
+ // Create the updated test case array based on the original format
1305
+ let updatedCase;
1306
+ const status = originalTestCase.status.toLowerCase();
1307
+
1308
+ if (status === 'modify') {
1309
+ // For modify: [updatedContent, newDescription, "Modify", testId]
1310
+ updatedCase = [
1311
+ textarea.value.trim(),
1312
+ originalTestCase.newDescription,
1313
+ originalTestCase.status,
1314
+ originalTestCase.testId
1315
+ ];
1316
+ } else if (status === 'remove') {
1317
+ // For remove: [updatedContent, "Remove", testId]
1318
+ updatedCase = [
1319
+ textarea.value.trim(),
1320
+ originalTestCase.status,
1321
+ originalTestCase.testId
1322
+ ];
1323
+ } else {
1324
+ // For new: [updatedContent, "New"]
1325
+ updatedCase = [
1326
+ textarea.value.trim(),
1327
+ originalTestCase.status
1328
+ ];
1329
+ }
1285
1330
 
1286
1331
  updatedTestCases.push(updatedCase);
1287
1332
  }
@@ -1464,10 +1509,35 @@ tool(
1464
1509
  return `${index + 1}. ${String(tc)} (New)`;
1465
1510
  }
1466
1511
 
1467
- const title = tc[0] || `Test Case ${index + 1}`;
1468
- const description = tc[1] || '';
1469
- const status = tc[2] || 'New';
1470
- const originalCase = tc[3] || '';
1512
+ // Handle different array structures based on length and content
1513
+ let title, description, status, originalCase;
1514
+
1515
+ if (tc.length === 4) {
1516
+ // Standard format: [title, description, status, originalCase]
1517
+ title = tc[0] || `Test Case ${index + 1}`;
1518
+ description = tc[1] || '';
1519
+ status = tc[2] || 'New';
1520
+ originalCase = tc[3] || '';
1521
+ } else if (tc.length === 3) {
1522
+ // Could be [title, status, originalCase] for remove cases
1523
+ title = tc[0] || `Test Case ${index + 1}`;
1524
+ if (tc[1] && tc[1].toLowerCase() === 'remove') {
1525
+ status = tc[1];
1526
+ originalCase = tc[2] || '';
1527
+ description = '';
1528
+ } else {
1529
+ // [title, description, status]
1530
+ description = tc[1] || '';
1531
+ status = tc[2] || 'New';
1532
+ originalCase = '';
1533
+ }
1534
+ } else {
1535
+ // Fallback
1536
+ title = tc[0] || `Test Case ${index + 1}`;
1537
+ description = tc[1] || '';
1538
+ status = tc[2] || 'New';
1539
+ originalCase = tc[3] || '';
1540
+ }
1471
1541
 
1472
1542
  const statusLower = status.toLowerCase();
1473
1543
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "description": "Appium MCP",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -54,4 +54,4 @@
54
54
  "lib": "lib"
55
55
  },
56
56
  "author": "nbakka"
57
- }
57
+ }