-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(website-e2e): add playwright lighthouse audit
test(website-e2e): add basic lighthouse audit
- Loading branch information
1 parent
d34864d
commit d825735
Showing
3 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// import type { Browser } from 'playwright' | ||
// import { chromium, expect, test } from '@playwright/test' | ||
// import getPort from 'get-port' | ||
// import { playAudit } from 'playwright-lighthouse' | ||
|
||
// const lighthouseTest = test.extend<{ Page }, { port: number, browser: Browser }>({ | ||
// port: [ | ||
// async (use) => { | ||
// // Assign a unique port for each playwright worker to support parallel tests | ||
// const port = await getPort() | ||
// await use(port) | ||
// }, | ||
// { scope: 'worker' }, | ||
// ], | ||
|
||
// browser: [ | ||
// async ({ port }, use) => { | ||
// const browser = await chromium.launch({ | ||
// args: [`--remote-debugging-port=${port}`], | ||
// }) | ||
// await use(browser) | ||
// }, | ||
// { scope: 'worker' }, | ||
// ], | ||
// }) | ||
|
||
// const thresholdsConfig = { | ||
// 'performance': 90, | ||
// 'accessibility': 90, | ||
// 'best-practices': 90, | ||
// 'seo': 90, | ||
// // 'pwa': 50, | ||
// } | ||
|
||
// TODO: re-activate after website refactor (three.js/spline) | ||
// lighthouseTest('should pass lighthouse audits', async ({ page, port }) => { | ||
// await page.goto('/') | ||
|
||
// await playAudit({ | ||
// page, | ||
// port, | ||
// thresholds: thresholdsConfig, | ||
// reports: { | ||
// formats: { | ||
// // json: true, // defaults to false | ||
// html: true, // defaults to false | ||
// // csv: true, // defaults to false | ||
// }, | ||
// name: `latest-report`, // defaults to `lighthouse-${new Date().getTime()}` | ||
// directory: `${process.cwd()}../../../lighthouse-report`, // defaults to `${process.cwd()}/lighthouse` | ||
// }, | ||
// }) | ||
// }) | ||
|
||
// test('has title', async ({ page }) => { | ||
// await page.goto('/') | ||
|
||
// // Expect h1 to contain a substring. | ||
// expect(await page.locator('h1').textContent()).toContain('Sponsorship') | ||
// }) |