|
| 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 | +}) |
0 commit comments