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

Add a (failing for unrelated reasons) test for reading a thread root #11534

Merged
merged 1 commit into from
Sep 8, 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
35 changes: 34 additions & 1 deletion cypress/e2e/read-receipts/high-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ describe("Read receipts", () => {
});
}

function jumpTo(room: string, message: string) {
cy.getClient().then((cli) => {
findRoomByName(room).then(async ({ roomId }) => {
const room = cli.getRoom(roomId);
const foundMessage = await getMessage(room, message);
cy.visit(`/#/room/${roomId}/${foundMessage.getId()}`);
});
});
}

function openThread(rootMessage: string) {
cy.log("Open thread", rootMessage);
cy.get(".mx_RoomView_body", { log: false }).within(() => {
Expand Down Expand Up @@ -246,6 +256,10 @@ describe("Read receipts", () => {
})();
}

function many(prefix: string, howMany: number): Array<string> {
return Array.from(Array(howMany).keys()).map((i) => prefix + i.toFixed());
}

/**
* BotActionSpec to send a reaction to an existing event into a room
* @param targetMessage - the body of the message to send a reaction to
Expand Down Expand Up @@ -668,7 +682,26 @@ describe("Read receipts", () => {
assertUnread(room2, 1);
assertUnreadThread("Msg1");
});
it.skip("Reading a thread root within the thread view marks it as read in the main timeline", () => {});
// XXX: fails because we jump to the wrong place in the timeline
it.skip("Reading a thread root within the thread view marks it as read in the main timeline", () => {
// Given lots of messages are on the main timeline, and one has a thread off it
goTo(room1);
receiveMessages(room2, [
...many("beforeThread", 30),
"ThreadRoot",
threadedOff("ThreadRoot", "InThread"),
...many("afterThread", 30),
]);
assertUnread(room2, 62); // Sanity

// When I jump to an old message and read the thread
jumpTo(room2, "beforeThread0");
openThread("ThreadRoot");

// Then the thread root is marked as read in the main timeline,
// so there are only 30 left - the ones after the thread root.
assertUnread(room2, 30);
});
it("Creating a new thread based on a reply makes the room unread", () => {
goTo(room1);
receiveMessages(room2, ["Msg1", replyTo("Msg1", "Reply1"), threadedOff("Reply1", "Resp1")]);
Expand Down
Loading