File size: 1,810 Bytes
afd56bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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();
})();