Automated accessibility testing with Lighthouse Accessibility

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Accessibility Testing with Lighthouse

Lighthouse is Google's tool for auditing web application quality: performance, accessibility, SEO, best practices. The accessibility score (0–100) is based on axe-core and covers WCAG 2.1 AA. It runs via CLI, Chrome DevTools, or Node.js API.

Lighthouse CLI

npm install -g lighthouse

# Basic audit
lighthouse https://example.com --only-categories=accessibility --output=json --output-path=report.json

# Headless audit
lighthouse https://example.com \
  --chrome-flags="--headless --no-sandbox" \
  --only-categories=accessibility \
  --output=html,json \
  --output-path=./reports/lighthouse

Node.js API for Batch Audit

// scripts/lighthouse-audit.js
const lighthouse = require('lighthouse');
const chromeLauncher = require('chrome-launcher');
const fs = require('fs');

const PAGES = [
  { url: 'http://localhost:3000',          name: 'Homepage' },
  { url: 'http://localhost:3000/catalog',  name: 'Catalog' },
  { url: 'http://localhost:3000/product/1', name: 'Product Card' },
  { url: 'http://localhost:3000/checkout', name: 'Checkout' },
];

async function runAudit() {
  const chrome = await chromeLauncher.launch({
    chromeFlags: ['--headless', '--no-sandbox', '--disable-gpu'],
  });

  const results = [];

  try {
    for (const page of PAGES) {
      const runnerResult = await lighthouse(page.url, {
        port:             chrome.port,
        onlyCategories:   ['accessibility'],
        formFactor:       'desktop',
        throttling:       { cpuSlowdownMultiplier: 1 },
        screenEmulation: { disabled: true },
      });

      const score = runnerResult.lhr.categories.accessibility.score * 100;
      const audits = runnerResult.lhr.audits;

      // Collect only failing checks
      const failures = Object.values(audits)
        .filter(a => a.score !== null && a.score < 1 && a.score >= 0)
        .map(a => ({ id: a.id, title: a.title, score: a.score }));

      results.push({ ...page, score, failures });
      console.log(`${page.name}: ${score}/100`);
    }
  } finally {
    await chrome.kill();
  }

  // Generate summary
  const minScore = Math.min(...results.map(r => r.score));
  console.log(`\nMinimum score: ${minScore}/100`);

  fs.writeFileSync('lighthouse-summary.json', JSON.stringify(results, null, 2));

  // Exit if score below threshold
  if (minScore < 90) {
    console.error('Accessibility below threshold 90!');
    process.exit(1);
  }
}

runAudit().catch(console.error);

Key Accessibility Checks in Lighthouse

Audit ID Description Impact on Score
color-contrast Text contrast (4.5:1 for AA) High
image-alt Alt attribute on images High
button-name Buttons with accessible name High
label Form fields linked with label High
heading-order Correct heading hierarchy Medium
link-name Links with meaningful text Medium
html-has-lang Lang attribute on html element Low
aria-* ARIA attribute correctness Varies

GitHub Actions Integration

# .github/workflows/lighthouse.yml
name: Lighthouse Accessibility
on: [pull_request]

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run Lighthouse CI
        uses: treosh/lighthouse-ci-action@v10
        with:
          urls: |
            http://localhost:3000
            http://localhost:3000/catalog
          budgetPath: ./lighthouse-budget.json
          uploadArtifacts: true

      - name: Assert scores
        run: |
          node scripts/assert-lighthouse-scores.js
// lighthouse-budget.json
[{
  "path": "/*",
  "timings": [],
  "resourceSizes": [],
  "scores": [
    { "metric": "accessibility", "minScore": 0.9 }
  ]
}]

Timeline

Setting up Lighthouse audit with budgets and CI integration: 1–2 business days.