Spaces:
Running
Running
| import { chromium } from 'playwright'; | |
| (async () => { | |
| const browser = await chromium.launch(); | |
| const page = await browser.newPage(); | |
| page.on('console', msg => console.log('PAGE LOG:', msg.text())); | |
| page.on('pageerror', error => console.log('PAGE ERROR:', error.message)); | |
| await page.route('**/*clerk*', async route => { | |
| if (route.request().url().includes('.js')) { | |
| console.log('Mocking Clerk JS:', route.request().url()); | |
| await route.fulfill({ | |
| status: 200, | |
| contentType: 'application/javascript', | |
| body: ` | |
| window.Clerk = { | |
| load: async () => console.log('Mock Clerk.load called'), | |
| isReady: () => true, | |
| session: null, | |
| user: null, | |
| addListener: () => {} | |
| }; | |
| ` | |
| }); | |
| } else { | |
| await route.continue(); | |
| } | |
| }); | |
| console.log('Navigating to http://localhost:5173/'); | |
| try { | |
| await page.goto('http://localhost:5173/'); | |
| console.log('Title:', await page.title()); | |
| await page.waitForTimeout(2000); | |
| const html = await page.content(); | |
| console.log('HTML size:', html.length); | |
| console.log('HTML excerpt:', html.substring(0, 1000)); | |
| if (html.includes('Missing Publishable Key')) { | |
| console.log('Found Clerk Publishable Key Error in HTML'); | |
| } else { | |
| console.log('No Clerk error found. Looking for Zaloguj...'); | |
| console.log('Matches for Zaloguj:', html.match(/Zaloguj/gi)); | |
| } | |
| } catch (e) { | |
| console.error('Error navigating:', e); | |
| } | |
| await browser.close(); | |
| })(); | |