Skip to content

Commit

Permalink
Add pixit to test 1 3 (#35281)
Browse files Browse the repository at this point in the history
* Added the PIXIT.SEAR.VALID_AREAS to the SEAR-1.3 test.

* Updated the rvc-app's PICS and readme following the addition of PIXIT.SEAR.VALID_AREAS.

* Restyled by prettier-markdown

* Update src/python_testing/TC_SEAR_1_3.py

Co-authored-by: Kiel Oleson <kielo@apple.com>

---------

Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Kiel Oleson <kielo@apple.com>
  • Loading branch information
3 people authored and pull[bot] committed Aug 30, 2024
1 parent 3d6f041 commit 1defa4c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
7 changes: 2 additions & 5 deletions examples/rvc-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,8 @@ Example command:

### TC 1.3

todo once the
[test plan issue](https://github.com/CHIP-Specifications/chip-test-plans/issues/4454)
is resolved, add the required PIXIT and set the
PICS`SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS=1`. PIXIT: `` Example command:
`./scripts/tests/run_python_test.py --script src/python_testing/TC_SEAR_1_3.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1`
PIXIT: `PIXIT.SEAR.VALID_AREAS:'[7, 1234567]'` Example command:
`./scripts/tests/run_python_test.py --script src/python_testing/TC_SEAR_1_3.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --json-arg PIXIT.SEAR.VALID_AREAS:'[7, 1234567]'`

### TC 1.4

Expand Down
2 changes: 1 addition & 1 deletion examples/rvc-app/rvc-common/pics/rvc-app-pics-values
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SEAR.S.M.ADD_AREA=1
SEAR.S.M.REMOVE_MAP=1
SEAR.S.M.ADD_MAP=1
SEAR.S.M.INVALID_STATE_FOR_SELECT_AREAS=1
SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS=0
SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS=1
SEAR.S.M.SELECT_AREAS_WHILE_NON_IDLE=1
SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL=1
SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL=1
Expand Down
30 changes: 18 additions & 12 deletions src/python_testing/TC_SEAR_1_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,36 +110,42 @@ async def test_TC_SEAR_1_3(self):
selected_areas = await self.read_selected_areas(step=6)
asserts.assert_true(len(selected_areas) == 0, "SelectedAreas should be empty")

await self.send_cmd_select_areas_expect_response(step=8, new_areas=[invalid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kUnsupportedArea)
await self.send_cmd_select_areas_expect_response(step=7, new_areas=[invalid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kUnsupportedArea)

if "PIXIT.SEAR.VALID_AREAS" not in self.matter_test_config.global_test_params:
# All the remaining tests require the PIXIT.SEAR.VALID_AREAS
return

valid_areas = self.matter_test_config.global_test_params['PIXIT.SEAR.VALID_AREAS']

if self.check_pics("SEAR.S.M.INVALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL"):
test_step = "Manually intervene to put the device in a state that prevents it from executing the SelectAreas command"
self.print_step("7", test_step)
self.print_step("8", test_step)
if self.is_ci:
await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=1), endpoint=self.endpoint)
else:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.send_cmd_select_areas_expect_response(step=10, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode)
await self.send_cmd_select_areas_expect_response(step=9, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode)

if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL"):
test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({supported_area_ids}) command"
self.print_step("9", test_step)
test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({valid_areas}) command"
self.print_step("10", test_step)
if self.is_ci:
self.write_to_app_pipe({"Name": "Reset"})
else:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.send_cmd_select_areas_expect_response(step=11, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess)
await self.send_cmd_select_areas_expect_response(step=11, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess)

selected_areas = await self.read_selected_areas(step=12)
asserts.assert_true(len(selected_areas) == len(supported_area_ids),
f"SelectedAreas({selected_areas}) should match SupportedAreas({supported_area_ids})")
asserts.assert_true(selected_areas == valid_areas,
f"SelectedAreas({selected_areas}) should match SupportedAreas({valid_areas})")

await self.send_cmd_select_areas_expect_response(step=13, new_areas=supported_area_ids, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess)
await self.send_cmd_select_areas_expect_response(step=13, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess)

if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS") and self.check_pics("SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL") and self.check_pics("SEAR.S.M.SELECT_AREAS_WHILE_NON_IDLE"):
test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({valid_area_id}) command, and put the device in a non-idle state"
test_step = f"Manually intervene to put the device in a state that allows it to execute the SelectAreas({valid_areas}) command, and put the device in a non-idle state"
self.print_step("14", test_step)
if self.is_ci:
self.write_to_app_pipe({"Name": "Reset"})
Expand All @@ -148,9 +154,9 @@ async def test_TC_SEAR_1_3(self):
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

if self.check_pics("SEAR.S.F00"):
await self.send_cmd_select_areas_expect_response(step=15, new_areas=[valid_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess)
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_area_id], expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode)
await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode)


if __name__ == "__main__":
Expand Down

0 comments on commit 1defa4c

Please sign in to comment.