GoogleChrome / GoogleChrome/lighthouse
Support selectors in config to validate page load or throw pageLoadError
- Dominant language
- JavaScript
- Stars
- 30.8k
- Forks
- 9.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Description
E2E-Testing with lighthouse is not always as straight-forward as we'd like. Chrome might refuse to start temporarily, the debug-port might not be open, the tested service might have a hickup.
I'd like to introduce functionality for validating a page before performing a lighthouse analysis and would like to invalidate the complete report, if the validator fails (similar to the NO_FCP behavior).
**Questions**
1) Where would I best do this to keep within the lighthouse architecture? The NO_FCP-error is thrown quite early, before the gatherers are run - which was the place I'd thought it would fit best. Does it need to be implemented out-of-band by utilizing the webdriver to first navigate to the page first before attaching lighthouse to it? Where's the best place to implement it in the lighthouse architecture?
2) How to invalidate the complete report, similar to what NO_FCP does?
3) I would like to validate simply by providing two configuration options: Both consist of an array of html selectors (XPath or something similar) - one defines one or more selectors that need to be present to identify a *good* state (so lighthouse should perform a test, e.g. that at least three product results are shown on the page), the other defines one of more selectors that need to be present to identify a *bad* state (so lighthouse should abort with an error instead, e.g. an error message on the html page).
Contributor guide
Assessment
This issue has not been assessed yet.