mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 23:55:20 +00:00
720c2ca909
* Add cloudflare job to publish pages * Try like this * Fix build path * Try end to end * Fix installation * Use var instead of secret for CLOUDFLARE_PROJECT_NAME * Use new puppeteer mode * Add more tests * Run in parallel * Go back to no-concurrency * Test pagespeed * Print output * Fix thresholds
38 lines
798 B
TypeScript
38 lines
798 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('');
|
|
}
|