test(home,maps): skip travelling-gated H1/M8 with a stated reason
H1 (home journal feed) and M8 (home journey map source) only apply when config.site.travelling is true — home.html.twig otherwise renders the between-trips highlights grid, which has neither. They now detect that mode (.home-highlights-title) and test.skip() with an explicit reason instead of failing misleadingly, so they still run and validate whenever travelling is on. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mpdu3Dt1iVoozHwAMyjrbn
This commit is contained in:
@@ -3,8 +3,15 @@
|
|||||||
const { test, expect } = require('@playwright/test');
|
const { test, expect } = require('@playwright/test');
|
||||||
|
|
||||||
// ── H1: Home page renders inline journal posts ─────────────────────────────────
|
// ── H1: Home page renders inline journal posts ─────────────────────────────────
|
||||||
|
// Only meaningful when the site is in "travelling" mode: home.html.twig gates the
|
||||||
|
// active-trip feed on `config.site.travelling`. When it's false the home renders
|
||||||
|
// the between-trips highlights grid instead (no journal feed), so this test would
|
||||||
|
// fail misleadingly. We skip loudly with a reason rather than assert against the
|
||||||
|
// wrong view — the test still runs and validates whenever travelling is on.
|
||||||
test('H1: home page shows at least one inline journal-post block', async ({ page }) => {
|
test('H1: home page shows at least one inline journal-post block', async ({ page }) => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
|
const betweenTrips = await page.locator('.home-highlights-title').count();
|
||||||
|
test.skip(betweenTrips > 0, 'home is in between-trips mode (site.travelling:false); H1 requires travelling:true');
|
||||||
await expect(page.locator('.journal-post').first()).toBeVisible();
|
await expect(page.locator('.journal-post').first()).toBeVisible();
|
||||||
await expect(page.locator('.site-header')).toBeVisible();
|
await expect(page.locator('.site-header')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,12 +40,17 @@ test('M7: clicking map marker briefly highlights the corresponding entry card',
|
|||||||
|
|
||||||
// ── M8: Home map has GPX journey source on active trip ────────────────────────
|
// ── 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 }) => {
|
test('M8: home map has a journey source after GPX settles (active trip)', async ({ page }) => {
|
||||||
// Requires travelling: true in user/config/site.yaml.
|
// Requires travelling: true in user/config/site.yaml — home.html.twig only
|
||||||
// Requires GPX files attached to the active trip (italy-2026-demo has 7).
|
// renders the active-trip journey map (home-journey / home-gpx-0 sources) in
|
||||||
|
// that mode. With travelling:false the home shows the between-trips highlights
|
||||||
|
// map, which has neither source, so we skip loudly rather than fail misleadingly.
|
||||||
|
// Also requires GPX files attached to the active trip (italy-2026-demo has 7).
|
||||||
const errors = [];
|
const errors = [];
|
||||||
page.on('pageerror', e => errors.push(e.message));
|
page.on('pageerror', e => errors.push(e.message));
|
||||||
|
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
|
const betweenTrips = await page.locator('.home-highlights-title').count();
|
||||||
|
test.skip(betweenTrips > 0, 'home is in between-trips mode (site.travelling:false); M8 requires travelling:true');
|
||||||
await expect(page.locator('#home-map canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 });
|
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 expect(page.locator('#home-map .maplibregl-marker').first()).toBeVisible({ timeout: 15000 });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user