v3.16.0: test scripts move to a server-side store
The scripts lived in the browser's localStorage although only the local
server can run them. The new test_scripts.py store
(~/.pysim-simple-server/test_scripts.json, --test-scripts PATH) sits next to
the card presets: stable uuids and timestamps, atomic writes, and every
mutation is validated with the runner's own engine (the submitted shape is
kept - the normaliser's output is not re-normalisable: it fills defaults
like an 'any' PoR check that the check normaliser then rejects), so a stored
script cannot fail at run start for a validation reason. Import accepts the
old localStorage export as-is (export/import remains the migration path; the
PWA import also takes an exported array).
- /api/test/scripts (GET card-free: path/count + scripts), POST create,
/update, /delete and /import serve the store; the endpoints answer 503
without a store and 500 on a write failure, like the preset endpoints.
- /api/test/run takes a stored script_id (resolved when no inline script is
sent); the PWA sends the edited copy inline plus the id for the report,
and the run snapshot carries script_id.
- The PWA's Test script pill loads from the store, writes through on edits
(debounced name, immediate step/new/copy/delete), reports load/save/delete
failures inline, and exports the portable {name, steps} shape.
Tests: 808 frontend + 701 Python; sw cache simple-v379.
This commit is contained in:
@@ -5,10 +5,12 @@ the card over the local server: ordered **actions** (each sends something and
|
||||
checks the response) and **expectations** (each fetches the proactive command
|
||||
the card announced, checks it, and sends the scripted TERMINAL RESPONSE).
|
||||
|
||||
Scripts are imported into the PWA (Simulator → Test script → Import) and run
|
||||
with **Run** against the equipped card, or POSTed directly to
|
||||
`/api/test/run` (see `docs/api.md`). While a run is active the card belongs to
|
||||
the script.
|
||||
Scripts live in the **server-side store**
|
||||
(`~/.pysim-simple-server/test_scripts.json`, `--test-scripts`): the PWA's Test
|
||||
script pill manages them (Import/Export move JSON in and out, the old
|
||||
localStorage export imports as-is), and any API client can create or run them
|
||||
(`POST /api/test/run` with an inline `script` or a stored `script_id` - see
|
||||
`docs/api.md`). While a run is active the card belongs to the script.
|
||||
|
||||
## Document shape
|
||||
|
||||
|
||||
Reference in New Issue
Block a user