From 4097844fed6de36f54cb19412e0d74287e82d268 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 22 Sep 2023 11:51:26 +0100 Subject: [PATCH] Fix flake in high-level tests by not using markAsRead --- cypress/e2e/read-receipts/high-level.spec.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/read-receipts/high-level.spec.ts b/cypress/e2e/read-receipts/high-level.spec.ts index 39ea887fc2..76da807a4c 100644 --- a/cypress/e2e/read-receipts/high-level.spec.ts +++ b/cypress/e2e/read-receipts/high-level.spec.ts @@ -22,6 +22,7 @@ import type { MatrixClient, MatrixEvent } from "matrix-js-sdk/src/matrix"; import { HomeserverInstance } from "../../plugins/utils/homeserver"; import { assertRead, + assertStillRead, assertUnread, customEvent, goTo, @@ -157,18 +158,25 @@ describe("Read receipts", () => { assertRead(room2); }); it("Sending an important event after unimportant ones makes the room unread", () => { + // Given We have read the important messages goTo(room1); assertRead(room2); receiveMessages(room2, ["Msg1", "Msg2"]); assertUnread(room2, 2); - - markAsRead(room2); + goTo(room2); assertRead(room2); + goTo(room1); + // When we receive important messages receiveMessages(room2, [customEvent("org.custom.event", { body: "foobar" })]); - assertRead(room2); + // Then the room is still read + assertStillRead(room2); + + // And when we receive more important ones receiveMessages(room2, ["Hello"]); + + // The room is unread again assertUnread(room2, 1); }); it.skip("A receipt for the last unimportant event makes the room read, even if all are unimportant", () => {});