blob: 637268ecdc587d3ab04d8ba51f10b6874e547652 [file] [log] [blame]
Vivien Nicolas408db8a2022-04-27 19:29:03 +02001# 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
15name: Events Tests
16
17config:
18 nodeId: 0x12344321
Andrei Litvincf323302022-11-15 15:00:44 +010019 cluster: "Unit Testing"
Vivien Nicolas408db8a2022-04-27 19:29:03 +020020 endpoint: 1
21
22tests:
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 Nicolasc7b17482023-02-08 10:29:03 +010034 response: []
Vivien Nicolas408db8a2022-04-27 19:29:03 +020035
36 - label: "Check reading events from an invalid endpoint"
37 command: "readEvent"
38 event: "TestEvent"
39 endpoint: 0
Boris Zbarsky8d2516a2023-06-14 12:15:18 -040040 response:
41 error: UNSUPPORTED_CLUSTER
Vivien Nicolas408db8a2022-04-27 19:29:03 +020042
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 Nicolase04564c2022-05-19 22:54:05 +020064 - 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 Nicolasc7b17482023-02-08 10:29:03 +010075 response: []
Vivien Nicolase04564c2022-05-19 22:54:05 +020076
Vivien Nicolas408db8a2022-04-27 19:29:03 +020077 - 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 Zbarsky309e9f12023-04-29 12:32:47 -040084 value: 1
Vivien Nicolas408db8a2022-04-27 19:29:03 +020085 - 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 Zbarsky309e9f12023-04-29 12:32:47 -040099 - value: { arg1: 3, arg2: 1, arg3: false }
Vivien Nicolasfb689542022-04-28 16:39:40 +0200100
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 Zbarsky309e9f12023-04-29 12:32:47 -0400110 - value: { arg1: 3, arg2: 1, arg3: false }
Vivien Nicolasfb689542022-04-28 16:39:40 +0200111
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-googlee4559452022-07-16 11:12:39 -0700119 value: 3
Vivien Nicolasfb689542022-04-28 16:39:40 +0200120 - 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-googlee4559452022-07-16 11:12:39 -0700133 value: { arg1: 4, arg2: 3, arg3: true }