chore: stabilize CI/CD pipeline with dynamic pre-warming and broader Traefik exemptions
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 50s
Build & Deploy / 🧪 QA (push) Successful in 1m23s
Build & Deploy / 🏗️ Build (push) Successful in 3m42s
Build & Deploy / 🚀 Deploy (push) Successful in 16s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 4m34s
Build & Deploy / 🔔 Notify (push) Successful in 2s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 50s
Build & Deploy / 🧪 QA (push) Successful in 1m23s
Build & Deploy / 🏗️ Build (push) Successful in 3m42s
Build & Deploy / 🚀 Deploy (push) Successful in 16s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 4m34s
Build & Deploy / 🔔 Notify (push) Successful in 2s
This commit is contained in:
@@ -11,9 +11,37 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
async function main() {
|
||||
console.log(`\n🚀 Starting E2E Form Submission Check for: ${targetUrl}`);
|
||||
|
||||
// 0. Settlement Delay: Wait for deployment to settle (sync containers/Varnish)
|
||||
console.log(`⏳ Waiting 10s for deployment settlement...`);
|
||||
await delay(10000);
|
||||
// 0. Pre-warming settlement: Wait for deployment to respond (sync containers/Varnish)
|
||||
console.log(`⏳ Pre-warming: Waiting for deployment to return 200 OK...`);
|
||||
const maxWaitMs = 60000;
|
||||
const startTime = Date.now();
|
||||
let warmed = false;
|
||||
|
||||
while (Date.now() - startTime < maxWaitMs) {
|
||||
try {
|
||||
const resp = await axios.get(targetUrl, {
|
||||
headers: { Cookie: `klz_gatekeeper_session=${gatekeeperPassword}` },
|
||||
timeout: 5000,
|
||||
validateStatus: (s) => s === 200,
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
warmed = true;
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
// Quietly retry
|
||||
}
|
||||
await delay(2000);
|
||||
}
|
||||
|
||||
if (!warmed) {
|
||||
console.warn(`⚠️ Pre-warming timed out after 60s. Proceeding anyway...`);
|
||||
} else {
|
||||
console.log(`✅ Deployment settled and responding.`);
|
||||
}
|
||||
|
||||
// Brief stabilization buffer
|
||||
await delay(5000);
|
||||
|
||||
// 1. Fetch Sitemap to discover the contact page and a product page
|
||||
const sitemapUrl = `${targetUrl.replace(/\/$/, '')}/sitemap.xml`;
|
||||
@@ -126,19 +154,29 @@ async function main() {
|
||||
chunkErrorsDetected = false;
|
||||
console.log(`\n🧪 Testing ${label} on: ${url}`);
|
||||
|
||||
// First attempt
|
||||
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
|
||||
await delay(3000); // Allow initial JS execution
|
||||
// First attempt: Wait for network to be relatively idle
|
||||
await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 });
|
||||
|
||||
if (chunkErrorsDetected) {
|
||||
const cbUrl = `${url}${url.includes('?') ? '&' : '?'}cb=${Date.now()}`;
|
||||
console.warn(` ⚠️ Assets failed to load (Varnish staleness suspected). Retrying with cache-buster: ${cbUrl}`);
|
||||
chunkErrorsDetected = false;
|
||||
await page.goto(cbUrl, { waitUntil: 'domcontentloaded', timeout: 30000 });
|
||||
// REDIRECTION CHECK: Logging redirected landing page
|
||||
const finalUrl = page.url();
|
||||
if (finalUrl !== url && !finalUrl.includes(url)) {
|
||||
console.log(` 🔀 Redirected to: ${finalUrl}`);
|
||||
}
|
||||
|
||||
// Wait for network to settle slightly
|
||||
await page.waitForNetworkIdle({ idleTime: 1000, timeout: 10000 }).catch(() => {});
|
||||
if (chunkErrorsDetected) {
|
||||
const buster = `cb=${Date.now()}`;
|
||||
const cbUrl = finalUrl.includes('?') ? `${finalUrl}&${buster}` : `${finalUrl}?${buster}`;
|
||||
console.warn(` ⚠️ Assets failed to load (Varnish staleness suspected). Retrying with cache-buster: ${cbUrl}`);
|
||||
chunkErrorsDetected = false;
|
||||
await page.goto(cbUrl, { waitUntil: 'networkidle2', timeout: 30000 });
|
||||
}
|
||||
|
||||
// Capture HTML on failure during hydration wait
|
||||
try {
|
||||
await page.waitForNetworkIdle({ idleTime: 1000, timeout: 5000 }).catch(() => {});
|
||||
} catch (e) {
|
||||
console.warn(' ⚠️ Network idle timeout, proceeding with current state.');
|
||||
}
|
||||
};
|
||||
|
||||
// 3. Authenticate through Gatekeeper login form
|
||||
@@ -189,7 +227,9 @@ async function main() {
|
||||
// Find the form input by name
|
||||
await page.waitForSelector('input[name="name"]', { visible: true, timeout: 15000 });
|
||||
} catch (e) {
|
||||
console.error('Failed to find Contact Form input. Page Title:', await page.title());
|
||||
console.error('❌ Failed to find Contact Form input. Page Title:', await page.title());
|
||||
const html = await page.content();
|
||||
console.log(`💻 FULL HTML DUMP (top 2000 chars):\n${html.slice(0, 2000)}`);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user