Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
await page.waitForResponse('**/api/users');
const { devices } = require('playwright');
const iPhone11 = devices['iPhone 11'];
const browser = await webkit.launch();
const context = await browser.newContext({ ...iPhone11 });
const cookies = await context.cookies();
await context.addCookies([{ name: 'mon_cookie', value: 'ma_valeur', url: '...' }]);
await page.route('**/api/users', route => {
route.fulfill({ json: [{ name: 'Mock User' }] });
});
await page.context().storageState({ path: 'state.json' });
// Dans un autre test :
const context = await browser.newContext({ storageState: 'state.json' });