User story
As a user, I would like to run Lighthouse on multiple pages in my app, to get a more holistic report of my app's performance, accessibility, etc. But the Lighthouse plugin currently only supports a single URL.
Proposal
We can easily accept an array of URLs and orchestrate multiple Lighthouse reports. The more tricky question is how to process the results from multiple pages. Lighthouse CI creates separate Lighthouse reports per page and doesn't attempt to aggregate them in any way.
The most reasonable solution is to generate the same audits and groups for each page - slugs would be performance-1, accessibility-1, performance-2, etc (display titles would include the source URL for readability). These could then be combined into a single category using multiple refs (e.g. performance category will reference groups performance-1, performance-2, etc.) - we could provide a helper function for that.
import lighthousePlugin, { mergeLighthouseCategoriesFromUrls } from '@code-pushup/lighthouse-plugin';
const lhPlugin = lighthousePlugin([
'https://example.com',
'https://example.com/about',
'https://example.com/contact'
]);
export default {
plugins: [
lhPlugin,
// ... other plugins ...
],
categories: [
...mergeLighthouseCategories(lhPlugin),
// ... other categories ...
],
};
Since it's likely that some pages in an application will be more likely than others, we could enable users to each URL their own weight to reflect this in the score calculation.
lighthousePlugin({
'https://example.com': 2,
'https://example.com/about': 1
'https://example.com/contact': 1,
});
Acceptance criteria
User story
As a user, I would like to run Lighthouse on multiple pages in my app, to get a more holistic report of my app's performance, accessibility, etc. But the Lighthouse plugin currently only supports a single URL.
Proposal
We can easily accept an array of URLs and orchestrate multiple Lighthouse reports. The more tricky question is how to process the results from multiple pages. Lighthouse CI creates separate Lighthouse reports per page and doesn't attempt to aggregate them in any way.
The most reasonable solution is to generate the same audits and groups for each page - slugs would be
performance-1,accessibility-1,performance-2, etc (display titles would include the source URL for readability). These could then be combined into a single category using multiple refs (e.g.performancecategory will reference groupsperformance-1,performance-2, etc.) - we could provide a helper function for that.Since it's likely that some pages in an application will be more likely than others, we could enable users to each URL their own weight to reflect this in the score calculation.
Acceptance criteria
lighthousePluginfunctionlighthousefor each URL sequentially