- Replace full config logging with sanitized version - Credentials now show as [REDACTED] in console logs - Fixed in: enhanced-screenshot service, API routes, test files - Prevents TradingView email/password from appearing in container logs
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
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)
|
||
})
|