0729e4ea1d
- 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
81 lines
4.3 KiB
JavaScript
81 lines
4.3 KiB
JavaScript
// @ts-check
|
||
// Tests: T1–T5 — dailies feed and individual entry pages
|
||
const { test, expect } = require('@playwright/test');
|
||
|
||
// Known fixture entries that always exist in the repo
|
||
const KNOWN_SLUG = '2026-06-17.entry';
|
||
const KNOWN_TITLE = 'The Journey Begins';
|
||
const KNOWN_CITY = 'Amsterdam';
|
||
const KNOWN_COUNTRY = 'Netherlands';
|
||
|
||
// 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 }) => {
|
||
await page.goto('/trips/japan-korea-2026/dailies');
|
||
await expect(page.locator('.journal-post').first()).toBeVisible();
|
||
await expect(page.locator('.site-header')).toBeVisible();
|
||
});
|
||
|
||
// ── T2: Entries are newest-first ──────────────────────────────────────────────
|
||
// 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/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}"]`);
|
||
const olderCard = page.locator(`.journal-post[id="entry-${OLDER_SLUG}"]`);
|
||
|
||
await expect(newerCard).toBeVisible();
|
||
await expect(olderCard).toBeVisible();
|
||
|
||
// The newer entry should appear higher in the DOM (lower index)
|
||
const newerIdx = await newerCard.evaluate(el => {
|
||
return [...document.querySelectorAll('.journal-post')].findIndex(c => c.id === el.id);
|
||
});
|
||
const olderIdx = await olderCard.evaluate(el => {
|
||
return [...document.querySelectorAll('.journal-post')].findIndex(c => c.id === el.id);
|
||
});
|
||
|
||
expect(newerIdx).toBeLessThan(olderIdx);
|
||
});
|
||
|
||
// ── T3: Individual entry page loads ───────────────────────────────────────────
|
||
test('T3: individual entry page loads at /trips/japan-korea-2026/dailies/{slug}', async ({ page }) => {
|
||
await page.goto(`/trips/japan-korea-2026/dailies/${KNOWN_SLUG}`);
|
||
await expect(page.locator('article.entry')).toBeVisible();
|
||
await expect(page.locator('.site-header')).toBeVisible();
|
||
});
|
||
|
||
// ── T4: Entry page shows title, date, and content ─────────────────────────────
|
||
test('T4: entry page shows title and body content', async ({ page }) => {
|
||
await page.goto(`/trips/japan-korea-2026/dailies/${KNOWN_SLUG}`);
|
||
await expect(page.locator('.entry-title')).toContainText(KNOWN_TITLE);
|
||
await expect(page.locator('.entry-body')).not.toBeEmpty();
|
||
await expect(page.locator('time.entry-date')).toBeVisible();
|
||
});
|
||
|
||
// ── T5: Entry page shows location when present ────────────────────────────────
|
||
test('T5: entry page shows city and country when set', async ({ page }) => {
|
||
await page.goto(`/trips/japan-korea-2026/dailies/${KNOWN_SLUG}`);
|
||
await expect(page.locator('.entry-location')).toContainText(KNOWN_CITY);
|
||
await expect(page.locator('.entry-location')).toContainText(KNOWN_COUNTRY);
|
||
});
|
||
|
||
// ── 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-06-17.entry';
|
||
await page.goto(KNOWN_ENTRY);
|
||
await expect(page.locator('article.entry')).toBeVisible();
|
||
// Fixed top pill (outside the article, before it)
|
||
const topPill = page.locator('.entry-back-fixed');
|
||
await expect(topPill).toBeVisible();
|
||
await expect(topPill).toHaveText(/← Back/);
|
||
// Footer pill
|
||
const footerPill = page.locator('.entry-footer .back-pill');
|
||
await expect(footerPill).toBeVisible();
|
||
await expect(footerPill).toHaveText(/← Back/);
|
||
});
|