Vivien Nicolas | 408db8a | 2022-04-27 19:29:03 +0200 | [diff] [blame] | 1 | # Copyright (c) 2022 Project CHIP Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | name: Events Tests |
| 16 | |
| 17 | config: |
| 18 | nodeId: 0x12344321 |
Andrei Litvin | cf32330 | 2022-11-15 15:00:44 +0100 | [diff] [blame] | 19 | cluster: "Unit Testing" |
Vivien Nicolas | 408db8a | 2022-04-27 19:29:03 +0200 | [diff] [blame] | 20 | endpoint: 1 |
| 21 | |
| 22 | tests: |
| 23 | - label: "Wait for the commissioned device to be retrieved" |
| 24 | cluster: "DelayCommands" |
| 25 | command: "WaitForCommissionee" |
| 26 | arguments: |
| 27 | values: |
| 28 | - name: "nodeId" |
| 29 | value: nodeId |
| 30 | |
| 31 | - label: "Check there is no event on the target endpoint" |
| 32 | command: "readEvent" |
| 33 | event: "TestEvent" |
Vivien Nicolas | c7b1748 | 2023-02-08 10:29:03 +0100 | [diff] [blame] | 34 | response: [] |
Vivien Nicolas | 408db8a | 2022-04-27 19:29:03 +0200 | [diff] [blame] | 35 | |
| 36 | - label: "Check reading events from an invalid endpoint" |
| 37 | command: "readEvent" |
| 38 | event: "TestEvent" |
| 39 | endpoint: 0 |
Boris Zbarsky | 8d2516a | 2023-06-14 12:15:18 -0400 | [diff] [blame] | 40 | response: |
| 41 | error: UNSUPPORTED_CLUSTER |
Vivien Nicolas | 408db8a | 2022-04-27 19:29:03 +0200 | [diff] [blame] | 42 | |
| 43 | - label: "Generate an event on the accessory" |
| 44 | command: "TestEmitTestEventRequest" |
| 45 | arguments: |
| 46 | values: |
| 47 | - name: "arg1" |
| 48 | value: 1 |
| 49 | - name: "arg2" |
| 50 | value: 2 |
| 51 | - name: "arg3" |
| 52 | value: true |
| 53 | response: |
| 54 | values: |
| 55 | - name: "value" |
| 56 | saveAs: eventNumber |
| 57 | |
| 58 | - label: "Read the event back" |
| 59 | command: "readEvent" |
| 60 | event: "TestEvent" |
| 61 | response: |
| 62 | value: { arg1: 1, arg2: 2, arg3: true } |
| 63 | |
Vivien Nicolas | e04564c | 2022-05-19 22:54:05 +0200 | [diff] [blame] | 64 | - label: "Read the event with eventNumber set to the event value" |
| 65 | command: "readEvent" |
| 66 | event: "TestEvent" |
| 67 | eventNumber: eventNumber |
| 68 | response: |
| 69 | value: { arg1: 1, arg2: 2, arg3: true } |
| 70 | |
| 71 | - label: "Read the event with eventNumber set to the event value + 1" |
| 72 | command: "readEvent" |
| 73 | event: "TestEvent" |
| 74 | eventNumber: eventNumber + 1 |
Vivien Nicolas | c7b1748 | 2023-02-08 10:29:03 +0100 | [diff] [blame] | 75 | response: [] |
Vivien Nicolas | e04564c | 2022-05-19 22:54:05 +0200 | [diff] [blame] | 76 | |
Vivien Nicolas | 408db8a | 2022-04-27 19:29:03 +0200 | [diff] [blame] | 77 | - label: "Generate a second event on the accessory" |
| 78 | command: "TestEmitTestEventRequest" |
| 79 | arguments: |
| 80 | values: |
| 81 | - name: "arg1" |
| 82 | value: 3 |
| 83 | - name: "arg2" |
Boris Zbarsky | 309e9f1 | 2023-04-29 12:32:47 -0400 | [diff] [blame] | 84 | value: 1 |
Vivien Nicolas | 408db8a | 2022-04-27 19:29:03 +0200 | [diff] [blame] | 85 | - name: "arg3" |
| 86 | value: false |
| 87 | response: |
| 88 | values: |
| 89 | - name: "value" |
| 90 | value: eventNumber + 1 |
| 91 | |
| 92 | - label: "Read the event back" |
| 93 | command: "readEvent" |
| 94 | event: "TestEvent" |
| 95 | response: |
| 96 | - values: |
| 97 | - value: { arg1: 1, arg2: 2, arg3: true } |
| 98 | - values: |
Boris Zbarsky | 309e9f1 | 2023-04-29 12:32:47 -0400 | [diff] [blame] | 99 | - value: { arg1: 3, arg2: 1, arg3: false } |
Vivien Nicolas | fb68954 | 2022-04-28 16:39:40 +0200 | [diff] [blame] | 100 | |
| 101 | - label: "Subscribe to the event" |
| 102 | command: "subscribeEvent" |
| 103 | event: "TestEvent" |
| 104 | minInterval: 3 |
| 105 | maxInterval: 5 |
| 106 | response: |
| 107 | - values: |
| 108 | - value: { arg1: 1, arg2: 2, arg3: true } |
| 109 | - values: |
Boris Zbarsky | 309e9f1 | 2023-04-29 12:32:47 -0400 | [diff] [blame] | 110 | - value: { arg1: 3, arg2: 1, arg3: false } |
Vivien Nicolas | fb68954 | 2022-04-28 16:39:40 +0200 | [diff] [blame] | 111 | |
| 112 | - label: "Generate a third event on the accessory" |
| 113 | command: "TestEmitTestEventRequest" |
| 114 | arguments: |
| 115 | values: |
| 116 | - name: "arg1" |
| 117 | value: 4 |
| 118 | - name: "arg2" |
yunhanw-google | e455945 | 2022-07-16 11:12:39 -0700 | [diff] [blame] | 119 | value: 3 |
Vivien Nicolas | fb68954 | 2022-04-28 16:39:40 +0200 | [diff] [blame] | 120 | - name: "arg3" |
| 121 | value: true |
| 122 | response: |
| 123 | values: |
| 124 | - name: "value" |
| 125 | value: eventNumber + 2 |
| 126 | |
| 127 | - label: "Check for event report" |
| 128 | command: "waitForReport" |
| 129 | event: "TestEvent" |
| 130 | response: |
| 131 | values: |
| 132 | - name: "TestEvent" |
yunhanw-google | e455945 | 2022-07-16 11:12:39 -0700 | [diff] [blame] | 133 | value: { arg1: 4, arg2: 3, arg3: true } |