Skip to content

Commit 6a12fbd

Browse files
committed
doc: add Advanced configurations
1 parent cfe6a5c commit 6a12fbd

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

docs/guides/9-adv-conf.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
label: Configurations avancées
3+
icon: zap
4+
order: 0
5+
---
6+
7+
# Cas d'usages et configurations avancées
8+
9+
## Audit d'un site nécessitant un cookie
10+
11+
> Obligation de créer cookie pour fermer une popin, par exemple.
12+
13+
### Utilisation du fichier `extra-header.json`
14+
15+
```json
16+
{ "Cookie": "monster=blue", "x-men": "wolverine" }
17+
```
18+
19+
### Utilisation du fichier `input-file.json`
20+
21+
```json
22+
{
23+
"extra-header": {
24+
"Cookie": "monster=blue",
25+
"x-men": "wolverine"
26+
}
27+
// ...
28+
}
29+
```
30+
31+
## Audit d'un site à accès sécurisé
32+
33+
Utilisation d'un `.puppeteerrc.cjs` custom.
34+
35+
> À adapter suivant le type d'authentification.
36+
37+
```javascript
38+
module.exports = async (browser, context) => {
39+
// launch browser for LHCI
40+
const page = await browser.newPage(context.options)
41+
page.authenticate({ username: '<to update>', password: '<to update>' })
42+
const session = await page.target().createCDPSession()
43+
await page.goto(context.url, { waitUntil: 'networkidle0' })
44+
await startEcoindexPageMesure(page, session)
45+
await endEcoindexPageMesure()
46+
// close session for next run
47+
await page.close()
48+
}
49+
```

0 commit comments

Comments
 (0)