Skip to content

Configuration

UI QA is configured through environment variables. This page documents all available options.

API Key

An OpenRouter API key is required. OpenRouter provides unified access to various LLM providers including OpenAI, Anthropic, and Google.

Obtaining a Key

  1. Visit openrouter.ai
  2. Create an account or sign in
  3. Navigate to Keys in the dashboard
  4. Generate a new key (format: sk-or-v1-...)

Setting the Key

Environment Variable

bash
export OPENROUTER_API_KEY=sk-or-v1-your-key-here

Add to your shell profile (~/.bashrc, ~/.zshrc) for persistence.

.env File

Create a .env file in your working directory:

ini
OPENROUTER_API_KEY=sk-or-v1-your-key-here

Security

Add .env to .gitignore to avoid committing credentials.

Environment Variables

Required

VariableDescription
OPENROUTER_API_KEYAPI key for LLM access

LLM Configuration

VariableDefaultDescription
OPENROUTER_MODELanthropic/claude-sonnet-4.5Model identifier
GOALShomepage UX + primary CTA + form validation + keyboardTesting objectives

Test Limits

VariableDefaultDescription
MAX_STEPS20Maximum total test steps
MAX_PAGES50Maximum pages to discover and test
STEPS_PER_PAGE5Maximum steps per individual page
PARALLEL_BROWSERS5Concurrent browser instances (1–10)

Timeouts

VariableDefaultDescription
BROWSER_TIMEOUT60000General browser timeout (ms)
NAVIGATION_TIMEOUT45000Page load timeout (ms)
ACTION_TIMEOUT15000Click/fill action timeout (ms)

Retry Behavior

VariableDefaultDescription
MAX_RETRIES3Retry attempts before skipping
RETRY_DELAY_MS1000Initial retry delay (doubles each attempt)

Features

VariableDefaultDescription
AUDITS_ENABLEDtrueRun accessibility and performance audits
STRICT_MODEfalseFail on any error (vs. skip and continue)
CAPTURE_BEFORE_AFTERtrueCapture screenshots before and after actions
DEBUGfalseEnable verbose logging

Viewports

UI QA tests three viewport sizes by default:

ViewportDimensions
Desktop1365×768
Tablet820×1180
Mobile390×844

Override with the VIEWPORTS variable:

bash
VIEWPORTS="desktop:1920x1080,tablet:768x1024,mobile:375x667"

Format: label:WIDTHxHEIGHT separated by commas. The label is optional.

Model Selection

Supported models include:

ModelIdentifierNotes
Claude Sonnet 4.5anthropic/claude-sonnet-4.5Default
Claude 3.5 Sonnetanthropic/claude-3.5-sonnetPrevious generation
Gemini 2.5 Flashgoogle/gemini-2.5-flashCost-effective
GPT-4oopenai/gpt-4oOpenAI option

See OpenRouter Models for the complete list.

Example Configuration

ini
# Required
OPENROUTER_API_KEY=sk-or-v1-your-key-here

# Model
OPENROUTER_MODEL=anthropic/claude-sonnet-4.5

# Test scope
MAX_PAGES=25
STEPS_PER_PAGE=8
PARALLEL_BROWSERS=4
GOALS=navigation + forms + mobile responsiveness

# Timeouts
BROWSER_TIMEOUT=60000
NAVIGATION_TIMEOUT=45000
ACTION_TIMEOUT=15000

# Retries
MAX_RETRIES=3
RETRY_DELAY_MS=1000

# Features
AUDITS_ENABLED=true
CAPTURE_BEFORE_AFTER=true
DEBUG=false

# Custom viewports
VIEWPORTS=desktop:1920x1080,mobile:390x844

CI/CD Integration

GitHub Actions

yaml
- name: Run UI QA
  env:
    OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
    MAX_PAGES: 10
    PARALLEL_BROWSERS: 2
  run: npx @usharma124/ui-qa https://staging.example.com

Other Platforms

Set OPENROUTER_API_KEY as a secret or environment variable in your CI configuration.

Released under the MIT License.