Check 46.12 · Automation and quality control

Integrate SEO, performance and accessibility tests into CI/CD

Block regressions before going live: Playwright SEO tests, axe, Lighthouse CI and Pa11y in GitHub Actions, GitLab CI, Vercel, Netlify, Laravel or Shopify.

Priority
Complementary
Difficulty
Advanced
Estimated time
1 to 2 days
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Integrating SEO, performance and accessibility tests into CI/CD (continuous integration and deployment) means having it checked automatically, on every merge request and before every production release, that key pages respond with a 200, remain indexable, keep their title, canonical and structured data, stay within the performance budget and do not break accessibility. Once this check is done, a change that would add a noindex or remove an H1 makes the pipeline fail, and the developer sees it before going live.

Why it matters

Most serious SEO regressions come from a deployment: a modified template loses its canonical, a staging environment variable turns on noindex in production, a new JavaScript library slows down rendering, a menu component becomes inaccessible from the keyboard. After-the-fact checks (scheduled crawls, traffic alerts, Search Console) detect them, but too late, when bots have already seen the broken pages.

A test in the pipeline acts beforehand. It costs a few minutes per run and needs no human vigilance: the pipeline rejects the change, with a message that says what to fix. It replaces neither the audit nor production monitoring: it covers a sample of pages, in a test environment, and only what someone thought of checking.

These tests also serve generative engines: AI assistants' crawlers often read the HTML without running JavaScript, and a test on the initial HTML checks that the essentials are in it.

What it improves

  • Prevention Regressions are blocked before the production release, instead of being discovered days later.
  • Indexing A noindex, a robots.txt block or a wrong canonical no longer goes unnoticed.
  • Performance The performance budget becomes a rule checked on every change. See set a performance budget (opens in a new tab).
  • Accessibility Errors that can be detected automatically (contrast, labels, ARIA attributes) are fixed as you go.
  • Cost Fixing before going live costs less than an incident in production.
  • Rankings An indirect effect, by avoiding regressions.

How to check

