Files
intotheeast-com/tests/ui/home/home.spec.js
m038 877d29b2b4 Merge branch 'feat/journal-post-form'
# Conflicts:
#	Makefile
#	docs/working/backlog.md
#	user
2026-07-08 00:10:14 +02:00

32 lines
2.0 KiB
JavaScript

// @ts-check
// Tests: H1 — home page journal feed; AE7 — active-trip header gating
const { test, expect } = require('@playwright/test');
// ── 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 }) => {
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('.site-header')).toBeVisible();
});
// ── AE7: the trip-page header extras never leak onto the home route ────────────
// The trip-page one-liner/description/banner are gated to the trip.html.twig
// caller of the shared trip-feed-col partial (trip_header_extras, default off);
// home's include omits the flag, so its header is unchanged (R12/KTD4). Asserted
// as an absence on `/` so it holds whether home is in active-trip or
// between-trips mode — the sibling home-highlights suite toggles that mode in a
// parallel worker, so this test must not depend on it.
test('AE7: home never renders the trip-page header extras', async ({ page }) => {
await page.goto('/');
await expect(page.locator('.home-trip-tagline')).toHaveCount(0);
await expect(page.locator('.trip-header-desc')).toHaveCount(0);
await expect(page.locator('.trip-header-banner')).toHaveCount(0);
});