From 81c375007e2793d193f0cfc5c6b80c9a7e982f07 Mon Sep 17 00:00:00 2001 From: David Langley Date: Fri, 21 Nov 2025 13:14:42 +0000 Subject: [PATCH] Fix location sharing dialog screenshot flake (#31288) * FIx location screenshot flake * const * Use the map marker to click on the map. --- playwright/e2e/location/location.spec.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/playwright/e2e/location/location.spec.ts b/playwright/e2e/location/location.spec.ts index e14c3f6516..5ea371b70d 100644 --- a/playwright/e2e/location/location.spec.ts +++ b/playwright/e2e/location/location.spec.ts @@ -46,24 +46,21 @@ test.describe("Location sharing", { tag: "@no-firefox" }, () => { await submitShareLocation(page); - await page.locator(".mx_RoomView_body .mx_EventTile .mx_MLocationBody").click({ - position: { - x: 225, - y: 150, - }, - }); + await page.getByRole("button", { name: "Map marker" }).click(); - // Wait for map to load - await expect(page.getByRole("region", { name: "Map" })).toMatchScreenshot( + const dialog = page.getByRole("dialog"); + + // wait for the dialog to be visible + await expect(dialog).toBeVisible(); + + // screenshot the map within the dialog + await expect(dialog.getByRole("region", { name: "Map" })).toMatchScreenshot( "location-pin-drop-message-map.png", ); - // clicking location tile opens maximised map - await expect(page.getByRole("dialog")).toBeVisible(); - await app.closeDialog(); - await expect(page.locator(".mx_Marker")).toBeVisible(); + await expect(page.getByRole("button", { name: "Map marker" })).toBeVisible(); }, );