FamilyNido — a self-hosted PWA for a single household: shared calendar, chores, meals, school agenda, health records and a family wall. One instance per family, deployable with `docker compose` on any home server. Stack: .NET 10 (ASP.NET Core Minimal APIs) + EF Core 10 + PostgreSQL 16 on the backend, Angular 21 (standalone, signals, zoneless) + Tailwind CSS v4 on the frontend, SignalR for realtime, optional OIDC alongside local credentials, integration via a versioned `/api/v1/**` public API. See README.md for the module overview and how to deploy.
37 lines
1.9 KiB
TypeScript
37 lines
1.9 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
/**
|
|
* Verifies the language picker in `/account` round-trips: switch from
|
|
* Spanish to English, the page reloads to the `/en/` bundle and the
|
|
* "Apply" button is visible (it reads "Aplicar" in es); switch back and
|
|
* the URL returns to `/es/`. This guards the i18n subpath wiring (the
|
|
* `window.location.assign('/' + newPrefix + ...)` in AuthService) and the
|
|
* server-side persistence of `User.PreferredLanguage` together.
|
|
*
|
|
* Resets the user back to `es-ES` before exiting so the rest of the suite
|
|
* (which assumes Spanish copy) keeps working on subsequent runs.
|
|
*/
|
|
test('language picker switches bundles and persists', async ({ page }) => {
|
|
// The <select> is reachable via its options (es-ES / en-US) — the label
|
|
// wraps it but the visible text lives in a <span>, which getByLabel
|
|
// doesn't pick up.
|
|
const langSelect = page.locator('select:has(option[value="es-ES"]):has(option[value="en-US"])');
|
|
|
|
// ── es-ES → en-US ─────────────────────────────────────────────────────
|
|
await page.goto('/es/account');
|
|
await expect(page.getByRole('button', { name: /aplicar/i })).toBeVisible();
|
|
|
|
await langSelect.selectOption('en-US');
|
|
await page.getByRole('button', { name: /aplicar/i }).click();
|
|
|
|
await page.waitForURL(/\/en\//);
|
|
expect(page.url()).toMatch(/\/en\/account/);
|
|
await expect(page.getByRole('button', { name: /^apply$/i })).toBeVisible();
|
|
|
|
// ── en-US → es-ES (cleanup) ───────────────────────────────────────────
|
|
await langSelect.selectOption('es-ES');
|
|
await page.getByRole('button', { name: /^apply$/i }).click();
|
|
|
|
await page.waitForURL(/\/es\//);
|
|
expect(page.url()).toMatch(/\/es\/account/);
|
|
});
|