From 0b49f90206c263a63b55bd77ba11cd9d2255e791 Mon Sep 17 00:00:00 2001 From: Mischa Date: Sat, 20 Jun 2026 00:50:19 +0200 Subject: [PATCH] =?UTF-8?q?test:=20add=20M5=E2=80=93M6=20integration=20tes?= =?UTF-8?q?ts=20for=20GPX=20connector=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/ui/maps.spec.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/ui/maps.spec.js b/tests/ui/maps.spec.js index 638b5f9..48491a5 100644 --- a/tests/ui/maps.spec.js +++ b/tests/ui/maps.spec.js @@ -42,3 +42,39 @@ test('M4: Home page map renders MapLibre GL canvas without JS errors', async ({ await expect(page.locator('#home-map canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 }); expect(errors, 'No JS errors on home page').toHaveLength(0); }); + +// ── M5: Italy map — no JS errors with GPX present ──────────────────────────── +test('M5: Italy map page renders without JS errors (GPX present)', async ({ page }) => { + const errors = []; + page.on('pageerror', e => errors.push(e.message)); + + await page.goto('/trips/italy-2025/map'); + await expect(page.locator('canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 }); + // Wait for markers to confirm map.on('load') completed + await expect(page.locator('.maplibregl-marker').first()).toBeVisible({ timeout: 15000 }); + // Give Promise.all time to resolve + await page.waitForTimeout(3000); + + expect(errors, 'No JS errors on Italy map page').toHaveLength(0); +}); + +// ── M6: Italy map — journey source exists after GPX loads ──────────────────── +test('M6: Italy map has a journey MapLibre source after GPX settles', async ({ page }) => { + await page.goto('/trips/italy-2025/map'); + await expect(page.locator('canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 }); + await expect(page.locator('.maplibregl-marker').first()).toBeVisible({ timeout: 15000 }); + + // Wait until the journey source appears — addJourneySegments runs inside Promise.all.then() + // `var map = ...` in map.html.twig is a plain