Skip to content

Commit e6c1de0

Browse files
committed
Fight Playwright
1 parent 4025270 commit e6c1de0

File tree

3 files changed

+18
-28
lines changed

3 files changed

+18
-28
lines changed

src/app/(main)/community/events/meetups-map.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export function MeetupsMap() {
140140

141141
return (
142142
<div
143+
id="meetups-map"
143144
onMouseOut={() => {
144145
setActiveMeetupId(null)
145146
}}

test/e2e/community-events.spec.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,30 @@ import { test, expect } from "@playwright/test"
33
test("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: /Zurich/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

4438
test("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

test/e2e/test-test.spec.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { test, expect } from "@playwright/test"
22

3-
const currentTime = Date.now()
4-
5-
const url1 = "chrome://gpu/"
63
const url2 = "https://www.soft8soft.com/webglreport"
74
const url3 = "https://webglsamples.org/aquarium/aquarium.html"
85

@@ -14,24 +11,18 @@ test.beforeEach(async ({ browser }, testInfo) => {
1411
testInfo.setTimeout(testInfo.timeout + 160000)
1512
})
1613

17-
test.describe("Testing 123", () => {
14+
test.describe("Testing WebGL Support", () => {
1815
test("2. webgl report", async ({ page }) => {
1916
await page.goto(url2)
2017

2118
await waitFor(2000)
22-
await page.screenshot({
23-
path: "playwright-report/screenshot" + currentTime + "_2.png",
24-
fullPage: true,
25-
})
19+
expect(page).toHaveScreenshot("webgl-report.png")
2620
})
2721

2822
test("3. aquarium", async ({ page }) => {
2923
await page.goto(url3)
3024

3125
await waitFor(5000)
32-
await page.screenshot({
33-
path: "playwright-report/screenshot" + currentTime + "_3.png",
34-
fullPage: true,
35-
})
26+
expect(page).toHaveScreenshot("aquarium.png")
3627
})
3728
})

0 commit comments

Comments
 (0)