Prompt

How do I run browser-based regression tests in CI

Technology / Testing & QA1 observationLast seen Oct 26, 2026

Latest observation

Oct 26, 2026OpenAI APIWeb search: off

To run browser-based regression tests in CI, you typically:

  1. Choose a browser automation tool

    • Common options:
      • Playwright (recommended for new projects)
      • Cypress
      • Selenium/WebDriver
    • For regression testing, Playwright is often the easiest because it supports Chromium, Firefox, and WebKit with good CI support.
  2. Make tests deterministic

    • Seed test data
    • Mock external APIs where possible
    • Use stable selectors (data-testid, ARIA labels) instead of brittle CSS/XPath
    • Avoid depending on timing; wait for specific UI states
  3. Run in headless mode

    • CI environments usually don’t have a display server
    • Headless mode is standard for browser tests in CI
  4. Set up CI to install dependencies and browsers

    • Install app dependencies
    • Install browser binaries
    • Start any required backend/services
    • Run tests after the app is up
  5. Capture artifacts on failure

    • Screenshots
    • Videos
    • Trace files/logs
    • This helps debug flaky failures

Example: Playwright in CI

1) Install Playwright

npm install -D @playwright/test
npx playwright install --with-deps

2) Example test

import { test, expect } from '@playwright/test';

test('homepage loads', async ({ page }) => {
  await page.goto('http://localhost:3000');
  await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible();
});

3) GitHub Actions workflow

name: Browser Tests

on:
  push:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - run: npm ci

      - run: npx playwright install --with-deps

      - run: npm run build

      - run: npm run start &
      - run: npx wait-on http://localhost:3000

      - run: npx playwright test

      - name: Upload Playwright artifacts on failure
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: playwright-artifacts
          path: |
            playwright-report
            test-results

Best practices for regression tests in CI

  • Run a smaller smoke suite on every PR, full regression nightly or on merge
  • Parallelize tests to keep CI fast
  • Use retries sparingly to reduce flaky failures, but don’t hide real issues
  • Tag tests so you can split fast/slow or critical/noncritical suites
  • Use ephemeral test environments if your app depends on backend state
  • Reset DB/state between tests if tests mutate data

If you use Cypress instead

Cypress also works well in CI:

npm install -D cypress
npx cypress run

GitHub Actions example:

- run: npm ci
- run: npm run build
- run: npm start &
- run: npx wait-on http://localhost:3000
- run: npx cypress run

If you want, I can give you a ready-to-use CI config for GitHub Actions, GitLab CI, or Jenkins, or show the best setup for Playwright/Cypress in your stack.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.