From 5d5d3e17a631e46e07328de29fcdf7af4d64f9ad Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 1 Sep 2023 17:01:12 +0100 Subject: [PATCH] Avoid using markAsRead where we don't need it which allows us to re-enable some disabled tests. --- cypress/e2e/read-receipts/high-level.spec.ts | 44 +++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/cypress/e2e/read-receipts/high-level.spec.ts b/cypress/e2e/read-receipts/high-level.spec.ts index a49804a38d21..92c311434702 100644 --- a/cypress/e2e/read-receipts/high-level.spec.ts +++ b/cypress/e2e/read-receipts/high-level.spec.ts @@ -692,15 +692,15 @@ describe("Read receipts", () => { describe("editing messages", () => { describe("in the main timeline", () => { // TODO: this passes but we think this should fail, because we think edits should not cause unreads. - // XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue. - it.skip("Editing a message makes a room unread", () => { + it("Editing a message makes a room unread", () => { // Given I am not looking at the room goTo(room1); receiveMessages(room2, ["Msg1"]); assertUnread(room2, 1); - markAsRead(room2); + goTo(room2); assertRead(room2); + goTo(room1); // When an edit appears in the room receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]); @@ -730,14 +730,12 @@ describe("Read receipts", () => { goTo(room1); assertRead(room2); }); - // XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue. - it.skip("Marking a room as read after an edit makes it read", () => { - // Given an edit is makng a room unread - goTo(room1); + it("Marking a room as read after an edit makes it read", () => { + // Given an edit is making a room unread + goTo(room2); receiveMessages(room2, ["Msg1"]); - assertUnread(room2, 1); - markAsRead(room2); assertRead(room2); + goTo(room1); receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]); assertUnread(room2, 1); @@ -795,13 +793,10 @@ describe("Read receipts", () => { // Then the room becomes unread assertUnread(room2, 1); }); - // XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue. - it.skip("A room with an edit is still unread after restart", () => { + it("A room with an edit is still unread after restart", () => { // Given a message is marked as read - goTo(room1); + goTo(room2); receiveMessages(room2, ["Msg1"]); - assertUnread(room2, 1); - markAsRead(room2); assertRead(room2); // When an edit appears in the room @@ -814,13 +809,10 @@ describe("Read receipts", () => { saveAndReload(); assertUnread(room2, 1); }); - // XXX: fails because on CI we get a dot, but locally we get a count. Must be a timing issue. - it.skip("A room where all edits are read is still read after restart", () => { + it("A room where all edits are read is still read after restart", () => { // Given an edit made the room unread - goTo(room1); + goTo(room2); receiveMessages(room2, ["Msg1"]); - assertUnread(room2, 1); - markAsRead(room2); assertRead(room2); receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]); assertUnread(room2, 1); @@ -906,8 +898,20 @@ describe("Read receipts", () => { saveAndReload(); assertUnread(room2, 3); }); + it("A room where all threaded edits are read is still read after restart", () => { + goTo(room2); + receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]); + assertUnread(room2, 2); + openThread("Msg1"); + assertRead(room2); + goTo(room1); + assertRead(room2); + + saveAndReload(); + assertRead(room2); + }); // XXX: fails because on CI the count is 2 instead of 3. Must be a timing issue. - it.skip("A room where all threaded edits are read is still read after restart", () => { + it.skip("A room where all threaded edits are marked as read is still read after restart", () => { goTo(room1); receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]); assertUnread(room2, 3);