From e50d56b53d959cdc18fb52f3b5cd074693d40027 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Wed, 15 Apr 2026 10:45:26 +0100 Subject: [PATCH] Prevent test flakes by closing verify toast --- .../threadsActivityCentre.spec.ts | 80 +++++++++++++------ 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/apps/web/playwright/e2e/spaces/threads-activity-centre/threadsActivityCentre.spec.ts b/apps/web/playwright/e2e/spaces/threads-activity-centre/threadsActivityCentre.spec.ts index 00ed8a8df1..a22ce1ec2b 100644 --- a/apps/web/playwright/e2e/spaces/threads-activity-centre/threadsActivityCentre.spec.ts +++ b/apps/web/playwright/e2e/spaces/threads-activity-centre/threadsActivityCentre.spec.ts @@ -34,7 +34,9 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { }, ); - test("should not show indicator when there is no thread", { tag: "@screenshot" }, async ({ room1, util }) => { + test("should not show indicator when there is no thread", { tag: "@screenshot" }, async ({ room1, util, app }) => { + await app.closeVerifyToast(); + // No indicator should be shown await util.assertNoTacIndicator(); @@ -45,7 +47,14 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { await util.assertNoTacIndicator(); }); - test("should show a notification indicator when there is a message in a thread", async ({ room1, util, msg }) => { + test("should show a notification indicator when there is a message in a thread", async ({ + room1, + util, + msg, + app, + }) => { + await app.closeVerifyToast(); + await util.goTo(room1); await util.receiveMessages(room1, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); @@ -58,7 +67,10 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { util, msg, user, + app, }) => { + await app.closeVerifyToast(); + await util.goTo(room1); await util.receiveMessages(room1, [ "Msg1", @@ -79,7 +91,9 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { test( "should show the rooms with unread threads", { tag: "@screenshot" }, - async ({ room1, room2, util, msg, user }) => { + async ({ room1, room2, util, msg, user, app }) => { + await app.closeVerifyToast(); + await util.goTo(room2); await util.populateThreads(room1, room2, msg, user); // The indicator should be shown @@ -97,30 +111,38 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { }, ); - test("should update with a thread is read", { tag: "@screenshot" }, async ({ room1, room2, util, msg, user }) => { - await util.goTo(room2); - await util.populateThreads(room1, room2, msg, user); + test( + "should update with a thread is read", + { tag: "@screenshot" }, + async ({ room1, room2, util, msg, user, app }) => { + await app.closeVerifyToast(); - // Click on the first room in TAC - await util.openTac(); - await util.clickRoomInTac(room2.name); + await util.goTo(room2); + await util.populateThreads(room1, room2, msg, user); - // Verify that the thread panel is opened after a click on the room in the TAC - await util.assertThreadPanelIsOpened(); + // Click on the first room in TAC + await util.openTac(); + await util.clickRoomInTac(room2.name); - // Open a thread and mark it as read - // The room 2 doesn't have a mention anymore in its unread, so the highest notification level is notification - await util.openThread("Msg1"); - await util.assertNotificationTac(); - await util.openTac(); - await util.assertRoomsInTac([ - { room: room1.name, notificationLevel: "notification" }, - { room: room2.name, notificationLevel: "notification" }, - ]); - await expect(util.getTacPanel()).toMatchScreenshot("tac-panel-notification-unread.png"); - }); + // Verify that the thread panel is opened after a click on the room in the TAC + await util.assertThreadPanelIsOpened(); + + // Open a thread and mark it as read + // The room 2 doesn't have a mention anymore in its unread, so the highest notification level is notification + await util.openThread("Msg1"); + await util.assertNotificationTac(); + await util.openTac(); + await util.assertRoomsInTac([ + { room: room1.name, notificationLevel: "notification" }, + { room: room2.name, notificationLevel: "notification" }, + ]); + await expect(util.getTacPanel()).toMatchScreenshot("tac-panel-notification-unread.png"); + }, + ); + + test("should order by recency after notification level", async ({ room1, room2, util, msg, user, app }) => { + await app.closeVerifyToast(); - test("should order by recency after notification level", async ({ room1, room2, util, msg, user }) => { await util.goTo(room2); await util.populateThreads(room1, room2, msg, user, false); @@ -131,7 +153,9 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { ]); }); - test("should block the Spotlight to open when the TAC is opened", async ({ util, page }) => { + test("should block the Spotlight to open when the TAC is opened", async ({ util, page, app }) => { + await app.closeVerifyToast(); + const toggleSpotlight = () => page.keyboard.press(`${CommandOrControl}+k`); // Sanity check @@ -158,7 +182,9 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { await expect(util.getSpacePanel()).toMatchScreenshot("tac-hovered-expanded.png"); }); - test("should mark all threads as read", { tag: "@screenshot" }, async ({ room1, room2, util, msg, page }) => { + test("should mark all threads as read", { tag: "@screenshot" }, async ({ room1, room2, util, msg, page, app }) => { + await app.closeVerifyToast(); + await util.receiveMessages(room1, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); await util.assertNotificationTac(); @@ -171,7 +197,9 @@ test.describe("Threads Activity Centre", { tag: "@no-firefox" }, () => { await util.assertNoTacIndicator(); }); - test("should focus the thread tab when clicking an item in the TAC", async ({ room1, room2, util, msg }) => { + test("should focus the thread tab when clicking an item in the TAC", async ({ room1, room2, util, msg, app }) => { + await app.closeVerifyToast(); + await util.receiveMessages(room1, ["Msg1", msg.threadedOff("Msg1", "Resp1")]); await util.openTac();