test: setup Vitest workspace and Playwright with first nutrition tests
Vitest: - Workspace at root (vitest.workspace.ts) running per-package configs - packages/shared/vitest.config.ts with v8 coverage and 70% thresholds - Root scripts: test / test:watch / test:coverage Nutrition module in @ketopath/shared: - calculateBmr (Mifflin-St Jeor) + calculateTdee with activity multipliers - ACTIVITY_MULTIPLIERS constants matching CLAUDE.md domain knowledge - 14 unit tests covering Michele/Laura PRD personas, all sex variants, every activity level, and input validation (100% coverage on src/nutrition) Playwright in apps/web: - chromium-only project, webServer auto-boot of pnpm dev - e2e/home.spec.ts smoke test asserts Italian copy and disclaimer Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ff004cdf8d
commit
a3109d2a6c
16 files changed
+194
-6
No files matched your search
@@ -3,3 +3,7 @@ out/
|
||||
next-env.d.ts.bak
|
||||
.vercel/
|
||||
*.tsbuildinfo
|
||||
test-results/
|
||||
playwright-report/
|
||||
playwright/.cache/
|
||||
blob-report/
|
||||
@@ -0,0 +1,11 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
test('home page renders Italian copy and CTAs', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await expect(page).toHaveTitle(/KetoPath/);
|
||||
await expect(page.getByRole('heading', { name: 'KetoPath' })).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Inizia gratis' })).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Scopri come funziona' })).toBeVisible();
|
||||
await expect(page.getByText(/non sostituiscono il parere di un medico/)).toBeVisible();
|
||||
});
|
||||
@@ -7,7 +7,8 @@
|
||||
"build": "next build",
|
||||
"start": "next start --port 3000",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "next lint --max-warnings=0"
|
||||
"lint": "next lint --max-warnings=0",
|
||||
"test:e2e": "playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ketopath/shared": "workspace:*",
|
||||
@@ -26,6 +27,7 @@
|
||||
"autoprefixer": "^10.4.19",
|
||||
"eslint-config-next": "^14.2.5",
|
||||
"postcss": "^8.4.39",
|
||||
"tailwindcss": "^3.4.4"
|
||||
"tailwindcss": "^3.4.4",
|
||||
"@playwright/test": "^1.45.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
const PORT = 3000;
|
||||
const baseURL = `http://localhost:${PORT}`;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
fullyParallel: true,
|
||||
forbidOnly: Boolean(process.env.CI),
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: process.env.CI ? 'github' : 'list',
|
||||
use: {
|
||||
baseURL,
|
||||
trace: 'on-first-retry',
|
||||
},
|
||||
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
||||
webServer: {
|
||||
command: 'pnpm dev',
|
||||
url: baseURL,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120_000,
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user