Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Replaced automatable PICS in SEAR tests #35231

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python_testing/TC_SEAR_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ async def read_and_validate_progress(self, step):
f"Progress entry should have a null TotalOperationalTime value (Status is {p.status})")
# TODO how to check that InitialTimeEstimate is either null or uint32?

def TC_SEAR_1_2(self) -> list[str]:
def pics_TC_SEAR_1_2(self) -> list[str]:
return ["SEAR.S"]

@async_test_body
Expand Down
4 changes: 2 additions & 2 deletions src/python_testing/TC_SEAR_1_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def send_cmd_select_areas_expect_response(self, step, new_areas, expected_
expected_response,
f"Command response ({ret.status}) doesn't match the expected one")

def TC_SEAR_1_3(self) -> list[str]:
def pics_TC_SEAR_1_3(self) -> list[str]:
return ["SEAR.S"]

@async_test_body
Expand Down Expand Up @@ -163,7 +163,7 @@ async def test_TC_SEAR_1_3(self):
else:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

if self.check_pics("SEAR.S.F00"):
if await self.feature_guard(endpoint=self.endpoint, cluster=Clusters.ServiceArea, feature_int=Clusters.ServiceArea.Bitmaps.Feature.kSelectWhileRunning):
await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess)
else:
await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode)
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_SEAR_1_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def read_sear_attribute_expect_success(self, endpoint, attribute):
cluster = Clusters.Objects.ServiceArea
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)

def TC_SEAR_1_4(self) -> list[str]:
def pics_TC_SEAR_1_4(self) -> list[str]:
return ["SEAR.S"]

@async_test_body
Expand Down
13 changes: 8 additions & 5 deletions src/python_testing/TC_SEAR_1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def send_cmd_skip_area_expect_response(self, step, skipped_area, expected_
expected_response,
f"Command response ({ret.status}) doesn't match the expected one")

def TC_SEAR_1_5(self) -> list[str]:
def pics_TC_SEAR_1_5(self) -> list[str]:
return ["SEAR.S", "SEAR.S.C02.Rsp"]

@async_test_body
Expand All @@ -111,6 +111,9 @@ async def test_TC_SEAR_1_5(self):
asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set")
self.app_pipe = self.app_pipe + str(app_pid)

if not await self.command_guard(endpoint=self.endpoint, command=Clusters.ServiceArea.Commands.SkipArea):
asserts.fail("Skip Area Response command needs to be supported to run this test")

self.print_step(1, "Commissioning, already done")

# Ensure that the device is in the correct state
Expand Down Expand Up @@ -167,15 +170,15 @@ async def test_TC_SEAR_1_5(self):
if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"):
return

if self.check_pics("SEAR.S.A0005"):
if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress):
old_progress_list = await self.read_progress(step=9)
asserts.assert_true(len(old_progress_list) > 0, f"len of Progress({len(old_progress_list)}) should not be zero)")

selected_areas = await self.read_selected_areas(step=10)
asserts.assert_true(len(selected_areas) > 0, "SelectedAreas is empty")

old_current_area = NullValue
if self.check_pics("SEAR.S.A0003"):
if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.CurrentArea):
old_current_area = await self.read_current_area(step=11)

self.print_step("12", "")
Expand All @@ -189,7 +192,7 @@ async def test_TC_SEAR_1_5(self):
if not self.is_ci:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

if self.check_pics("SEAR.S.A0005"):
if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress):
new_progress_list = await self.read_progress(step=15)
asserts.assert_true(len(new_progress_list) > 0,
f"len of Progress({len(new_progress_list)}) should not be zero)")
Expand Down Expand Up @@ -230,7 +233,7 @@ async def test_TC_SEAR_1_5(self):
self.print_step("17", "")
return

if not self.check_pics("SEAR.S.A0005"):
if not await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress):
return

if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"):
Expand Down
13 changes: 12 additions & 1 deletion src/python_testing/TC_SEAR_1_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def read_progress(self, step):

return progress

def TC_SEAR_1_6(self) -> list[str]:
def pics_TC_SEAR_1_6(self) -> list[str]:
return ["SEAR.S", "SEAR.S.A0005", "SEAR.S.A0000", "SEAR.S.A0002", "SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL"]

@async_test_body
Expand All @@ -94,6 +94,17 @@ async def test_TC_SEAR_1_6(self):
asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set")
self.app_pipe = self.app_pipe + str(app_pid)

attributes = Clusters.ServiceArea.Attributes

if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SupportedAreas):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we now have the top-level guards, this should be changed over to use those.

Also, I'm pretty sure the pics_ function in this test is incorrect - it looks like the function on line 83 is suppose to be pics_TC_SEAR_1_6, which is probably why these were added - the pics definition seems wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the function name for the pics to be pics_TC_SEAR_1_* based on the test being run so that the pics can be found during testing if they are needed.

asserts.fail("Supported areas attribute required in attribute list to run test")

if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SelectedAreas):
asserts.fail("Selected areas attribute required in attribute list to run test")

if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.Progress):
asserts.fail("Progress attribute required in attribute list to run test")

self.print_step(1, "Commissioning, already done")

# Ensure that the device is in the correct state
Expand Down
Loading