Problem/Motivation

Lighthouse is an open-source, automated tool for improving the quality of web pages. You can run it against any web page, public or requiring authentication. It has audits for performance, accessibility, progressive web apps, SEO, and more.

https://developer.chrome.com/docs/lighthouse/overview

Lighthouse is a yardstick on which a websites quality can be graded. Since Drupal CMS creates functionality out of the box, we should verify that functionality is best in class.

Lighthouse works by running audits on a URL and grading the results. There is even a Drupal Stack Pack which offers recommendations on making improvements.

Proposed resolution

Add Lighthouse testing to DDEV
Add Lighthouse testing to Gitlab (Can be integrated from Tugboat)

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#16 img07-unlighthouse.png281.45 KBtunic

Issue fork byte-3479394

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thejimbirch created an issue. See original summary.

thejimbirch’s picture

jurgenhaas’s picture

What you could also do is to use https://unlighthouse.dev/ which offers the same (?) functionality but let's you running it in your own stack, like e.g. GitLab pipelines. Just to make sure we don't get throttling issues like we currently see with GitHub.

phenaproxima’s picture

Assigned: Unassigned » phenaproxima

Self-assigning to investigate.

phenaproxima’s picture

Title: Add Google Lighthouse testing » [PP-1] Add Google Lighthouse testing
Status: Active » Postponed

Since this requires Chrome to be available, I'll block this on #3479386: Add Cypress for end-to-end testing, which will add Cypress (including Chrome) to our infrastructure and thus facilitate more easily running Lighthouse.

phenaproxima’s picture

Title: [PP-1] Add Google Lighthouse testing » Add Google Lighthouse testing
Status: Postponed » Active

Blocker's in.

phenaproxima’s picture

Assigned: phenaproxima » Unassigned
Issue tags: +Accessibility, +Performance

It seems pretty straightforward to at least add Unlighthouse to our DDEV setup. I tried it and was able to get a report generated. But I am not an expert; anyone else want to take this on?

If there's a DDEV add-on for Unlighthouse, that's probably the more preferable way to go.

ressa’s picture

Thanks @dunx! Perhaps add them as "Related issues"? This way, there's a two way connection between them.

kentr’s picture

Noting this DDEV add-on: https://github.com/Metadrop/ddev-lighthouse

I'm curious how to get lighthouse into functional javascript tests with the existing use of Selenium.

Would the accessibility tests provided by Lighthouse offer more than accessibility tests directly using Axe-core?

mgifford’s picture

My understanding is that the Lighthouse test are the same as Deque's axe-core. Google uses axe-core.

tunic’s picture

Hi, I'm from Metadrop and we are using https://github.com/Metadrop/ddev-lighthouse internally for our tests and QA process. We would be glad to help if you want to use it or take ideas from it.

We are currently working to improve it to make it easier to use.

ressa’s picture

ressa’s picture

phenaproxima’s picture

Project: Drupal CMS development repository » Byte
Version: » 1.x-dev
Component: Infrastructure » Miscellaneous
Priority: Minor » Normal

I'm moving this over to Byte's queue, because this is most valuable for site templates, not Drupal CMS itself. I think it would make a ton of sense for Byte to have automatic Lighthouse testing on CI.

tunic’s picture

StatusFileSize
new281.45 KB

By the way, I would use Unlighthouse instead of Lighthouse. Unlighthouse executes Lighthouse in a complete site, providing a report that cover all discoverer pages. It detects patterns in URL to avoid reviewing the same type of paga again and again (for example, it tests a few products in a shop instead of all products), it can follow the sitemap or autodiscover the URLs to check.

See its home page: https://unlighthouse.dev/.

Example of output:

A screenshot of an Unlighthouse report

The first line is a score calculated taking into account all visited pages. Each line below is the Lighthouse report for each visited page. Each report line can be clicked to see all the details. Unlighthouse can be run locally or in a CI system.

We maintain a DDEV addon for Unligthouse: https://github.com/Metadrop/ddev-unlighthouse

phenaproxima’s picture

Title: Add Google Lighthouse testing » Add Unlighthouse accessibility testing on CI