Getting wrong performance score with lighthouse/Playwright

  Kiến thức lập trình

I am running lighthouse test using playwright to calculate performance score but seems it’s capturing wrong score (~95), when tried same using lighthouse chrome extension or through Puppeteer getting score of ~60.

Script :-

import {playAudit} from "playwright-lighthouse";
import {test, chromium} from "@playwright/test";
import lighthouseDesktopConfig from "lighthouse/core/config/lr-desktop-config.js"
import path from "node:path";
import * as os from "os";

const options = {
    loglevel: "info",

test(`Ligthouse test`, async ({page}) => {
    const userDataDir = path.join(os.tmpdir(), 'pw', String(Math.random()));
    const context = await chromium.launchPersistentContext(userDataDir, {
        args: ['--remote-debugging-port=9222'],
        headless: false
    page = await context.newPage();

    await page.goto("");
    await verifyPageLoad(page);
    await context.close();

var thresholds = {
    performance: 50

async function verifyPageLoad(page) {

    await playAudit({
        page: page,
        config: lighthouseDesktopConfig,
        thresholds: thresholds,
        port: 9222,
        opts: options,
        reports: {
            formats: {
                html: true, //defaults to false
                json: true
            name: `ligthouse-${new Date().toISOString()}`, //defaults to `lighthouse-${new Date().getTime()}`
            directory: `${process.cwd()}/lighthouse`, //defaults to `${process.cwd()}/lighthouse`