Ka-Note/ka-note/test-idb.mjs

30 lines
984 B
JavaScript

import { chromium } from 'playwright';
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext();
const page = await context.newPage();
page.on('console', msg => {
if (!msg.text().includes('[vite]')) console.log('[PAGE]', msg.text());
});
await page.goto('http://localhost:5173', { waitUntil: 'networkidle' });
await page.waitForTimeout(3000);
const url = page.url();
console.log('URL:', url);
// Screenshot
await page.screenshot({ path: '/c/work/chrka/myNote/ka-note/test-screen1.png' });
// Find clickable items - look for a context/topic to open
const links = await page.locator('a, [role="button"], button').all();
console.log('Clickable count:', links.length);
for (const l of links.slice(0, 10)) {
const txt = await l.innerText().catch(() => '');
const href = await l.getAttribute('href').catch(() => '');
if (txt || href) console.log(' -', JSON.stringify(txt.trim().substring(0, 50)), href);
}
await browser.close();