fix(ci): use correct auth cookie name for e-tib gatekeeper bypass
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 1m17s
Build & Deploy / 🧪 QA (push) Successful in 1m47s
Build & Deploy / 🏗️ Build (push) Successful in 3m29s
Build & Deploy / 🚀 Deploy (push) Successful in 35s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 1m17s
Build & Deploy / 🧪 QA (push) Successful in 1m47s
Build & Deploy / 🏗️ Build (push) Successful in 3m29s
Build & Deploy / 🚀 Deploy (push) Successful in 35s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
This commit is contained in:
@@ -6,13 +6,14 @@ module.exports = async (browser, context) => {
|
|||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
// Using LHCI_URL or TARGET_URL if available
|
// Using LHCI_URL or TARGET_URL if available
|
||||||
const targetUrl =
|
const targetUrl =
|
||||||
process.env.LHCI_URL || process.env.TARGET_URL || 'https://testing.klz-cables.com';
|
process.env.LHCI_URL || process.env.TARGET_URL || 'https://testing.e-tib.com';
|
||||||
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
|
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
|
||||||
|
const authCookieName = process.env.AUTH_COOKIE_NAME || 'etib_gatekeeper_session';
|
||||||
|
|
||||||
console.log(`🔑 LHCI Auth: Setting gatekeeper cookie for ${new URL(targetUrl).hostname}...`);
|
console.log(`🔑 LHCI Auth: Setting gatekeeper cookie (${authCookieName}) for ${new URL(targetUrl).hostname}...`);
|
||||||
|
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'klz_gatekeeper_session',
|
name: authCookieName,
|
||||||
value: gatekeeperPassword,
|
value: gatekeeperPassword,
|
||||||
domain: new URL(targetUrl).hostname,
|
domain: new URL(targetUrl).hostname,
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const targetUrl =
|
|||||||
'http://localhost:3000';
|
'http://localhost:3000';
|
||||||
const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; // Default limit to avoid infinite runs
|
const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; // Default limit to avoid infinite runs
|
||||||
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
|
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
|
||||||
|
const authCookieName = process.env.AUTH_COOKIE_NAME || 'etib_gatekeeper_session';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log(`\n🚀 Starting PageSpeed test for: ${targetUrl}`);
|
console.log(`\n🚀 Starting PageSpeed test for: ${targetUrl}`);
|
||||||
@@ -32,7 +33,7 @@ async function main() {
|
|||||||
// We might need to bypass gatekeeper for the sitemap fetch too
|
// We might need to bypass gatekeeper for the sitemap fetch too
|
||||||
const response = await axios.get(sitemapUrl, {
|
const response = await axios.get(sitemapUrl, {
|
||||||
headers: {
|
headers: {
|
||||||
Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`,
|
Cookie: `${authCookieName}=${gatekeeperPassword}`,
|
||||||
},
|
},
|
||||||
validateStatus: (status) => status < 400,
|
validateStatus: (status) => status < 400,
|
||||||
});
|
});
|
||||||
@@ -77,7 +78,7 @@ async function main() {
|
|||||||
// Handle authentication for staging/testing
|
// Handle authentication for staging/testing
|
||||||
// Lighthouse can set cookies via --collect.settings.extraHeaders
|
// Lighthouse can set cookies via --collect.settings.extraHeaders
|
||||||
const extraHeaders = JSON.stringify({
|
const extraHeaders = JSON.stringify({
|
||||||
Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`,
|
Cookie: `${authCookieName}=${gatekeeperPassword}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Detect Chrome path from Puppeteer installation if not provided
|
// Detect Chrome path from Puppeteer installation if not provided
|
||||||
|
|||||||
Reference in New Issue
Block a user