Files
intotheeast-com/tests/ui/dailies.spec.js
T
m038 5e954d8adf fix: update paths for trips/japan-korea-2026/dailies restructure
- Update post form parent, Makefile demo targets, and test scripts to use
  new trip-scoped paths (01.trips/japan-korea-2026/01.dailies)
- Rename tracker.spec.js → dailies.spec.js and update all /tracker URLs
  to /trips/japan-korea-2026/dailies across nav.spec.js, post.spec.js,
  helpers.js, and dailies.spec.js
- Add Italy 2025 demo trip to Makefile demo-load/demo-reset targets

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 01:49:38 +02:00

67 lines
3.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// @ts-check
// Tests: T1T5 — 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-03-25-1540-wheels-down-narita.entry';
const KNOWN_TITLE = 'Wheels Down at Narita';
const KNOWN_CITY = 'Tokyo';
const KNOWN_COUNTRY = 'Japan';
// Use two fixture entries with different dates to verify descending order
const NEWER_SLUG = '2026-06-17.entry'; // most recent fixture (June 17)
const OLDER_SLUG = '2026-03-25-1540-wheels-down-narita.entry'; // oldest fixture (March 25)
// ── 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('.entry-card').first()).toBeVisible();
await expect(page.locator('.site-header')).toBeVisible();
});
// ── 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).
test('T2: dailies shows newer entries before older entries', async ({ page }) => {
await page.goto('/trips/japan-korea-2026/dailies');
// Both fixture entries must be visible on the page
const newerCard = page.locator(`.entry-card a[href*="${NEWER_SLUG}"]`);
const olderCard = page.locator(`.entry-card a[href*="${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('.entry-card')].findIndex(c => c.contains(el));
});
const olderIdx = await olderCard.evaluate(el => {
return [...document.querySelectorAll('.entry-card')].findIndex(c => c.contains(el));
});
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);
});