Metadata-Version: 2.4
Name: fusiontest
Version: 0.2.77
Summary: AI-powered UI testing for mobile and desktop — by FusionLeap.io
Author-email: FusionLeap <hello@fusionleap.io>
License: MIT AND MPL-2.0
Project-URL: Homepage, https://fusionleap.io
Project-URL: Repository, https://github.com/mohigo/fusion-test
Project-URL: Issues, https://github.com/mohigo/fusion-test/issues
Keywords: testing,AI,mobile,desktop,LLM,automation,QA
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: License :: OSI Approved :: MIT License
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1
Requires-Dist: pyyaml>=6.0
Requires-Dist: httpx<1,>=0.27
Requires-Dist: python-dotenv>=1.0
Requires-Dist: rich>=13.0
Requires-Dist: pydantic<3,>=2.0
Requires-Dist: openai<4,>=1.58
Provides-Extra: mobile
Requires-Dist: Appium-Python-Client<7,>=3.1; extra == "mobile"
Requires-Dist: selenium<5,>=4.18; extra == "mobile"
Provides-Extra: desktop
Requires-Dist: playwright>=1.43; extra == "desktop"
Provides-Extra: mcp
Requires-Dist: mcp<3,>=2.3; extra == "mcp"
Provides-Extra: pdf
Requires-Dist: pypdf>=7.0; extra == "pdf"
Provides-Extra: windows
Requires-Dist: Appium-Python-Client<7,>=3.1; extra == "windows"
Requires-Dist: selenium<5,>=4.18; extra == "windows"
Provides-Extra: macos
Requires-Dist: pyobjc-framework-ApplicationServices>=10; sys_platform == "darwin" and extra == "macos"
Requires-Dist: pyobjc-framework-Cocoa>=10; sys_platform == "darwin" and extra == "macos"
Requires-Dist: pyobjc-framework-Quartz>=10; sys_platform == "darwin" and extra == "macos"
Provides-Extra: mpnet
Requires-Dist: sentence-transformers>=2.7; extra == "mpnet"
Requires-Dist: torch>=2.2; extra == "mpnet"
Provides-Extra: api
Requires-Dist: fastapi>=0.111; extra == "api"
Requires-Dist: uvicorn[standard]>=0.29; extra == "api"
Requires-Dist: pydantic[email]<3,>=2.8; extra == "api"
Requires-Dist: python-jose[cryptography]>=3.3; extra == "api"
Requires-Dist: cryptography>=42; extra == "api"
Requires-Dist: passlib[bcrypt]>=1.7; extra == "api"
Requires-Dist: psycopg2-binary>=2.9; extra == "api"
Requires-Dist: boto3>=1.34; extra == "api"
Requires-Dist: tzdata>=2024.1; extra == "api"
Requires-Dist: pypdf>=7.0; extra == "api"
Provides-Extra: training
Requires-Dist: sentence-transformers>=2.7; extra == "training"
Requires-Dist: torch>=2.2; extra == "training"
Requires-Dist: datasets>=2.19; extra == "training"
Requires-Dist: accelerate>=0.30; extra == "training"
Requires-Dist: scikit-learn>=1.4; extra == "training"
Requires-Dist: pandas>=2.2; extra == "training"
Requires-Dist: numpy>=1.26; extra == "training"
Requires-Dist: tqdm>=4.66; extra == "training"
Requires-Dist: wandb>=0.17; extra == "training"
Provides-Extra: openai
Requires-Dist: openai<4,>=1.58; extra == "openai"
Provides-Extra: groq
Requires-Dist: openai<4,>=1.58; extra == "groq"
Provides-Extra: claude
Requires-Dist: anthropic<3,>=0.25; extra == "claude"
Provides-Extra: gemini
Requires-Dist: google-genai<4,>=1.0; extra == "gemini"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pre-commit>=3.7; extra == "dev"
Requires-Dist: fusiontest[desktop,mobile,openai,pdf]; extra == "dev"
Provides-Extra: all
Requires-Dist: fusiontest[api,claude,desktop,gemini,groq,macos,mobile,mpnet,openai,pdf,training,windows]; extra == "all"

# 🧪 FusionTest

