import { test, expect } from '@playwright/test';

test('Capability demo page deep DOM dump', async ({ page }) => {
    page.on('console', msg => console.log('BROWSER:', msg.text()));

    await page.goto('http://localhost:5173/test/capability.html');
    await page.waitForTimeout(3000);

    const dump = await page.evaluate(() => {
        const nav = document.getElementById('mainNav');
        const form = document.getElementById('demoForm');
        return {
            nav: {
                tagName: nav?.tagName,
                childCount: nav?.children.length,
                innerHTML: nav?.innerHTML
            },
            form: {
                tagName: form?.tagName,
                childCount: form?.children.length,
                innerHTML: form?.innerHTML
            }
        };
    });
    
    console.log('Deep DOM Dump:', JSON.stringify(dump, null, 2));

    expect(dump.nav.childCount).toBeGreaterThan(0);
});
