lighthouse-ci icon indicating copy to clipboard operation
lighthouse-ci copied to clipboard

Second run and beyond falls back to old Chrome headless mode

Open dcsaszar opened this issue 6 months ago • 1 comments

Describe the bug

The Chrome --headless=new option is only effective on the first run because of repeated --headless=new --headless=new ... for the other runs, which apparently triggers the old headless mode.

To Reproduce Steps to reproduce the behavior:

  1. Pick a URL that reports a significantly lower or higher performance with the --headless=new mode compared to --headless.
  • I use https://dev.d33869rf57mkjo.amplifyapp.com/ as an example here (found in https://github.com/GoogleChrome/lighthouse/issues/6708).
  • http://www.lumme.info/ (from https://github.com/GoogleChrome/lighthouse/issues/14957) should also show an effect (only terminate with --headless=new)
  1. Use this .lighthouserc.yml:
ci:
  assert:
    assertions:
      categories:performance: [error, minScore: 0]
    includePassedAssertions: true
  collect:
    url:
      - https://dev.d33869rf57mkjo.amplifyapp.com/
  upload:
    outputDir: .lighthouseci/results
    target: filesystem
  1. npx lhci autorun
  2. Check the three reported values
  • The first value matches the score of the browser devtools Lighthouse.
  • The second and third score are different from the first.
Checking assertions against 1 URL(s), 3 total run(s)

1 result(s) for https://dev.d33869rf57mkjo.amplifyapp.com/ :

  ✅  categories.performance passing for minScore assertion
        expected: >=0
           found: 1
      all values: 1, 0.73, 0.72

Expected behavior

  • All three scores should be similar.
  • All three scores should match the browser devtools Lighthouse result.

The expected behavior can be enforced by adding under collect::

    headful: true
    settings:
      chromeFlags: --headless=new
Checking assertions against 1 URL(s), 3 total run(s)

1 result(s) for https://dev.d33869rf57mkjo.amplifyapp.com/ :

  ✅  categories.performance passing for minScore assertion
        expected: >=0
           found: 1
      all values: 1, 1, 1

Environment (please complete the following information):

  • OS: macOS 14.5
  • Browser: Chrome
  • Version: 127.0.6533.89

Additional context

console.log({chromeFlagsAsString}) in static computeArgumentsAndCleanup(url, options) logs the problem.

dcsaszar avatar Aug 03 '24 00:08 dcsaszar