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

pull/28217/head
Andy Balaam 2023-09-08 01:32:16 +01:00 committed by GitHub
parent d30c85772a
commit 77b681eed9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 1 deletions

View File

@ -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(() => {
@ -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
@ -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")]);