Skip to content

Commit bdadfb0

Browse files
committed
fixup for 3.1 test
1 parent 84a0899 commit bdadfb0

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/python_testing/TC_VALCC_3_1.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import chip.clusters as Clusters
3030
from chip.clusters.Types import NullValue
3131
from chip.interaction_model import InteractionModelError, Status
32-
from matter_testing_support import MatterBaseTest, TestStep, default_matter_test_main, has_cluster, run_if_endpoint_matches
32+
from matter_testing_support import AttributeValue, ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, default_matter_test_main, has_cluster, run_if_endpoint_matches
3333
from mobly import asserts
3434

3535

@@ -44,13 +44,14 @@ def desc_TC_VALCC_3_1(self) -> str:
4444
def steps_TC_VALCC_3_1(self) -> list[TestStep]:
4545
steps = [
4646
TestStep(1, "Commissioning, already done", is_commissioning=True),
47-
TestStep(2, "Send Open command"),
48-
TestStep(3, "Read CurrentState and TargetState attribute until CurrentState is Open",
49-
"Target state is Open while CurrentState is Transitioning"),
47+
TestStep(2, "Set up a subscription to all attributes on the DUT"),
48+
TestStep(2, "Send Open command", "DUT returns SUCCESS"),
49+
TestStep(3, "Wait until TH receives and data report for TargetState set to NULL and an attribute report for CurrentState set to Open (ordering does not matter)",
50+
"Expected attribute reports are received"),
5051
TestStep(4, "Read CurrentState and TargetState attribute", "CurrentState is Open, TargetState is NULL"),
51-
TestStep(5, "Send Close command"),
52-
TestStep(6, "Read CurrentState and TargetState attribute until CurrentState is Open",
53-
"Target state is Closed while CurrentState is Transitioning"),
52+
TestStep(5, "Send Close command", "DUT returns SUCCESS"),
53+
TestStep(3, "Wait until TH receives and data report for TargetState set to NULL and an attribute report for CurrentState set to Closed (ordering does not matter)",
54+
"Expected attribute reports are received"),
5455
TestStep(7, "Read CurrentState and TargetState attribute", "CurrentState is Closed, TargetState is NULL"),
5556
]
5657
return steps
@@ -63,6 +64,8 @@ async def test_TC_VALCC_3_1(self):
6364
self.step(1)
6465
cluster = Clusters.ValveConfigurationAndControl
6566
attributes = cluster.Attributes
67+
attribute_subscription = ClusterAttributeChangeAccumulator(cluster)
68+
await attribute_subscription.start(self.default_controller, self.dut_node_id, endpoint)
6669

6770
self.step(2)
6871
try:
@@ -73,6 +76,13 @@ async def test_TC_VALCC_3_1(self):
7376

7477
self.step(3)
7578

79+
# Wait until the current state is open and the target state is Null.
80+
# Wait for the entire duration of the test because this valve may be slow. The test will time out before this does. That's fine.
81+
timeout = self.matter_test_config.timeout if self.matter_test_config.timeout is not None else self.default_timeout
82+
expected_final_state = [AttributeValue(endpoint_id=endpoint, attribute=attributes.TargetState, value=NullValue), AttributeValue(
83+
endpoint_id=endpoint, attribute=attributes.CurrentState, value=cluster.Enums.ValveStateEnum.kOpen)]
84+
attribute_subscription.await_all_final_values_reported(expected_final_values=expected_final_state, timeout_sec=timeout)
85+
7686
# Read target state first in case the current state goes to open between these calls.
7787
# The test re-reads target state after CurrentState goes to open.
7888
target_state_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.TargetState)

0 commit comments

Comments
 (0)