- Replace all Playwright APIs with Puppeteer equivalents - Fix login authentication system to use Puppeteer page automation - Update method signatures: isLoggedIn() -> checkLoginStatus(), takeScreenshot() params - Remove Playwright dependency completely from package.json - Convert browser automation to use Puppeteer's selector methods - Fix session management and cookie handling for Puppeteer - Eliminate resource overhead: ~150MB reduction in Docker image size - Ensure authentication works with new Puppeteer implementation
39 lines
1023 B
JavaScript
Executable File
39 lines
1023 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { TradingViewAutomation } from './lib/tradingview-automation.js'
|
|
|
|
async function testPuppeteerLogin() {
|
|
console.log('🧪 Testing Puppeteer TradingView Login...')
|
|
|
|
const automation = TradingViewAutomation.getInstance()
|
|
|
|
try {
|
|
console.log('1. Initializing browser...')
|
|
await automation.init()
|
|
|
|
console.log('2. Testing login...')
|
|
const loginSuccess = await automation.login()
|
|
|
|
if (loginSuccess) {
|
|
console.log('✅ SUCCESS: Login test passed!')
|
|
|
|
console.log('3. Testing navigation...')
|
|
await automation.navigateToSymbol('SOLUSD', '240')
|
|
|
|
console.log('4. Taking test screenshot...')
|
|
await automation.takeScreenshot({ filename: 'puppeteer_test.png' })
|
|
|
|
console.log('✅ All tests passed!')
|
|
} else {
|
|
console.log('❌ FAILED: Login test failed')
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ TEST FAILED:', error)
|
|
} finally {
|
|
await automation.forceCleanup()
|
|
}
|
|
}
|
|
|
|
testPuppeteerLogin()
|