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

Fix read receipt tests with incorrect read counts #11465

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions cypress/e2e/read-receipts/high-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ describe("Read receipts", () => {
// Given a thread exists
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);
goTo(room2);

openThread("Msg1");
Expand All @@ -462,7 +462,7 @@ describe("Read receipts", () => {
// Given a thread exists
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), threadedOff("Msg1", "Resp2")]);
assertUnread(room2, 2); // (Sanity)
assertUnread(room2, 3); // (Sanity)

// When I read the main timeline
goTo(room2);
Expand All @@ -481,7 +481,7 @@ describe("Read receipts", () => {
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), "Msg2", threadedOff("Msg2", "Resp2")]);
assertUnread(room2, 4);
goTo(room2);
assertUnread(room2, 4);
assertUnread(room2, 2);

openThread("Msg1");
assertUnread(room2, 1);
Expand Down Expand Up @@ -562,7 +562,7 @@ describe("Read receipts", () => {
// Given a thread exists
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), threadedOff("Msg1", "Resp2")]);
assertUnread(room2, 2); // (Sanity)
assertUnread(room2, 3); // (Sanity)

// When I read the main timeline
goTo(room2);
Expand Down Expand Up @@ -609,7 +609,7 @@ describe("Read receipts", () => {
goTo(room2);

// Then room does appear unread
assertUnread(room2, 2);
assertUnread(room2, 1);
assertUnreadThread("Msg1");
});
it.skip("Reading a thread root within the thread view marks it as read in the main timeline", () => {});
Expand Down Expand Up @@ -701,7 +701,7 @@ describe("Read receipts", () => {
goTo(room1);

receiveMessages(room2, ["Msg1", replyTo("Msg1", "Reply1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);

goTo(room2);
assertRead(room2);
Expand All @@ -718,7 +718,7 @@ describe("Read receipts", () => {
goTo(room1);

receiveMessages(room2, ["Msg1", replyTo("Msg1", "Reply1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);
markAsRead(room2);

// When an edit appears in the room
Expand Down Expand Up @@ -769,7 +769,7 @@ describe("Read receipts", () => {
it("An edit of a threaded message makes the room unread", () => {
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);

goTo(room2);
openThread("Msg1");
Expand All @@ -782,7 +782,7 @@ describe("Read receipts", () => {
it("Reading an edit of a threaded message makes the room read", () => {
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);

goTo(room2);
openThread("Msg1");
Expand All @@ -799,21 +799,21 @@ describe("Read receipts", () => {
it("Marking a room as read after an edit in a thread makes it read", () => {
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]);
assertUnread(room2, 2);
assertUnread(room2, 3); // TODO: the edit counts as a message!

markAsRead(room2);
assertRead(room2);
});
it.skip("Editing a thread message after marking as read makes the room unread", () => {
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);

markAsRead(room2);
assertRead(room2);

receiveMessages(room2, [editOf("Resp1", "Edit1")]);
assertUnread(room2, 1);
assertUnread(room2, 1); // TODO: should this edit make us unread?
});
it("A room with an edited threaded message is still unread after restart", () => {
goTo(room1);
Expand All @@ -840,7 +840,7 @@ describe("Read receipts", () => {
it("An edit of a thread root makes the room unread", () => {
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
assertUnread(room2, 1);
assertUnread(room2, 2);

goTo(room2);
openThread("Msg1");
Expand Down Expand Up @@ -983,7 +983,7 @@ describe("Read receipts", () => {
goTo(room1);
assertRead(room2);
receiveMessages(room2, ["Msg1", "Msg2"]);
assertUnread(room2, 1);
assertUnread(room2, 2);

// When I read the main timeline
goTo(room2);
Expand Down