Fix four defects the screenshots and tests exposed

Verifying the rendered pages rather than the build turned up real bugs:

- The WP-00 health page still sat at src/app/page.tsx and silently won
  the route over the new Aperçu screen, so the home page was a database
  status readout. Moved to /api/sante, where a probe belongs, and wired
  into the compose healthcheck.
- The unassigned row showed a +14 h delta against a contract of zero,
  reading as an overshoot when it is simply the volume left to staff.
  It now shows what there is to fill.
- Two sidebar entries lit at once: an anchor link matched its own page,
  and /equipe matched an employee record. Highlighting now resolves to
  the most specific match, and a test asserts exactly one entry lights
  per screen.
- Section tabs with no built screen pointed at the home page, which
  reads as a broken tab. They now lead to their first entry's
  placeholder.

Also gives truncated compliance alerts a title attribute, so a narrow
cell no longer says there is a problem without saying which.

Playwright can reuse a preinstalled browser through
PLAYWRIGHT_CHROMIUM_PATH when its revision differs from the bundled one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cr9dkEHwbDgkWPnyGj1Rjv
This commit is contained in:
Claude committed 2026-08-07 22:26:38 +00:00
1 parent 4012f32f7f
commit 93852c2602
11 files changed
+260 -47

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
import { expect, test } from '@playwright/test';
test('les six écrans se chargent et affichent leur contenu', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('heading', { name: 'Aperçu RH' })).toBeVisible();
await page.getByRole('link', { name: 'Plannings' }).click();
await expect(
page.getByRole('heading', { name: /Planning · semaine 33/ }),
).toBeVisible();
// La grille doit porter des créneaux, pas seulement son ossature.
await expect(page.getByText('Congés payés').first()).toBeVisible();
await page.getByRole('link', { name: 'Vue jour' }).click();
await expect(
page.getByRole('heading', { name: /Planning · mercredi 12 août/ }),
).toBeVisible();
await page.getByRole('link', { name: 'Équipe', exact: true }).click();
await expect(page.getByRole('heading', { name: 'Équipe' })).toBeVisible();
await page.getByRole('link', { name: 'Camille Ferrand' }).click();
await expect(
page.getByRole('heading', { name: 'Camille Ferrand' }),
).toBeVisible();
await page.getByRole('link', { name: 'Congés' }).click();
await expect(
page.getByRole('heading', { name: 'Calendrier des absences' }),
).toBeVisible();
});
test('le thème bascule et survit à un rechargement', async ({ page }) => {
await page.goto('/');
const html = page.locator('html');
await expect(html).toHaveAttribute('data-theme', 'light');
await page.getByRole('button', { name: /^Thème/ }).click();
await expect(html).toHaveAttribute('data-theme', 'dark');
// Le script inline doit reposer le thème avant le premier rendu : sans lui,
// la page reviendrait en clair puis basculerait — un flash blanc.
await page.reload();
await expect(html).toHaveAttribute('data-theme', 'dark');
});
test('une entrée de navigation non construite mène à un écran explicite', async ({
page,
}) => {
await page.goto('/');
await page.getByRole('link', { name: 'Profils incomplets' }).click();
await expect(
page.getByRole('heading', { name: 'Profils incomplets' }),
).toBeVisible();
// `exact` évite de heurter l'annonceur de route de Next, qui répète le titre
// du document — « Écran à venir · PlanFlow ».
await expect(
page.getByText('Écran à venir', { exact: true }),
).toBeVisible();
});
+69
View File
@@ -0,0 +1,69 @@
import { describe, expect, it } from 'vitest';
import {
activeItem,
isActive,
matches,
NAVIGATION,
sectionForPath,
} from '@/components/shell/navigation';
describe('matches', () => {
it('reconnaît la racine sans capturer tout le site', () => {
expect(matches('/', '/')).toBe(true);
expect(matches('/', '/equipe')).toBe(false);
});
it('couvre les sous-routes', () => {
expect(matches('/equipe', '/equipe')).toBe(true);
expect(matches('/equipe', '/equipe/camille-ferrand')).toBe(true);
expect(matches('/equipe', '/equipements')).toBe(false);
});
it('écarte les liens d’ancre', () => {
expect(matches('/conges#attente', '/conges')).toBe(false);
});
});
describe('activeItem', () => {
it('retient la correspondance la plus spécifique', () => {
// Sur une fiche, « Membres » (/equipe) et « Fiche salarié » correspondent
// tous deux ; c'est la fiche qui doit s'allumer.
expect(activeItem('/equipe/camille-ferrand')?.id).toBe('fiche');
expect(activeItem('/equipe')?.id).toBe('membres');
});
it('ne renvoie rien pour une route hors navigation', () => {
expect(activeItem('/inconnu')).toBeUndefined();
});
});
describe('isActive', () => {
it('n’allume qu’une entrée par écran', () => {
const targets = NAVIGATION.flatMap((section) => section.items)
.map((item) => item.href)
.filter(
(href): href is string =>
typeof href === 'string' && !href.includes('#'),
);
for (const pathname of [...targets, '/equipe/sarah-lemoine']) {
const lit = NAVIGATION.flatMap((section) => section.items).filter(
(item) => item.href && isActive(item.href, pathname),
);
expect(lit.length, `${pathname} allume ${lit.length} entrées`).toBe(1);
}
});
});
describe('sectionForPath', () => {
it('trouve la section portant la route courante', () => {
expect(sectionForPath('/planning/semaine').id).toBe('plannings');
expect(sectionForPath('/equipe/camille-ferrand').id).toBe('equipe');
expect(sectionForPath('/conges').id).toBe('conges');
});
it('retombe sur la première section pour une route inconnue', () => {
expect(sectionForPath('/inconnu').id).toBe('apercu');
});
});