Skip to content

Commit 1ae3b7b

Browse files
committed
Add an end-to-end test for the meetups map
1 parent bd4fed7 commit 1ae3b7b

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

test/e2e/community-events.spec.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { test, expect } from "@playwright/test"
2+
3+
test("community events page map loads and Zurich meetup link works", async ({
4+
page,
5+
}) => {
6+
await page.goto("/community/events")
7+
8+
// Wait for the map canvas to be visible
9+
const mapCanvas = page.locator("canvas").first()
10+
await expect(mapCanvas).toBeVisible({ timeout: 10000 })
11+
12+
// Wait for map to finish loading by checking if it has proper dimensions
13+
await expect
14+
.poll(async () => {
15+
const box = await mapCanvas.boundingBox()
16+
return box && box.width > 100 && box.height > 100
17+
})
18+
.toBe(true)
19+
20+
// Take a screenshot of the map and verify it matches snapshot
21+
const mapContainer = page.locator("canvas").first()
22+
await expect(mapContainer).toHaveScreenshot("meetups-map.png", {
23+
timeout: 10000,
24+
})
25+
26+
// Find the "Past events & meetups" section
27+
const pastEventsSection = page.locator("text=Past events & meetups")
28+
await pastEventsSection.scrollIntoViewIfNeeded()
29+
30+
// Find the scrollview container with past events and meetups
31+
const meetupsList = page.locator('[class*="scrollview"]').first()
32+
await expect(meetupsList).toBeVisible()
33+
34+
// Scroll the meetups list to find Zurich
35+
await meetupsList.evaluate(el => {
36+
el.scrollLeft = el.scrollWidth
37+
})
38+
39+
// Find the Zurich meetup card in the scrollable list (not the map popup)
40+
const zurichLink = meetupsList.getByText("Zurich").first()
41+
await expect(zurichLink).toBeVisible()
42+
await zurichLink.scrollIntoViewIfNeeded()
43+
await zurichLink.click()
44+
45+
// Click the link and verify it opens to the correct URL
46+
const pagePromise = page.context().waitForEvent("page")
47+
await zurichLink.click()
48+
const newPage = await pagePromise
49+
50+
await newPage.waitForLoadState("domcontentloaded", { timeout: 10000 })
51+
expect(newPage.url()).toContain("meetup.com/graphql-zurich")
52+
})
3.97 KB
Loading

0 commit comments

Comments
 (0)