import { enhancedScreenshotService } from './lib/enhanced-screenshot' async function testDualSessionScreenshots() { console.log('๐Ÿš€ Testing Enhanced Screenshot Service with Dual Sessions') try { // Test configuration const config = { symbol: 'SOLUSD', timeframe: '240', layouts: ['ai', 'diy'] as ('ai' | 'diy')[], credentials: { email: process.env.TRADINGVIEW_EMAIL || '', password: process.env.TRADINGVIEW_PASSWORD || '' } } console.log('๐Ÿ“‹ Test Configuration:', { symbol: config.symbol, timeframe: config.timeframe, layouts: config.layouts, credentials: '[REDACTED]' }) // Perform the dual-session screenshot capture console.log('\n๐Ÿ”„ Starting dual-session capture...') const screenshots = await enhancedScreenshotService.captureWithLogin(config) console.log('\nโœ… Capture completed!') console.log(`๐Ÿ“ธ Screenshots captured: ${screenshots.length}`) screenshots.forEach((screenshot, index) => { console.log(` ${index + 1}. ${screenshot}`) }) if (screenshots.length === 2) { console.log('\n๐ŸŽฏ SUCCESS: Both AI and DIY layouts captured successfully!') } else { console.log('\nโš ๏ธ WARNING: Expected 2 screenshots, got', screenshots.length) } // Test cleanup console.log('\n๐Ÿงน Testing cleanup...') await enhancedScreenshotService.cleanup() console.log('โœ… Cleanup completed') } catch (error: any) { console.error('\nโŒ Test failed:', error.message) console.error('Stack trace:', error.stack) // Ensure cleanup even on error try { await enhancedScreenshotService.cleanup() } catch (cleanupError: any) { console.error('Cleanup also failed:', cleanupError.message) } process.exit(1) } } // Run the test testDualSessionScreenshots() .then(() => { console.log('\n๐ŸŽ‰ All tests completed successfully!') process.exit(0) }) .catch((error) => { console.error('\n๐Ÿ’ฅ Test suite failed:', error) process.exit(1) })