> AI-powered UI testing for web, desktop and mobile — built by [FusionLeap.io](https://fusionleap.io)

FusionTest runs UI tests written as plain-English goals. An LLM reads the
screen and decides what to do, an independent judge model confirms each goal
from the screen, a screenshot and the app's own errors, and goals that pass are
recorded so later runs replay them without calling the AI at all.

Coding agents use it to verify their changes: `fusiontest verify` (or the MCP
server) reads the diff, checks what it promises in the running app, and keeps
what passes as regression goals. See [docs/coding-agents.md](docs/coding-agents.md).

---

## ✨ Features

| Feature | Notes |
|---|---|
| Natural-language goals | `"Open the Pricing page and verify all three plans are shown"` |
| Verify a change | `fusiontest verify` plans checks from a diff and judges them; JSON verdict for agents and CI |
| MCP server | `fusiontest mcp`: `verify_change`, `run_goals`, `run_goals_file`, `scan_site` for Claude Code and other agents |
| Independent judge | A stronger model judges pass/fail (Claude or OpenAI when set) while a cheap one clicks |
| Goal discovery | Crawls a site and proposes goals grounded in its real content |
| Goals from a spec | `fusiontest plan spec.md` (Markdown, text, PDF) or a GitHub, Linear or Jira issue in the dashboard: goals to review, each quoting the sentence it checks |
| Goals over a table | `{product}` in a goal and `rows:` (inline or a CSV): one flow over many products, locales or invalid values. Each row is its own result, with its own recording and history |
| AI feature testing | `criteria:` on a goal: a chatbot's reply, AI search or recommendations graded per criterion by the judge, each verdict quoting the answer. All must be met to pass. [How it works](docs/ai-features.md) |
| API steps | `before:` and `after:` a goal call your API without the AI: seed a user, reset a cart, clean up. `capture` keeps values of the answer as `{{NAME}}` secrets for later goals; dashboard calls go through the SSRF guard |
| Emails the app sends | `{{EMAIL:NAME}}` is a new test-inbox address per run and row, `{{EMAIL_CODE:NAME}}` the code emailed to it, and an `email:` step checks a message and opens its link. Mailpit, local or in the dashboard ([ADR-015](docs/adr/ADR-015-inbox-and-api-steps.md)) |
| Record & replay | Passing goals replay with no LLM calls; the AI repairs them when the page changes |
| Honest results | Capacity or infrastructure problems are reported as **errors**, not test failures |
| Real bug or test issue | Every failed goal is labelled a **real bug** (the app is wrong) or a **test issue** (ambiguous or stale goal, a recording that no longer fits, an agent that got lost, a missing sign-in or test data), with a reason and the evidence, in the CLI, reports, PR comments, Slack, annotations, MCP results and the dashboard (filterable) |
| Multi-provider LLMs | Groq, Claude, Gemini, OpenAI or local Ollama, with automatic fallback |
| Safe secrets | `{{PASSWORD}}` placeholders — the AI never sees values, which are only typed on allowed sites |
| 2FA sign-in | `{{TOTP:NAME}}` types an unused authenticator code (RFC 6238) from a stored seed, in CLI and dashboard runs (not security checks) |
| Guardrails | Invalid-action checks, loop detection, backtracking, no-progress detection |
| Run evidence | Web & Electron: a video of the run, a Playwright trace per failed goal, and console and network errors, in the report and the dashboard |
| Accessibility checks | `--accessibility`: axe-core's WCAG A and AA rules on every page a web run visits, without AI calls, with an optional gate. Finds only some problems: [not a compliance claim](docs/accessibility.md) |
| Localization checks | `--locale de-DE --localization`: the browser runs in the locale (language, `Accept-Language`, time zone), and every page a web run visits is checked for raw translation keys and placeholders, numbers, prices and dates in another locale's format, and untranslated text, each finding quoting the element. No AI calls (an optional, bounded judge for strings the rules can't decide), an optional gate. [What is and isn't checked](docs/localization.md) |
| Reporting | JSON reports, dashboard uploads, failure screenshots, Slack, GitHub Actions annotations, webhooks |
| Scheduled runs | Run goals every night, weekday, week or few hours from the dashboard, in your time zone, without CI |
| Share links | Send one run (errors, video, browser logs, accessibility, localization) to someone without an account, by a link that expires and can be revoked |
| Issue filing | Confirmed bugs and failed goals that are real bugs (and optionally test issues) open issues in GitHub Issues, Linear or Jira Cloud, with steps to reproduce and a link to the run's evidence; repeats comment on the open issue |
| Platforms | Web (Playwright), [Electron](docs/getting-started.md#electron-desktop-app), Android & iOS (Appium), Windows, macOS |
| Device & browser clouds | `--remote`: real iPhones, iPads and Android phones, simulators and browsers on your BrowserStack, LambdaTest, Sauce Labs or own grid, credentials from the environment. Dashboard runs can use your browser cloud too. [Remote devices](docs/remote-devices.md) |
| Parallel sessions | `--sessions N`: goals in N browsers or devices at once (up to 5 on your browser cloud in the dashboard). Goals that continue from the one before stay together |
| Exit country | `--proxy … --country DE`: web traffic leaves through your proxy provider in that country |

---

## 🏗 Architecture

```
fusiontest/
├── core/         # Runner, LLM action model + fallback chain, goal verifier,
│                 # screen parser, secrets, replay, SSRF guard (netguard)
├── accessibility/ # axe-core checks on the pages a run visits (vendored, MPL-2.0)
├── localization/ # Raw keys, wrong formats and untranslated text on the pages a run visits
├── desktop/      # Playwright (web/Electron), Windows, macOS adapters
├── mobile/       # Android (UIAutomator2) and iOS (XCUITest) adapters via Appium
├── discovery/    # Goals from a site's pages, a change or a spec
├── guardrails/   # Action validation, loop detection, backtracking
├── reporting/    # JSON reports, Slack, GitHub annotations
└── training/     # Experimental MPNet fine-tuning (not wired into runs)
api/              # SaaS backend (FastAPI + PostgreSQL) — see docs/api.md
dashboard/        # React dashboard
website/          # Marketing site (Next.js)
```

Design decisions are recorded in [docs/adr](docs/adr) — start with
[ADR-007](docs/adr/ADR-007-llm-capacity-and-execution.md).

---

## 🚀 Quickstart

```bash
# macOS (Homebrew Python) or anywhere you want an isolated CLI — recommended
brew install pipx && pipx ensurepath        # then open a new terminal
pipx install "fusiontest[desktop]"
"$(pipx environment --value PIPX_LOCAL_VENVS)/fusiontest/bin/playwright" install chromium

# …or inside a virtual environment
python3 -m venv .venv && source .venv/bin/activate
pip install "fusiontest[desktop]"
playwright install chromium

export GROQ_API_KEY=gsk_...          # or ANTHROPIC_API_KEY / GEMINI_API_KEY / OPENAI_API_KEY

fusiontest run --url https://example.com \
  --goal "Verify the page heading says Example Domain" --headless

# Changed the UI? Check that the change does what it says (uncommitted changes by default)
fusiontest verify --url http://localhost:5173

# No goals yet? Map what works on a test/staging site, and save the flows that do
fusiontest scan https://staging.example.com --save fusiontest.goals.yaml
# Behind a login: EMAIL and PASSWORD come from the environment, never the AI
fusiontest scan https://staging.example.com --login "Sign in with email {{EMAIL}} and password {{PASSWORD}}"
```

Groq, OpenAI and Ollama work out of the box; for Claude or Gemini add the
extra — `fusiontest[desktop,claude]` or `fusiontest[desktop,gemini]`.
Upgrade with `pipx upgrade fusiontest` (or `pip install -U fusiontest` in
the venv).

Set `FUSIONTEST_API_KEY` (from the dashboard's API Keys page) to upload each
run to your FusionTest dashboard.

Exit codes: `0` all goals passed · `1` a goal failed · `2` some goals couldn't
be evaluated (LLM capacity or infrastructure) — not a test failure.

> **Full guide:** [docs/getting-started.md](docs/getting-started.md) — platforms,
> goal files, configuration, secrets, replay, dashboard and CI.

---

## 📝 Writing goals

```yaml
# tests/goals/smoke.yaml
name: Marketing site smoke test
platform: playwright
url: https://example.com
goals:
  - "Open the Pricing page and verify three plan tiers are shown"
  - "Open the Contact page, submit the form empty, and verify required-field errors appear"
  - name: Log in
    goal: "Log in with {{EMAIL}} and {{PASSWORD}} and verify the dashboard loads"
  - goal: "Open the help chat, ask 'How do I cancel my plan?' and wait for the answer"
    criteria:                    # an AI feature: the answer is graded, not matched
      - "Explains where to cancel in Settings"
      - "Doesn't ask for a card number"
```

```bash
fusiontest run --file tests/goals/smoke.yaml --headless
```

Tips: say what to verify, not just where to go; one outcome per goal; don't
submit real forms on production sites.

---

## 🛠 Configuration

`fusiontest init` creates `fusiontest.config.yaml`:

```yaml
backend: groq               # unset = auto-detect from API keys
guardrails:
  loop_detection_window: 5
  max_retries: 3
replay:
  enabled: true
  trace_dir: .fusiontest/traces
  reverify_every: 10
# remote:                   # a device or browser cloud (docs/remote-devices.md)
#   url: https://${SAUCE_USERNAME}:${SAUCE_ACCESS_KEY}@ondemand.eu-central-1.saucelabs.com/wd/hub
# sessions: 4               # goals in 4 sessions at once
```

---

## 🔌 CI/CD

Run `fusiontest run --headless` in any CI system. With `FUSIONTEST_API_KEY`
set, replay recordings are shared through your FusionTest account (laptop, CI
and dashboard all replay each other's passing goals); without it, cache
`.fusiontest/traces`. Guides for GitHub Actions, Bitrise,
Fastlane and Jenkins: [docs/ci-integrations.md](docs/ci-integrations.md).

---

## 🤝 Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) and [ROADMAP.md](ROADMAP.md).

## 📄 License

MIT © [FusionLeap.io](https://fusionleap.io)

Includes [axe-core](fusiontest/accessibility/vendor/axe-core/README.md), © Deque Systems, Inc.,
unmodified, under the [Mozilla Public License 2.0](fusiontest/accessibility/vendor/axe-core/LICENSE).
