@@ -3,36 +3,30 @@ import { test, expect } from "@playwright/test"
33test ( "map loads and Zurich meetup link works" , async ( { page } ) => {
44 await page . goto ( "/community/events" )
55
6- // Wait for the map canvas to be visible
76 const mapCanvas = page . locator ( "canvas" ) . first ( )
87 await expect ( mapCanvas ) . toBeVisible ( { timeout : 10000 } )
98
10- // Wait for map to finish loading by checking if it has proper dimensions
119 await expect
1210 . poll ( async ( ) => {
1311 const box = await mapCanvas . boundingBox ( )
1412 return box && box . width > 100 && box . height > 100
1513 } )
1614 . toBe ( true )
1715
18- // Take a screenshot of the map and verify it matches snapshot
19- const mapContainer = page . locator ( "canvas" ) . first ( )
20- await expect ( mapContainer ) . toHaveScreenshot ( "meetups-map.png" , {
21- timeout : 20_000 ,
22- } )
16+ const mapContainer = page . locator ( "#meetups-map" )
17+ await mapContainer . scrollIntoViewIfNeeded ( )
18+ await expect ( mapContainer . locator ( "canvas" ) . first ( ) ) . toHaveScreenshot (
19+ "meetups-map.png" ,
20+ { timeout : 10_000 } ,
21+ )
2322
24- // Find the "Past events & meetups" section
2523 const pastEventsSection = page . locator ( "text=Past events & meetups" )
2624 await pastEventsSection . scrollIntoViewIfNeeded ( )
2725
28- // Find the scrollview container with past events and meetups
29-
30- // Find the Zurich meetup card in the scrollable list (not the map popup)
3126 const link = page . getByRole ( "link" , { name : / Z u r i c h / i } ) . first ( )
3227 await link . scrollIntoViewIfNeeded ( )
3328 await link . click ( )
3429
35- // Click the link and verify it opens to the correct URL
3630 const pagePromise = page . context ( ) . waitForEvent ( "page" )
3731 await link . click ( )
3832 const newPage = await pagePromise
@@ -43,19 +37,23 @@ test("map loads and Zurich meetup link works", async ({ page }) => {
4337
4438test ( "map tooltip appears on marker hover" , async ( { page } ) => {
4539 await page . goto ( "/community/events" )
46- const mapCanvas = page . locator ( "canvas" ) . first ( )
47- await expect ( mapCanvas ) . toBeVisible ( { timeout : 10000 } )
40+ const mapContainer = page . locator ( "#meetups-map" ) . first ( )
41+ await mapContainer . scrollIntoViewIfNeeded ( )
42+ await expect ( mapContainer ) . toBeVisible ( { timeout : 10000 } )
4843 await expect
4944 . poll ( async ( ) => {
50- const box = await mapCanvas . boundingBox ( )
45+ const box = await mapContainer . boundingBox ( )
5146 return Boolean ( box && box . width > 100 && box . height > 100 )
5247 } )
5348 . toBe ( true )
5449 const tooltip = page . getByRole ( "tooltip" )
5550 await expect ( tooltip ) . toHaveCount ( 0 )
51+ const mapCanvas = mapContainer . locator ( "canvas" ) . first ( )
5652 await mapCanvas . hover ( )
5753 const { clientX, clientY } = await page . evaluate ( ( ) => {
58- const canvas = document . querySelector ( "canvas" ) as HTMLCanvasElement | null
54+ const canvas = document . querySelector (
55+ "#meetups-map canvas" ,
56+ ) as HTMLCanvasElement | null
5957 if ( ! canvas ) throw new Error ( "Canvas not found" )
6058 const targetLat = 51.51
6159 const targetLon = - 0.12
0 commit comments