GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.33k stars 633 forks source link

The puppeteerLaunchOptions seems not working #947

Closed yixuanhou closed 1 week ago

yixuanhou commented 9 months ago

Describe the bug I suspect the puppeteerLaunchOptions is not working because I passed "new" to the headless option, and I still get the headless deprecation warning. I also tried passing false to it, and getting the same warning and there was no chrome instance launched. Screenshot 2023-10-09 at 10 59 44 AM

To Reproduce

  1. setting up .lighthouserc.js
    module.exports = {
    ci: {
    collect: {
      staticDistDir: "./build",
      puppeteerScript: "./puppeteer-script.js",
      puppeteerLaunchOptions: {
        headless: false,
        slowMo: 100,
      },
      settings: {
        disableStorageReset: true,
      },
      numberOfRuns: 1,
    },
    assert: {
      preset: "lighthouse:recommended",
    },
    },
    };

    And setting up puppeteer-script.js.

module.exports = async (browser, context) => {
  const page = await browser.newPage();

  await page.goto(context.url);

  await page.waitForSelector('input[type="email"]');

  await page.type('body input[type="email"]', user);
  console.log("email typed");
  await page.click('body input[type="submit"]');
  await page.type('body input[type="password"]', pwd);
  console.log("password typed");
  await page.click('body input[type="submit"]');

  await page.click('body input[type="submit"]');
};

Expected behavior I'm expecting when I set the headless to be false, after run lhci collect, a chrome browser gets launched so that I can debug the log in steps.

jeremyfrank commented 6 months ago

I am experiencing the same issue when passing { headless: "new" } to puppeteerLaunchOptions. The old headless deprecation warning still appears.

jakub-izbicki-wttech commented 5 months ago

Same for me.

danaragao commented 3 months ago

Still and issue, anyone looking at this?

romulo-rosinha commented 2 weeks ago

it works with cli option headful https://github.com/GoogleChrome/lighthouse-ci/blob/6914f5be825ea23e09edcd5cb46660b06dc38100/docs/configuration.md?plain=1#L206

it has preference over puppeteerLaunchOptions: https://github.com/GoogleChrome/lighthouse-ci/blob/6914f5be825ea23e09edcd5cb46660b06dc38100/packages/cli/src/collect/puppeteer-manager.js#L61-L68