Files
trading_bot_v3/test-enhanced-screenshot.ts
mindesbunister 743bb6bc73 SECURITY: Remove credential exposure from logs
- 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
2025-07-17 14:46:01 +02:00

72 lines
2.1 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)
})