Docs/Enterprise/AI-Driven QA

AI-Driven QA with Predicate

Predicate enables self-healing, intent-driven QA for modern web applications.

Instead of brittle selectors and blind retries, Predicate verifies user-visible outcomes using structured snapshots from a live, rendered browser (post-SPA hydration).

Predicate does not parse static HTML and does not rely on vision by default.


Why traditional E2E tests flake

Most QA pipelines fail for reasons unrelated to product bugs:

  • Pages hydrate asynchronously
  • Layout and DOM settle over time
  • Selectors drift with minor UI changes
  • Test runners retry entire tests blindly

This produces flaky tests, low trust, and high maintenance cost.

The core problem

Traditional tests retry actions. Predicate retries verification.


How Predicate approaches QA

Predicate treats QA as a verification problem, not a scripting problem.

Intent → Deterministic actions → Verified outcome

Key principles:

  • Snapshot the rendered DOM + layout from a real browser
  • Assert semantic state, not DOM trivia
  • Retry only when the page is unstable
  • Escalate only when structure is exhausted

Example 1 — Eliminating flaky waits (self-healing verification)

Diagram (what happens)

┌─────────────┐
│ Test step   │
│ "Dashboard" │
└──────┬──────┘
┌─────────────────────────┐
│ Snapshot #1             │
│ confidence: 0.42        │
│ reason: dom_unstable    │
└──────┬──────────────────┘
       │ retry verification
┌─────────────────────────┐
│ Snapshot #2             │
│ confidence: 0.78        │
│ stable                  │
└──────┬──────────────────┘
┌─────────────────────────┐
│ ASSERT PASS ✓           │
│ "Dashboard" visible     │
└─────────────────────────┘

What this replaces

  • sleep(5)
  • blind test retries
  • flaky CI failures

Minimal example

await runtime.check(
  exists("role=heading text~'Dashboard'"),
  label="dashboard_loaded"
).eventually(
  timeout_s=10,
  min_confidence=0.7,
  max_snapshot_attempts=3
)

Predicate retries only while the page is unstable and stops deterministically.


Example 2 — State-aware QA without brittle selectors

Diagram (semantic verification)

┌─────────────────────┐
│ User expectation    │
│ "Continue is ready" │
└─────────┬───────────┘
┌──────────────────────────────┐
│ Rendered DOM snapshot        │
│ - button                     │
│ - text: "Continue"           │
│ - enabled: false → true      │
└─────────┬────────────────────┘
┌──────────────────────────────┐
│ ASSERT PASS ✓                │
│ enabled == true              │
└──────────────────────────────┘

Why this matters

QA verifies what the user sees, not how the DOM happens to be structured today.

Minimal example

runtime.assert_(is_enabled("role=button text~'Continue'"))
runtime.assert_(is_checked("role=checkbox name~'Subscribe'"))
runtime.assert_(value_contains("role=textbox name~'Email'", "@"))

If verification fails, Predicate reports:

  • why it failed (state_mismatch, no_match)
  • what the closest matching elements were

Example 3 — Vision fallback as a last resort (auditable)

Diagram (controlled escalation)

┌────────────────────────┐
│ Snapshot attempts      │
│ confidence < threshold │
└──────────┬─────────────┘
           │ exhausted
┌────────────────────────┐
│ Vision verifier        │
│ YES / NO question      │
└──────────┬─────────────┘
┌────────────────────────┐
│ ASSERT PASS / FAIL     │
│ (logged + auditable)   │
└────────────────────────┘

Important guarantees

  • Vision is never default
  • Assertions remain unchanged
  • All fallbacks are explicit and logged

Minimal example

await runtime.check(
  exists("text~'Order Complete'"),
  label="order_complete"
).eventually(
  min_confidence=0.7,
  max_snapshot_attempts=2,
  vision_provider=vision_llm
)

Auditability first

Vision is used only when structure fails. No silent recovery. No hidden AI behavior.


Optional: Deep debugging with Predicate Studio

For teams that need deeper inspection, Predicate Studio provides an optional visual layer on top of the same runtime assertions.

Studio can be used to:

  • Inspect semantic snapshots and stability diagnostics
  • Replay agent steps deterministically
  • Time-travel through retries and failures
  • Understand why an assertion failed, not just that it failed

Studio is optional

All QA verification works in CI without Studio. Studio is a debugging aid, not a requirement.


Where Predicate fits in an enterprise QA stack

Predicate complements existing QA tools:

  • Use it for critical user flows
  • Use it where E2E tests flake the most
  • Run it in CI as a verifier, not a recorder
Unit tests → Playwright/Cypress → Predicate verification

Why enterprises adopt Predicate for QA

  • Fewer flaky tests
  • Clear failure diagnostics
  • Works on real SPAs
  • Lower maintenance cost
  • Auditable AI behavior

Predicate turns QA from brittle scripts into verifiable contracts.