chore: Add additional audits to Lighthouse report

This commit is contained in:
Florian Zia 2024-11-12 11:49:49 +01:00
Родитель 61c04f5f0b
Коммит 4a4e9ae1e2
Не найден ключ, соответствующий данной подписи
3 изменённых файлов: 18 добавлений и 6 удалений

2
.github/workflows/lighthouse_cron.yml поставляемый
Просмотреть файл

@ -27,4 +27,4 @@ jobs:
npm install -g @lhci/cli@0.14.x
npm run lighthouse
env:
LIGHTHOUSE_COLLECT_URL: "https://stage.firefoxmonitor.nonprod.cloudops.mozgcp.net"
LIGHTHOUSE_COLLECT_URL: ${{ secrets.LIGHTHOUSE_COLLECT_URL }}

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const pages = ["/", "/breaches"];
const pages = ["/", "/breaches", "/breach-details/InternetArchive"];
const collectBaseUrl =
process.env.LIGHTHOUSE_COLLECT_URL ?? "http://localhost:3000";

Просмотреть файл

@ -5,11 +5,21 @@
import Sentry from "@sentry/nextjs";
import { logger } from "../../app/functions/server/logging";
// The location autocomplete data will be created during the build step.
// @ts-ignore-next-line
// eslint-disable-next-line import/no-unresolved
import lighthouseResults from "../../../.lighthouseci/manifest.json";
const SENTRY_SLUG = "cron-report-lighthouse-results";
const AUDITS_TO_INCLUDE = ["first-contentful-paint", "interactive"];
const AUDITS_TO_INCLUDE = [
"first-contentful-paint",
"largest-contentful-paint",
"speed-index",
"total-blocking-time",
"max-potential-fid",
"layout-shifts",
"server-response-time",
"interactive",
];
Sentry.init({
dsn: process.env.SENTRY_DSN,
@ -37,9 +47,11 @@ async function run() {
.map(async (medianResult) => {
const { jsonPath, url, summary } = medianResult;
const fullReport = await import(jsonPath);
const audits = AUDITS_TO_INCLUDE.map(
(auditId) => fullReport.audits[auditId],
);
const audits = AUDITS_TO_INCLUDE.map((auditId) => {
const { id, score, numericValue } = fullReport.audits[auditId];
return { id, score, numericValue };
});
return { url, summary, audits };
}),
);