cocos_assert_scene_state
Validate scene and prefab states using regression-style assertions to detect changes in properties, components, and node structures during automated testing.
Instructions
Declarative expectations against a scene/prefab — regression- test style.
Each entry in assertions:
{"path": "", "op": "", "value": }
with optional root-finder shortcuts:
{"find_node_by_name": "Player", # find first cc.Node _name "path": "_lpos.x", "op": "gt", "value": 0}
{"find_component": {"type": "cc.Sprite", "on_node_named": "Enemy"}, "path": "_color.r", "op": "eq", "value": 255}
Ops: eq / ne / gt / ge / lt / le / in / not_in / contains / match / is_null / not_null / type_is / exists / not_exists
Path syntax: _children[0].__id__ / 15._lpos.x.
First dotted segment as int + root is list → list index.
[N] always list index. Missing path → LookupError surfaces
as a failed assertion (or passes if op=not_exists).
Runs EVERY assertion even if earlier ones fail — regression checks want a full report, not a first-failure bail.
Returns {ok, scene_path, total, passed_count, failed_count, passed: [...], failed: [...]}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| assertions | Yes |