Skip to content

Web Server

Skiritai includes an optional FastAPI web server for remote test management.

Install

bash
pip install -e ".[web]"

Start

bash
skiritai serve

The server starts at http://localhost:8000 by default.

REST API

Case Endpoints

MethodEndpointDescription
GET/api/cases/List all test cases
GET/api/cases/{id}Get case details with steps
POST/api/cases/{id}/runRun a test case
POST/api/cases/{id}/stopStop a running case
GET/api/healthHealth check

Script Endpoints

MethodEndpointDescription
GET/api/cases/{id}/scriptsList all generated replay scripts
GET/api/cases/{id}/scripts/{step}Get script content
PUT/api/cases/{id}/scripts/{step}Update script content
POST/api/cases/{id}/scripts/{step}/solidifySolidify a script for replay mode

Result Endpoints

MethodEndpointDescription
GET/api/cases/{id}/resultsList all historical execution results
GET/api/cases/{id}/results/{timestamp}Get a specific run's report + screenshot list
GET/api/cases/{id}/results/{timestamp}/screenshots/{file}Serve screenshot PNG

WebSocket

Connect to ws://localhost:8000/api/ws/cases/{case_id} for real-time event streaming:

javascript
const ws = new WebSocket("ws://localhost:8000/api/ws/cases/my_test");
ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  // msg.type: "node_status" | "log" | "execution_status"
  console.log(msg);
};

WebSocket Message Types

TypeDescription
node_statusStep started (running), completed (success), or failed (failed)
logTool call or log message from the execution engine
execution_statusExecution started (running) or completed with full report

Sending Commands

The server accepts {"command": "stop"} to cancel a running execution:

javascript
ws.send(JSON.stringify({ command: "stop" }));

基于 MIT 许可证发布。