DEV Community

Discussion on: Testing Web Vitals With Cypress

Collapse
 
craigmorten profile image
Craig Morten • Edited

Hey @ir3ne 👋

Yes I would expect the results to be different. You will encounter some natural variation regardless (even between runs on the same page with lighthouse) due to volatility in network etc., but beyond that I’d generally expect the results to be slower reported by this package than by Lighthouse.

With this package we’re running the page instrumented with Cypress which will have a performance impact compared with just loading the page in the browser by itself. It also is injecting the web-vitals snippet into the page to get the results which suffers from the Observer Effect of introducing extra page weight (though minimised best as possible). Lighthouse (assuming devtools) doesn’t suffer from these points so likely gives a more accurate reading of performance (unless using lighthouse and Cypress, in which case it depends).

If you want your “lab” results to be as close to real user performance then lighthouse is likely better (though with the caveat that even lighthouse isn’t realistic, only real user monitoring can give a real gauge!). If using for relative performance budgeting/benchmarks then either is hopefully fine 🙃

Collapse
 
ir3ne profile image
irène

@craigmorten thanks for your exhaustive reply. I appreciate that :)