Commit 599073f9 by PLN (Algolia)

e2e: smoke the Clarté routes, full CAT-Q flow test

parent a7ae5dd7
...@@ -32,6 +32,12 @@ const ROUTES: string[] = [ ...@@ -32,6 +32,12 @@ const ROUTES: string[] = [
'/parvagues/fiche', '/parvagues/fiche',
'/parvagues/live', // redirects to /parvagues '/parvagues/live', // redirects to /parvagues
'/parvagues/live/montreuil-algorave', '/parvagues/live/montreuil-algorave',
// Clarté mini-apps (client-rendered quiz shells)
'/tdah',
'/adhd',
'/couple',
'/tsa',
'/asd',
]; ];
// Dev-only / third-party noise we deliberately ignore. // Dev-only / third-party noise we deliberately ignore.
......
import { test, expect } from '@playwright/test';
/**
* Clarté TSA — parcours complet CAT-Q sur /tsa : consentement → 25 items
* répondues au clavier (touches 1–7) → récapitulatif → résultats avec le
* score attendu. On répond 3 partout : total = 20×3 + 5×(8−3) = 85.
*
* La compilation de dev peut être lente quand la suite tourne en entier :
* timeout élargi, et attente sync sur l'écran suivant (pas de sleep fixe).
*/
test.setTimeout(120_000);
test('cat-q flow: consent, 25 answers, recap, results', async ({ page }) => {
await page.goto('/tsa', { waitUntil: 'domcontentloaded' });
await page.waitForLoadState('networkidle', { timeout: 5000 }).catch(() => {});
// consentement bloquant
await page.getByRole('checkbox').check();
await page.getByRole('button', { name: 'Commencer' }).click();
// intro
await page.getByRole('button', { name: 'C’est parti' }).click();
// 25 items : touche 3, on attend l'écran suivant (auto-avance ~350 ms)
for (let i = 1; i <= 25; i++) {
await expect(page.getByText(`${i} / 25`)).toBeVisible({ timeout: 10_000 });
await page.keyboard.press('3');
}
await expect(page.getByRole('heading', { name: 'Récapitulatif' })).toBeVisible({ timeout: 10_000 });
// récapitulatif → résultats
await page.getByRole('button', { name: 'Voir mes résultats →' }).click();
// résultats : total 85 / 175, bande modérée
await expect(page.getByText('/ 175 · modéré')).toBeVisible();
await expect(page.getByText(/Score total : 85 \/ 175/)).toBeVisible();
await expect(page.getByRole('heading', { name: 'Les trois sous-échelles' })).toBeVisible();
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment