From b015c6265062ded6707675da2c8a562d9f81e7d6 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 2 Mar 2026 16:51:12 +0100 Subject: [PATCH] fix(ci): add --ignore-certificate-errors, disable gpu, and diagnostics for E2E form check --- apps/web/scripts/check-forms.ts | 34 +++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/apps/web/scripts/check-forms.ts b/apps/web/scripts/check-forms.ts index 993ce2d..869ca6e 100644 --- a/apps/web/scripts/check-forms.ts +++ b/apps/web/scripts/check-forms.ts @@ -17,21 +17,42 @@ async function main() { "--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage", + "--disable-gpu", + "--ignore-certificate-errors", ], }); const page = await browser.newPage(); + // Enable console logging from the page for debugging + page.on("console", (msg) => console.log(` [PAGE] ${msg.text()}`)); + page.on("pageerror", (err) => console.error(` [PAGE ERROR] ${err.message}`)); + page.on("requestfailed", (req) => + console.error( + ` [REQUEST FAILED] ${req.url()} - ${req.failure()?.errorText}`, + ), + ); + try { // Authenticate through Gatekeeper console.log(`\nšŸ›”ļø Authenticating through Gatekeeper...`); - await page.goto(targetUrl, { waitUntil: "networkidle2", timeout: 60000 }); + console.log(` Navigating to: ${targetUrl}`); + + const response = await page.goto(targetUrl, { + waitUntil: "domcontentloaded", + timeout: 60000, + }); + console.log(` Response status: ${response?.status()}`); + console.log(` Response URL: ${response?.url()}`); const isGatekeeperPage = await page.$('input[name="password"]'); if (isGatekeeperPage) { await page.type('input[name="password"]', gatekeeperPassword); await Promise.all([ - page.waitForNavigation({ waitUntil: "networkidle2", timeout: 60000 }), + page.waitForNavigation({ + waitUntil: "domcontentloaded", + timeout: 60000, + }), page.click('button[type="submit"]'), ]); console.log(`āœ… Gatekeeper authentication successful!`); @@ -51,6 +72,15 @@ async function main() { } } catch (err: any) { console.error(`āŒ Test Failed: ${err.message}`); + // Take a screenshot for debugging + try { + const screenshotPath = "/tmp/e2e-failure.png"; + await page.screenshot({ path: screenshotPath, fullPage: true }); + console.log(`šŸ“ø Screenshot saved to ${screenshotPath}`); + } catch { + /* ignore screenshot errors */ + } + console.log(` Current URL: ${page.url()}`); await browser.close(); process.exit(1); }