From 537b4a1971740951d1b7a878022d76d1d387ed05 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Tue, 19 Dec 2023 10:59:05 +0100 Subject: [PATCH] Playwright: Fix thread root skipped tests (#12067) * Fix thread root skipped tests * Add comment about collapsed content in `redactions.spec.ts` --------- Co-authored-by: David Baker --- playwright/e2e/read-receipts/index.ts | 9 +++++++++ playwright/e2e/read-receipts/redactions.spec.ts | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/playwright/e2e/read-receipts/index.ts b/playwright/e2e/read-receipts/index.ts index fcdecc06d9..00b52a907f 100644 --- a/playwright/e2e/read-receipts/index.ts +++ b/playwright/e2e/read-receipts/index.ts @@ -370,6 +370,15 @@ class Helpers { await this.app.viewRoomByName(typeof room === "string" ? room : room.name); } + /** + * Expand the message with the supplied index in the timeline. + * @param index + */ + async openCollapsedMessage(index: number) { + const button = this.page.locator(".mx_GenericEventListSummary_toggle"); + await button.nth(index).click(); + } + /** * Click the thread with the supplied content in the thread root to open it in * the Threads panel. diff --git a/playwright/e2e/read-receipts/redactions.spec.ts b/playwright/e2e/read-receipts/redactions.spec.ts index 5ec202ed0d..f12807d287 100644 --- a/playwright/e2e/read-receipts/redactions.spec.ts +++ b/playwright/e2e/read-receipts/redactions.spec.ts @@ -849,8 +849,7 @@ test.describe("Read receipts", () => { // Then the room is still read await util.assertStillRead(room2); }); - // TODO: Can't open a thread on a redacted thread root - test.skip("Redacting a thread root still allows us to read the thread", async ({ + test("Redacting a thread root still allows us to read the thread", async ({ roomAlpha: room1, roomBeta: room2, util, @@ -874,12 +873,13 @@ test.describe("Read receipts", () => { // And I can open the thread and read it await util.goTo(room2); await util.assertUnread(room2, 2); - await util.openThread("Root"); + // The redacted message gets collapsed into, "foo was invited, joined and removed a message" + await util.openCollapsedMessage(1); + await util.openThread("Message deleted"); await util.assertRead(room2); await util.assertReadThread("Root"); }); - // TODO: Can't open a thread on a redacted thread root - test.skip("Sending a threaded message onto a redacted thread root leaves the room unread", async ({ + test("Sending a threaded message onto a redacted thread root leaves the room unread", async ({ roomAlpha: room1, roomBeta: room2, util, @@ -905,7 +905,7 @@ test.describe("Read receipts", () => { // Then the room and thread are unread await util.assertUnread(room2, 1); await util.goTo(room2); - await util.assertUnreadThread("Root"); + await util.assertUnreadThread("Message deleted"); }); test("Reacting to a redacted thread root leaves the room read", async ({ roomAlpha: room1,