Lighthouse Integration with Docker

In this blog, we are going to integrate Lighthouse with our Test automation framework and running them on Docker. If You are not aware of Lighthouse and basic integration with the Test automation framework, I will suggest going through my previous blog LightHouse Integration with Test Automation Framework.

  1. Basics of Docker and Docker compose File
  2. Walkthrough my previous blog — Lighthouse with Test Automation Framework
  1. If your Lighthouse Audit is working fine in your local system but not on Docker
  2. Your lighthouse chrome launcher is not connecting and throwing errors -
connect ECONNREFUSED 127.0.0.1:32867

3. You are getting, Chrome/Chromium binary path that is not available.

4. You might try with Chromium or Puppeteer and it's connecting with Lighthouse also but you are still getting errors —

read ECONNRESETLH:CriConnection:warn Cannot create new tab; reusing open tab.

if You are also getting the errors mentioned above, then I hope this blog will help you.

We analyzed the actual need for Lighthouse is, Instance of an Actual chrome, and the port for chrome launcher should be the same as the port of our actual chrome.

We are going to pull chrome image also on docker and the port we are going to assign to chrome image, the same port we will use for chrome launcher also in Lighthouse.

Docker Compose File :

In our Docker. compose file, We assigned PORT 3000 to the Chrome service. We are going to assign the same port to ChromeLauncher also.

You are all set Now. You can run your Lighthouse audit on Docker too.

Happy Learning !!.