@@ -187,11 +187,11 @@ test.describe("Read receipts", () => {
187
187
// Given we have read the thread
188
188
await util . goTo ( room1 ) ;
189
189
await util . receiveMessages ( room2 , [ "Msg1" , msg . threadedOff ( "Msg1" , "Resp1" ) ] ) ;
190
- await util . assertUnread ( room2 , 2 ) ;
190
+ await util . assertUnread ( room2 , 1 ) ;
191
191
await util . goTo ( room2 ) ;
192
192
await util . openThread ( "Msg1" ) ;
193
193
await util . assertRead ( room2 ) ;
194
- await util . backToThreadsList ( ) ;
194
+ await util . assertReadThread ( "Resp1" ) ;
195
195
await util . goTo ( room1 ) ;
196
196
197
197
// When a message inside it is edited
@@ -202,6 +202,7 @@ test.describe("Read receipts", () => {
202
202
await util . goTo ( room2 ) ;
203
203
await util . assertReadThread ( "Msg1" ) ;
204
204
} ) ;
205
+
205
206
test ( "Reading an edit of a threaded message makes the room read" , async ( {
206
207
roomAlpha : room1 ,
207
208
roomBeta : room2 ,
@@ -211,11 +212,11 @@ test.describe("Read receipts", () => {
211
212
// Given an edited thread message appears after we read it
212
213
await util . goTo ( room1 ) ;
213
214
await util . receiveMessages ( room2 , [ "Msg1" , msg . threadedOff ( "Msg1" , "Resp1" ) ] ) ;
214
- await util . assertUnread ( room2 , 2 ) ;
215
+ await util . assertUnread ( room2 , 1 ) ;
215
216
await util . goTo ( room2 ) ;
216
217
await util . openThread ( "Msg1" ) ;
217
218
await util . assertRead ( room2 ) ;
218
- await util . backToThreadsList ( ) ;
219
+ await util . assertReadThread ( "Resp1" ) ;
219
220
await util . goTo ( room1 ) ;
220
221
await util . receiveMessages ( room2 , [ msg . editOf ( "Resp1" , "Edit1" ) ] ) ;
221
222
await util . assertStillRead ( room2 ) ;
@@ -228,6 +229,7 @@ test.describe("Read receipts", () => {
228
229
await util . assertStillRead ( room2 ) ;
229
230
await util . assertReadThread ( "Msg1" ) ;
230
231
} ) ;
232
+
231
233
test ( "Marking a room as read after an edit in a thread makes it read" , async ( {
232
234
roomAlpha : room1 ,
233
235
roomBeta : room2 ,
@@ -241,14 +243,16 @@ test.describe("Read receipts", () => {
241
243
msg . threadedOff ( "Msg1" , "Resp1" ) ,
242
244
msg . editOf ( "Resp1" , "Edit1" ) ,
243
245
] ) ;
244
- await util . assertUnread ( room2 , 2 ) ;
246
+ await util . assertUnread ( room2 , 1 ) ;
245
247
246
248
// When I mark the room as read
247
249
await util . markAsRead ( room2 ) ;
248
250
249
251
// Then it is read
250
252
await util . assertRead ( room2 ) ;
253
+ await util . assertReadThread ( "Msg1" ) ;
251
254
} ) ;
255
+
252
256
test ( "Editing a thread message after marking as read leaves the room read" , async ( {
253
257
roomAlpha : room1 ,
254
258
roomBeta : room2 ,
@@ -258,7 +262,7 @@ test.describe("Read receipts", () => {
258
262
// Given a room is marked as read
259
263
await util . goTo ( room1 ) ;
260
264
await util . receiveMessages ( room2 , [ "Msg1" , msg . threadedOff ( "Msg1" , "Resp1" ) ] ) ;
261
- await util . assertUnread ( room2 , 2 ) ;
265
+ await util . assertUnread ( room2 , 1 ) ;
262
266
await util . markAsRead ( room2 ) ;
263
267
await util . assertRead ( room2 ) ;
264
268
@@ -267,7 +271,9 @@ test.describe("Read receipts", () => {
267
271
268
272
// Then the room remains read
269
273
await util . assertStillRead ( room2 ) ;
274
+ await util . assertReadThread ( "Msg1" ) ;
270
275
} ) ;
276
+
271
277
test ( "A room with an edited threaded message is still read after restart" , async ( {
272
278
roomAlpha : room1 ,
273
279
roomBeta : room2 ,
@@ -287,6 +293,7 @@ test.describe("Read receipts", () => {
287
293
// Then is it still read
288
294
await util . assertRead ( room2 ) ;
289
295
} ) ;
296
+
290
297
test ( "A room where all threaded edits are read is still read after restart" , async ( {
291
298
roomAlpha : room1 ,
292
299
roomBeta : room2 ,
@@ -295,20 +302,23 @@ test.describe("Read receipts", () => {
295
302
} ) => {
296
303
await util . goTo ( room1 ) ;
297
304
await util . receiveMessages ( room2 , [ "Msg1" , msg . threadedOff ( "Msg1" , "Resp1" ) ] ) ;
298
- await util . assertUnread ( room2 , 2 ) ;
305
+ await util . assertUnread ( room2 , 1 ) ;
299
306
await util . receiveMessages ( room2 , [ msg . editOf ( "Resp1" , "Edit1" ) ] ) ;
300
- await util . assertUnread ( room2 , 2 ) ;
307
+ await util . assertUnread ( room2 , 1 ) ;
301
308
302
309
await util . goTo ( room2 ) ;
303
310
304
311
await util . openThread ( "Msg1" ) ;
305
312
await util . assertRead ( room2 ) ;
313
+ await util . assertReadThread ( "Msg1" ) ;
306
314
await util . goTo ( room1 ) ; // Make sure we are looking at room1 after reload
307
315
await util . assertStillRead ( room2 ) ;
308
316
309
317
await util . saveAndReload ( ) ;
310
318
await util . assertRead ( room2 ) ;
319
+ await util . assertReadThread ( "Msg1" ) ;
311
320
} ) ;
321
+
312
322
test ( "A room where all threaded edits are marked as read is still read after restart" , async ( {
313
323
roomAlpha : room1 ,
314
324
roomBeta : room2 ,
@@ -321,15 +331,17 @@ test.describe("Read receipts", () => {
321
331
msg . threadedOff ( "Msg1" , "Resp1" ) ,
322
332
msg . editOf ( "Resp1" , "Edit1" ) ,
323
333
] ) ;
324
- await util . assertUnread ( room2 , 2 ) ;
334
+ await util . assertUnread ( room2 , 1 ) ;
325
335
await util . markAsRead ( room2 ) ;
326
336
await util . assertRead ( room2 ) ;
337
+ await util . assertReadThread ( "Msg1" ) ;
327
338
328
339
// When I restart
329
340
await util . saveAndReload ( ) ;
330
341
331
342
// It is still read
332
343
await util . assertRead ( room2 ) ;
344
+ await util . assertReadThread ( "Msg1" ) ;
333
345
} ) ;
334
346
} ) ;
335
347
@@ -343,7 +355,7 @@ test.describe("Read receipts", () => {
343
355
// Given I have read a thread
344
356
await util . goTo ( room1 ) ;
345
357
await util . receiveMessages ( room2 , [ "Msg1" , msg . threadedOff ( "Msg1" , "Resp1" ) ] ) ;
346
- await util . assertUnread ( room2 , 2 ) ;
358
+ await util . assertUnread ( room2 , 1 ) ;
347
359
await util . goTo ( room2 ) ;
348
360
await util . openThread ( "Msg1" ) ;
349
361
await util . backToThreadsList ( ) ;
@@ -361,6 +373,7 @@ test.describe("Read receipts", () => {
361
373
await util . assertStillRead ( room2 ) ;
362
374
await util . assertReadThread ( "Edit1" ) ;
363
375
} ) ;
376
+
364
377
test ( "Reading an edit of a thread root leaves the room read" , async ( {
365
378
roomAlpha : room1 ,
366
379
roomBeta : room2 ,
@@ -386,6 +399,7 @@ test.describe("Read receipts", () => {
386
399
await util . goTo ( room1 ) ;
387
400
await util . assertStillRead ( room2 ) ;
388
401
} ) ;
402
+
389
403
test ( "Editing a thread root after reading leaves the room read" , async ( {
390
404
roomAlpha : room1 ,
391
405
roomBeta : room2 ,
@@ -405,6 +419,7 @@ test.describe("Read receipts", () => {
405
419
// Then the room stays read
406
420
await util . assertStillRead ( room2 ) ;
407
421
} ) ;
422
+
408
423
test ( "Marking a room as read after an edit of a thread root keeps it read" , async ( {
409
424
roomAlpha : room1 ,
410
425
roomBeta : room2 ,
@@ -431,6 +446,7 @@ test.describe("Read receipts", () => {
431
446
await util . goTo ( room1 ) ;
432
447
await util . assertStillRead ( room2 ) ;
433
448
} ) ;
449
+
434
450
test ( "Editing a thread root that is a reply after marking as read leaves the room read" , async ( {
435
451
roomAlpha : room1 ,
436
452
roomBeta : room2 ,
@@ -444,7 +460,7 @@ test.describe("Read receipts", () => {
444
460
msg . replyTo ( "Msg" , "Reply" ) ,
445
461
msg . threadedOff ( "Reply" , "InThread" ) ,
446
462
] ) ;
447
- await util . assertUnread ( room2 , 3 ) ;
463
+ await util . assertUnread ( room2 , 2 ) ;
448
464
await util . markAsRead ( room2 ) ;
449
465
await util . assertRead ( room2 ) ;
450
466
@@ -458,6 +474,7 @@ test.describe("Read receipts", () => {
458
474
await util . goTo ( room2 ) ;
459
475
await util . assertReadThread ( "Edited Reply" ) ;
460
476
} ) ;
477
+
461
478
test ( "Marking a room as read after an edit of a thread root that is a reply leaves it read" , async ( {
462
479
roomAlpha : room1 ,
463
480
roomBeta : room2 ,
@@ -472,7 +489,7 @@ test.describe("Read receipts", () => {
472
489
msg . threadedOff ( "Reply" , "InThread" ) ,
473
490
] ) ;
474
491
await util . receiveMessages ( room2 , [ msg . editOf ( "Reply" , "Edited Reply" ) ] ) ;
475
- await util . assertUnread ( room2 , 3 ) ;
492
+ await util . assertUnread ( room2 , 2 ) ;
476
493
477
494
// When I mark the room as read
478
495
await util . markAsRead ( room2 ) ;
0 commit comments