Files
ketopath/apps/web/e2e/profile.spec.ts
T
lucianoandClaude Opus 4.7 59a311cfc9 feat(web): editorial slow-food redesign across the whole UI
A complete visual + tonal pass on every page. Replaces the previous shadcn
slate+emerald defaults with an Italian editorial aesthetic — refined slow-food
magazine crossed with a luxury cookbook. Mobile-first, premium, distinctly
Italian, no generic AI-wellness vibes.

Tokens:
- New palette: carta (cream parchment), ink (warm black), oliva (deep olive),
  pomodoro (terracotta), oro (aged gold), rule (hairline). All exposed as
  HSL CSS variables and as Tailwind colors. Dark mode = oxblood/cream.
- Type stack: Fraunces (variable, optical-sizing auto, italic + roman) for
  display / Inter Tight for body / JetBrains Mono with tnum + zero for
  numerals. Replaces Inter-only setup.
- Font feature settings on body and .font-display for ligatures, opsz
  and stylistic alternates.
- Subtle SVG paper grain on body::before (multiply blend, 4.5% opacity).
- 2px radius default (editorial print, not soft web).

Component primitives:
- Button — mono uppercase 11px tracking-widest, sharp corners, hover
  inverts ink/cream. Variants tuned for the new palette.
- Input — bottom-only hairline, Fraunces 18px text, italic placeholders.
- Label — tiny mono caps, ink-soft.
- Card — top + bottom hairlines only, no shadow; Fraunces title and italic
  description; CardFooter has its own top-rule.
- Select — same hairline-bottom trigger as Input; SelectContent panel uses
  a hard 6px offset shadow for an editorial print stamp feel.

New component:
- Masthead — top-of-page newspaper header with thick top-rule, KP wordmark
  with terracotta dot, "ANNO I · N. 0X" issue label, today's date in Italian.

Pages:
- / — Massive Fraunces "Una keto italiana, sostenibile." with terracotta
  dot, italic Fraunces tagline, right-column nav with category eyebrows
  (CUCINA / PROFILO) and arrow rule. Bottom: "Tre principi" with roman
  numerals I/II/III. Disclaimer in italic.
- /sign-in — "CAPITOLO II / Bentornato in cucina." split layout.
- /sign-up — "CAPITOLO III / Inizia il tuo percorso." Italian copy refresh.
- /welcome — Editor's-letter layout with the four PRD §14.3 points as a
  Roman-numeral list; custom hand-drawn check icon for the consent boxes.
- /profile — 7/5 split: form on the left (anagrafica + peso group), summary
  on the right with massive mono numerals (BMR, TDEE, multiplier) and italic
  "kcal" units; empty-state copy until the profile is saved.
- /plan — "CAPITOLO V / Il tuo piano." Italian-formatted week range. Each
  day has a Roman-numeral mark (I-VII), Fraunces day name, mono kcal total.
  Each meal slot uses Roman numerals (I-IV) for the meal index.
- Cookie banner — refreshed to match (italic Fraunces, "PRIVACY" eyebrow,
  outline button).

Italian copy refresh:
- Headline: "Una keto italiana, sostenibile" (was "KetoPath")
- Tagline: narrative arc instead of marketing line
- CTAs: "Iscriviti" / "Accedi" (was "Inizia gratis" / "Scopri come funziona")
- Greeting: "Buongiorno, {name}." (was "Accesso effettuato come ...")
- Profile: weight columns become Iniziale / Attuale / Obiettivo under a
  "Peso (chilogrammi)" group eyebrow.

E2E updated to match: home looks for the new headline and CTA labels;
profile uses the new "Come ti chiami" / "Iniziale / Attuale / Obiettivo"
labels and asserts numeric values separately from the "kcal" unit span.

All 4 specs pass. Verified visually at 1280×900 and 375×812.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 16:44:55 +02:00

52 lines
2.3 KiB
TypeScript

import { expect, test } from '@playwright/test';
function uniqueEmail(): string {
const ts = Date.now();
const rand = Math.floor(Math.random() * 1e6);
return `e2e-profile-${ts}-${rand}@ketopath.test`;
}
test('profile flow — submit returns BMR/TDEE for the Michele PRD persona', async ({ page }) => {
const email = uniqueEmail();
const password = 'Password!123';
const name = 'Michele E2E';
// Sign-up gives us an authenticated session
await page.goto('/sign-up');
await page.getByLabel('Come ti chiami').fill(name);
await page.getByLabel('Email').fill(email);
await page.getByLabel('Password').fill(password);
await page.getByRole('button', { name: 'Crea account' }).click();
await page.waitForURL('/');
// Open profile from home — first time we'll be redirected through /welcome
await page.getByRole('link', { name: 'Profilo & calcoli' }).click();
await page.waitForURL('/welcome');
// Accept the medical disclaimer (3 mandatory checkboxes + submit)
await page.getByText(/Confermo di essere maggiorenne/).click();
await page.getByText(/Dichiaro di non avere condizioni mediche escludenti/).click();
await page.getByText(/Accetto che KetoPath non sostituisce/).click();
await page.getByRole('button', { name: 'Accetto e proseguo' }).click();
await page.waitForURL('/profile');
// Fill the form with the "Michele" PRD persona values
await page.getByLabel('Età').fill('49');
await page.getByLabel('Sesso').click();
await page.getByRole('option', { name: 'Maschio' }).click();
await page.getByLabel('Altezza (cm)').fill('170');
await page.getByLabel('Iniziale').fill('76');
await page.getByLabel('Attuale').fill('76');
await page.getByLabel('Obiettivo').fill('70');
await page.getByLabel('Livello di attività').click();
await page.getByRole('option', { name: /Sedentario/ }).click();
await page.getByRole('button', { name: 'Salva profilo' }).click();
// BMR/TDEE summary panel becomes visible after a successful save
await expect(page.getByText('Calcolo personalizzato')).toBeVisible();
// Numbers are rendered in monospace next to a separate "kcal" unit span,
// so check for the bare numeric values.
await expect(page.getByText('1583', { exact: true })).toBeVisible();
await expect(page.getByText('1899', { exact: true })).toBeVisible();
});