fix(ci): rewrite check-forms with KLZ pattern (executablePath, networkidle2, 60s timeout)
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 6s
Build & Deploy / 🧪 QA (push) Successful in 1m54s
Build & Deploy / 🏗️ Build (push) Successful in 11m31s
Build & Deploy / 🚀 Deploy (push) Successful in 24s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 3m14s
Build & Deploy / 🔔 Notify (push) Successful in 1s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 6s
Build & Deploy / 🧪 QA (push) Successful in 1m54s
Build & Deploy / 🏗️ Build (push) Successful in 11m31s
Build & Deploy / 🚀 Deploy (push) Successful in 24s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 3m14s
Build & Deploy / 🔔 Notify (push) Successful in 1s
This commit is contained in:
@@ -1,49 +1,63 @@
|
|||||||
import puppeteer from "puppeteer";
|
import puppeteer from "puppeteer";
|
||||||
|
|
||||||
const targetUrl = process.env.TEST_URL || "http://localhost:3000";
|
const targetUrl = process.env.TEST_URL || "http://localhost:3000";
|
||||||
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || "secret"; // Use ENV or default
|
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || "secret";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log(`\n🚀 Starting E2E Form Submission Check for: ${targetUrl}`);
|
console.log(`\n🚀 Starting E2E Form Submission Check for: ${targetUrl}`);
|
||||||
|
|
||||||
|
// Launch browser with KLZ pattern: use system chromium via env
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
headless: true,
|
headless: true,
|
||||||
args: ["--no-sandbox", "--disable-setuid-sandbox"],
|
executablePath:
|
||||||
|
process.env.PUPPETEER_EXECUTABLE_PATH ||
|
||||||
|
process.env.CHROME_PATH ||
|
||||||
|
undefined,
|
||||||
|
args: [
|
||||||
|
"--no-sandbox",
|
||||||
|
"--disable-setuid-sandbox",
|
||||||
|
"--disable-dev-shm-usage",
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Authenticate through Gatekeeper
|
||||||
console.log(`\n🛡️ Authenticating through Gatekeeper...`);
|
console.log(`\n🛡️ Authenticating through Gatekeeper...`);
|
||||||
await page.goto(targetUrl, { waitUntil: "networkidle0" });
|
await page.goto(targetUrl, { waitUntil: "networkidle2", timeout: 60000 });
|
||||||
|
|
||||||
const isGatekeeperPage = await page.$('input[name="password"]');
|
const isGatekeeperPage = await page.$('input[name="password"]');
|
||||||
if (isGatekeeperPage) {
|
if (isGatekeeperPage) {
|
||||||
await page.type('input[name="password"]', gatekeeperPassword);
|
await page.type('input[name="password"]', gatekeeperPassword);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.waitForNavigation({ waitUntil: "networkidle2" }),
|
page.waitForNavigation({ waitUntil: "networkidle2", timeout: 60000 }),
|
||||||
page.click('button[type="submit"]'),
|
page.click('button[type="submit"]'),
|
||||||
]);
|
]);
|
||||||
console.log(`✅ Gatekeeper authentication successful!`);
|
console.log(`✅ Gatekeeper authentication successful!`);
|
||||||
|
} else {
|
||||||
|
console.log(`✅ Already authenticated (no Gatekeeper gate detected).`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`\n🧪 Testing Contact Form submission...`);
|
// Basic smoke test
|
||||||
// Note: This needs to be adapted to the actual selectors on mintel.me
|
console.log(`\n🧪 Testing page load...`);
|
||||||
// For now, we perform a simple smoke test of the home page
|
|
||||||
const title = await page.title();
|
const title = await page.title();
|
||||||
console.log(`✅ Page Title: ${title}`);
|
console.log(`✅ Page Title: ${title}`);
|
||||||
|
|
||||||
if (title.toLowerCase().includes("mintel")) {
|
if (title.toLowerCase().includes("mintel")) {
|
||||||
console.log(`✅ Basic smoke test passed!`);
|
console.log(`✅ Basic smoke test passed!`);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Page title mismatch");
|
throw new Error(`Page title mismatch: "${title}"`);
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(`❌ Test Failed: ${err.message}`);
|
console.error(`❌ Test Failed: ${err.message}`);
|
||||||
process.exit(1);
|
|
||||||
} finally {
|
|
||||||
await browser.close();
|
await browser.close();
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
console.log(`\n🎉 SUCCESS: E2E smoke test passed!`);
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|||||||
Reference in New Issue
Block a user