# 🎯🛡️ Intentproof
### **AI-Driven E2E Verification Orchestrator & Interactive Browser Recorder**
> **"Don't just test the code. Prove the user intent."**
[](https://github.com/egagofur/intentproof/actions)
[](https://www.npmjs.com/package/intentproof)
[](https://opensource.org/licenses/MIT)
[](https://www.typescriptlang.org/)
[](https://playwright.dev/)
[](CONTRIBUTING.md)
Key Features •
Quick Start •
Interactive Recording •
Executors •
Flow Contract •
AI Diagnostics •
CI/CD •
Contributing
---
## 💡 What is Intentproof?
Modern web applications are complex, and traditional E2E tests are notoriously **brittle, time-consuming to write, and hard to maintain** when CSS classes or UI frameworks change.
**Intentproof** re-imagines end-to-end testing as a **declarative, proof-driven verification system**. Instead of maintaining brittle test scripts with hardcoded selectors, Intentproof lets you:
1. 🔴 **Record User Flows Visually (`intentproof record`)**: Click and fill forms directly in your real browser; Intentproof automatically captures smart semantic selectors, network mutations, and generates clean YAML contracts.
2. 🤖 **Execute with Multiple Engines**: Choose fast deterministic **Playwright**, resilient **Aside AI Agent**, or **Hybrid Mode** with automatic self-healing fallback.
3. 🔐 **Authenticate Once (`InteractiveBrowserAuth`)**: Log in manually once through Google OAuth, SSO, or MFA; Intentproof securely persists your session for all future automated runs.
4. 📷 **Produce Audit-Ready Evidence**: Collect visual screenshot proofs at defined checkpoints, Playwright traces (`trace.zip`), and structured Markdown summaries.
5. 🧠 **AI Root-Cause Diagnosis (`intentproof inspect`)**: Automatically analyze why a test failed, pinpointing whether it was an **application regression**, **stale selector**, or **environment blip**.
---
## 🌟 Key Features
| Feature | Description |
| :--- | :--- |
| 🔴 **Interactive Flow Recorder** | Just browse and interact with your app; Intentproof synthesizes full YAML contracts automatically. |
| ⚡ **Playwright Engine** | Blazing-fast, deterministic execution for continuous integration and regression testing. |
| 🧠 **Aside AI Agentic Engine** | Natural language, goal-oriented browser automation that doesn't break when CSS selectors change. |
| 🔄 **Hybrid Self-Healing Mode** | Runs Playwright first; if a selector drifts, automatically falls back to Aside to verify if the business intent still works. |
| 🔐 **Interactive Universal Auth** | Built-in stealth Chrome mode that bypasses bot detection for Google OAuth, MFA, and SSO logins. |
| 📸 **First-Class Evidence Proof** | Captures screenshot checkpoints, traces, and execution timelines in organized artifact directories. |
| 🧭 **Automatic Route Discovery** | `intentproof discover` scans Next.js, Vite, React, and Vue routes to scaffold candidate flow contracts. |
| 🎯 **Change Impact Analysis** | `intentproof verify --affected` reads Git diffs to run only flows impacted by recent code changes. |
| 💬 **Mattermost & Chat Reporting** | Instant formatted markdown summaries ready for Mattermost, Slack, or PR comments. |
---
## 🚀 Quick Start in 60 Seconds
### 1. Installation
Install Intentproof globally or as a dev dependency in your project:
```bash
# Global CLI installation via GitHub (or NPM):
npm install -g github:egagofur/intentproof
# or via NPM:
npm install -g intentproof
# Or install as dev dependency in your project:
pnpm add -D github:egagofur/intentproof playwright
npx playwright install chromium
```
---
### 2. Initialize in Any Web Application
Run `intentproof init` in your project root (Next.js, Vite, React, Vue, Svelte, or Remix):
```bash
intentproof init
```
This automatically:
- Detects your framework and local dev port (e.g. Next.js `3000`, Vite `5173`).
- Generates `intentproof.config.ts` with recommended authentication strategies.
- Creates the `./flows` directory for declarative contracts.
- Configures `./artifacts` in `.gitignore`.
---
### 3. Record a User Flow Interactively (`intentproof record`)
No need to write YAML by hand! Simply start the interactive recorder:
```bash
intentproof record --flow app.user.create-item --url /dashboard/items/create
```
1. A real browser opens with your active session.
2. Fill the inputs, select dropdowns, pick dates, and click **Submit**.
3. Click the floating **`Finish & Save YAML`** button in the browser.
4. Intentproof instantly generates `./flows/app-user-create-item.yaml`!
---
### 4. Verify & Prove the User Flow
Run the verification orchestrator:
```bash
# Run with Aside Agentic Executor:
intentproof verify --flow app.user.create-item --executor aside
# Or run with fast Playwright:
intentproof verify --flow app.user.create-item --executor playwright
# Or run in Self-Healing Hybrid Mode:
intentproof verify --flow app.user.create-item --executor hybrid
```
---
## 🖥️ Interactive Recording (`intentproof record`)
The **Intentproof Recorder** watches real user interactions, extracts smart accessibility selectors, and outputs clean declarative YAML:
```text
┌────────────────────────────────────────────────────────────┐
│ INTENTPROOF RECORDER │
│ │
│ 1. Run: intentproof record --url /checkout │
│ 2. Real browser opens with your authenticated session │
│ 3. You click items, fill inputs, and submit │
│ 4. Click [Finish & Save YAML] on floating in-browser HUD │
│ 5. Clean YAML contract is saved to ./flows/*.yaml │
└────────────────────────────────────────────────────────────┘
```
---
## 🤖 Executors: Playwright, Aside & Hybrid
Intentproof decouples the **what** (flow contract) from the **how** (browser executor):
```
[ Flow Definition (YAML) ]
│
▼
[ Flow Orchestrator ]
│
┌─────────────────────────┼─────────────────────────┐
▼ ▼ ▼
[ Playwright ] [ Aside AI ] [ Hybrid ]
Fast, deterministic Adaptive, goal-based Playwright speed +
E2E for CI pipelines resilient to UI drift Aside self-healing
```
* **Playwright (`--executor playwright`)**: Highly optimized for deterministic assertions and maximum speed.
* **Aside (`--executor aside`)**: Evaluates semantic intent (e.g. *"Click Save button"* or *"Select active item"*), navigating complex UI libraries (Ant Design, Radix, Tailwind Headless UI) without brittle CSS selectors.
* **Hybrid (`--executor hybrid`)**: Runs Playwright; if a selector changed due to UI refactoring, Aside kicks in to diagnose if the user flow still succeeds.
---
## 📄 Declarative Flow Contract
Flow contracts are clean, human-readable YAML documents stored in `./flows/`:
```yaml
id: erp.master-data.create-fiscal-year
name: "[AUTOMATION] Master Data: Create & Save Fiscal Year"
description: Navigates to Master Data, selects Year, Position, District, Period Type, and submits.
priority: critical
roles:
- user
tags:
- master-data
- enterprise
- forms
preconditions:
- authenticated_as: user
route: /master-data/fiscal-years/create
steps:
- id: step-navigate
action: navigate
target: /master-data/fiscal-years/create
description: Open Create Fiscal Year form
- id: step-select-year
action: select
target: '.ant-form-item:has-text("Year") .ant-select'
value: "2027"
description: Select Year (2027)
- id: step-select-position
action: select
target: '.ant-form-item:has-text("Position") .ant-select'
value: "Unfinal"
description: Select Position (Unfinal)
- id: step-fill-open-date
action: fill
target: 'input#open_date, input[placeholder="Select Open Date"]'
value: "2027-01-01"
description: Fill Open Date
- id: step-click-submit
action: click
target: 'button:has-text("Submit"), button[type="submit"]'
description: Click Submit button to persist data
assertions:
- id: assert-submission-completed
type: element_visible
target: body
description: Form submission completed and redirected
evidence:
checkpoints:
- id: form-filled-proof
trigger: after_step
stepId: step-fill-open-date
screenshot: true
description: "[PROOF] All required fields filled"
- id: final-submission-proof
trigger: after_step
stepId: step-click-submit
screenshot: true
description: "[PROOF] Form submitted and response received"
```
---
## Strapi 5 and semantic browser flows
Legacy CSS selector strings remain valid, but semantic targets are preferred for
Strapi Design System controls:
```yaml
variables:
entryTitle: "E2E News ${runId}"
steps:
- action: fill
target: { label: Title, exact: true }
value: "${entryTitle}"
- action: select_option
target: { role: combobox, name: Status, exact: true }
value: Published
- action: select_relation
target: { testId: relation-input-news_category }
value: News
assertions:
- type: text_contains
target: { text: Saved, exact: true }
value: Saved
```
Supported target keys are `role` plus optional accessible `name`, `label`,
`testId`, `text`, `placeholder`, and explicit `selector`. Locator object forms
are mutually exclusive. Runtime built-ins are `${runId}`, `${currentDate}`,
`${currentDateTime}`, and explicitly namespaced `${env.NAME}`. Missing variables
fail before browser execution. Project `variables` may provide per-flow fixture
values.
The Playwright executor supports native `select` plus custom `select_option`,
`select_relation`, `remove_relation`, `toggle`, `upload_file`, and
`fill_tiptap` actions. Custom listbox options are resolved at page level so
portaled Strapi listboxes work without framework CSS classes.
### Error policy and automatic failure artifacts
```ts
export default defineConfig({
baseUrl: process.env.CMS_URL!,
options: {
errorPolicy: {
failOnPageError: true,
failOnConsoleError: true,
failOnHttp5xx: true,
failOnHttp4xx: false,
failOnRequestFailed: false,
failOnDangerNotification: true,
failOnUnexpectedDialog: true,
ignoredConsolePatterns: [],
ignoredRequestPatterns: [],
},
screenshotMaskTargets: [{ label: 'API token', exact: true }],
},
});
```
Ignore entries use anchored glob matching (`*`) or `/regex/flags` with only
`i` and `m` flags. They never execute YAML as code. Password inputs are always
masked. Failed or blocked browser runs attempt viewport/full-page screenshots,
page HTML, an accessibility snapshot, trace, console/network logs,
`result.json`, and `summary.md`. Partial capture failures are listed as artifact
warnings while the original flow error remains primary.
### Strapi schema generation
```bash
intentproof generate --adapter strapi --dir . --output-dir flows/strapi
```
The adapter discovers `src/api/*/content-types/*/schema.json` and
`src/components/**/*.json`, writes a stable `manifest.json`, one lifecycle
draft per collection type, one edit/reload/restore draft per single type, and a
generation report. Component cycles and unsupported custom fields/dynamic
zones are explicit. Generated drafts are generator-owned: regenerate them from
schema changes, then implement project-owned `strapi.todo.*` handlers or create
hand-authored flows for business-specific population and assertions. The
generator does not claim those TODOs as executed coverage.
### Reusable password authentication
`PasswordAuthStrategy` caches successful state once per role/run. Set
`storageStatePath` (a path containing optional `{role}`, or a role-to-path
function) to reuse it across processes. Supply `validateSuccess` to detect and
refresh expired disk state. Auth-state paths such as `.auth/`, `auth-state/`,
and `*.storage-state.json` must remain uncommitted.
Suite verification runs `beforeAll`/`afterAll` once and
`beforeFlow`/`afterFlow` per flow. A `beforeFlow` hook can call
`lifecycle.registerCleanup(...)`; registered cleanup runs even after a failed
flow.
## 🧠 AI Diagnostic Engine
When a flow fails, Intentproof doesn't just output a stack trace. The **AI Diagnostic Engine** classifies the failure into 4 actionable root causes:
1. **`application_regression`**: The flow failed because the application logic broke.
2. **`stale_selector`**: The UI still works, but a CSS class or button label changed (Intentproof proposes a YAML patch!).
3. **`auth_failure`**: Session expired or login credentials invalid.
4. **`environment_failure`**: Target backend/server unreachable or timed out.
Inspect any execution:
```bash
intentproof inspect