[ICD] Update ICDM 4.1 Test script (#34812)

* Update ICDM 4.1 Test script

* Restyled by whitespace

* Restyled by prettier-json

* Restyled by prettier-yaml

* Add a slight tolerance to avoid false negatives

---------

Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/app/tests/suites/certification/Test_TC_ICDM_4_1.yaml b/src/app/tests/suites/certification/Test_TC_ICDM_4_1.yaml
index b845764..3539da0 100644
--- a/src/app/tests/suites/certification/Test_TC_ICDM_4_1.yaml
+++ b/src/app/tests/suites/certification/Test_TC_ICDM_4_1.yaml
@@ -17,58 +17,57 @@
 
 PICS:
     - ICDM.S
-    - ICDM.S.C00.Rsp
-    - ICDM.S.C02.Rsp
-    - ICDM.S.C03.Rsp
+    - ICDM.S.F02
 
 config:
     nodeId: 0x12344321
-    cluster: "Basic Information"
+    cluster: "ICD Management"
     endpoint: 0
 
 tests:
-    - label: "Preconditions"
-      verification: |
-          1.Commission DUT to TH (can be skipped if done in a preceding test).
-      disabled: true
+    - label: "Wait for the commissioned device to be retrieved"
+      cluster: "DelayCommands"
+      command: "WaitForCommissionee"
+      arguments:
+          values:
+              - name: "nodeId"
+                value: nodeId
 
     - label:
-          "Step 1: TH sends StayActiveRequest command with StayActiveDuration."
-      PICS: ICDM.S.C03.Rsp
-      verification: |
-          ./chip-tool icdmanagement stay-active-request 1 0
+          "TH sends StayActiveRequest command with StayActiveDuration greater
+          than or equal 30000 milliseconds."
+      command: "StayActiveRequest"
+      arguments:
+          values:
+              - name: "StayActiveDuration"
+                value: 30000
+      response:
+          values:
+              - name: "PromisedActiveDuration"
+                saveAs: ActiveDuration
+                constraints:
+                    type: int32u
+                    minValue: 29995
 
-          Via the TH (chip-tool), verify the SUCCESS response for StayActiveRequest command.
+    - label: "Wait for the PromisedActiveDuration to end"
+      cluster: "DelayCommands"
+      command: "WaitForMs"
+      arguments:
+          values:
+              - name: "ms"
+                value: ActiveDuration
 
-          [1702414315.312084][3787:3789] CHIP:DMG: InvokeResponseMessage =
-          [1702414315.312130][3787:3789] CHIP:DMG: {
-          [1702414315.312244][3787:3789] CHIP:DMG:         suppressResponse = false,
-          [1702414315.312295][3787:3789] CHIP:DMG:         InvokeResponseIBs =
-          [1702414315.312360][3787:3789] CHIP:DMG:         [
-          [1702414315.312497][3787:3789] CHIP:DMG:                 InvokeResponseIB =
-          [1702414315.312572][3787:3789] CHIP:DMG:                 {
-          [1702414315.312626][3787:3789] CHIP:DMG:                         CommandStatusIB =
-          [1702414315.312709][3787:3789] CHIP:DMG:                         {
-          [1702414315.312774][3787:3789] CHIP:DMG:                                 CommandPathIB =
-          [1702414315.312857][3787:3789] CHIP:DMG:                                 {
-          [1702414315.312921][3787:3789] CHIP:DMG:                                         EndpointId = 0x0,
-          [1702414315.312994][3787:3789] CHIP:DMG:                                         ClusterId = 0x46,
-          [1702414315.313060][3787:3789] CHIP:DMG:                                         CommandId = 0x3,
-          [1702414315.313155][3787:3789] CHIP:DMG:                                 },
-          [1702414315.313234][3787:3789] CHIP:DMG:
-          [1702414315.313293][3787:3789] CHIP:DMG:                                 StatusIB =
-          [1702414315.313382][3787:3789] CHIP:DMG:                                 {
-          [1702414315.313450][3787:3789] CHIP:DMG:                                         status = 0x81 (UNSUPPORTED_COMMAND),
-          [1702414315.313536][3787:3789] CHIP:DMG:                                 },
-          [1702414315.313603][3787:3789] CHIP:DMG:
-          [1702414315.313679][3787:3789] CHIP:DMG:                         },
-          [1702414315.313747][3787:3789] CHIP:DMG:
-          [1702414315.313799][3787:3789] CHIP:DMG:                 },
-          [1702414315.313878][3787:3789] CHIP:DMG:
-          [1702414315.313928][3787:3789] CHIP:DMG:         ],
-          [1702414315.313989][3787:3789] CHIP:DMG:
-          [1702414315.314057][3787:3789] CHIP:DMG:         InteractionModelRevision = 11
-          [1702414315.314106][3787:3789] CHIP:DMG: },
-          [1702414315.314254][3787:3789] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_0046 Command=0x0000_0003 Status=0x81
-          [1702414315.314359][3787:3789] CHIP:TOO: Error: IM Error 0x00000581: General error: 0x81 (UNSUPPORTED_COMMAND)
-      disabled: true
+    - label:
+          "TH sends StayActiveRequest command with StayActiveDuration less than
+          30000 milliseconds."
+      command: "StayActiveRequest"
+      arguments:
+          values:
+              - name: "StayActiveDuration"
+                value: 20000
+      response:
+          values:
+              - name: "PromisedActiveDuration"
+                constraints:
+                    type: int32u
+                    minValue: 19995
diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json
index a96ef4a..1e24106 100644
--- a/src/app/tests/suites/ciTests.json
+++ b/src/app/tests/suites/ciTests.json
@@ -71,7 +71,8 @@
     "IcdManagement": [
         "TestIcdManagementCluster",
         "Test_TC_ICDM_1_1",
-        "Test_TC_ICDM_3_4"
+        "Test_TC_ICDM_3_4",
+        "Test_TC_ICDM_4_1"
     ],
     "Identify": ["Test_TC_I_2_1", "Test_TC_I_2_2", "Test_TC_I_2_3"],
     "IlluminanceMeasurement": ["Test_TC_ILL_2_1", "Test_TC_ILL_2_2"],
diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json
index bbb86f7..5edf1cb 100644
--- a/src/app/tests/suites/manualTests.json
+++ b/src/app/tests/suites/manualTests.json
@@ -117,11 +117,7 @@
     "GeneralCommissioning": ["Test_TC_CGEN_2_2"],
     "GeneralDiagnostics": ["Test_TC_DGGEN_2_2"],
     "Identify": ["Test_TC_I_3_2"],
-    "IcdManagement": [
-        "Test_TC_ICDM_3_2",
-        "Test_TC_ICDM_4_1",
-        "Test_TC_ICDM_5_1"
-    ],
+    "IcdManagement": ["Test_TC_ICDM_3_2", "Test_TC_ICDM_5_1"],
     "IlluminanceMeasurement": [],
     "InteractionDataModel": [
         "Test_TC_IDM_1_1",