Skip to main content
Glama
manual-screenshot-test.tsโ€ข4.57 kB
/** * Manual test for screenshot download and analysis * Run this to verify screenshot tools work with real Zebrunner URLs * * Usage: * npm run build && node dist/tests/manual-screenshot-test.js */ import { ZebrunnerReportingClient } from '../src/api/reporting-client.js'; import { analyzeScreenshot, saveScreenshotToTemp } from '../src/utils/screenshot-analyzer.js'; import { config } from 'dotenv'; config(); async function testScreenshotTools() { console.log('๐Ÿงช Testing Screenshot Download and Analysis\n'); const baseUrl = process.env.ZEBRUNNER_URL || 'https://your-workspace.zebrunner.com'; const token = process.env.ZEBRUNNER_TOKEN; if (!token) { console.error('โŒ ZEBRUNNER_TOKEN not set in environment'); process.exit(1); } const client = new ZebrunnerReportingClient({ baseUrl, accessToken: token, debug: true }); // Test screenshot URL from the user's example const testScreenshotUrl = 'https://your-workspace.zebrunner.com/files/19a3c384-a06a-10d7-1aa1-cf9c3244b021'; console.log(`๐Ÿ“ธ Test Screenshot URL: ${testScreenshotUrl}\n`); try { // Test 1: Download Screenshot console.log('1๏ธโƒฃ Testing screenshot download...'); const imageBuffer = await client.downloadScreenshot(testScreenshotUrl); console.log(`โœ… Downloaded ${imageBuffer.length} bytes\n`); // Test 2: Save to file console.log('2๏ธโƒฃ Saving screenshot to file...'); const filePath = await saveScreenshotToTemp(imageBuffer, 'test_screenshot.png'); console.log(`โœ… Saved to: ${filePath}\n`); // Test 3: Basic Analysis (no OCR) console.log('3๏ธโƒฃ Running basic analysis (no OCR)...'); const basicAnalysis = await analyzeScreenshot(imageBuffer, { enableOCR: false }); console.log('โœ… Basic Analysis Results:'); console.log(` - Dimensions: ${basicAnalysis.metadata.width}x${basicAnalysis.metadata.height}`); console.log(` - Format: ${basicAnalysis.metadata.format}`); console.log(` - Size: ${Math.round(basicAnalysis.metadata.size / 1024)} KB`); console.log(` - Orientation: ${basicAnalysis.metadata.orientation}`); console.log(` - Aspect Ratio: ${basicAnalysis.metadata.aspectRatio}\n`); // Test 4: Analysis with OCR (slower) console.log('4๏ธโƒฃ Running analysis with OCR (this may take 5-10 seconds)...'); const ocrAnalysis = await analyzeScreenshot(imageBuffer, { enableOCR: true }); console.log('โœ… OCR Analysis Results:'); console.log(` - Text confidence: ${Math.round(ocrAnalysis.ocrText?.confidence || 0)}%`); console.log(` - Lines extracted: ${ocrAnalysis.ocrText?.lines.length || 0}`); if (ocrAnalysis.ocrText && ocrAnalysis.ocrText.lines.length > 0) { console.log(' - First 5 lines:'); ocrAnalysis.ocrText.lines.slice(0, 5).forEach((line, idx) => { if (line.trim()) { console.log(` ${idx + 1}. ${line}`); } }); } console.log(''); // Test 5: Device Detection if (ocrAnalysis.deviceInfo?.detectedDevice) { console.log('5๏ธโƒฃ Device Detection:'); console.log(` - Device: ${ocrAnalysis.deviceInfo.detectedDevice}`); console.log(''); } // Test 6: UI Elements if (ocrAnalysis.uiElements) { console.log('6๏ธโƒฃ UI Elements Detected:'); if (ocrAnalysis.uiElements.hasEmptyState) console.log(' - โœ… Empty State'); if (ocrAnalysis.uiElements.hasLoadingIndicator) console.log(' - โณ Loading Indicator'); if (ocrAnalysis.uiElements.hasErrorDialog) console.log(' - โŒ Error Dialog'); if (ocrAnalysis.uiElements.hasNavigationBar) console.log(' - ๐Ÿงญ Navigation Bar'); console.log(''); } console.log('๐ŸŽ‰ All tests passed!\n'); console.log('๐Ÿ“ Summary:'); console.log(' โœ… Screenshot download: Working'); console.log(' โœ… File saving: Working'); console.log(' โœ… Metadata extraction: Working'); console.log(' โœ… OCR text extraction: Working'); console.log(' โœ… Device detection: Working'); console.log(' โœ… UI element detection: Working\n'); console.log('๐Ÿ’ก Next steps:'); console.log(' 1. Test with analyze_screenshot MCP tool in Claude Desktop'); console.log(' 2. Use "detailed" analysis type to pass image to Claude Vision'); console.log(' 3. Integrate with analyze_test_failure for automatic screenshot analysis\n'); } catch (error) { console.error('โŒ Test failed:', error); process.exit(1); } } // Run the test testScreenshotTools().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/maksimsarychau/mcp-zebrunner'

If you have feedback or need assistance with the MCP directory API, please join our Discord server