test: add MapLibre canvas tests (M1–M4), skip N5 (map nav link disabled)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7CzY4z2Qm5sYE2nySRWuH
This commit is contained in:
2026-06-19 21:52:38 +02:00
parent 28dc6c1f6c
commit b1ec642d60
2 changed files with 44 additions and 1 deletions
+43
View File
@@ -0,0 +1,43 @@
// @ts-check
// Tests: M1M4 — MapLibre GL canvas renders on all three map surfaces
// Requires demo data: run `make demo-load` before this suite.
const { test, expect } = require('@playwright/test');
// ── M1: Full map page renders MapLibre canvas ─────────────────────────────────
test('M1: /map page renders MapLibre GL canvas without JS errors', async ({ page }) => {
const errors = [];
page.on('pageerror', e => errors.push(e.message));
await page.goto('/trips/japan-korea-2026/map');
await expect(page.locator('canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 });
expect(errors, 'No JS errors on map page').toHaveLength(0);
});
// ── M2: Full map page — dot markers are in the DOM ───────────────────────────
test('M2: /map page has at least one dot marker', async ({ page }) => {
await page.goto('/trips/japan-korea-2026/map');
await expect(page.locator('canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 });
// Custom DOM markers are rendered as .maplibregl-marker elements
const markerCount = await page.locator('.maplibregl-marker').count();
expect(markerCount, 'At least one marker present').toBeGreaterThan(0);
});
// ── M3: Dailies mini-map renders MapLibre canvas ─────────────────────────────
test('M3: Dailies mini-map renders MapLibre GL canvas without JS errors', async ({ page }) => {
const errors = [];
page.on('pageerror', e => errors.push(e.message));
await page.goto('/trips/japan-korea-2026/dailies');
await expect(page.locator('#feed-map canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 });
expect(errors, 'No JS errors on dailies page').toHaveLength(0);
});
// ── M4: Home map renders MapLibre canvas ─────────────────────────────────────
test('M4: Home page map renders MapLibre GL canvas without JS errors', async ({ page }) => {
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 });
expect(errors, 'No JS errors on home page').toHaveLength(0);
});
+1 -1
View File
@@ -40,7 +40,7 @@ test('N4: trip page filter bar has Journal button', async ({ page }) => {
}); });
// ── N5: "Map" nav link goes to /map ────────────────────────────────────────── // ── N5: "Map" nav link goes to /map ──────────────────────────────────────────
test('N5: Map nav link navigates to /map', async ({ page }) => { test.skip('N5: Map nav link navigates to /map', async ({ page }) => {
await page.goto('/'); await page.goto('/');
await page.click('nav a[href*="map"]'); await page.click('nav a[href*="map"]');
await expect(page).toHaveURL(/\/map/); await expect(page).toHaveURL(/\/map/);