From 6a12fbdca8773e3aa4f686e4edea333716619c08 Mon Sep 17 00:00:00 2001 From: Renaud Heluin Date: Sat, 30 Mar 2024 19:32:25 +0100 Subject: [PATCH] doc: add Advanced configurations --- docs/guides/9-adv-conf.md | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/guides/9-adv-conf.md diff --git a/docs/guides/9-adv-conf.md b/docs/guides/9-adv-conf.md new file mode 100644 index 00000000..b0db43d0 --- /dev/null +++ b/docs/guides/9-adv-conf.md @@ -0,0 +1,49 @@ +--- +label: Configurations avancées +icon: zap +order: 0 +--- + +# Cas d'usages et configurations avancées + +## Audit d'un site nécessitant un cookie + +> Obligation de créer cookie pour fermer une popin, par exemple. + +### Utilisation du fichier `extra-header.json` + +```json +{ "Cookie": "monster=blue", "x-men": "wolverine" } +``` + +### Utilisation du fichier `input-file.json` + +```json +{ + "extra-header": { + "Cookie": "monster=blue", + "x-men": "wolverine" + } + // ... +} +``` + +## Audit d'un site à accès sécurisé + +Utilisation d'un `.puppeteerrc.cjs` custom. + +> À adapter suivant le type d'authentification. + +```javascript +module.exports = async (browser, context) => { + // launch browser for LHCI + const page = await browser.newPage(context.options) + page.authenticate({ username: '', password: '' }) + const session = await page.target().createCDPSession() + await page.goto(context.url, { waitUntil: 'networkidle0' }) + await startEcoindexPageMesure(page, session) + await endEcoindexPageMesure() + // close session for next run + await page.close() +} +```