test(maps): add M8 — home map GPX source on active trip

This commit is contained in:
2026-06-21 01:43:27 +02:00
parent e9cd9c5946
commit 0c924139b1
+25
View File
@@ -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 // Within 500ms of click + delay, one journal-post should have is-highlighted
await expect(page.locator('.journal-post.is-highlighted')).toBeVisible({ timeout: 1500 }); 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);
});