VKS1995 / GoogleLighthouse

Run Lighthouse along with Cypress to test performance of website behind authentication page

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run Lighthouse and Pa11y audits directly in Cypress test suites

License: GNU General Public License

Table of Content

Introduction

The first tool that most engineers probably associate with front end or client side performance testing is Google Lighthouse. So when I stumbled upon a Cypress plugin which lets you run Lighthouse audits directly from your Cypress tests, I had to share this knowledge with the community.

The following tools and applications are used in doing the audit.

  • Cypress - The web has evolved. Finally, testing has too. Fast, easy and reliable testing for anything that runs in a browser.
  • Lighthouse - To perform Performance audit with various parameters
  • Pa11y - Tools to analyze and improve the accessibility status of applications

This is an example repository to showcase how you can use cypress-audit to easily integrate lighthouse commands into your Cypress tests.

How to use the repo

  • Clone the repository
  • In the root folder run npm install to get all the dependencies required to run the test

Process and Working (Just for information)

The following things are configured as part of creating this demo.

Pre-Requisite

Adding dependencies and writing test

  • Information on adding dependencies for importing cypress-audit library is added in support folder.
  • Information on adding Lighthouse and Report Configuration is added in plugin folder.
  • Information on Test Case and Parameter for running the test is added in integration folder.
  • Cypress.json consist of BaseUrl and default timeouts which can be changed based on need.
  • package-lock.json consist of all the npm dependencies required to run Cypress and Lighthouse.

References

About

Run Lighthouse along with Cypress to test performance of website behind authentication page

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%