Welcome to the Playwright + Lighthouse Puppeteer Automated Performance Testing project! This tool helps you measure and improve the performance of your web application by automating performance tests for both logged-in (authorized) and public (unauthorized) users. Whether you're a developer, QA engineer, or project manager, this tool makes it easy to ensure your website runs smoothly on both desktop, tablet and mobile devices.
- Automated Performance Testing: Combines the power of Playwright (for UI automation) and Puppeteer (for Lighthouse browser automation) to test your website's speed and responsiveness.
- Real User Scenarios: Tests both logged-in and public user flows to ensure your app performs well for all users.
- Cross-Device Testing: Runs tests on both desktop and mobile configurations to simulate real-world usage.
- Interactive Dashboard: Visualize performance results in an easy-to-understand dashboard deployed on Netlify.
- Easy to Use: Simple setup and clear instructions make it accessible for both technical and non-technical users.
- What Does This Tool Do?
- Getting Started
- Running Tests
- Understanding the Results
- Interactive Dashboard
- Continuous Integration (CI)
- Project Structure
- Dependencies
- FAQs
This tool automates performance testing for your web application by simulating two types of users:
- Authorized Users (Logged-In): Tests the performance of pages that require user login (e.g., dashboards, account settings).
- Unauthorized Users (Public): Tests the performance of public-facing pages (e.g., homepage, product listings).
It uses:
- Playwright: For UI automation (e.g., logging in, navigating pages).
- Puppeteer: For Lighthouse browser automation (e.g., running performance audits).
The results are displayed in an interactive dashboard deployed on Netlify, where you can visualize key performance metrics like:
- Page Load Time: How long it takes for your page to fully load.
- Time to Interactive (TTI): How long it takes for the page to become fully interactive.
- Performance Score: A score out of 100 that summarizes your page's performance.
Before you begin, make sure you have the following installed:
- Node.js: Download and install the latest LTS (Long Term Support) version from nodejs.org.
- npm: This comes pre-installed with Node.js.
To check if you have Node.js and npm installed, run these commands in your terminal:
node -v
npm -vIf you see version numbers, you're good to go! π
-
Clone the Repository: Download the project to your computer.
git clone https://github.com/your-repo/playwright-lighthouse-performance-testing.git cd playwright-lighthouse-performance-testing -
Install Dependencies: Install all the required tools and libraries.
npm ci
Note: Use
npm ciinstead ofnpm installto ensure the exact versions of dependencies are installed.
To test logged-in user flows, you need to provide login credentials. Create a .env file in the root of your project and add the following:
EMAIL=your_email@example.com
PASSWORD=your_passwordImportant: Never share your
.envfile or commit it to version control (e.g., GitHub). It contains sensitive information.
This project includes three types of tests:
Run performance tests for logged-in users:
npm run test:AuthThis will:
- Remove old performance reports.
- Run tests for both desktop and mobile configurations.
Run performance tests for public users:
npm run test:UnAuthThis will:
- Remove old performance reports.
- Run tests for both desktop and mobile configurations.
Run general performance tests (without focusing on login):
npm run testAfter running the tests, you'll find performance reports in the performance-report/ folder. These reports include:
- Performance Scores: A score out of 100 for each page.
- Metrics: Detailed metrics like page load time, time to interactive, and more.
- Recommendations: Suggestions for improving performance.
The performance results are visualized in an interactive dashboard deployed on Netlify and Render. You can access the dashboard here:
π Performance Matrix Dashboard
The dashboard provides:
- Visual Charts: Bar charts, line graphs, and pie charts to visualize performance metrics.
- Filter Options: Filter results by device type (desktop/mobile) or performance range (e.g., 100-80, 79-50, 49-0).
- Latest Run Data: View the latest performance results for each test.
Hereβs a sneak peek of the dashboard:
π Dashboard Screenshots
This project is set up to run tests automatically using GitHub Actions. Every time you push changes to the main or master branch, the tests will run, and performance reports will be generated and saved as artifacts.
Hereβs how the project is organized:
βββ tests
β βββ Auth
β β βββ performance.spec.ts # Tests for logged-in users
β βββ UnAuth
β β βββ performance.spec.ts # Tests for public users
βββ utils
β βββ helpers.ts # Helper functions for running tests
βββ lighthouse
β βββ base.ts # Lighthouse configuration
βββ test-data
β βββ enum.ts # URLs for testing
βββ .env # Environment variables (not included in repo)
βββ package.json # Project dependencies and scripts
βββ playwright.config.ts # Playwright configuration
βββ playwright.yml # GitHub Actions CI workflow
This project uses the following tools:
- Playwright: For UI automation (e.g., logging in, navigating pages).
- Puppeteer: For Lighthouse browser automation (e.g., running performance audits).
- Lighthouse: For performance audits.
- Netlify: For deploying the interactive dashboard.
- Dotenv: For managing environment variables.
All dependencies are listed in the package.json file.
Playwright is a tool for automating browser actions, like clicking buttons, filling forms, and navigating pages. Itβs used here to simulate user behavior.
Puppeteer is a Node.js library for controlling headless Chrome or Chromium. Itβs used here to automate Lighthouse performance audits.
Lighthouse is a tool by Google that audits web pages for performance, accessibility, SEO, and more. Itβs used here to measure how fast your website loads.
Yes! Just update the URLs in the test-data/enum.ts file to point to your website.
After running the tests, open the reports in the allure-report/index-html.
Follow the steps above to set up and run your performance tests. If you have any questions, feel free to reach out! π

