fix: update tests for demo reorganisation (italy-2026-demo, central-asia ordering, japan real entry)

- dailies T2: switch ordering test to central-asia-2023 (pixelfed-1 oldest, pixelfed-22 newest)
- dailies T3-T6: update KNOWN_SLUG/TITLE/CITY/COUNTRY to the real japan entry (2026-06-17)
- stories S1-S7: update all italy-2025 URLs to italy-2026-demo
- stories S5/S6: fix URL regex and use val-dorcia-dawn for hero sanity check
- maps M5/M6: point Italy GPX map tests to italy-2026-demo (has markers + GPX)
- global-setup: run make demo-load before tests so italy-2026-demo always exists
- post P2: add retries:1 + test.setTimeout(60s) for intermittent FilePond upload
- user: story template hero fallback for media.types config override (see user commit)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vgmzx8VTTTmCskSpQtsLTr
This commit is contained in:
2026-06-20 16:31:37 +02:00
parent 9cb1b3cb3a
commit 0729e4ea1d
6 changed files with 28 additions and 24 deletions
+4
View File
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
module.exports = async function globalSetup() {
const envFile = path.join(__dirname, '../.env');
@@ -11,4 +12,7 @@ module.exports = async function globalSetup() {
}
});
}
// Ensure demo content is loaded (italy-2026-demo trip + stories + GPX files)
execSync('make demo-load', { cwd: path.join(__dirname, '..'), stdio: 'inherit' });
};
+10 -11
View File
@@ -3,14 +3,14 @@
const { test, expect } = require('@playwright/test');
// Known fixture entries that always exist in the repo
const KNOWN_SLUG = '2026-03-25-1540-wheels-down-narita.entry';
const KNOWN_TITLE = 'Wheels Down at Narita';
const KNOWN_CITY = 'Tokyo';
const KNOWN_COUNTRY = 'Japan';
const KNOWN_SLUG = '2026-06-17.entry';
const KNOWN_TITLE = 'The Journey Begins';
const KNOWN_CITY = 'Amsterdam';
const KNOWN_COUNTRY = 'Netherlands';
// Use two fixture entries with different dates to verify descending order
const NEWER_SLUG = '2026-04-01-0900-seoul-calling.entry'; // newer fixture
const OLDER_SLUG = '2026-03-25-1540-wheels-down-narita.entry'; // older fixture
// Use two real entries from central-asia-2023 to verify descending order
const NEWER_SLUG = '2023-10-18-pixelfed-22.entry'; // newest date in that trip
const OLDER_SLUG = '2023-08-28-pixelfed-1.entry'; // oldest date in that trip
// ── T1: Dailies page loads ─────────────────────────────────────────────────────
test('T1: /trips/japan-korea-2026/dailies loads and shows at least one entry card', async ({ page }) => {
@@ -20,10 +20,9 @@ test('T1: /trips/japan-korea-2026/dailies loads and shows at least one entry car
});
// ── T2: Entries are newest-first ──────────────────────────────────────────────
// Verify using two known fixture entries rather than all entries
// (the dailies may contain noisy test-run debris with inconsistent dates).
// Verify using two known real entries from central-asia-2023 (22 entries, stable order).
test('T2: dailies shows newer entries before older entries', async ({ page }) => {
await page.goto('/trips/japan-korea-2026/dailies');
await page.goto('/trips/central-asia-2023/dailies');
// Use attribute selector to handle dots in slug names (CSS dots are class selectors)
const newerCard = page.locator(`.journal-post[id="entry-${NEWER_SLUG}"]`);
@@ -67,7 +66,7 @@ test('T5: entry page shows city and country when set', async ({ page }) => {
// ── T6: Entry page has a fixed top back pill and a footer back pill ───────────────
test('T6: entry page has fixed back pill at top and back pill in footer', async ({ page }) => {
const KNOWN_ENTRY = '/trips/japan-korea-2026/dailies/2026-03-25-1540-wheels-down-narita.entry';
const KNOWN_ENTRY = '/trips/japan-korea-2026/dailies/2026-06-17.entry';
await page.goto(KNOWN_ENTRY);
await expect(page.locator('article.entry')).toBeVisible();
// Fixed top pill (outside the article, before it)
+2 -2
View File
@@ -48,7 +48,7 @@ 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 page.goto('/trips/italy-2026-demo/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 });
@@ -60,7 +60,7 @@ test('M5: Italy map page renders without JS errors (GPX present)', async ({ page
// ── 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 page.goto('/trips/italy-2026-demo/map');
await expect(page.locator('canvas.maplibregl-canvas')).toBeVisible({ timeout: 10000 });
await expect(page.locator('.maplibregl-marker').first()).toBeVisible({ timeout: 15000 });
+2 -1
View File
@@ -44,7 +44,8 @@ test('P1: post text-only entry → created on disk and visible on /dailies', asy
});
// ── P2: Post with photo ────────────────────────────────────────────────────────
test('P2: post entry with photo → photo saved in entry folder and visible on /dailies', async ({ page }) => {
test('P2: post entry with photo → photo saved in entry folder and visible on /dailies', { retries: 1 }, async ({ page }) => {
test.setTimeout(60_000);
const tag = `p2-${Date.now()}`;
const title = `UI Test ${tag}`;
+9 -9
View File
@@ -3,10 +3,10 @@
// Requires demo data: run `make demo-load` before this suite.
const { test, expect } = require('@playwright/test');
const STORIES_URL = '/trips/italy-2025/stories';
const STORY_GALLERY = '/trips/italy-2025/stories/val-dorcia-dawn'; // gallery-led: snap-gallery × 2, chapter-break, text-only pull-quote
const STORY_SCROLLY = '/trips/italy-2025/stories/long-climb-montalcino'; // scrolly-led: scrolly-section × 2, chapter-break, pull-quote with image
const JAPAN_STORY = '/trips/japan-korea-2026/stories/the-thousand-gates';
const STORIES_URL = '/trips/italy-2026-demo/stories';
const STORY_GALLERY = '/trips/italy-2026-demo/stories/val-dorcia-dawn'; // gallery-led: snap-gallery × 2, chapter-break, text-only pull-quote
const STORY_SCROLLY = '/trips/italy-2026-demo/stories/long-climb-montalcino'; // scrolly-led: scrolly-section × 2, chapter-break, pull-quote with image
const DEMO_STORY = '/trips/italy-2026-demo/stories/val-dorcia-dawn'; // used for cross-trip hero sanity check
// ── S1: Stories listing shows cards ──────────────────────────────────────────
test('S1: stories listing renders at least 3 story cards', async ({ page }) => {
@@ -63,20 +63,20 @@ test('S5: back button navigates back to stories listing', async ({ page }) => {
await expect(page.locator('.story-hero__img')).toBeVisible({ timeout: 8000 });
await page.locator('.story-escape').click();
// After history.back(), URL should be the stories listing
await expect(page).toHaveURL(/italy-2025\/stories$/);
await expect(page).toHaveURL(/italy-2026-demo\/stories$/);
await expect(page.locator('.story-card').first()).toBeVisible();
});
// ── S6: Japan story — cross-trip hero image sanity check ─────────────────────
test('S6: Japan story renders hero image without placeholder', async ({ page }) => {
await page.goto(JAPAN_STORY);
// ── S6: Demo story — hero image sanity check ─────────────────────────────────
test('S6: demo story renders hero image without placeholder', async ({ page }) => {
await page.goto(DEMO_STORY);
await expect(page.locator('.story-hero__img')).toBeVisible({ timeout: 8000 });
await expect(page.locator('.story-hero__img-placeholder')).toHaveCount(0);
});
// ── S7: Story body back link is styled as a back-pill ────────────────────────
test('S7: story body back link has back-pill class', async ({ page }) => {
await page.goto('/trips/italy-2025/stories/val-dorcia-dawn');
await page.goto('/trips/italy-2026-demo/stories/val-dorcia-dawn');
await expect(page.locator('.story-hero__img')).toBeVisible({ timeout: 8000 });
// Scroll past the hero to reveal the story body
await page.evaluate(() => window.scrollBy(0, window.innerHeight * 1.5));
+1 -1
Submodule user updated: 138649c8e5...229532ab8b