From 0c924139b18b4e94bae36f631c35808e45e79b88 Mon Sep 17 00:00:00 2001 From: Mischa Date: Sun, 21 Jun 2026 01:43:27 +0200 Subject: [PATCH] =?UTF-8?q?test(maps):=20add=20M8=20=E2=80=94=20home=20map?= =?UTF-8?q?=20GPX=20source=20on=20active=20trip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/ui/maps.spec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/ui/maps.spec.js b/tests/ui/maps.spec.js index 16bcc61..615e768 100644 --- a/tests/ui/maps.spec.js +++ b/tests/ui/maps.spec.js @@ -100,3 +100,28 @@ test('M7: clicking map marker briefly highlights the corresponding entry card', // Within 500ms of click + delay, one journal-post should have is-highlighted await expect(page.locator('.journal-post.is-highlighted')).toBeVisible({ timeout: 1500 }); }); + +// ── M8: Home map has GPX journey source on active trip ──────────────────────── +test('M8: home map has a journey source after GPX settles (active trip)', async ({ page }) => { + // Requires travelling: true in user/config/site.yaml (set in Task 1). + // Requires GPX files attached to the active trip (italy-2026-demo has 7). + const errors = []; + page.on('pageerror', e => errors.push(e.message)); + + await page.goto('/'); + await expect(page.locator('#home-map canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 }); + await expect(page.locator('#home-map .maplibregl-marker').first()).toBeVisible({ timeout: 15000 }); + + await page.waitForFunction(function () { + return window.homeMap && + (window.homeMap.getSource('home-journey') !== undefined || + window.homeMap.getSource('home-gpx-0') !== undefined); + }, { timeout: 20000 }); + + const hasSource = await page.evaluate(function () { + return !!(window.homeMap.getSource('home-journey') || window.homeMap.getSource('home-gpx-0')); + }); + + expect(hasSource, 'Home map has a journey or GPX source').toBe(true); + expect(errors, 'No JS errors on home page').toHaveLength(0); +});