The setup is in place if:

  1. The pipeline configuration file (.github/workflows/*.yml, .gitlab-ci.yml, netlify.toml…) contains an SEO test step, a Lighthouse step and an accessibility step.
  2. These steps run on every merge request and can block the merge (branch protection or an equivalent rule).
  3. A deliberately broken test makes the pipeline fail: add <meta name="robots" content="noindex"> to the home page on a test branch and check that it fails.
  4. The reports (Lighthouse, Playwright) are kept as artifacts of each run.

How to implement

The examples follow the fictitious store Thé des Lisières, served by a Node.js application on port 3000. Adapt the paths and commands to your project.

Before you start

Decide what blocks and what warns. A test that is too strict and fails at random ends up disabled.

Check Tool Recommended level
HTTP 200 status code for key pages Playwright Blocking
No noindex on indexable pages, noindex on private pages Playwright Blocking
Title present in the initial HTML, meta description, at least one H1 Playwright Blocking
Expected canonical Playwright Blocking, in production only
Syntactically valid JSON-LD Playwright Blocking
Detectable WCAG A and AA accessibility errors axe Blocking
Lighthouse SEO and accessibility categories Lighthouse CI Blocking below 0.9
Lighthouse performance score and metrics Lighthouse CI Warning

Keep performance as a warning at first: lab measurements vary from one run to the next on CI machines. Lighthouse CI runs three measurements per URL by default and lets you keep the median run.

Choose 5 to 15 representative URLs, one per template: home page, category, product page, article, local page, private page (cart). The tests target the templates, not the content.

Good to know: automated accessibility tests only detect some of the problems. They replace neither a keyboard navigation test (opens in a new tab) nor a manual check.

Writing the SEO tests with Playwright

Versions Playwright Test and @axe-core/playwright, November 2026; Node.js 22 or 24.

Install the dependencies:

npm install -D @playwright/test @axe-core/playwright
npx playwright install --with-deps chromium

Create playwright.config.ts at the root. Without a BASE_URL variable, Playwright starts the application itself:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  testDir: './tests/seo',
  reporter: [['html', { open: 'never' }]],
  use: {
    baseURL: process.env.BASE_URL ?? 'http://localhost:3000',
  },
  webServer: process.env.BASE_URL
    ? undefined
    : {
        command: 'npm run start',
        url: 'http://localhost:3000',
        reuseExistingServer: !process.env.CI,
      },
});

Then tests/seo/seo.spec.ts:

import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

const PAGES = [
  { path: '/', indexable: true },
  { path: '/thes/the-vert/', indexable: true },
  { path: '/thes/the-vert/sencha-bio/', indexable: true },
  { path: '/panier/', indexable: false },
];
const PRODUCTION = process.env.SEO_ENV === 'production';

for (const { path, indexable } of PAGES) {
  test(`SEO ${path}`, async ({ page, request, baseURL }) => {
    const raw = await request.get(path, { maxRedirects: 0 });
    expect(raw.status(), 'HTTP status code').toBe(200);
    const html = await raw.text();
    const robotsHeader = raw.headers()['x-robots-tag'] ?? '';

    await page.goto(path);
    const seo = await page.evaluate(() => ({
      description: document.querySelector('meta[name="description"]')?.getAttribute('content') ?? '',
      robots: document.querySelector('meta[name="robots"]')?.getAttribute('content') ?? '',
      canonical: document.querySelector('link[rel="canonical"]')?.getAttribute('href') ?? '',
      h1: document.querySelectorAll('h1').length,
      jsonLd: [...document.querySelectorAll('script[type="application/ld+json"]')].map((s) => s.textContent ?? ''),
    }));

    expect(html, 'title in the initial HTML').toMatch(/<title[^>]*>[^<]{10,}<\/title>/i);
    expect(seo.description.length, 'meta description').toBeGreaterThan(50);
    expect(seo.h1, 'at least one H1').toBeGreaterThanOrEqual(1);
    for (const block of seo.jsonLd) {
      expect(() => JSON.parse(block), 'valid JSON-LD').not.toThrow();
    }

    const robots = `${seo.robots} ${robotsHeader}`;
    if (!indexable) {
      expect(robots, 'noindex expected').toMatch(/noindex/i);
      return;
    }
    if (PRODUCTION) {
      expect(robots, 'indexable page').not.toMatch(/noindex/i);
      expect(seo.canonical, 'canonical').toBe(new URL(path, baseURL).href);
    }
  });

  test(`accessibility ${path}`, async ({ page }) => {
    await page.goto(path);
    const results = await new AxeBuilder({ page })
      .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
      .analyze();
    expect(results.violations).toEqual([]);
  });
}

test('robots.txt without a global block', async ({ request }) => {
  test.skip(!PRODUCTION, 'production-only check');
  const robotsTxt = await (await request.get('/robots.txt')).text();
  expect(robotsTxt).not.toMatch(/^Disallow:\s*\/\s*$/m);
});

The indexability and canonical checks only run with SEO_ENV=production, because a staging site is normally set to noindex and its canonicals point to the production domain. The robots.txt test fails as soon as a Disallow: / line appears: if you deliberately block a specific bot entirely, adapt the expression so that it only checks the User-agent: * group. The presence of an H1 and the length of the description are conventions, not ranking rules: adjust them to your templates. To validate the content of structured data, keep using the Rich Results Test and the Schema Markup Validator (opens in a new tab).

Configuring Lighthouse CI

Versions Lighthouse CI 0.16, November 2026.

Create lighthouserc.json at the root:

{
  "ci": {
    "collect": {
      "url": [
        "http://localhost:3000/",
        "http://localhost:3000/thes/the-vert/",
        "http://localhost:3000/thes/the-vert/sencha-bio/"
      ],
      "startServerCommand": "npm run start",
      "numberOfRuns": 3
    },
    "assert": {
      "assertions": {
        "categories:seo": ["error", { "minScore": 0.9 }],
        "categories:accessibility": ["error", { "minScore": 0.9 }],
        "categories:performance": ["warn", { "minScore": 0.8, "aggregationMethod": "median-run" }],
        "is-crawlable": "error",
        "document-title": "error",
        "http-status-code": "error",
        "largest-contentful-paint": ["warn", { "maxNumericValue": 2500, "aggregationMethod": "median-run" }],
        "cumulative-layout-shift": ["warn", { "maxNumericValue": 0.1, "aggregationMethod": "median-run" }]
      }
    },
    "upload": {
      "target": "filesystem",
      "outputDir": "./lhci-rapports"
    }
  }
}

Run it with npx @lhci/[email protected] autorun. The thresholds of 2,500 ms for LCP (Largest Contentful Paint, rendering of the largest element) and 0.1 for CLS (Cumulative Layout Shift) match the “good” thresholds of the Core Web Vitals, but a lab measurement is not a field measurement: use it as a safeguard against regressions. The temporary-public-storage target from the documentation publishes the reports at a temporary public address; the filesystem target keeps them in the pipeline artifacts.

Adding Pa11y CI

Versions Pa11y CI 5, Node.js 22.13 and later.

Playwright and axe test a few templates on every merge request. Pa11y CI can go through every URL in a sitemap, which suits a nightly check of the staging site better. Create .pa11yci:

{
  "defaults": {
    "standard": "WCAG2AA",
    "runners": ["axe", "htmlcs"],
    "timeout": 60000,
    "chromeLaunchConfig": {
      "args": ["--no-sandbox"]
    }
  }
}

Then run npx pa11y-ci --sitemap https://staging.example.com/sitemap.xml. The command exits with code 2 if at least one page exceeds the error threshold (zero by default), which makes the job fail.

With GitHub Actions

Versions GitHub Actions, November 2026.

Create .github/workflows/qualite.yml:

name: SEO, performance and accessibility quality

on:
  pull_request:
  push:
    branches: [main]

jobs:
  qualite:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 24
          cache: npm
      - run: npm ci
      - run: npm run build
      - name: Install Chromium for Playwright
        run: npx playwright install --with-deps chromium
      - name: SEO and accessibility tests
        run: npx playwright test
      - name: Lighthouse CI
        run: npx @lhci/[email protected] autorun
      - name: Keep the reports
        if: always()
        uses: actions/upload-artifact@v7
        with:
          name: rapports-qualite
          path: |
            playwright-report
            lhci-rapports

Then make the check mandatory: Settings > Branches, protection rule for the main branch (or a ruleset), require the qualite job to pass before merging.

To check production after each release, add a second workflow triggered after the deployment or every night, with BASE_URL=https://www.example.com and SEO_ENV=production in env: Playwright then tests the live site without starting the application.

With GitLab CI

Versions GitLab CI/CD, November 2026.

In .gitlab-ci.yml, use an image that contains Node.js and Chrome, for example the one cited in the Lighthouse CI documentation:

qualite:
  image: cypress/browsers:node-22.21.0-chrome-141.0.7390.107-1-ff-144.0-edge-141.0.3537.92-1
  stage: test
  script:
    - npm ci
    - npm run build
    - npx playwright install --with-deps chromium
    - npx playwright test
    - npx @lhci/[email protected] autorun --collect.settings.chromeFlags="--no-sandbox"
  artifacts:
    when: always
    paths:
      - playwright-report
      - lhci-rapports
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Chrome must run with --no-sandbox in GitLab containers. To block the merge, turn on the Pipelines must succeed option in the project's merge request settings.

Vercel

Versions Vercel with the GitHub integration, all plans, November 2026.

Vercel creates a preview deployment for each branch and reports it to GitHub. A workflow triggered by the deployment_status event can test that URL:

name: Preview quality

on: deployment_status

jobs:
  qualite:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    env:
      BASE_URL: ${{ github.event.deployment_status.environment_url }}
      VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 24
      - run: npm ci
      - run: npx playwright install --with-deps chromium
      - run: npx playwright test

Two specifics:

  • Deployment protection: if previews are protected, create a secret in Settings > Deployment Protection > Protection Bypass for Automation and add it to Playwright's headers (use.extraHTTPHeaders with x-vercel-protection-bypass and x-vercel-set-bypass-cookie: 'true'), as shown in the Vercel documentation.
  • Noindex on previews: Vercel adds an X-Robots-Tag: noindex header to preview deployments. This is intended: leave SEO_ENV empty for these tests, and turn off the is-crawlable assertion if you run Lighthouse CI on these URLs.

Netlify

Versions Netlify with @netlify/plugin-lighthouse, November 2026.

Netlify's Lighthouse plugin runs on every build. Install it (npm install -D @netlify/plugin-lighthouse), then declare it in netlify.toml:

[[plugins]]
  package = "@netlify/plugin-lighthouse"

  [plugins.inputs]
    fail_deploy_on_score_thresholds = "true"

  [plugins.inputs.thresholds]
    performance = 0.8
    accessibility = 0.9
    best-practices = 0.9
    seo = 0.9

  [[plugins.inputs.audits]]
    path = "index.html"

  [[plugins.inputs.audits]]
    path = "thes/the-vert/index.html"

With fail_deploy_on_score_thresholds, the audit takes place before publishing, on the build files, and an insufficient score makes the deployment fail. This option does not suit pages rendered on demand on the server: test them with Playwright on the preview URL.

Next.js

Versions Next.js 15 and 16.

Always test the production build, never the development server, which serves different HTML and has different performance. In package.json, the build and start scripts (next build, next start) are enough: the Playwright configuration and lighthouserc.json above start npm run start on port 3000. Add one page from each dynamic route and one statically generated page to the PAGES list, and check that the title and canonical do come from generateMetadata in the initial HTML, which the check on the raw response does.

Laravel

Versions Laravel 12 and 13, Pest 4 and 5 with the browser testing plugin.

Pest's browser testing plugin drives Playwright and provides accessibility assertions:

composer require pestphp/pest-plugin-browser --dev
npm install playwright@latest
npx playwright install

Create tests/Browser/SeoTest.php:

<?php

it('serves the home page with a 200 and no noindex', function () {
    $this->get('/')
        ->assertOk()
        ->assertHeaderMissing('X-Robots-Tag')
        ->assertSee('<link rel="canonical"', escape: false);
});

it('renders an accessible home page with no JavaScript errors', function () {
    visit('/')
        ->assertTitleContains('Thé des Lisières')
        ->assertSourceMissing('noindex')
        ->assertNoSmoke()
        ->assertNoAccessibilityIssues();
});

it('excludes the cart from the index', function () {
    visit('/panier')->assertSourceHas('noindex');
});

assertNoAccessibilityIssues() fails by default on serious and critical issues; pass a level (from 0, critical, to 3, minor) to make it stricter. In GitHub Actions, after installing PHP and the Composer dependencies, add the steps documented by Pest: npm ci, npx playwright install --with-deps, then ./vendor/bin/pest --ci --parallel. For Lighthouse CI, use "startServerCommand": "php artisan serve --port=8000", URLs on http://127.0.0.1:8000/ and "startServerReadyPattern": "Server running", because Artisan's startup message does not match the default pattern.

WordPress

Versions WordPress 6.8 and later.

A WordPress site is rarely tested in the code repository itself, because the rendering depends on the database. Two approaches:

  • After deploying to staging: a GitHub Actions workflow triggered at the end of the deployment runs Playwright and Lighthouse CI on the staging URL (BASE_URL=https://staging.example.com). If staging is protected by HTTP authentication, pass the Authorization header in Playwright's use.extraHTTPHeaders and in Lighthouse CI's collect.settings.extraHeaders.
  • After the production release: the same workflow with SEO_ENV=production and the production URL checks in particular that the “Discourage search engines from indexing this site” box (Settings > Reading) has not been ticked by a copy of the staging database.

To test a theme or a plugin in isolation, @wordpress/env starts a local WordPress in Docker on the CI machine; you then need to import a set of test content so that the pages make sense.

Shopify

Versions Shopify Online Store 2.0, Shopify CLI 3 and shopify/lighthouse-ci-action@v1, November 2026.

For a theme versioned in GitHub:

  • Theme Check: shopify theme check analyzes the theme's Liquid code (errors, bad practices, some of the performance and accessibility problems). Run it in the pipeline after installing Shopify CLI.
  • Lighthouse CI for Shopify: the shopify/lighthouse-ci-action action uploads the theme to the store and runs Lighthouse on the home page, a product page and a collection:
- uses: shopify/lighthouse-ci-action@v1
  with:
    store: ${{ secrets.SHOP_STORE }}
    client_id: ${{ secrets.SHOP_CLIENT_ID }}
    client_secret: ${{ secrets.SHOP_CLIENT_SECRET }}
    lhci_min_score_performance: 0.6
    lhci_min_score_accessibility: 0.9

The credentials come from an app created for the store, with permission to write themes; see the action's page for the exact scopes. The performance threshold of 0.6 is the action's default value: the scripts of installed apps weigh on store scores.

Common mistakes

  • Testing staging like production: staging is set to noindex and its canonicals point elsewhere. Separate the checks by environment.
  • Making performance blocking from day one: lab measurements vary on CI machines, and random failures discredit the whole pipeline.
  • Testing the development server instead of the production build: HTML, scripts and performance differ.
  • Publishing Lighthouse reports to public storage without knowing it: the temporary-public-storage target makes the reports accessible to anyone who has the address.
  • Testing only the home page: a regression often affects a single template.
  • Leaving a test failing without fixing it, then disabling it: remove a check explicitly, with a reason, rather than leaving the pipeline red.
  • Believing that a Lighthouse accessibility score of 100 is enough: automated checks only see some of the problems.

Frequently asked questions

Which SEO tests should you automate in CI/CD?

First automate the checks behind the most serious incidents: HTTP 200 status code for key pages, no noindex on indexable pages, title present in the initial HTML, expected canonical in production, valid JSON-LD and a robots.txt with no global block. Test one page per template. Then add the Lighthouse SEO and accessibility categories, and performance as a simple warning.

Is Lighthouse CI reliable enough to block a deployment on performance?

Not at first. Lab performance measurements vary from one run to the next, especially on shared CI machines. Run three measurements per URL, keep the median run and leave performance as a warning while you observe the variability. The SEO and accessibility categories, which are much more stable, can block from the start with a 0.9 threshold.

How do you test the SEO of Vercel preview deployments?

Trigger a GitHub Actions workflow on the deployment_status event when the state is success, and pass the preview URL to Playwright or Lighthouse CI. Vercel adds an X-Robots-Tag: noindex header to previews: do not test indexability there. If previews are protected, use the Protection Bypass for Automation secret, sent in the x-vercel-protection-bypass header.

Are automated accessibility tests enough?

No. Tools such as axe, Pa11y or Lighthouse detect some of the problems, such as insufficient contrast, images without alternative text or fields without a label, but not everything: reading order, relevance of alternative text, use with a keyboard or a screen reader. Keep them in CI to prevent regressions, and add regular manual tests.

Updated on

Topic checklist (PDF)

And now?

In the “Automation and quality control” topic

  1. Schedule automated crawls
  2. Monitor HTTP status codes and uptime
  3. Monitor robots.txt and noindex
  4. Monitor canonicals and sitemaps
  5. Monitor titles and structured data
  6. Monitor performance
  7. Monitor backlinks and brand mentions
  8. Monitor rankings
  9. Schedule recurring GEO tests
  10. Create alerts for traffic and conversion drops
  11. Create deindexing alerts
  12. Integrate SEO, performance and accessibility tests into CI/CD
  13. Review template changes
  14. Keep a history of changes
  15. Keep an incident log
  16. Generate periodic reports
  17. Assign an owner to each issue