mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-26 15:21:19 -05:00
34 lines
2.3 KiB
JSON
34 lines
2.3 KiB
JSON
// Scripts in the web views of modal dialogs, which run_javascript runs in whenever the dialog is the
|
|
// topmost: by default and by locator, and the bundle dialog closed from its page's own button, which
|
|
// replies closed. Run it on a fresh datadir set up with the default printer:
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/webview_modal.json --out /tmp/webview_modal
|
|
// The refusals (a web view behind a modal, a dialog under the topmost) are in
|
|
// tools/mcp/test_webview_modal.py; the same dialogs driven through the GUI tools are in web_dialogs.json.
|
|
{
|
|
"orca_replay": 1,
|
|
"name": "web views in modal dialogs",
|
|
"steps": [
|
|
{"tool": "wait", "args": {"for": "ready"}},
|
|
{"tool": "set_window", "args": {"size": [1920, 1200]}},
|
|
|
|
// ---- The preset bundle dialog ----
|
|
{"tool": "run_action", "args": {"id": "orca_command:preset_bundle:orca"}, "await": false, "save_as": "bundle"},
|
|
{"tool": "wait", "args": {"for": "dialog", "timeout_s": 10}, "expect": {"/satisfied": {"eq": true}}},
|
|
{"tool": "run_javascript", "args": {"code": "document.title"},
|
|
"expect": {"/result": {"eq": "Preset Bundle"}, "/url": {"contains": "PresetBundleDialog"}}},
|
|
{"tool": "run_javascript", "args": {"code": "!!document.getElementById('close_btn')", "target": {"class": "webview", "within": "Preset Bundle"}},
|
|
"expect": {"/result": {"eq": true}}},
|
|
{"tool": "run_javascript", "args": {"code": "document.getElementById('close_btn').click()"}, "expect": {"/closed": {"eq": true}}},
|
|
{"tool": "wait", "args": {"for": "job", "job": "${jobs.bundle}"}},
|
|
{"tool": "get_app_state", "expect": {"/dialogs": {"empty": true}}},
|
|
|
|
// ---- The setup wizard: its page is read, and the dialog only closed ----
|
|
{"tool": "run_action", "args": {"id": "orca_command:help_setup_wizard:orca"}, "await": false, "save_as": "wizard"},
|
|
{"tool": "wait", "args": {"for": "dialog", "timeout_s": 30}, "expect": {"/satisfied": {"eq": true}}},
|
|
{"tool": "run_javascript", "args": {"code": "typeof document.title"}, "expect": {"/result": {"eq": "string"}, "/url": {"contains": "/guide/"}}},
|
|
{"tool": "answer_dialog", "args": {"dialog": {"title": "Setup Wizard"}, "button": "close"}},
|
|
{"tool": "wait", "args": {"for": "job", "job": "${jobs.wizard}"}},
|
|
{"tool": "get_app_state", "expect": {"/dialogs": {"empty": true}}}
|
|
]
|
|
}
|