0
0
Fork 0
Codesys-MCP-SP21-plus/tests
phobicdotno f0a44f877e
test(e2e): regression coverage for the four 2026-04-29 fixes (#14)
* feat(live-values): --live-values-interval <ms> CLI flag

Replaces the hardcoded 500ms poll with a configurable interval.
Clamped to [100, 60000] -- below 100 the read_variable IPC round-
trip-per-var dominates and the pump can't keep up; above 60000 a
session shorter than the interval would never see any update.

ServerConfig.liveValuesIntervalMs?: number plumbs through bin.ts
(parseInt + clamp) into the LiveValuesPump constructor and the
'Live-values pump started (<ms>ms)' log line.

Default unchanged at 500ms, so existing --live-values invocations
behave identically.

* test(e2e): regression coverage for the four 2026-04-29 fixes

Five new template-prep assertions:

1. set_symbol_access mutation lookup goes to get_all_signatures FIRST
   (PR #7). The configured-view probe is tracking-only and must come
   AFTER both compile=False/True all-signatures lookups -- if the order
   ever flips, the mutation hits the read-only view and CODESYS rejects
   the assignment with 'can only be changed in the list of all
   signatures/data types'.

2. set_symbol_access int->SymbolAccess coerce (PR #9). The fallback
   block must use type(maximal_access) and call enum_cls(int_val)
   BEFORE 'var.configured_access = requested_access'. Without it,
   non-zero ints are rejected with 'must be zero'.

3. set_signature_access_bulk same coerce, lazily on the first variable
   in the for-loop (PR #9). Verifies loop -> coerce -> assign order.

4. create_project without deviceName preserves the no-swap path
   (backwards compat for PR #8). Empty DEVICE_NAME substitutes; the
   if-DEVICE_NAME branch is in the template but the runtime gates it.

5. create_project deviceName swap (PRs #8/#10/#11/#12 combined).
   Verifies:
     - PromptHandling.NONE setter is rendered (script_prompt_handling
       is read-only -- earlier code silently failed).
     - device_repository accessed via script_engine, not as a builtin.
     - update() is the first-attempt mutation, remove+add only fires
       'if not update_ok'.
     - project.close() + precompilecache delete render after swap.

Vitest: 27/27 in tests/integration/e2e.test.ts (was 22).

---------

Co-authored-by: Karstein Phobic Nyvold Kvistad <karstein.kvistad@maritimerobotics.com>
2026-04-29 13:44:02 +02:00
..
integration test(e2e): regression coverage for the four 2026-04-29 fixes (#14) 2026-04-29 13:44:02 +02:00
tui tui(v0.3): useLiveValues hook + wire into Browser/Viewer 2026-04-29 09:49:15 +02:00
unit test(e2e): regression coverage for the four 2026-04-29 fixes (#14) 2026-04-29 13:44:02 +02:00
bench-results-v5.json test(bench): v5 sweep -- fix set_pou_code params, all 10 cases pass 2026-04-26 19:30:48 +02:00
bench-results.json fix: 4 broken-tool fixes (compile json long, connect_to_device LoginMode, 2026-04-26 16:53:25 +02:00
bench.mjs test(bench): v5 sweep -- fix set_pou_code params, all 10 cases pass 2026-04-26 19:30:48 +02:00
mock_watcher.py fix(test): retry on PermissionError in mock_watcher (Win race) 2026-04-29 08:34:06 +02:00
test-fixes.mjs fix(create_folder): try project.create_folder(name, SV_POU) first; drop ScriptManager cache 2026-04-26 17:16:44 +02:00
TEST_OVERVIEW.md rename: Codesys-MCP-SP22+ -> Codesys-MCP-SP21+ + multi-install README + missing tools 2026-04-26 22:02:46 +02:00