28
28
# === END CI TEST ARGUMENTS ===
29
29
30
30
import logging
31
- from time import sleep
32
31
33
32
import chip .clusters as Clusters
34
33
from chip .clusters .Types import NullValue
@@ -72,14 +71,6 @@ async def send_pause_cmd(self) -> Clusters.Objects.RvcOperationalState.Commands.
72
71
ret = await self .send_single_cmd (cmd = Clusters .Objects .RvcOperationalState .Commands .Pause (), endpoint = self .endpoint )
73
72
return ret
74
73
75
- # Sends and out-of-band command to the rvc-app
76
- def write_to_app_pipe (self , command ):
77
- with open (self .app_pipe , "w" ) as app_pipe :
78
- app_pipe .write (command + "\n " )
79
- # Allow some time for the command to take effect.
80
- # This removes the test flakyness which is very annoying for everyone in CI.
81
- sleep (0.001 )
82
-
83
74
def TC_RVCOPSTATE_2_1 (self ) -> list [str ]:
84
75
return ["RVCOPSTATE.S" ]
85
76
@@ -100,7 +91,7 @@ async def test_TC_RVCOPSTATE_2_1(self):
100
91
101
92
# Ensure that the device is in the correct state
102
93
if self .is_ci :
103
- self .write_to_app_pipe (' {"Name": "Reset"}' )
94
+ self .write_to_app_pipe ({"Name" : "Reset" })
104
95
105
96
if self .check_pics ("RVCOPSTATE.S.A0000" ):
106
97
self .print_step (2 , "Read PhaseList attribute" )
@@ -195,15 +186,15 @@ async def test_TC_RVCOPSTATE_2_1(self):
195
186
test_step = "Manually put the device in the error state"
196
187
self .print_step ("6g" , test_step )
197
188
if self .is_ci :
198
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "UnableToStartOrResume"}' )
189
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "UnableToStartOrResume" })
199
190
else :
200
191
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
201
192
await self .read_and_validate_opstate (step = "6h" , expected_state = Clusters .OperationalState .Enums .OperationalStateEnum .kError )
202
193
if self .check_pics ("RVCOPSTATE.S.M.ST_SEEKING_CHARGER" ):
203
194
test_step = "Manually put the device in the seeking charger state"
204
195
self .print_step ("6i" , test_step )
205
196
if self .is_ci :
206
- self .write_to_app_pipe (' {"Name": "Reset"}' )
197
+ self .write_to_app_pipe ({"Name" : "Reset" })
207
198
await self .send_run_change_to_mode_cmd (1 )
208
199
await self .send_run_change_to_mode_cmd (0 )
209
200
else :
@@ -213,15 +204,15 @@ async def test_TC_RVCOPSTATE_2_1(self):
213
204
test_step = "Manually put the device in the charging state"
214
205
self .print_step ("6k" , test_step )
215
206
if self .is_ci :
216
- self .write_to_app_pipe (' {"Name": "ChargerFound"}' )
207
+ self .write_to_app_pipe ({"Name" : "ChargerFound" })
217
208
else :
218
209
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
219
210
await self .read_and_validate_opstate (step = "6l" , expected_state = Clusters .RvcOperationalState .Enums .OperationalStateEnum .kCharging )
220
211
if self .check_pics ("RVCOPSTATE.S.M.ST_DOCKED" ):
221
212
test_step = "Manually put the device in the docked state"
222
213
self .print_step ("6m" , test_step )
223
214
if self .is_ci :
224
- self .write_to_app_pipe (' {"Name": "Charged"}' )
215
+ self .write_to_app_pipe ({"Name" : "Charged" })
225
216
else :
226
217
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
227
218
await self .read_and_validate_opstate (step = "6n" , expected_state = Clusters .RvcOperationalState .Enums .OperationalStateEnum .kDocked )
@@ -254,87 +245,87 @@ async def test_TC_RVCOPSTATE_2_1(self):
254
245
test_step = "Manually put the device in the unable to start or resume error state"
255
246
self .print_step ("7c" , test_step )
256
247
if self .is_ci :
257
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "UnableToStartOrResume"}' )
248
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "UnableToStartOrResume" })
258
249
else :
259
250
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
260
251
await self .read_and_validate_operror (step = "7d" , expected_error = Clusters .OperationalState .Enums .ErrorStateEnum .kUnableToStartOrResume )
261
252
if self .check_pics ("RVCOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION" ):
262
253
test_step = "Manually put the device in the unable to complete operation error state"
263
254
self .print_step ("7e" , test_step )
264
255
if self .is_ci :
265
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "UnableToCompleteOperation"}' )
256
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "UnableToCompleteOperation" })
266
257
else :
267
258
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
268
259
await self .read_and_validate_operror (step = "7f" , expected_error = Clusters .OperationalState .Enums .ErrorStateEnum .kUnableToCompleteOperation )
269
260
if self .check_pics ("RVCOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE" ):
270
261
test_step = "Manually put the device in the command invalid error state"
271
262
self .print_step ("7g" , test_step )
272
263
if self .is_ci :
273
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "CommandInvalidInState"}' )
264
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "CommandInvalidInState" })
274
265
else :
275
266
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
276
267
await self .read_and_validate_operror (step = "7h" , expected_error = Clusters .OperationalState .Enums .ErrorStateEnum .kCommandInvalidInState )
277
268
if self .check_pics ("RVCOPSTATE.S.M.ERR_FAILED_TO_FIND_CHARGING_DOCK" ):
278
269
test_step = "Manually put the device in the failed to find dock error state"
279
270
self .print_step ("7i" , test_step )
280
271
if self .is_ci :
281
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "FailedToFindChargingDock"}' )
272
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "FailedToFindChargingDock" })
282
273
else :
283
274
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
284
275
await self .read_and_validate_operror (step = "7j" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kFailedToFindChargingDock )
285
276
if self .check_pics ("RVCOPSTATE.S.M.ERR_STUCK" ):
286
277
test_step = "Manually put the device in the stuck error state"
287
278
self .print_step ("7k" , test_step )
288
279
if self .is_ci :
289
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "Stuck"}' )
280
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "Stuck" })
290
281
else :
291
282
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
292
283
await self .read_and_validate_operror (step = "7l" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kStuck )
293
284
if self .check_pics ("RVCOPSTATE.S.M.ERR_DUST_BIN_MISSING" ):
294
285
test_step = "Manually put the device in the dust bin missing error state"
295
286
self .print_step ("7m" , test_step )
296
287
if self .is_ci :
297
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "DustBinMissing"}' )
288
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "DustBinMissing" })
298
289
else :
299
290
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
300
291
await self .read_and_validate_operror (step = "7n" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kDustBinMissing )
301
292
if self .check_pics ("RVCOPSTATE.S.M.ERR_DUST_BIN_FULL" ):
302
293
test_step = "Manually put the device in the dust bin full error state"
303
294
self .print_step ("7o" , test_step )
304
295
if self .is_ci :
305
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "DustBinFull"}' )
296
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "DustBinFull" })
306
297
else :
307
298
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
308
299
await self .read_and_validate_operror (step = "7p" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kDustBinFull )
309
300
if self .check_pics ("RVCOPSTATE.S.M.ERR_WATER_TANK_EMPTY" ):
310
301
test_step = "Manually put the device in the water tank empty error state"
311
302
self .print_step ("7q" , test_step )
312
303
if self .is_ci :
313
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "WaterTankEmpty"}' )
304
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "WaterTankEmpty" })
314
305
else :
315
306
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
316
307
await self .read_and_validate_operror (step = "7r" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kWaterTankEmpty )
317
308
if self .check_pics ("RVCOPSTATE.S.M.ERR_WATER_TANK_MISSING" ):
318
309
test_step = "Manually put the device in the water tank missing error state"
319
310
self .print_step ("7s" , test_step )
320
311
if self .is_ci :
321
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "WaterTankMissing"}' )
312
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "WaterTankMissing" })
322
313
else :
323
314
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
324
315
await self .read_and_validate_operror (step = "7t" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kWaterTankMissing )
325
316
if self .check_pics ("RVCOPSTATE.S.M.ERR_WATER_TANK_LID_OPEN" ):
326
317
test_step = "Manually put the device in the water tank lid open error state"
327
318
self .print_step ("7u" , test_step )
328
319
if self .is_ci :
329
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "WaterTankLidOpen"}' )
320
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "WaterTankLidOpen" })
330
321
else :
331
322
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
332
323
await self .read_and_validate_operror (step = "7v" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kWaterTankLidOpen )
333
324
if self .check_pics ("RVCOPSTATE.S.M.ERR_MOP_CLEANING_PAD_MISSING" ):
334
325
test_step = "Manually put the device in the mop cleaning pad missing error state"
335
326
self .print_step ("7w" , test_step )
336
327
if self .is_ci :
337
- self .write_to_app_pipe (' {"Name": "ErrorEvent", "Error": "MopCleaningPadMissing"}' )
328
+ self .write_to_app_pipe ({"Name" : "ErrorEvent" , "Error" : "MopCleaningPadMissing" })
338
329
else :
339
330
self .wait_for_user_input (prompt_msg = f"{ test_step } , and press Enter when done.\n " )
340
331
await self .read_and_validate_operror (step = "7x" , expected_error = Clusters .RvcOperationalState .Enums .ErrorStateEnum .kMopCleaningPadMissing )
0 commit comments