@nbakka/mcp-appium 2.0.54 ā 2.0.55
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 +38 -83
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -580,7 +580,7 @@ tool(
|
|
|
580
580
|
|
|
581
581
|
|
|
582
582
|
// ----------------------
|
|
583
|
-
// TOOL: Generate Manual Test Cases from PDF + JIRA
|
|
583
|
+
// FIXED TOOL: Generate Manual Test Cases from PDF + JIRA
|
|
584
584
|
// ----------------------
|
|
585
585
|
tool(
|
|
586
586
|
"upload_pdf_to_openai",
|
|
@@ -602,7 +602,9 @@ tool(
|
|
|
602
602
|
const client = new OpenAI({ apiKey: openaiKey });
|
|
603
603
|
|
|
604
604
|
// Validate file exists
|
|
605
|
-
|
|
605
|
+
try {
|
|
606
|
+
await fs.access(pdfPath);
|
|
607
|
+
} catch (error) {
|
|
606
608
|
throw new Error(`PDF file not found at path: ${pdfPath}`);
|
|
607
609
|
}
|
|
608
610
|
|
|
@@ -611,9 +613,12 @@ tool(
|
|
|
611
613
|
|
|
612
614
|
console.log(`š Processing ${fileName} for test case generation...`);
|
|
613
615
|
|
|
616
|
+
// Use the require() fs for createReadStream (CommonJS style)
|
|
617
|
+
const fsSync = require('fs');
|
|
618
|
+
|
|
614
619
|
// Upload PDF to OpenAI
|
|
615
620
|
const fileUpload = await client.files.create({
|
|
616
|
-
file:
|
|
621
|
+
file: fsSync.createReadStream(pdfPath), // Use fsSync.createReadStream
|
|
617
622
|
purpose: "assistants"
|
|
618
623
|
});
|
|
619
624
|
|
|
@@ -629,7 +634,7 @@ tool(
|
|
|
629
634
|
- Edge cases and negative scenarios
|
|
630
635
|
- Cross-browser/device compatibility tests
|
|
631
636
|
- Accessibility testing scenarios`,
|
|
632
|
-
model: "gpt-4o",
|
|
637
|
+
model: "gpt-4o",
|
|
633
638
|
tools: [{ type: "file_search" }],
|
|
634
639
|
tool_resources: {
|
|
635
640
|
file_search: {
|
|
@@ -681,7 +686,7 @@ Please structure your response as follows:
|
|
|
681
686
|
[Same format as above]
|
|
682
687
|
|
|
683
688
|
**IMPORTANT GUIDELINES:**
|
|
684
|
-
1. Create 15-
|
|
689
|
+
1. Create 15-20 test cases total covering all aspects
|
|
685
690
|
2. Reference specific UI elements from the PDF design
|
|
686
691
|
3. Include both positive and negative test scenarios
|
|
687
692
|
4. Consider different user roles if applicable
|
|
@@ -714,7 +719,7 @@ Generate detailed test cases now based on the PDF design and JIRA requirements.
|
|
|
714
719
|
// Wait for completion with progress tracking
|
|
715
720
|
let runStatus = await client.beta.threads.runs.retrieve(thread.id, run.id);
|
|
716
721
|
let attempts = 0;
|
|
717
|
-
const maxAttempts = 60;
|
|
722
|
+
const maxAttempts = 60;
|
|
718
723
|
|
|
719
724
|
while (runStatus.status !== 'completed' && attempts < maxAttempts) {
|
|
720
725
|
if (runStatus.status === 'failed') {
|
|
@@ -741,7 +746,7 @@ Generate detailed test cases now based on the PDF design and JIRA requirements.
|
|
|
741
746
|
.map(msg => msg.content[0]?.text?.value)
|
|
742
747
|
.join('\n\n');
|
|
743
748
|
|
|
744
|
-
// Parse
|
|
749
|
+
// Parse test case count
|
|
745
750
|
const testCaseCount = (testCases.match(/\*\*TC-/g) || []).length;
|
|
746
751
|
|
|
747
752
|
// Clean up assistant
|
|
@@ -751,7 +756,7 @@ Generate detailed test cases now based on the PDF design and JIRA requirements.
|
|
|
751
756
|
console.warn('ā ļø Assistant cleanup failed:', cleanupError.message);
|
|
752
757
|
}
|
|
753
758
|
|
|
754
|
-
// Save test cases to file
|
|
759
|
+
// Save test cases to file
|
|
755
760
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
756
761
|
const outputFileName = `test_cases_${timestamp.substring(0, 19)}.md`;
|
|
757
762
|
const outputPath = path.join(path.dirname(pdfPath), outputFileName);
|
|
@@ -782,96 +787,46 @@ ${testCases}
|
|
|
782
787
|
|
|
783
788
|
console.log(`ā
Test cases generated and saved!`);
|
|
784
789
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
outputs: {
|
|
806
|
-
savedToFile: outputPath,
|
|
807
|
-
fileName: outputFileName,
|
|
808
|
-
generatedAt: new Date().toISOString()
|
|
809
|
-
},
|
|
810
|
-
execution: {
|
|
811
|
-
processingTime: `${attempts} seconds`,
|
|
812
|
-
model: "gpt-4o",
|
|
813
|
-
pdfAnalyzed: true
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
};
|
|
790
|
+
// CRITICAL: Return only a STRING, not an object
|
|
791
|
+
// The MCP wrapper will handle the proper formatting
|
|
792
|
+
return `ā
Successfully generated ${testCaseCount} manual test cases!
|
|
793
|
+
|
|
794
|
+
š Test cases saved to: ${outputFileName}
|
|
795
|
+
š Full path: ${outputPath}
|
|
796
|
+
|
|
797
|
+
š Generation Summary:
|
|
798
|
+
- Total Test Cases: ${testCaseCount}
|
|
799
|
+
- Categories: Functional, UI/UX, Edge Cases, Compatibility, Accessibility
|
|
800
|
+
- Source File: ${fileName} (${(stats.size / 1024).toFixed(2)} KB)
|
|
801
|
+
- Processing Time: ${attempts} seconds
|
|
802
|
+
- Model Used: gpt-4o
|
|
803
|
+
|
|
804
|
+
šÆ Test Case Preview:
|
|
805
|
+
${testCases.substring(0, 1000)}...
|
|
806
|
+
|
|
807
|
+
[Complete test cases saved to markdown file for easy reference and sharing]`;
|
|
817
808
|
|
|
818
809
|
} catch (err) {
|
|
819
810
|
console.error("ā Test Case Generation Error:", err);
|
|
820
811
|
|
|
821
|
-
|
|
812
|
+
// Return only error string, not object
|
|
813
|
+
let errorMessage = `ā Failed to generate test cases: ${err.message}`;
|
|
822
814
|
|
|
823
815
|
if (err.message?.includes('quota')) {
|
|
824
|
-
errorMessage += "OpenAI quota exceeded. Check billing.";
|
|
816
|
+
errorMessage += "\n\nš” Troubleshooting: OpenAI quota exceeded. Check your billing at platform.openai.com";
|
|
825
817
|
} else if (err.message?.includes('timeout')) {
|
|
826
|
-
errorMessage += "Generation took too long. Try with smaller PDF.";
|
|
818
|
+
errorMessage += "\n\nš” Troubleshooting: Generation took too long. Try with a smaller PDF file.";
|
|
827
819
|
} else if (err.message?.includes('file')) {
|
|
828
|
-
errorMessage += "PDF processing error. Check file format.";
|
|
820
|
+
errorMessage += "\n\nš” Troubleshooting: PDF processing error. Check file format and accessibility.";
|
|
829
821
|
} else if (err.message?.includes('API key')) {
|
|
830
|
-
errorMessage += "Invalid OpenAI API key.";
|
|
831
|
-
} else {
|
|
832
|
-
errorMessage += err.message || "Unknown error occurred.";
|
|
822
|
+
errorMessage += "\n\nš” Troubleshooting: Invalid OpenAI API key. Check ~/Desktop/openai.json file.";
|
|
833
823
|
}
|
|
834
824
|
|
|
835
|
-
return
|
|
836
|
-
success: false,
|
|
837
|
-
message: errorMessage,
|
|
838
|
-
error: {
|
|
839
|
-
message: err.message,
|
|
840
|
-
timestamp: new Date().toISOString(),
|
|
841
|
-
attempted: {
|
|
842
|
-
jiraSummary: jiraSummary,
|
|
843
|
-
pdfPath: pdfPath
|
|
844
|
-
}
|
|
845
|
-
},
|
|
846
|
-
troubleshooting: [
|
|
847
|
-
"Verify OpenAI API key in ~/Desktop/openai.json",
|
|
848
|
-
"Check PDF file exists and is readable",
|
|
849
|
-
"Ensure sufficient OpenAI credits",
|
|
850
|
-
"Try with smaller PDF if timeout occurs"
|
|
851
|
-
]
|
|
852
|
-
};
|
|
825
|
+
return errorMessage;
|
|
853
826
|
}
|
|
854
827
|
}
|
|
855
828
|
);
|
|
856
829
|
|
|
857
|
-
// ----------------------
|
|
858
|
-
// USAGE EXAMPLE
|
|
859
|
-
// ----------------------
|
|
860
|
-
|
|
861
|
-
/*
|
|
862
|
-
const result = await tools.uploadPdfToOpenai({
|
|
863
|
-
jiraSummary: "User Login Page Implementation",
|
|
864
|
-
jiraDescription: "Create a responsive login page with email/password fields, remember me checkbox, forgot password link, and social login options. Must support mobile and desktop views.",
|
|
865
|
-
pdfPath: "/path/to/login-design.pdf"
|
|
866
|
-
});
|
|
867
|
-
|
|
868
|
-
// Expected Output:
|
|
869
|
-
// - 15-25 detailed manual test cases
|
|
870
|
-
// - Categories: Functional, UI/UX, Edge Cases, Compatibility, Accessibility
|
|
871
|
-
// - Saved to markdown file for easy reference
|
|
872
|
-
// - Structured format ready for test management tools
|
|
873
|
-
*/
|
|
874
|
-
|
|
875
830
|
return server;
|
|
876
831
|
};
|
|
877
832
|
|