[TC-CLDIM-3.3] Error fixes (#40446)
* Added check to ensure reception of subscription report
* Fixed expected response
* Fixed expected value
* Renamed variable after code review
diff --git a/src/python_testing/TC_CLDIM_3_3.py b/src/python_testing/TC_CLDIM_3_3.py
index 44bfbc5..76e32be 100644
--- a/src/python_testing/TC_CLDIM_3_3.py
+++ b/src/python_testing/TC_CLDIM_3_3.py
@@ -101,7 +101,7 @@
TestStep("5a", "If LimitRange is unsupported, skip step 5b to 5g"),
TestStep("5b", "Send SetTarget command with Position 0%"),
TestStep("5c", "Verify TargetState attribute is updated"),
- TestStep("5d", "Wait for CurrentState.Position to be updated to 0%"),
+ TestStep("5d", "Wait for CurrentState.Position to be updated to MinPosition"),
TestStep("5e", "Send SetTarget command with Position 100%"),
TestStep("5f", "Verify TargetState attribute is updated"),
TestStep("5g", "Wait for CurrentState.Position to be updated to 100%"),
@@ -114,8 +114,8 @@
TestStep("7f", "If not Resolution == 1: Wait for CurrentState.Position to be updated"),
TestStep("7g", "Send SetTarget command with Position not a multiple of Resolution"),
TestStep("7h", "Verify TargetState attribute is updated"),
- TestStep("7i", "If not Resolution > 2: Wait for CurrentState.Position to be updated"),
- TestStep("7j", "If not Resolution <= 2: Wait for CurrentState.Position to be updated"),
+ TestStep("7i", "If Resolution <= 2 and position change expected: Wait for CurrentState.Position to be updated"),
+ TestStep("7j", "If Resolution > 2 and position change expected: Wait for CurrentState.Position to be updated"),
TestStep(8, "Send SetTarget command with Latch field when MotionLatching is unsupported"),
TestStep(9, "Send SetTarget command with Speed field when Speed is unsupported"),
TestStep(10, "Send SetTarget command with invalid Speed when Speed is unsupported"),
@@ -171,11 +171,11 @@
# STEP 2e: Read CurrentState attribute
self.step("2e")
- initial_state = await self.read_cldim_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState)
+ current_state = await self.read_cldim_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState)
# STEP 2f: If Latching feature is not supported or state is unlatched, skip steps 2g to 2l
self.step("2f")
- if (not is_latching_supported) or (not initial_state.latch):
+ if (not is_latching_supported) or (not current_state.latch):
logging.info("Latching feature is not supported or state is unlatched. Skipping steps 2g to 2l.")
self.mark_step_range_skipped("2g", "2l")
else:
@@ -280,11 +280,8 @@
cmd=Clusters.Objects.ClosureDimension.Commands.SetTarget(position=10001),
endpoint=endpoint, timedRequestTimeoutMs=1000
)
-
- asserts.fail("Expected ConstraintError for Position exceeding 100%")
-
except InteractionModelError as e:
- asserts.assert_equal(e.status, Status.ConstraintError, "Unexpected status returned")
+ asserts.assert_equal(e.status, Status.Success, "Unexpected error returned")
# STEP 5a: If LimitRange is unsupported, skip step 5b to 5g
self.step("5a")
@@ -308,11 +305,11 @@
target_state = await self.read_cldim_attribute_expect_success(endpoint=endpoint, attribute=attributes.TargetState)
asserts.assert_equal(target_state.position, min_position, "TargetState Position does not match MinPosition")
- # STEP 5d: Wait for CurrentState.Position to be updated to 0%
+ # STEP 5d: Wait for CurrentState.Position to be updated to MinPosition
self.step("5d")
- if initial_state.position > 0:
+ if current_state.position > 0:
sub_handler.await_all_expected_report_matches(
- expected_matchers=[current_position_matcher(0)], timeout_sec=timeout)
+ expected_matchers=[current_position_matcher(min_position)], timeout_sec=timeout)
else:
logging.info("Initial Position not > 0. Skipping step 5d.")
self.mark_current_step_skipped()
@@ -366,7 +363,7 @@
else:
# STEP 7b: Read CurrentState attribute
self.step("7b")
- initial_state = await self.read_cldim_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState)
+ current_state = await self.read_cldim_attribute_expect_success(endpoint=endpoint, attribute=attributes.CurrentState)
# STEP 7c: Send SetTarget command with Position not a multiple of Resolution
self.step("7c")
@@ -391,19 +388,21 @@
# STEP 7e: If not Resolution != 1: Wait for CurrentState.Position to be updated
self.step("7e")
- if (resolution != 1) or (initial_state.position == min_position):
+ if (resolution != 1) or (current_state.position == min_position):
self.mark_current_step_skipped()
else:
sub_handler.await_all_expected_report_matches(
expected_matchers=[current_position_matcher(min_position)], timeout_sec=timeout)
+ current_state.position = min_position
# STEP 7f: If not Resolution == 1: Wait for CurrentState.Position to be updated
self.step("7f")
- if (resolution == 1) or (initial_state.position == min_position + resolution):
+ if (resolution == 1) or (current_state.position == min_position + resolution):
self.mark_current_step_skipped()
else:
sub_handler.await_all_expected_report_matches(
expected_matchers=[current_position_matcher(min_position + resolution)], timeout_sec=timeout)
+ current_state.position = min_position + resolution
# STEP 7g: Send SetTarget command with Position not a multiple of Resolution
self.step("7g")
@@ -426,17 +425,17 @@
asserts.assert_equal(target_state.position, max_position - resolution,
"TargetState Position does not match expected value")
- # STEP 7i: If not Resolution > 2: Wait for CurrentState.Position to be updated
+ # STEP 7i: If Resolution <= 2 and position change expected: Wait for CurrentState.Position to be updated
self.step("7i")
- if (resolution > 2):
+ if (resolution > 2 or current_state.position == max_position):
self.mark_current_step_skipped()
else:
sub_handler.await_all_expected_report_matches(
expected_matchers=[current_position_matcher(max_position)], timeout_sec=timeout)
- # STEP 7j: If not Resolution <= 2: Wait for CurrentState.Position to be updated
+ # STEP 7j: If Resolution > 2 and position change expected: Wait for CurrentState.Position to be updated
self.step("7j")
- if (resolution <= 2):
+ if (resolution <= 2 or current_state.position == max_position - resolution):
self.mark_current_step_skipped()
else:
sub_handler.await_all_expected_report_matches(