-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does it work with headless Chrome? #2008
Comments
Some related material:
When I tested some time ago, there were bugs with headless that skewed the lighthouse perf numbers. It's possible those have been worked out since. See my comment in #1970 (comment) for more info. |
@ebidel can we close this? As your IO talks cover lots of this |
Lighthouse works with --headless but we need to do some testing to verify any perf skew is acceptable. |
@paulirish @ebidel I did some testing for I wrote a simple script: const lighthouse = require('lighthouse')
const { launch } = require('lighthouse/chrome-launcher/chrome-launcher')
function launchChromeAndRunLighthouse (url, launchFlags = {}) {
return launch(launchFlags).then(chrome => {
const flags = { output: 'json', port: chrome.port }
return lighthouse(url, flags).then(r => {
return new Promise((resolve) => setTimeout(resolve, 500)).then(() => { // wait a little
return chrome.kill().then(() => {
console.log('url: %s, launch flags: %j', url, launchFlags)
console.log('fast pwa: %s, %s', r.audits['load-fast-enough-for-pwa'].score, r.audits['load-fast-enough-for-pwa'].debugString)
console.log('fmp: %s', r.audits['first-meaningful-paint'].displayValue)
console.log('pwa score: %s, perf score: %s', getScore(r, 'Progressive Web App'), getScore(r, 'Performance'))
console.log('run time: %sms', r.timing.total)
})
})
})
})
}
function getScore (result, scoreName) {
const score = result.aggregations.find(({ name }) => name === scoreName)
return score ? (100 * score.total).toFixed(2) : null
}
const url = 'https://developers.google.com/'
launchChromeAndRunLighthouse(url)
// launchChromeAndRunLighthouse(url, { chromeFlags: ['--headless', '--remote-debugging-port=9222'], port: 9222 }) regular run of https://developers.google.com/:
run with
the similar pattern appears with other websites, for example https://www.nytimes.com
|
@alekseykulikov awesome analysis. I've also observed network throttling issues under headless chrome. Basically, no built-in latency to the requests...which is why the "load-fast-enough-for-pwa" audit fails and the perf numbers are off. I'm going to pass this off to the Headless Chrome team to see what they can do :) |
This is a known issue with headless chrome atm: https://bugs.chromium.org/p/chromium/issues/detail?id=728451 (no support for network throttling) |
Mostly resolved by #2675 but needs docs, basically. |
Should I stop using Xvfb in our CI?
The text was updated successfully, but these errors were encountered: