@nbakka/mcp-appium 2.0.70 → 2.0.72

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 +50 -14
  2. package/package.json +1 -1
package/lib/server.js CHANGED
@@ -621,6 +621,10 @@ tool(
621
621
  },
622
622
  async ({ jiraSummary, jiraDescription }) => {
623
623
  try {
624
+ // Clear the generated test cases file before starting
625
+ const testCasesFilePath = path.join(__dirname, 'generated-testcases.txt');
626
+ await fs.writeFile(testCasesFilePath, ''); // Clear the file
627
+
624
628
  // Load OpenAI API key from Desktop/openai.json
625
629
  const openaiConfigPath = path.join(os.homedir(), "Desktop", "openai.json");
626
630
  const configContent = await fs.readFile(openaiConfigPath, "utf-8");
@@ -646,23 +650,22 @@ tool(
646
650
  const pngBuffer = await fs.readFile(pngPath);
647
651
  const base64Image = pngBuffer.toString('base64');
648
652
 
649
- const completion = await client.chat.completions.create({
650
- model: "gpt-5", // Use vision model for image analysis
653
+ // Start OpenAI generation (this will run in background due to timeout)
654
+ client.chat.completions.create({
655
+ model: "gpt-5", // Use GPT-5 model for image analysis
651
656
  messages: [{
652
657
  role: "user",
653
658
  content: [
654
659
  {
655
660
  type: "text",
656
- text: `Generate comprehensive manual test cases based on the following:
661
+ text: `Generate manual test cases based on the following:
657
662
 
658
663
  JIRA Summary: ${jiraSummary}
659
664
 
660
665
  JIRA Description: ${jiraDescription}
661
666
 
662
667
  Test Case Generation Guidelines:
663
- ${guidelines}
664
-
665
- Please analyze the provided Figma design (PNG image) and create detailed manual test cases that cover all the functionality described in the JIRA requirements. Focus on UI/UX changes, user interactions, navigation flows, and edge cases.`
668
+ ${guidelines}`
666
669
  },
667
670
  {
668
671
  type: "image_url",
@@ -673,19 +676,52 @@ Please analyze the provided Figma design (PNG image) and create detailed manual
673
676
  }
674
677
  ]
675
678
  }],
676
- max_tokens: 10000
679
+ max_completion_tokens: 10000
680
+ }).then(async (completion) => {
681
+ // Save test cases to file when generation completes
682
+ const testCases = completion.choices[0].message.content;
683
+ await fs.writeFile(testCasesFilePath, testCases);
684
+ }).catch(async (error) => {
685
+ // Save error to file if generation fails
686
+ await fs.writeFile(testCasesFilePath, `Error generating test cases: ${error.message}`);
677
687
  });
678
688
 
679
- const testCases = completion.choices[0].message.content;
689
+ return "✅ Test case generation started. Use 'check_testcases_status' tool to check if generation is complete.";
690
+ } catch (err) {
691
+ return `❌ Error starting test case generation: ${err.message}`;
692
+ }
693
+ }
694
+ );
680
695
 
681
- // Save the generated test cases to a file for reference
682
- const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -5);
683
- const testCasesPath = path.join(figmaDir, `test-cases-${timestamp}.txt`);
684
- await fs.writeFile(testCasesPath, testCases);
696
+ tool(
697
+ "check_testcases_status",
698
+ "Check if test cases have been generated and saved to file",
699
+ {},
700
+ async () => {
701
+ try {
702
+ // Wait for 20 seconds before checking
703
+ await new Promise(resolve => setTimeout(resolve, 20000));
685
704
 
686
- return `✅ Test cases generated successfully!\n\nSaved to: ${testCasesPath}\n\n${testCases}`;
705
+ const testCasesFilePath = path.join(__dirname, 'generated-testcases.txt');
706
+
707
+ // Check if file exists and has content
708
+ try {
709
+ const fileContent = await fs.readFile(testCasesFilePath, 'utf-8');
710
+
711
+ if (fileContent.trim().length === 0) {
712
+ return "❌ Test cases are still being generated. Please wait and try again.";
713
+ }
714
+
715
+ if (fileContent.startsWith('Error generating test cases:')) {
716
+ return `❌ ${fileContent}`;
717
+ }
718
+
719
+ return `✅ Test cases generated successfully!\n\n${fileContent}`;
720
+ } catch (fileError) {
721
+ return "❌ Test cases file not found or still being created. Please wait and try again.";
722
+ }
687
723
  } catch (err) {
688
- return `❌ Error generating test cases: ${err.message}`;
724
+ return `❌ Error checking test cases status: ${err.message}`;
689
725
  }
690
726
  }
691
727
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbakka/mcp-appium",
3
- "version": "2.0.70",
3
+ "version": "2.0.72",
4
4
  "description": "Appium MCP",
5
5
  "engines": {
6
6
  "node": ">=18"