Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit a4b8616

Browse files
authored
Avoid using markAsRead where we don't need it (#11517)
* Avoid using markAsRead where we don't need it * Review response
1 parent 493d508 commit a4b8616

File tree

1 file changed

+46
-27
lines changed

1 file changed

+46
-27
lines changed

cypress/e2e/read-receipts/high-level.spec.ts

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -735,23 +735,24 @@ describe("Read receipts", () => {
735735
describe("editing messages", () => {
736736
describe("in the main timeline", () => {
737737
// TODO: this passes but we think this should fail, because we think edits should not cause unreads.
738-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
738+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
739739
it.skip("Editing a message makes a room unread", () => {
740740
// Given I am not looking at the room
741741
goTo(room1);
742742

743743
receiveMessages(room2, ["Msg1"]);
744744
assertUnread(room2, 1);
745-
markAsRead(room2);
745+
goTo(room2);
746746
assertRead(room2);
747+
goTo(room1);
747748

748749
// When an edit appears in the room
749750
receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]);
750751

751752
// Then it becomes unread
752753
assertUnread(room2, 1);
753754
});
754-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
755+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
755756
it.skip("Reading an edit makes the room read", () => {
756757
// Given an edit is making the room unread
757758
goTo(room1);
@@ -773,14 +774,12 @@ describe("Read receipts", () => {
773774
goTo(room1);
774775
assertRead(room2);
775776
});
776-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
777-
it.skip("Marking a room as read after an edit makes it read", () => {
778-
// Given an edit is makng a room unread
779-
goTo(room1);
777+
it("Marking a room as read after an edit makes it read", () => {
778+
// Given an edit is making a room unread
779+
goTo(room2);
780780
receiveMessages(room2, ["Msg1"]);
781-
assertUnread(room2, 1);
782-
markAsRead(room2);
783781
assertRead(room2);
782+
goTo(room1);
784783
receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]);
785784
assertUnread(room2, 1);
786785

@@ -790,7 +789,7 @@ describe("Read receipts", () => {
790789
// Then the room becomes read
791790
assertRead(room2);
792791
});
793-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
792+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
794793
it.skip("Editing a message after marking as read makes the room unread", () => {
795794
// Given the room is marked as read
796795
goTo(room1);
@@ -805,7 +804,7 @@ describe("Read receipts", () => {
805804
// Then the room becomes unread
806805
assertUnread(room2, 1);
807806
});
808-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
807+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
809808
it.skip("Editing a reply after reading it makes the room unread", () => {
810809
// Given the room is all read
811810
goTo(room1);
@@ -823,7 +822,7 @@ describe("Read receipts", () => {
823822
// Then it becomes unread
824823
assertUnread(room2, 1);
825824
});
826-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
825+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
827826
it.skip("Editing a reply after marking as read makes the room unread", () => {
828827
// Given a reply is marked as read
829828
goTo(room1);
@@ -838,14 +837,13 @@ describe("Read receipts", () => {
838837
// Then the room becomes unread
839838
assertUnread(room2, 1);
840839
});
841-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
840+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
842841
it.skip("A room with an edit is still unread after restart", () => {
843842
// Given a message is marked as read
844-
goTo(room1);
843+
goTo(room2);
845844
receiveMessages(room2, ["Msg1"]);
846-
assertUnread(room2, 1);
847-
markAsRead(room2);
848845
assertRead(room2);
846+
goTo(room1);
849847

850848
// When an edit appears in the room
851849
receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]);
@@ -857,13 +855,22 @@ describe("Read receipts", () => {
857855
saveAndReload();
858856
assertUnread(room2, 1);
859857
});
860-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
861-
it.skip("A room where all edits are read is still read after restart", () => {
858+
it("An edited message becomes read if it happens while I am looking", () => {
859+
// Given a message is marked as read
860+
goTo(room2);
861+
receiveMessages(room2, ["Msg1"]);
862+
assertRead(room2);
863+
864+
// When I see an edit appear in the room I am looking at
865+
receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]);
866+
867+
// Then it becomes read
868+
assertRead(room2);
869+
});
870+
it("A room where all edits are read is still read after restart", () => {
862871
// Given an edit made the room unread
863-
goTo(room1);
872+
goTo(room2);
864873
receiveMessages(room2, ["Msg1"]);
865-
assertUnread(room2, 1);
866-
markAsRead(room2);
867874
assertRead(room2);
868875
receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]);
869876
assertUnread(room2, 1);
@@ -881,7 +888,7 @@ describe("Read receipts", () => {
881888
});
882889

883890
describe("in threads", () => {
884-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
891+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
885892
it.skip("An edit of a threaded message makes the room unread", () => {
886893
goTo(room1);
887894
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
@@ -895,7 +902,7 @@ describe("Read receipts", () => {
895902
receiveMessages(room2, [editOf("Resp1", "Edit1")]);
896903
assertUnread(room2, 1);
897904
});
898-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
905+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
899906
it.skip("Reading an edit of a threaded message makes the room read", () => {
900907
goTo(room1);
901908
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
@@ -940,7 +947,7 @@ describe("Read receipts", () => {
940947
// Then the room becomes unread
941948
assertUnread(room2, 1); // TODO: should this edit make us unread?
942949
});
943-
// XXX: fails because on CI the count is 2 instead of 3. Must be a timing issue.
950+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
944951
it.skip("A room with an edited threaded message is still unread after restart", () => {
945952
goTo(room1);
946953
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]);
@@ -949,8 +956,20 @@ describe("Read receipts", () => {
949956
saveAndReload();
950957
assertUnread(room2, 3);
951958
});
952-
// XXX: fails because on CI the count is 2 instead of 3. Must be a timing issue.
953-
it.skip("A room where all threaded edits are read is still read after restart", () => {
959+
it("A room where all threaded edits are read is still read after restart", () => {
960+
goTo(room2);
961+
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]);
962+
assertUnread(room2, 2);
963+
openThread("Msg1");
964+
assertRead(room2);
965+
goTo(room1); // Make sure we are looking at room1 after reload
966+
assertRead(room2);
967+
968+
saveAndReload();
969+
assertRead(room2);
970+
});
971+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
972+
it.skip("A room where all threaded edits are marked as read is still read after restart", () => {
954973
goTo(room1);
955974
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]);
956975
assertUnread(room2, 3);
@@ -964,7 +983,7 @@ describe("Read receipts", () => {
964983
});
965984

966985
describe("thread roots", () => {
967-
// XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue.
986+
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
968987
it.skip("An edit of a thread root makes the room unread", () => {
969988
goTo(room1);
970989
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);

0 commit comments

Comments
 (0)