Skip to content

Commit 25f879f

Browse files
Fixed test 1.6 and updated the scripts to work in CI. (project-chip#34918)
* Fixed test 1.6 and updated the scripts to work in CI. * Restyled by autopep8 --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent e994cbf commit 25f879f

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/python_testing/TC_SEAR_1_6.py

+19-9
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def read_supported_areas(self, step):
5252
self.print_step(step, "Read SupportedAreas attribute")
5353
supported_areas = await self.read_sear_attribute_expect_success(
5454
endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.SupportedAreas)
55-
logging.info("SupportedAreas: %s" % (supported_areas))
55+
logging.info("SupportedAreas: %s" % supported_areas)
5656

5757
return [a.areaID for a in supported_areas]
5858

@@ -77,7 +77,7 @@ def write_to_app_pipe(self, command):
7777
with open(self.app_pipe, "w") as app_pipe:
7878
app_pipe.write(command + "\n")
7979
# Allow some time for the command to take effect.
80-
# This removes the test flakyness which is very annoying for everyone in CI.
80+
# This removes the test flakiness which is very annoying for everyone in CI.
8181
sleep(0.001)
8282

8383
def TC_SEAR_1_6(self) -> list[str]:
@@ -102,7 +102,10 @@ async def test_TC_SEAR_1_6(self):
102102

103103
test_step = "Manually intervene to put the device in the idle state and ensure SupportedAreas and SelectedAreas are not empty"
104104
self.print_step("2", test_step)
105-
if not self.is_ci:
105+
if self.is_ci:
106+
await self.send_single_cmd(cmd=Clusters.Objects.ServiceArea.Commands.SelectAreas(newAreas=[7, 1234567]),
107+
endpoint=self.endpoint)
108+
else:
106109
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")
107110

108111
supported_area_ids = await self.read_supported_areas(step=3)
@@ -113,7 +116,10 @@ async def test_TC_SEAR_1_6(self):
113116

114117
test_step = "Manually intervene to put the device in the operating state"
115118
self.print_step("5", test_step)
116-
if not self.is_ci:
119+
if self.is_ci:
120+
await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=1),
121+
endpoint=self.endpoint)
122+
else:
117123
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")
118124

119125
progress_list_operating = await self.read_progress(step=6)
@@ -122,16 +128,20 @@ async def test_TC_SEAR_1_6(self):
122128

123129
for p in progress_list_operating:
124130
asserts.assert_true(p.areaID in selected_areas, f"Progress entry with unknown AreaID({p.areaID})")
125-
asserts.assert_true(p.status in (Clusters.ServiceArea.OperationalStatusEnum.kPending,
126-
Clusters.ServiceArea.OperationalStatusEnum.kOperating),
131+
asserts.assert_true(p.status in (Clusters.ServiceArea.Enums.OperationalStatusEnum.kPending,
132+
Clusters.ServiceArea.Enums.OperationalStatusEnum.kOperating),
127133
f"Progress entry with unexpected Status({p.status})")
128-
asserts.assert_true(p.TotalOperationalTime is NullValue, "Progress entry with non-null TotalOperationalTime")
134+
asserts.assert_true(type(p.totalOperationalTime) in [type(None), type(
135+
NullValue)], "Progress.TotalOperationalTime has a value")
129136

130137
test_step = "While all entries in Progress show the Pending or Operating status (i.e. \
131138
before any area is skipped or completed), manually intervene to put the device \
132139
in the idle state, by ending the operation unexpectedly (e.g. force an error)"
133140
self.print_step("7", test_step)
134-
if not self.is_ci:
141+
if self.is_ci:
142+
await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=0),
143+
endpoint=self.endpoint)
144+
else:
135145
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")
136146

137147
progress_list_idle = await self.read_progress(step=8)
@@ -140,7 +150,7 @@ async def test_TC_SEAR_1_6(self):
140150

141151
for p in progress_list_idle:
142152
asserts.assert_true(p.areaID in selected_areas, f"Progress entry with unknown AreaID({p.areaID})")
143-
asserts.assert_true(p.status == Clusters.ServiceArea.OperationalStatusEnum.kSkipped,
153+
asserts.assert_true(p.status == Clusters.ServiceArea.Enums.OperationalStatusEnum.kSkipped,
144154
f"Progress entry with unexpected Status({p.status})")
145155

146156

0 commit comments

Comments
 (0)