docs(auth): Fix double use of JSON.stringify in Session storage example (#29554)

This commit is contained in:
Jan Lelis 2024-02-20 19:57:44 +01:00 committed by GitHub
parent 593feea166
commit 3f46ba0680
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -575,7 +575,7 @@ Reusing authenticated state covers [cookies](https://developer.mozilla.org/en-US
```js
// Get session storage and store as env variable
const sessionStorage = await page.evaluate(() => JSON.stringify(sessionStorage));
fs.writeFileSync('playwright/.auth/session.json', JSON.stringify(sessionStorage), 'utf-8');
fs.writeFileSync('playwright/.auth/session.json', sessionStorage, 'utf-8');
// Set session storage in a new context
const sessionStorage = JSON.parse(fs.readFileSync('playwright/.auth/session.json', 'utf-8'));