From 4607325a9b1bd1c63491bb7878c06c112f961f9a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 4 Dec 2024 21:34:39 +0000 Subject: [PATCH] Playwright: fix (hopefully) flaky shields test Wait for our user to fetch the bot's identity before running the test, to work around a race in the shield logic. Hopefully, fixes https://github.com/element-hq/element-web/issues/28061 --- playwright/e2e/crypto/event-shields.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/playwright/e2e/crypto/event-shields.spec.ts b/playwright/e2e/crypto/event-shields.spec.ts index 84b908bf6d..0beb8e3650 100644 --- a/playwright/e2e/crypto/event-shields.spec.ts +++ b/playwright/e2e/crypto/event-shields.spec.ts @@ -280,6 +280,15 @@ test.describe("Cryptography", function () { bot: bob, homeserver, }) => { + // Workaround for https://github.com/element-hq/element-web/issues/28640: + // make sure that Alice has seen Bob's identity before she goes offline. We do this by opening + // his user info. + await app.toggleRoomInfoPanel(); + const rightPanel = page.locator(".mx_RightPanel"); + await rightPanel.getByRole("menuitem", { name: "People" }).click(); + await rightPanel.getByRole("button", { name: bob.credentials!.userId }).click(); + await expect(rightPanel.locator(".mx_UserInfo_devices")).toContainText("1 session"); + // Our app is blocked from syncing while Bob sends his messages. await app.client.network.goOffline();