From 76be5ccc9eec45b165b6cc6ea7849bcc3501d5c8 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Tue, 12 Aug 2025 11:26:44 +0200 Subject: [PATCH] test(e2e): fix share-by-url flakiness (#30550) --- playwright/e2e/share-dialog/share-by-url.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/playwright/e2e/share-dialog/share-by-url.spec.ts b/playwright/e2e/share-dialog/share-by-url.spec.ts index c5b9174782..49024d79d9 100644 --- a/playwright/e2e/share-dialog/share-by-url.spec.ts +++ b/playwright/e2e/share-dialog/share-by-url.spec.ts @@ -18,13 +18,14 @@ test.describe("share from URL", () => { test("should share message when users navigates to share URL", async ({ page, user, room, app }) => { await page.goto("/#/share?msg=Hello+world"); + const dialog = page.getByRole("dialog", { name: "Forward message" }); // The forward message dialog doesn't update as new infomation arrives via sync, which means sometimes // this is just says, "Empty room". For the same reason, we can't reliably write a test for loading the // app straight away with a /#/share url as the room doesn't appear until the client syncs.] // Ideally we should fix the forward dialog to update and eliminate races, until then, there is only one // room so we click the first button. - await page.getByRole("listitem" /*, { name: "A test room" }*/).getByRole("button", { name: "Send" }).click(); - await page.keyboard.press("Escape"); + await dialog.getByRole("listitem" /*, { name: "A test room" }*/).getByRole("button", { name: "Send" }).click(); + await dialog.getByRole("button", { name: "Close" }).click(); await app.viewRoomByName("A test room"); const lastMessage = page.locator(".mx_RoomView_MessageList .mx_EventTile_last"); await expect(lastMessage).toBeVisible();