v3.18.0: the semantic event action for test scripts

The other-applet batch: a test script can send the common event downloads
semantically instead of raw hex.

- events.py: server-side mirrors of the PWA's event forms for Location status
  (0x03), Access technology change (0x0B), Network rejection (0x12 - the
  LA/RA/TA object selected by the registration group, the extended EMM cause
  and the extended information object) and Data connection status change
  (0x1D - status/type/TI plus the optional cause, host-clock 8.39 date-time,
  location information, access technology, APN and PDP/PDN/PDU type).  Fields
  are validated before the run (a bad value is a script error, not a step
  failure); `src` overrides the device-identities source (default terminal,
  matching the Phone forms).
- The engine gains the `event` action kind; the runner builds and sends it.
  The PWA's action-kind list stays in sync (drift-guarded - the guard itself
  caught its own regex bug on the first run).
- Byte parity: the vectors are generated from the PWA's own builders and
  pinned in tests/test_events.py; the frontend suites assert the same values.
  PLMN and SCTS helpers are mirrored too.
- The Phone tab's event form shows the built "Event data (hex)" (updated as
  the fields change), so every event without a builder can be used through
  the raw `envelope` action.
- The test-step editor offers the event select + a JSON fields textarea;
  malformed JSON refuses the save with a clear message.
- docs/test-scripts.md (the semantic-event table, an event example, the
  format stamp), docs/api.md and help EN/RU updated.

Tests: 812 frontend + 717 Python; sw cache simple-v381.
This commit is contained in:
2026-10-04 18:00:53 +03:00
parent 0b9e9e4c5e
commit fb4e4bd7b2
15 changed files with 715 additions and 19 deletions
+13
View File
@@ -981,6 +981,19 @@ class PresetStoreHttpTests(unittest.TestCase):
self.assertEqual(status, 503, resp)
class TestActionKindsDriftTests(unittest.TestCase):
"""The PWA's test-script action kinds must match the engine's (a missing
kind in either side breaks scripts silently)."""
def test_the_pwa_and_the_server_share_the_action_kinds(self):
from pysim_simple_server import testscript
html = (ROOT / 'frontend' / 'index.html').read_text(encoding='utf-8')
m = re.search(r"const TEST_ACTION_KINDS = \[(.*?)\];", html)
self.assertIsNotNone(m, 'TEST_ACTION_KINDS not found in the PWA')
pwa = re.findall(r"'([a-z0-9-]+)'", m.group(1))
self.assertEqual(pwa, list(testscript.ACTION_KINDS))
class TestScriptStoreHttpTests(unittest.TestCase):
"""The test script endpoints (v3.16.0): the PWA's Test script pill talks
to the server store instead of localStorage, and a run may name a stored