Files
gitbook/tests/pagespeed-testing.ts
Greg Bergé 5a5b4bb93c Replace Puppeteer by Playwright (#224)
* Replace Puppeteer by Playwright

* Remove the limit of workers on ci

* Various fixes after review

* Document things
2024-03-08 10:41:30 +01:00

39 lines
799 B
TypeScript

import psi from 'psi';
import { getContentTestURL, getTargetURL } from './utils';
interface Test {
url: string;
strategy: 'mobile' | 'desktop';
threshold: number;
}
const tests: Array<Test> = [
{
url: 'https://docs.gitbook.com',
strategy: 'desktop',
threshold: 90,
},
{
url: 'https://docs.gitbook.com',
strategy: 'mobile',
threshold: 80,
},
];
console.log(`Starting PageSpeed testing with ${getTargetURL()}...`);
for (const test of tests) {
const url = getContentTestURL(test.url);
console.log(`Testing ${url} on ${test.strategy}...`);
await psi.output(url, {
strategy: test.strategy,
threshold: test.threshold,
key: process.env.PAGESPEED_API_KEY,
});
console.log('');
}