Lighthouse desktop emulation settings are wrong

This run specified Chrome and desktop default: testing for screene...em : homedepot.com - WebPageTest Result.

I also enabled lighthouse:

.

This caused lighthouse to be launched with the following command line parameters:

 --form-factor desktop --screenEmulation.disabled --chrome-flags="--user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/117.0.0.0 Safari/537.36 

See the lighthouse log here.

In the lighthouse json report, there is a section called configSettings that shows the conflict:

"formFactor": "desktop",
    "screenEmulation": {
      "mobile": true,
      "width": 412,
      "height": 823,
      "deviceScaleFactor": 1.75,
      "disabled": true
    },
    "emulatedUserAgent": "Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36",

I discovered this because I realized that lighthouse was referring to a mobile version of a web page where as WPT itself was referring to the desktop version.

I believe the lighthouse should be launched with:

 --form-factor desktop --presets desktop

which would be fixed by changing the following lines of code: https://github.com/catchpoint/WebPageTest.agent/blob/465638a486fedde645e5e4c602fe160d8ca31332/internal/devtools_browser.py#L873.

Thanks. Looks like some time since the code was originally created, Lighthouse added a new param to pass a UA string (and defaults to a mobile UA string if not provided).

PR is in flight: Fixed the lighthouse user agent string by pmeenan · Pull Request #641 · catchpoint/WebPageTest.agent · GitHub

Do you also plan to set the screenEmulation parameters to have them match the WPT agent device chosen by the tester? For instance, when we launch lighthouse with “–form-factor desktop --preset desktop”, we get the following for screenEmulation in the lighthouse json:

"screenEmulation": {
      "mobile": false,
      "width": 1350,
      "height": 940,
      "deviceScaleFactor": 1,
      "disabled": false
    }

Thanks,

Peter