Skip to content

Commit abb9354

Browse files
authored
fix(e2e): look at the location map before clicking (#31180)
1 parent 24aa759 commit abb9354

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

playwright/e2e/location/location.spec.ts

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,42 @@ test.describe("Location sharing", { tag: "@no-firefox" }, () => {
3030
});
3131
});
3232

33-
test("sends and displays pin drop location message successfully", async ({ page, user, app }) => {
34-
const roomId = await app.client.createRoom({});
35-
await page.goto(`/#/room/${roomId}`);
33+
test(
34+
"sends and displays pin drop location message successfully",
35+
{ tag: "@screenshot" },
36+
async ({ page, user, app }) => {
37+
const roomId = await app.client.createRoom({});
38+
await page.goto(`/#/room/${roomId}`);
3639

37-
const composerOptions = await app.openMessageComposerOptions();
38-
await composerOptions.getByRole("menuitem", { name: "Location", exact: true }).click();
40+
const composerOptions = await app.openMessageComposerOptions();
41+
await composerOptions.getByRole("menuitem", { name: "Location", exact: true }).click();
3942

40-
await selectLocationShareTypeOption(page, "Pin").click();
43+
await selectLocationShareTypeOption(page, "Pin").click();
4144

42-
await page.locator("#mx_LocationPicker_map").click();
45+
await page.locator("#mx_LocationPicker_map").click();
4346

44-
await submitShareLocation(page);
47+
await submitShareLocation(page);
4548

46-
await page.locator(".mx_RoomView_body .mx_EventTile .mx_MLocationBody").click({
47-
position: {
48-
x: 225,
49-
y: 150,
50-
},
51-
});
49+
await page.locator(".mx_RoomView_body .mx_EventTile .mx_MLocationBody").click({
50+
position: {
51+
x: 225,
52+
y: 150,
53+
},
54+
});
5255

53-
// clicking location tile opens maximised map
54-
await expect(page.getByRole("dialog")).toBeVisible();
56+
// Wait for map to load
57+
await expect(page.getByRole("region", { name: "Map" })).toMatchScreenshot(
58+
"location-pin-drop-message-map.png",
59+
);
5560

56-
await app.closeDialog();
61+
// clicking location tile opens maximised map
62+
await expect(page.getByRole("dialog")).toBeVisible();
5763

58-
await expect(page.locator(".mx_Marker")).toBeVisible();
59-
});
64+
await app.closeDialog();
65+
66+
await expect(page.locator(".mx_Marker")).toBeVisible();
67+
},
68+
);
6069

6170
test(
6271
"is prompted for and can consent to live location sharing",
16.8 KB
Loading

0 commit comments

Comments
 (0)