From 94484692f8ca41aecf9e8c601852bd9d955b7d4f Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Thu, 9 Nov 2023 15:09:03 +0000 Subject: [PATCH] Test for adding and removing a reaction in a thread (#11839) * Test for adding and removing a reaction in a thread * Remove timeouts added for debugging --- cypress/e2e/read-receipts/reactions.spec.ts | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/cypress/e2e/read-receipts/reactions.spec.ts b/cypress/e2e/read-receipts/reactions.spec.ts index aa7a9ff5f6..df402fda50 100644 --- a/cypress/e2e/read-receipts/reactions.spec.ts +++ b/cypress/e2e/read-receipts/reactions.spec.ts @@ -252,6 +252,38 @@ describe("Read receipts", () => { assertReadThread("Msg1"); assertReadThread("Msg2"); }); + it("Can remove a reaction in a thread", () => { + // Note: this is not strictly a read receipt test, but it checks + // for a bug we caused when we were fixing unreads, so it's + // included here. The bug is: + // https://github.com/vector-im/element-web/issues/26498 + + // Given a thread exists + goTo(room1); + assertRead(room2); + receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Reply1a")]); + assertUnread(room2, 2); + + // When I react to a thread message + goTo(room2); + openThread("Msg1"); + cy.get(".mx_ThreadPanel").findByText("Reply1a").realHover(); + cy.findByRole("button", { name: "React" }).click(); + cy.get(".mx_EmojiPicker_body").findByText("😀").click(); + + // And cancel the reaction + cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").click(); + + // Then it disappears + cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").should("not.exist"); + + // And I can do it all again without an error + cy.get(".mx_ThreadPanel").findByText("Reply1a").realHover(); + cy.findByRole("button", { name: "React" }).click(); + cy.get(".mx_EmojiPicker_body").findAllByText("😀").first().click(); + cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").click(); + cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").should("not.exist"); + }); }); describe("thread roots", () => {