Open arishoham opened 1 year ago
You could also try to use a puppeteer script for this like
/**
* @param {puppeteer.Browser} browser
* @param context
*/
module.exports = async (browser, context) => {
const page = await browser.newPage();
await page.setCookie({
name: 'cookie-test',
value: 'true',
domain: 'example.com',
});
await page.close();
};
I was able to send a cookie value using lighthouserc.json. In a non-prod environment, we check for the presence of a certain cookie and a value to allow access to the website. The code below allowed lighthouse to do the scans. If it had no effect, I also would double check in the Github Actions workflow that the config path to the json file is set up: configPath: .github/workflows/lighthouserc.json
under the with:
key
{
"ci": {
"collect": {
"settings": {
"extraHeaders": {
"COOKIE": "cookie_name=value_of_cookie"
}
}
},
"assert": {
},
"upload": {
},
"server": {
},
"wizard": {
}
}
}
I need to add a cookie to the page request when lighthouse runs, I tried using
extraHeaders
inlighthouserc.json
like so, but it seems to have no effect. Is there another way to accomplish this?