Skip to content

Commit

Permalink
tech: ajout playwright-lighthouse
Browse files Browse the repository at this point in the history
  • Loading branch information
OCTO-GUIC committed Feb 13, 2024
1 parent c2d9bbc commit d7550b5
Show file tree
Hide file tree
Showing 4 changed files with 862 additions and 20 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"husky": "^8.0.3",
"jsdom": "^22.1.0",
"jsdom-global": "^3.0.2",
"lighthouse": "^11.5.0",
"lint-staged": "^14.0.1",
"playwright": "^1.41.2",
"playwright-lighthouse": "^4.0.0",
"prettier": "^2.8.8",
"release-please": "^16.3.1",
"ts-node": "^10.9.1",
Expand Down
24 changes: 24 additions & 0 deletions tests/e2e/lighthouse/lighthouse.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { playAudit } from 'playwright-lighthouse';
import playwright from 'playwright';

import { creerUtilisateurOuSupprimmer } from '../utils/creerUtilisateurConnecte';

describe('audit example', () => {
it('open browser', async () => {
const browser = await playwright['chromium'].launch({
args: ['--remote-debugging-port=9222'],
});
const context = await browser.newContext();
let page: any = await context.newPage();
// page = await creerUtilisateurOuSupprimmer(page);

await page.goto('/vos-aides');

await playAudit({
page: page,
port: 9222,
});

await browser.close();
});
});
2 changes: 1 addition & 1 deletion tests/e2e/utils/creerUtilisateurConnecte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const creerUtilisateurConnecte: () => Promise<Page> = async () => {
return page;
};

async function creerUtilisateurOuSupprimmer(page: Page): Promise<Page> {
export async function creerUtilisateurOuSupprimmer(page: Page): Promise<Page> {
await page.goto('/onboarding');
await page.evaluate(() => {
localStorage.setItem(
Expand Down
Loading

0 comments on commit d7550b5

Please sign in to comment.