How wendellhua/sighttest works
Purpose and deployment shape
SightTest is a local web-based automated testing platform: a user submits a target URL, and the system explores it with a real Chromium browser, designs tests from observed behavior, runs multidimensional checks, and produces reports. It is served by a Python FastAPI process; static frontend assets are included in the same repository. Primary launch point: backend/main.py; browser entry/UI shell: index.html.
Frontend application and fallback
The frontend is an unbundled ES-module SPA. js/main.js owns routing, event binding, and render dispatch; views render task, experience, case, and report workflows under js/views/. js/api.js calls FastAPI and probes backend availability, while js/store.js holds task state, persistence, and SSE subscriptions. If the backend is unavailable, js/engine.js supplies local simulated data rather than blocking UI use.
API and task lifecycle boundary
backend/main.py is the HTTP/SSE boundary: it exposes task, experience, report, and LLM configuration APIs; serves/redirects to frontend assets; and initiates asynchronous work. Tasks move through pending, exploration, case design, testing, reporting, and completion states. SSE task streams carry status and logs to the frontend, separating long-running automation from request/response UI interactions.
Orchestration pipeline
backend/orchestrator.py is the principal workflow coordinator. It starts browser-backed execution, transitions task state, collects stage outputs, handles cancellation/failure recovery, and invokes reporting. The main pipeline is:
1. Explore the target and produce product understanding.
2. Generate tailored cases from that understanding when LLM support exists.
3. Execute enabled test suites and collect evidence/results.
4. Aggregate findings into a report.
Core pipeline modules are backend/explorer.py, backend/casegen.py, backend/case_runner.py, and backend/reporter.py.
Browser exploration and network evidence
backend/browser.py encapsulates Playwright/Chromium lifecycle and is the boundary for real page interaction. backend/explorer.py uses that runtime to navigate and inspect the target product, producing the experience artifact used as the basis for case design. backend/whistle.py optionally manages the Node.js whistle proxy to capture request parameters and response payloads; without it, API evidence degrades to browser-level network observation.
Test execution domains
Execution is partitioned into independently archived suites: functional/page behavior (backend/suite_func.py), API/contract validation (backend/suite_api.py, backend/suite_api_core.py, backend/suite_api_ext.py), security probing (backend/suite_security.py), performance checks (backend/suite_perf.py), and optional AI-driven testing (backend/suite_ai.py). backend/case_runner.py provides the common case-execution layer, while backend/models.py defines shared models and cross-stage data contracts.
AI integration, reporting, and persistence
backend/llm.py manages configuration and calls any OpenAI-compatible provider; absent credentials disable AI case generation/report features without disabling browser-based suites. backend/reporter.py consolidates suite outcomes, defects, evidence, and risk assessment into conclusion-first reports. Runtime task/report data and local LLM settings reside under backend/data/, intentionally outside source control. Required runtimes are Python 3.10+, FastAPI/Uvicorn, Playwright Chromium, and optionally Node.js plus whistle.
Main entry points: case_runner.py Case execution layer · orchestrator.py Task orchestrator · main.py FastAPI / SSE boundary · explorer.py Product explorer
Components 21
Frontend SPA
- UI shell
index.html - SPA router & views
js/main.js - API client
js/api.js - Task store & SSE · Persists task state and receives task streams.
js/store.js - Offline simulator · Supplies simulated data when the backend is unavailable.
js/engine.js
API & Workflow
- FastAPI / SSE boundary · Serves assets and exposes task, experience, report, and LLM APIs.
backend/main.py - Task orchestrator · Advances asynchronous tasks through exploration, design, testing, and reporting.
backend/orchestrator.py - Shared contracts
backend/models.py - Report aggregator · Produces conclusion-first reports from findings, evidence, and risks.
backend/reporter.py - Task, report & LLM data · Runtime data intentionally remains outside source control.
Browser & Test Execution
- Product explorer · Creates the experience artifact from a target product.
backend/explorer.py - Case generator · Builds tailored cases from product understanding when AI is enabled.
backend/casegen.py - Case execution layer · Runs enabled suites and collects evidence and results.
backend/case_runner.py - Functional suite
backend/suite_func.py - API contract suite · Contract validation spans core and extended API checks.
backend/suite_api.py - Security suite
backend/suite_security.py - Performance suite
backend/suite_perf.py - AI-driven suite
backend/suite_ai.py
External Runtimes
- Playwright Chromium · Owns real-page interaction and browser-level network observation.
backend/browser.py - Whistle proxy · Captures request parameters and response payloads when available.
backend/whistle.py - OpenAI-compatible LLM · Enables AI case generation and report features when configured.
backend/llm.py
Connections 25
- UI shell → SPA router & views: loads
- SPA router & views → API client: uses
- SPA router & views → Task store & SSE: renders state
- API client → FastAPI / SSE boundary: HTTP APIs
- Task store & SSE → FastAPI / SSE boundary: SSE task stream
- API client → Offline simulator: fallback when unavailable
- FastAPI / SSE boundary → Task orchestrator: starts async task
- FastAPI / SSE boundary → Task, report & LLM data: reads/writes
- Task orchestrator → Product explorer: explore
- Product explorer → Playwright Chromium: navigates and inspects
- Playwright Chromium → Whistle proxy: optional network capture
- Task orchestrator → Case generator: design cases
- Product explorer → Case generator: experience artifact
- Case generator → OpenAI-compatible LLM: optional generation
- Task orchestrator → Case execution layer: execute cases
- Case execution layer → Functional suite: runs
- Case execution layer → API contract suite: runs
- Case execution layer → Security suite: runs
- Case execution layer → Performance suite: runs
- Case execution layer → AI-driven suite: optionally runs
- Task orchestrator → Report aggregator: aggregate outcomes
- Report aggregator → OpenAI-compatible LLM: optional AI reporting
- Report aggregator → Task, report & LLM data: stores reports
- Shared contracts → Product explorer: contracts
- Shared contracts → Case execution layer: contracts