diff --git a/src/app/clusters/service-area-server/service-area-server.cpp b/src/app/clusters/service-area-server/service-area-server.cpp index 55ee2ab27c9943..b474d8ee87df95 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -378,12 +378,19 @@ void Instance::HandleSkipAreaCmd(HandlerContext & ctx, const Commands::SkipArea: ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); }; - // The SkippedArea field SHALL match an entry in the SupportedAreas list. - // If the Status field is set to InvalidAreaList, the StatusText field SHALL be an empty string. + // If the SelectedAreas attribute is empty, the SkipAreaResponse command’s Status field SHALL indicate InvalidAreaList. + if (GetNumberOfSelectedAreas() == 0) + { + exitResponse(SkipAreaStatus::kInvalidAreaList, ""_span); + return; + } + + // If the SkippedArea field does not match an entry in the SupportedAreas attribute, the SkipAreaResponse command’s Status field + // SHALL indicate InvalidSkippedArea. if (!mStorageDelegate->IsSupportedArea(req.skippedArea)) { ChipLogError(Zcl, "SkippedArea (%" PRIu32 ") is not in the SupportedAreas attribute.", req.skippedArea); - exitResponse(SkipAreaStatus::kInvalidAreaList, ""_span); + exitResponse(SkipAreaStatus::kInvalidSkippedArea, ""_span); return; } diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index 50b9080dff08c2..d4704d686a61e4 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -115,26 +115,30 @@ async def test_TC_SEAR_1_5(self): if self.check_pics("SEAR.S.M.INVALID_STATE_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): test_step = "Manually intervene to put the device in a state that prevents it from executing the SkipArea command \ - (e.g. set CurrentArea to null or make it not operate, i.e. be in the idle state)" + (e.g. set CurrentArea to null or make it not operate, i.e. be in the idle state). Ensure that SelectedArea is not empty." self.print_step("3", test_step) - if not self.is_ci: + if self.is_ci: + await self.send_single_cmd(cmd=Clusters.Objects.ServiceArea.Commands.SelectAreas(newAreas=[7]), + endpoint=self.endpoint) + else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - await self.send_cmd_skip_area_expect_response(step=4, skipped_area=valid_area_id, - expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidInMode) + await self.send_cmd_skip_area_expect_response(step=4, skipped_area=valid_area_id, + expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidInMode) if self.check_pics("SEAR.S.M.NO_SELAREA_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): test_step = "Manually intervene to put the device in a state where the state would allow it to execute the SkipArea command, \ if SelectedAreas wasn't empty, and SelectedAreas is empty" self.print_step("5", test_step) if self.is_ci: + self.write_to_app_pipe({"Name": "Reset"}) 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_skip_area_expect_response(step=6, skipped_area=valid_area_id, - expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidAreaList) + await self.send_cmd_skip_area_expect_response(step=6, skipped_area=valid_area_id, + expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidAreaList) if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): test_step = "Manually intervene to put the device in a state that allows it to execute the SkipArea command" @@ -148,8 +152,8 @@ async def test_TC_SEAR_1_5(self): else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - await self.send_cmd_skip_area_expect_response(step=8, skipped_area=invalid_area_id, - expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidSkippedArea) + await self.send_cmd_skip_area_expect_response(step=8, skipped_area=invalid_area_id, + expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidSkippedArea) if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"): return