test-exact-manual.jsā¢2.61 kB
#!/usr/bin/env node
/**
* TASK-001: Test Exact Manual Replication
* Replicates exactly what the user did manually
*/
import { chromium } from 'playwright';
async function testExactManualReplication() {
console.log('š§Ŗ TASK-001: Testing Exact Manual Replication...\n');
const WORKING_URL = "https://composer.euconquisto.com/#/embed/auth-with-token/pt_br/home/36c92686-c494-ec11-a22a-dc984041c95d/[JWT_TOKEN]";
let browser = null;
try {
// Step 1: Launch browser exactly as you would manually
console.log('1ļøā£ Launching browser (same way as manual test)...');
browser = await chromium.launch({
headless: false,
timeout: 60000
});
// Step 2: Create a new page (same as manual new tab)
console.log('2ļøā£ Creating new page (like manual new tab)...');
const page = await browser.newPage();
// Step 3: Navigate to the working URL
console.log('3ļøā£ Navigating to working URL...');
console.log(` URL: ${WORKING_URL}`);
const response = await page.goto(WORKING_URL, {
waitUntil: 'domcontentloaded',
timeout: 30000
});
console.log(` Response status: ${response.status()}`);
// Step 4: Wait a moment like manual test
console.log('4ļøā£ Waiting 10 seconds (like manual test)...');
await page.waitForTimeout(10000);
// Step 5: Check page content
console.log('5ļøā£ Checking page content...');
const title = await page.title();
const bodyText = await page.textContent('body');
const hasButtons = await page.locator('button').count();
console.log(` Page title: "${title}"`);
console.log(` Body text length: ${bodyText?.length || 0} characters`);
console.log(` Number of buttons: ${hasButtons}`);
if (bodyText && bodyText.includes('You need to enable JavaScript')) {
console.log(' ā ļø JavaScript not enabled message detected');
}
// Step 6: Take screenshot
await page.screenshot({
path: `manual-replication-test-${Date.now()}.png`,
fullPage: true
});
if (hasButtons > 0 || (bodyText && bodyText.length > 100 && !bodyText.includes('You need to enable JavaScript'))) {
console.log('\nš SUCCESS: Page loaded with content (like manual test)!');
} else {
console.log('\nā FAILED: Page still blank (unlike manual test)');
}
} catch (error) {
console.error('ā Test failed:', error.message);
} finally {
if (browser) {
await browser.close();
}
}
}
testExactManualReplication().catch(console.error);