diff --git a/scripts/py_matter_yamltests/matter_yamltests/fixes.py b/scripts/py_matter_yamltests/matter_yamltests/fixes.py index d2d4a5fc48ee71..47355227f45834 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/fixes.py +++ b/scripts/py_matter_yamltests/matter_yamltests/fixes.py @@ -100,8 +100,9 @@ def try_add_yaml_support_for_scientific_notation_without_dot(loader): # accessory. But this state may not exist in the runner (as in it prevent to have multiple node ids # associated to a fabric...) so the 'nodeId' needs to be added back manually. def try_update_yaml_node_id_test_runner_state(tests, config): + default_identity = 'alpha' identities = { - 'alpha': None if 'nodeId' not in config else config['nodeId']} + default_identity: None if 'nodeId' not in config else config['nodeId']} for test in tests: if not test.is_enabled: @@ -109,11 +110,21 @@ def try_update_yaml_node_id_test_runner_state(tests, config): identity = test.identity - if test.cluster == 'CommissionerCommands': - if test.command == 'PairWithCode': + if test.cluster == 'CommissionerCommands' or test.cluster == 'DelayCommands': + if test.command == 'PairWithCode' or test.command == 'WaitForCommissionee': + if test.response_with_placeholders: + # It the test expects an error, we should not update the + # nodeId of the identity. + error = test.response_with_placeholders.get('error') + if error: + continue + for item in test.arguments_with_placeholders['values']: if item['name'] == 'nodeId': identities[identity] = item['value'] elif identity is not None and identity in identities: node_id = identities[identity] test.node_id = node_id + elif identity is None and default_identity in identities: + node_id = identities[default_identity] + test.node_id = node_id