diff --git a/package.json b/package.json index a548f38d..bf0550bf 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "scripts": { "start": "npm run build && npx serve dist", + "prepare": "npm run build:css", "serve": "npx serve", "build": "node scripts/build-dist.mjs && npm run verify:dist:deploy-artifact", "build:css": "postcss css/tailwind.source.css -o css/tailwind.generated.css", diff --git a/scripts/agent/debug_frontend.py b/scripts/agent/debug_frontend.py index 0441d740..8b06bc50 100644 --- a/scripts/agent/debug_frontend.py +++ b/scripts/agent/debug_frontend.py @@ -6,16 +6,22 @@ def run(): browser = p.chromium.launch() page = browser.new_page() - page.on("console", lambda msg: print(f"console:{msg.type}: {msg.text}")) - page.on("pageerror", lambda exc: print(f"pageerror: {exc}")) - page.on("requestfailed", lambda req: print(f"requestfailed: {req.url} - {req.failure}")) + # Print all console messages + page.on("console", lambda msg: print(f"CONSOLE [{msg.type}]: {msg.text}")) + + # Print all uncaught exceptions + page.on("pageerror", lambda exc: print(f"PAGE ERROR: {exc}")) + + # Print failed network requests + page.on("requestfailed", lambda req: print(f"REQUEST FAILED: {req.url} {req.failure}")) try: + print("Navigating to http://localhost:8000...") page.goto("http://localhost:8000") - # Wait a bit for JS to execute and errors to appear + # Wait a few seconds to capture initialization errors page.wait_for_timeout(5000) except Exception as e: - print(f"Error navigating: {e}") + print(f"SCRIPT ERROR: {e}") finally: browser.close()