Skip to content

Instantly share code, notes, and snippets.

@jeremyfrank
Created July 9, 2023 18:56
Show Gist options
  • Save jeremyfrank/6c1901f1fa72824e17fae3313a29bef0 to your computer and use it in GitHub Desktop.
Save jeremyfrank/6c1901f1fa72824e17fae3313a29bef0 to your computer and use it in GitHub Desktop.
Puppeteer config for modal cookie suppression with Lighthouse CI
/**
* @param {puppeteer.Browser} browser
* @param {{url: string, options: LHCI.CollectCommand.Options}} context
*/
module.exports = async (browser, context) => {
const cookies = [{
name: 'COOKIE_NAME_HERE',
value: 'COOKIE_VALUE_HERE',
url: context.url,
}]
const page = await browser.newPage();
await page.setCookie(...cookies);
await page.goto(context.url);
await page.close();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment