Files
OrcaSlicer/tools/mcp/smoke_test.json
T
SoftFever d64e10f4dd Regroup the slicer's MCP commands and let each run from its arguments
Outside the Design tab an agent had 175 commands, 50 of them in the tool
list. There are now 118, named by what they act on (`object_`, `plate_`,
`preset_`, `filament_`, `plugin_` and so on), and 115 are listed. Each takes
its target and values in the call, acts on the selection when it names no
target and says what it acted on; an old name is refused. Printers and
system filaments install and uninstall, preferences read and write, plugins
enable, reload, uninstall and refresh, and objects reorder, with no dialog
to drive.

The Speed Dial keeps its 129 tiles under the same ids. Eight defects in the
rows these commands share with the menus are fixed. For a person: an object
row that cannot run says why instead of "Select an object first.", rows
that failed no longer claim success, Duplicate Plate can be undone, and
Refresh Plugins picked while a refresh runs now runs after it instead of
beside it.
2026-11-18 16:50:32 +08:00

37 lines
2.7 KiB
JSON

// Smoke test of the MCP server's main paths: an auto-answered prompt, a setting changed and read
// back, slicing, export, a dialog opened by an action and answered by the replay, and screenshots of
// the dialog, the preview and the main window. Run against a running instance with
// tools/mcp/orca_mcp.py run-replay tools/mcp/smoke_test.json --out /tmp/smoke
// or headless with
// orca-slicer --run tools/mcp/smoke_test.json --outputdir /tmp/smoke
{
"orca_replay_version": "0.2.0",
"name": "smoke",
"vars": {"model": "${replay_dir}/../../resources/handy_models/3DBenchy.drc"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
// Startup may ask to restore a project an earlier run left unsaved, and project_new asks about
// unsaved changes. The rules end with the replay, so they never answer a prompt after the run.
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "unsaved changes", "button": "no"},
{"match": "restore", "button": "no"}]}},
{"tool": "project_new", "args": {"silent": true}},
{"tool": "project_import", "args": {"paths": ["${vars.model}"]}, "expect": {"/added": {"eq": 1}}},
{"tool": "settings_set", "args": {"type": "process", "values": {"wall_loops": 3}}},
{"tool": "settings_get", "args": {"type": "process", "keys": ["wall_loops"]}, "expect": {"/items/0/value": {"eq": "3"}}},
{"tool": "plate_slice", "expect": {"/status": {"eq": "done"}, "/plates/0/outcome": {"eq": "ok"}}},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/benchy.gcode", "overwrite": true}},
// The action blocks in the dialog it opens, so it is not awaited until the dialog is answered.
{"tool": "action_run", "args": {"id": "orca_command:open_preferences:orca"}, "await": false, "save_as": "prefs"},
{"tool": "app_wait", "args": {"for": "dialog", "timeout_s": 10}, "expect": {"/satisfied": {"eq": true}}},
{"tool": "widget_list", "args": {"target": "dialog", "query": "splash"}, "expect": {"/nodes": {"ge": 1}}},
{"tool": "window_screenshot", "args": {"target": "dialog", "save_path": "${out_dir}/preferences.png", "overwrite": true, "include_image": false}},
{"tool": "dialog_answer", "args": {"dialog": {"title": "Preferences"}, "button": "close"}},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.prefs}"}},
{"tool": "view_set", "args": {"tab": "preview", "camera": "iso"}},
{"tool": "window_screenshot", "args": {"target": "canvas", "save_path": "${out_dir}/preview.png", "overwrite": true, "include_image": false}},
{"tool": "window_screenshot", "args": {"target": "main", "save_path": "${out_dir}/window.png", "overwrite": true, "include_image": false}}
]
}