1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
|
def refpat = /blake2#[0-9a-f]+/
test ChatroomSetup:
let services = "chatroom"
# Local chatrooms
spawn as p1
with p1:
send "create-identity Device1 Owner1"
send "chatroom-create first"
send "chatroom-create second"
send "chatroom-list-local"
expect /chatroom-list-item ([a-z0-9#]+) first sub true/ capture first
expect /chatroom-list-item [a-z0-9#]+ second sub true/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
expect /chatroom-create-done ([a-z0-9#]+) first.*/ from p1 capture first
expect /chatroom-create-done ([a-z0-9#]+) second.*/ from p1 capture second
# Send chatrooms to new peers
spawn as p2
send "create-identity Device2 Owner2" to p2
spawn as p3
send "create-identity Device3 Owner3" to p3
for p in [ p1, p2, p3 ]:
with p:
send "chatroom-watch-local"
send "start-server services $services"
for p in [ p2, p3 ]:
with p:
expect /chatroom-watched-added [a-z0-9#]+ first sub false/
expect /chatroom-watched-added [a-z0-9#]+ second sub false/
# Subscribe and unsubscribe
with p1:
send "chatroom-unsubscribe $first"
expect /chatroom-watched-updated [a-z0-9#]+ first sub false .*/
send "chatroom-subscribe $first"
expect /chatroom-watched-updated [a-z0-9#]+ first sub true .*/
with p2:
send "chatroom-list-local"
expect /chatroom-list-item ([a-z0-9#]+) first sub false/ capture p2_first
expect /chatroom-list-item ([a-z0-9#]+) second sub false/ capture p2_second
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
send "chatroom-subscribe $p2_first"
send "chatroom-subscribe $p2_second"
expect /chatroom-watched-updated [a-z0-9#]+ first sub true .*/
expect /chatroom-watched-updated [a-z0-9#]+ second sub true .*/
send "chatroom-unsubscribe $p2_first"
send "chatroom-unsubscribe $p2_second"
expect /chatroom-watched-updated [a-z0-9#]+ first sub false .*/
expect /chatroom-watched-updated [a-z0-9#]+ second sub false .*/
# Create and sync additional chatrooms
send "chatroom-create third" to p1
send "chatroom-create fourth" to p2
send "chatroom-create fifth" to p3
expect /chatroom-create-done ([a-z0-9#]+) fourth.*/ from p2 capture fourth
expect /chatroom-create-done ([a-z0-9#]+) fifth.*/ from p3 capture fifth
for p in [ p1, p2, p3 ]:
with p:
expect /chatroom-watched-added [a-z0-9#]+ third sub [a-z]+/
expect /chatroom-watched-added [a-z0-9#]+ fourth sub [a-z]+/
expect /chatroom-watched-added [a-z0-9#]+ fifth sub [a-z]+/
# Update chatroom name
send "chatroom-set-name $first first2" to p1
for p in [ p1, p2, p3 ]:
with p:
expect /chatroom-watched-updated [a-z0-9#]+ first2.*/
send "chatroom-set-name $fourth fourth2" to p2
send "chatroom-set-name $fifth fifth2" to p3
for p in [ p1, p2, p3 ]:
with p:
expect /chatroom-watched-updated [a-z0-9#]+ fourth2.*/
expect /chatroom-watched-updated [a-z0-9#]+ fifth2.*/
test ChatroomMessages:
let services = "chatroom"
spawn as p1
spawn as p2
send "create-identity Device1 Owner1" to p1
send "create-identity Device2 Owner2" to p2
for p in [ p1, p2 ]:
with p:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create first_room" to p1
expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1
expect /chatroom-watched-added [a-z0-9#]+ first_room sub true/ from p1
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2
send "chatroom-message-send $room1_p1 message1" to p1
expect /chatroom-message-new $room1_p1 room first_room from Owner1 text message1/ from p1
send "chatroom-message-send $room1_p1 message2" to p1
local:
expect /chatroom-message-new $room1_p1 room first_room from Owner1 text (.*)/ from p1 capture msg
guard (msg == "message2")
# Subscribe to chatroom
send "chatroom-subscribe $room1_p2" to p2
expect /chatroom-watched-updated [a-z0-9#]+ first_room sub true .*/ from p2
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner1 text (.*)/ capture msg
guard (msg == "message1")
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner1 text (.*)/ capture msg
guard (msg == "message2")
send "chatroom-message-send $room1_p2 message3" to p2
for p in [ p1, p2 ]:
with p:
expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner2 text message3/
send "chatroom-message-send $room1_p1 message4" to p1
for p in [ p1, p2 ]:
with p:
expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner1 text message4/
# Multiple rooms
send "chatroom-create second_room" to p1
expect /chatroom-create-done ([a-z0-9#]+) second_room.*/ from p1 capture room2_p1
send "chatroom-create third_room" to p2
expect /chatroom-create-done ([a-z0-9#]+) third_room.*/ from p2 capture room3_p2
expect /chatroom-watched-added $room2_p1 second_room sub true/ from p1
expect /chatroom-watched-added $room3_p2 third_room sub true/ from p2
expect /chatroom-watched-added ([a-z0-9#]+) second_room sub false/ from p2 capture room2_p2
expect /chatroom-watched-added ([a-z0-9#]+) third_room sub false/ from p1 capture room3_p1
spawn as p3
send "create-identity Device3 Owner3" to p3
send "chatroom-watch-local" to p3
send "start-server services $services" to p3
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p3 capture room1_p3
expect /chatroom-watched-added ([a-z0-9#]+) second_room sub false/ from p3 capture room2_p3
expect /chatroom-watched-added ([a-z0-9#]+) third_room sub false/ from p3 capture room3_p3
with p3:
for room in [ room1_p3, room2_p3, room3_p3 ]:
send "chatroom-subscribe $room"
expect /chatroom-watched-updated $room [a-z_]+ sub true .*/
for i in [1..4]:
expect /chatroom-message-new $room1_p3 room first_room from Owner. text (.*)/ capture message
guard (message == "message$i")
with p2:
send "chatroom-message-send $room2_p2 msg_r2_1"
send "chatroom-message-send $room2_p2 msg_r2_2"
send "chatroom-message-send $room2_p2 msg_r2_3"
expect /chatroom-message-new $room2_p2 room second_room from Owner2 text msg_r2_1/
expect /chatroom-message-new $room2_p2 room second_room from Owner2 text msg_r2_2/
expect /chatroom-message-new $room2_p2 room second_room from Owner2 text msg_r2_3/
send "chatroom-message-send $room3_p2 msg_r3_1"
send "chatroom-message-send $room3_p2 msg_r3_2"
send "chatroom-message-send $room3_p2 msg_r3_3"
expect /chatroom-message-new $room3_p2 room third_room from Owner2 text msg_r3_1/
expect /chatroom-message-new $room3_p2 room third_room from Owner2 text msg_r3_2/
expect /chatroom-message-new $room3_p2 room third_room from Owner2 text msg_r3_3/
with p1:
local:
expect /chatroom-message-new [a-z0-9#]+ room ([a-z_]+) from Owner2 text ([a-z0-9_]+)/ capture room, message
guard (room == "second_room")
guard (message == "msg_r2_1")
local:
expect /chatroom-message-new [a-z0-9#]+ room ([a-z_]+) from Owner2 text ([a-z0-9_]+)/ capture room, message
guard (room == "second_room")
guard (message == "msg_r2_2")
local:
expect /chatroom-message-new [a-z0-9#]+ room ([a-z_]+) from Owner2 text ([a-z0-9_]+)/ capture room, message
guard (room == "second_room")
guard (message == "msg_r2_3")
with p3:
expect /chatroom-message-new $room2_p3 room second_room from Owner2 text msg_r2_1/
expect /chatroom-message-new $room2_p3 room second_room from Owner2 text msg_r2_2/
expect /chatroom-message-new $room2_p3 room second_room from Owner2 text msg_r2_3/
expect /chatroom-message-new $room3_p3 room third_room from Owner2 text msg_r3_1/
expect /chatroom-message-new $room3_p3 room third_room from Owner2 text msg_r3_2/
expect /chatroom-message-new $room3_p3 room third_room from Owner2 text msg_r3_3/
# Unsubscribe
send "chatroom-unsubscribe $room1_p1" to p1
expect /chatroom-watched-updated $room1_p1 [a-z_]+ sub false .*/ from p1
send "chatroom-unsubscribe $room1_p3" to p3
expect /chatroom-watched-updated $room1_p3 [a-z_]+ sub false .*/ from p3
send "chatroom-unsubscribe $room2_p3" to p3
expect /chatroom-watched-updated $room2_p3 [a-z_]+ sub false .*/ from p3
with p2:
send "chatroom-message-send $room1_p2 msg_r1_4"
expect /chatroom-message-new $room1_p2 room first_room from Owner2 text msg_r1_4/
send "chatroom-message-send $room2_p2 msg_r2_4"
expect /chatroom-message-new $room2_p2 room second_room from Owner2 text msg_r2_4/
send "chatroom-message-send $room3_p2 msg_r3_4"
expect /chatroom-message-new $room3_p2 room third_room from Owner2 text msg_r3_4/
with p1:
local:
expect /chatroom-message-new [a-z0-9#]+ room ([a-z_]+) from Owner2 text ([a-z0-9_]+)/ capture room, message
guard (room == "second_room")
guard (message == "msg_r2_4")
with p3:
local:
expect /chatroom-message-new [a-z0-9#]+ room ([a-z_]+) from Owner2 text ([a-z0-9_]+)/ capture room, message
guard (room == "third_room")
guard (message == "msg_r3_4")
test ChatroomSubscribedBeforeStart:
let services = "chatroom"
spawn as p1
spawn as p2
send "create-identity Device1 Owner1" to p1
send "create-identity Device2 Owner2" to p2
for p in [ p1, p2 ]:
with p:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create first_room" to p1
expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1
expect /chatroom-watched-added [a-z0-9#]+ first_room sub true/ from p1
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2
with p2:
send "chatroom-subscribe $room1_p2"
expect /chatroom-watched-updated [a-z0-9#]+ first_room sub true .*/
for p in [p1, p2]:
with p:
send "stop-server"
for p in [p1, p2]:
with p:
expect /stop-server-done/
for p in [p1, p2]:
with p:
send "start-server services $services"
send "chatroom-message-send $room1_p1 message1" to p1
expect /chatroom-message-new $room1_p1 room first_room from Owner1 text message1/ from p1
expect /chatroom-message-new $room1_p2 room first_room from Owner1 text message1/ from p2
send "chatroom-message-send $room1_p2 message2" to p2
expect /chatroom-message-new $room1_p1 room first_room from Owner2 text message2/ from p1
expect /chatroom-message-new $room1_p2 room first_room from Owner2 text message2/ from p2
test ParallelThreads:
let services = "chatroom"
spawn as p1
spawn as p2
send "create-identity Device1 Owner1" to p1
send "create-identity Device2 Owner2" to p2
for p in [ p1, p2 ]:
with p:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create first_room" to p1
expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1
expect /chatroom-watched-added [a-z0-9#]+ first_room sub true/ from p1
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2
with p2:
send "chatroom-subscribe $room1_p2"
expect /chatroom-watched-updated [a-z0-9#]+ first_room sub true .*/
for p in [p1, p2]:
with p:
send "stop-server"
for p in [p1, p2]:
with p:
expect /stop-server-done/
send "chatroom-message-send $room1_p1 message1A" to p1
send "chatroom-message-send $room1_p1 message1B" to p1
send "chatroom-message-send $room1_p2 message2A" to p2
send "chatroom-message-send $room1_p2 message2B" to p2
with p1:
expect /chatroom-message-new $room1_p1 room first_room from Owner. text message(..)/ capture msg
guard (msg == "1A")
with p1:
expect /chatroom-message-new $room1_p1 room first_room from Owner. text message(..)/ capture msg
guard (msg == "1B")
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner. text message(..)/ capture msg
guard (msg == "2A")
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner. text message(..)/ capture msg
guard (msg == "2B")
for p in [p1, p2]:
with p:
send "start-server services $services"
with p1:
expect /chatroom-message-new $room1_p1 room first_room from Owner. text message(..)/ capture msg
guard (msg == "2A")
with p1:
expect /chatroom-message-new $room1_p1 room first_room from Owner. text message(..)/ capture msg
guard (msg == "2B")
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner. text message(..)/ capture msg
guard (msg == "1A")
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner. text message(..)/ capture msg
guard (msg == "1B")
test ChatroomMembers:
let services = "chatroom"
spawn as p1
spawn as p2
spawn as p3
send "create-identity Device1 Owner1" to p1
send "create-identity Device2 Owner2" to p2
send "create-identity Device3 Owner3" to p3
for p in [ p1, p2, p3 ]:
with p:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create first_room" to p1
expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1
expect /chatroom-watched-added $room1_p1 first_room sub true/ from p1
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p3 capture room1_p3
local:
send "chatroom-members $room1_p1" to p1
expect /chatroom-members-([a-z]+)/ from p1 capture done
guard (done == "done")
local:
send "chatroom-members $room1_p2" to p2
expect /chatroom-members-([a-z]+)/ from p2 capture done
guard (done == "done")
send "chatroom-message-send $room1_p1 message1" to p1
send "chatroom-message-send $room1_p1 message2" to p1
send "chatroom-join $room1_p2" to p2
send "chatroom-message-send $room1_p2 message3" to p2
send "chatroom-join $room1_p3" to p3
with p1:
expect /chatroom-message-new $room1_p1 room first_room from Owner1 text message2/
expect /chatroom-message-new $room1_p1 room first_room from Owner2 text message3/
expect /chatroom-message-new $room1_p1 room first_room from Owner3/
with p2:
expect /chatroom-message-new $room1_p2 room first_room from Owner1 text message2/
expect /chatroom-message-new $room1_p2 room first_room from Owner2 text message3/
expect /chatroom-message-new $room1_p2 room first_room from Owner3/
with p3:
expect /chatroom-message-new $room1_p3 room first_room from Owner1 text message2/
expect /chatroom-message-new $room1_p3 room first_room from Owner2 text message3/
expect /chatroom-message-new $room1_p3 room first_room from Owner3/
local:
send "chatroom-members $room1_p1" to p1
expect /chatroom-members-item Owner1/ from p1
expect /chatroom-members-item Owner2/ from p1
expect /chatroom-members-item Owner3/ from p1
expect /chatroom-members-([a-z]+)/ from p1 capture done
guard (done == "done")
local:
send "chatroom-members $room1_p2" to p2
expect /chatroom-members-item Owner1/ from p2
expect /chatroom-members-item Owner2/ from p2
expect /chatroom-members-item Owner3/ from p2
expect /chatroom-members-([a-z]+)/ from p2 capture done
guard (done == "done")
send "chatroom-leave $room1_p1" to p1
send "chatroom-leave $room1_p3" to p3
for p in [ p1, p2 ]:
with p:
expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner1 leave/
for p in [ p2, p3 ]:
with p:
expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner3 leave/
send "chatroom-members $room1_p1" to p1
send "chatroom-members $room1_p2" to p2
send "chatroom-members $room1_p3" to p3
for p in [ p1, p2, p3 ]:
with p:
expect /chatroom-members-item Owner2/
expect /chatroom-members-([a-z]+)/ capture done
guard (done == "done")
test ChatroomIdentity:
let services = "chatroom"
spawn as p1
spawn as p2
send "create-identity Device1 Owner1" to p1
send "create-identity Device2 Owner2" to p2
for p in [ p1, p2 ]:
with p:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create first_room" to p1
expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1
expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2
send "chatroom-join-as $room1_p1 Custom1" to p1
expect /chatroom-join-as-done $room1_p1/ from p1
send "chatroom-join-as $room1_p2 Custom2" to p2
expect /chatroom-join-as-done $room1_p2/ from p2
send "chatroom-message-send $room1_p1 message1" to p1
send "chatroom-message-send $room1_p2 message2" to p2
for p in [ p1, p2 ]:
with p:
expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message1/ capture name1
guard (name1 == "Custom1")
expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message2/ capture name2
guard (name2 == "Custom2")
spawn as p1b on p1.node
spawn as p2b on p2.node
for p in [ p1b, p2b ]:
with p:
send "chatroom-watch-local"
send "chatroom-message-send $room1_p1 message3" to p1b
send "chatroom-message-send $room1_p2 message4" to p2b
for p in [ p1, p2, p1b, p2b ]:
with p:
expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message3/ capture name1
guard (name1 == "Custom1")
expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message4/ capture name2
guard (name2 == "Custom2")
test ChatroomDelete:
let services = "chatroom"
node n1
node n2
node n3
# Create and sync chatrooms on n1 and sync to n2
local:
spawn as p1 on n1
with p1:
send "create-identity Device1 Owner1"
expect /create-identity-done .*/
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create first"
send "chatroom-create second"
expect /chatroom-create-done $refpat first.*/
expect /chatroom-create-done $refpat second.*/
spawn as p2 on n2
with p2:
send "create-identity Device2 Owner2"
expect /create-identity-done .*/
send "chatroom-watch-local"
send "start-server services $services"
expect /chatroom-watched-added ($refpat) first sub false/ capture first
expect /chatroom-watched-added ($refpat) second sub false/ capture second
send "chatroom-subscribe $first"
send "chatroom-subscribe $second"
expect /chatroom-watched-updated $first first sub true .*/
expect /chatroom-watched-updated $second second sub true .*/
local:
spawn as p3 on n3
with p3:
send "create-identity Device3 Owner3"
expect /create-identity-done .*/
local:
spawn as p1 on n1
spawn as p2 on n2
spawn as p3 on n3
# Delete first chatroom from n1
with p1:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-list-local"
expect /chatroom-list-item ($refpat) first sub true/ capture first
expect /chatroom-list-item $refpat second sub true/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
send "chatroom-delete $first"
expect /chatroom-delete-done .*/
# Setup n3
with p3:
send "chatroom-watch-local"
send "start-server services $services"
expect /chatroom-watched-added $refpat second sub false/
# Check that both n1 and n3 see only the second chatroom
for p in [ p1, p3 ]:
with p:
send "chatroom-list-local"
expect /chatroom-list-item $refpat second .*/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
# Reactive server on n2 and create third chatroom
with p2:
send "chatroom-watch-local"
send "start-server services $services"
send "chatroom-create third"
expect /chatroom-create-done $refpat third.*/
# Verify that first chatroom appears only on n3 ...
with p3:
expect /chatroom-watched-added $refpat first sub false/
expect /chatroom-watched-added $refpat third sub false/
send "chatroom-list-local"
expect /chatroom-list-item $refpat first .*/
expect /chatroom-list-item $refpat second .*/
expect /chatroom-list-item $refpat third .*/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
# ... and not on n1
with p1:
expect /chatroom-watched-added ($refpat) third sub false/ capture third
send "chatroom-subscribe $third"
expect /chatroom-watched-updated $third third sub true .*/
send "chatroom-list-local"
expect /chatroom-list-item $refpat second .*/
expect /chatroom-list-item $refpat third .*/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
# Delete second chatroom on n2
with p2:
send "chatroom-list-local"
expect /chatroom-list-item $refpat first .*/
expect /chatroom-list-item ($refpat) second .*/ capture second
expect /chatroom-list-item $refpat third .*/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
send "chatroom-delete $second"
expect /chatroom-delete-done .*/
# Send messages
with p3:
send "chatroom-list-local"
expect /chatroom-list-item ($refpat) first .*/ capture first
expect /chatroom-list-item ($refpat) second .*/ capture second
expect /chatroom-list-item ($refpat) third .*/ capture third
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
send "chatroom-message-send $first message_first"
send "chatroom-message-send $second message_second"
send "chatroom-message-send $third message_third"
# Receive only to non-deleted ones
with p1:
expect /chatroom-message-new $refpat room second from Owner3 text message_second/
expect /chatroom-message-new $refpat room ([a-z]+) from Owner3 text ([a-z_]+)/ capture room, msg
guard (room == "third")
guard (msg == "message_third")
send "chatroom-list-local"
expect /chatroom-list-item $refpat second .*/
expect /chatroom-list-item $refpat third .*/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
with p2:
expect /chatroom-message-new $refpat room first from Owner3 text message_first/
expect /chatroom-message-new $refpat room ([a-z]+) from Owner3 text ([a-z_]+)/ capture room, msg
guard (room == "third")
guard (msg == "message_third")
send "chatroom-list-local"
expect /chatroom-list-item $refpat first .*/
expect /chatroom-list-item $refpat third .*/
local:
expect /chatroom-list-(.*)/ capture done
guard (done == "done")
|