Skip to main content

Overview

End-to-end tests are essential but expensive to maintain. Playwright and Selenium tests break every time the UI changes — a renamed CSS class, a restructured form, a redesigned navigation. Teams spend more time fixing selectors than catching bugs. Refrain replaces brittle test scripts with self-healing runbooks. Describe what each test should verify, generate a runbook, and integrate it into your CI/CD pipeline. When the UI changes, the runbook adapts — no test code to maintain.

Example runbook

name: login-flow-test
url: https://staging.example.com/login
variables:
  - name: test_email
    source: secrets
  - name: test_password
    source: secrets
steps:
  - action: input
    selector: "#email"
    value: "{{ test_email }}"
  - action: input
    selector: "#password"
    value: "{{ test_password }}"
  - action: click
    selector: "#login-button"
  - action: wait
    selector: ".dashboard"
  - action: extract
    selector: ".welcome-message"
    capture: welcome_text
  - action: extract
    selector: ".user-menu"
    capture: user_menu

Generate and execute

1

Generate the test runbook

npx @refrainai/cli generate -- \
  --url https://staging.example.com/login \
  --goal "Log in with test credentials and verify the dashboard loads with a welcome message" \
  --context ./context.md \
  --output ./tests/login-flow.yaml
2

Run locally

npx @refrainai/cli execute -- \
  --runbook ./tests/login-flow.yaml \
  --secrets ./secrets.json \
  --report ./test-reports/login-flow.md
3

Integrate into CI/CD

Add the execute command to your CI pipeline:
# .github/workflows/e2e.yml
- name: Run E2E tests
  run: |
    npx @refrainai/cli execute -- \
      --runbook ./tests/login-flow.yaml \
      --secrets ./secrets.json \
      --report ./test-reports/login-flow.md

Why this works well

  • No test code — Runbooks replace Playwright/Selenium scripts. No selectors to maintain.
  • Self-healing — UI changes are handled automatically. Tests don’t break on redesigns.
  • CI/CD native — Run via CLI in any pipeline — GitHub Actions, GitLab CI, Jenkins, etc.
  • Visual debugging — Use --headless false and --screenshots to debug failures visually.

What’s next