Coder Social home page Coder Social logo

lighthouse-puppeteer's Introduction

Puppeteer and Lighthouse

Using Google Puppeteer to run Google Lighthouse programmatically within a CI-CD environment and generate reports to measure performance accessibility and security on the fly.

Report sample against nature.com

Two projects

What is Lighthouse?

Google 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, and more.

What is Puppeteer?

Most things that you can do manually in the browser can be done using Google Puppeteer! Automate form submission, UI testing, keyboard input, etc. Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.

Setup

Install node via brew install node

Run

./build

Notes

  • Runs only Desktop compatibility tests, to run mobile pass in a different config to lighthouse
const report = await lighthouse(page.url(), opts, config).then(results => {
    return results;
});

lighthouse-puppeteer's People

Contributors

joviano-dias avatar

Stargazers

Krzysztof Raczyński avatar Ashik Nesin avatar Katsuro Kurosaki avatar  avatar Marc Wieland avatar Ayyappa Balasubramayam avatar Jesse Woo avatar Shaun avatar Kati Holasz avatar Carolyn Ma avatar Martin Cleaver avatar

lighthouse-puppeteer's Issues

Facing Issue while integrating with CI/CD

Hi @joviano-dias-springernature ,

I am facing error while automating this in CI/CD. Getting below error while running the test inside Docker image :

Error :
ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:37139 +1ms ChromeLauncher:error Logging contents of /tmp/lighthouse.lqSemFJ/chrome-err.log +0ms ChromeLauncher:error [0610/095945.085518:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. ChromeLauncher:error +0ms { Error: connect ECONNREFUSED 127.0.0.1:37139 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 37139 } (node:19) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:80 ChromeLauncher:error connect ECONNREFUSED 127.0.0.1:37139 +1ms ChromeLauncher:error Logging contents of /tmp/lighthouse.lqSemFJ/chrome-err.log +0ms ChromeLauncher:error [0610/095945.085518:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. ChromeLauncher:error +0ms { Error: connect ECONNREFUSED 127.0.0.1:37139 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 37139 } (node:19) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:80

Docker image :

`
FROM node-image:v10.16

USER root

RUN apt-get update && apt-get -y install chromium

RUN set -ex
&& apt-get update

# Chromium dependences
&& apt-get install -y
xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget &&
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /lighthouse

RUN chown -R root /lighthouse

RUN cd /lighthouse

COPY / /lighthouse

WORKDIR /lighthouse

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.