Skip to main content
Glama
test-existing-tab.js4.9 kB
#!/usr/bin/env node /** * TASK-001: Test Existing Working Tab * Connects to existing browser and finds the working Composer tab */ import { chromium } from 'playwright'; async function testExistingWorkingTab() { console.log('🧪 TASK-001: Testing Existing Working Tab...\n'); try { // Connect to existing browser session using the persistent context console.log('1️⃣ Connecting to existing browser session...'); const context = await chromium.launchPersistentContext('/tmp/composer-browser', { headless: false, timeout: 30000 }); // Get all pages (tabs) in the browser console.log('2️⃣ Getting all open tabs...'); const pages = context.pages(); console.log(` Found ${pages.length} open tabs`); // Look for the working Composer tab console.log('3️⃣ Searching for working Composer tab...'); let workingPage = null; for (let i = 0; i < pages.length; i++) { const page = pages[i]; const url = page.url(); const title = await page.title().catch(() => 'Unknown'); console.log(` Tab ${i + 1}: "${title}" - ${url.substring(0, 80)}...`); // Check if this is a Composer tab that's actually working if (url.includes('composer.euconquisto.com') && url.includes('[JWT_TOKEN]')) { console.log(` 📋 Found Composer tab with [JWT_TOKEN]!`); // Check if it has interactive content (buttons, forms, etc.) const hasButtons = await page.locator('button').count(); const hasInputs = await page.locator('input').count(); const bodyText = await page.textContent('body').catch(() => ''); console.log(` Buttons: ${hasButtons}, Inputs: ${hasInputs}`); console.log(` Has JavaScript error: ${bodyText.includes('You need to enable JavaScript')}`); if (hasButtons > 0 || hasInputs > 0 || (bodyText.length > 100 && !bodyText.includes('You need to enable JavaScript'))) { workingPage = page; console.log(` ✅ This tab appears to be working!`); break; } } } if (workingPage) { console.log('\n4️⃣ Testing DOM interaction on working tab...'); // Try to find "Nova composição" button using our enhanced selectors const newCompositionSelectors = [ 'button:has-text("Nova composição")', 'a:has-text("Nova composição")', 'button >> text="Nova composição"', 'text="Nova composição"', '.new-composition', '.btn:has-text("Nova")', 'button:text("Criar")', 'button:text("Novo")' ]; let buttonFound = false; for (const selector of newCompositionSelectors) { try { const element = await workingPage.waitForSelector(selector, { timeout: 2000 }); if (element) { console.log(` ✅ Found "Nova composição" button with selector: ${selector}`); buttonFound = true; // Take screenshot before clicking await workingPage.screenshot({ path: `working-tab-before-click-${Date.now()}.png`, fullPage: true }); // Try clicking it console.log(' 🖱️ Attempting to click the button...'); await element.click(); // Wait and take screenshot after clicking await workingPage.waitForTimeout(3000); await workingPage.screenshot({ path: `working-tab-after-click-${Date.now()}.png`, fullPage: true }); console.log(' ✅ Button clicked successfully!'); break; } } catch (error) { // Try next selector continue; } } if (!buttonFound) { console.log(' ⚠️ Could not find "Nova composição" button in working tab'); // List all visible buttons for debugging const allButtons = await workingPage.locator('button').all(); console.log(` 📋 Found ${allButtons.length} buttons total:`); for (let i = 0; i < Math.min(allButtons.length, 10); i++) { const text = await allButtons[i].textContent(); console.log(` Button ${i + 1}: "${text}"`); } } console.log('\n🎉 TASK-001 SUCCESS: Can interact with existing working tab!'); } else { console.log('\n❌ No working Composer tab found. Please ensure you have:'); console.log(' 1. Opened the provided URL in the same browser window'); console.log(' 2. Confirmed the Composer interface is visible and working'); } } catch (error) { console.error('❌ Test failed:', error.message); } } testExistingWorkingTab().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rkm097git/euconquisto-composer-mcp-poc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server