Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
828d930
test(US-221): parcours dorés « réservation » PA et PY sous les rôles …
Projetapploccar Nov 18, 2026
26fa0fd
test(US-221): e2e S01 → S06, capacité inconnue retirée avec son point…
Projetapploccar Nov 18, 2026
d9e8264
test(US-221): segment A indépendant des comptes de passage ; stratégi…
Projetapploccar Nov 18, 2026
f522c87
test(US-221): diagnostic du refus de T1 au segment A (comptes actifs …
Projetapploccar Nov 18, 2026
f64c655
Merge remote-tracking branch 'origin/main' into story/US-221-parcours…
Projetapploccar Nov 18, 2026
c23dd76
test(US-221): T1 du segment A suit un compte de passage ouvert après …
Projetapploccar Nov 18, 2026
02b5910
docs(US-221): passation — état de la CI (run 44389110795 vert) et con…
Projetapploccar Nov 18, 2026
11125c1
docs(US-221): cinq revues indépendantes au SHA 02b5910b (architecture…
Projetapploccar Nov 18, 2026
e33c943
test(US-221): essais de T1 du segment A retenus seulement sur le comp…
Projetapploccar Nov 18, 2026
6990585
docs(US-221): cinq revues indépendantes du delta e33c943a (architectu…
Projetapploccar Nov 18, 2026
b11aba6
test(US-221): attente du compte FAKE en tête sur UNE connexion ; comp…
Projetapploccar Nov 18, 2026
9567538
docs(US-221): cinq revues indépendantes du delta b11aba65 (architectu…
Projetapploccar Nov 18, 2026
814f480
Merge remote-tracking branch 'origin/main' into story/US-221-parcours…
Projetapploccar Nov 18, 2026
f8ca03f
test(US-221): porte de la caution (US-701) au service de paiement des…
Projetapploccar Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,439 changes: 1,439 additions & 0 deletions apps/api/test/int/parcours-dores-reservation.int.test.ts

Large diffs are not rendered by default.

133 changes: 133 additions & 0 deletions apps/web/e2e/parcours-dore.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/**
* Parcours doré « réservation » du voyageur, de bout en bout sur le site (US-221 ; 19 US-221, §1.8
* « Parcours dorés inter-modules ») : S01 → résultats → S03 (dates reprises de la recherche) → S05
* → hold posé → « Pagar {total} » → page hébergée du PSP (interceptée : aucun réseau externe) →
* webhook FAKE signé joué par le double (e2e/stub-api.mjs) → S06 « confirmé ».
*
* Minimal par construction (job e2e limité à 30 min) : téléphone 360 px, espagnol (langue
* faisant foi), un seul test ; chaque écran est déjà éprouvé en quatre langues par sa spec propre
* (search, listing, checkout, checkout-payment). Textes attendus lus dans le catalogue officiel
* (`@rueda/i18n`), total TA01 (16 A.8.1 : 40,00 × 3 j + 7 % = 128,40) rendu par l'API, jamais
* recalculé par le site. Aucune capture d'écran : références et seuils inchangés.
*
* Marché sans décimale : le double ne sert la réservation que dans son marché à deux décimales
* (XTS) ; la variante PYG du parcours est prouvée de bout en bout par
* apps/api/test/int/parcours-dores-reservation.int.test.ts (trou du double, passation US-221).
*/
import { randomBytes } from 'node:crypto';
import { createTranslator, getProfile } from '@rueda/i18n';
import type { MessageKey, Translator } from '@rueda/i18n';
import { LOCALE_CONFIG } from '../locale-config.ts';
import { expect, submitAndSettle, tagOf, test } from './fixtures.ts';
import { AREA, CITY, place, PUBLIC_ID, START } from './search-data.ts';

const API = `http://127.0.0.1:${process.env['RUEDA_E2E_API_PORT'] ?? '3199'}`;
const PSP = /^https:\/\/psp\.fake\.invalid\/pay\/[0-9a-f-]{36}$/;
const HOLD_URL = /\/checkout\/hold\/([0-9a-f-]{36})$/;
/** TA01 (16 A.8.1) : total 128,40, rendu par l'API. */
const TA01_TOTAL = /128[.,]40/;
/** Trois jours facturés (TA01) : départ de la recherche, retour trois jours plus tard. */
const END = { date: '2036-12-13', time: START.time } as const;
const MAIN = 'main:not([aria-busy])';
const LANGUAGE = 'es' as const;
const MARK = '\u0001';

const translator = (): Translator => createTranslator(getProfile(LOCALE_CONFIG, tagOf(LANGUAGE)));
const fixedPart = (t: Translator, key: MessageKey, param: string): string =>
t.t(key, { [param]: MARK }).split(MARK)[0] ?? '';

test.describe(`parcours doré « réservation » · ${LANGUAGE}`, () => {
test.use({ locale: tagOf(LANGUAGE) });

test('S01 → résultats → S03 → S05 → hold → « Pagar 128,40 » → PSP → webhook signé → S06 confirmé', async ({
page,
context,
offsite,
}) => {
const t = translator();
await context.addCookies([
{
name: '__Host-session',
value: `G0st${LANGUAGE}${randomBytes(30).toString('base64url').slice(0, 37)}`,
domain: 'localhost',
path: '/',
httpOnly: true,
secure: true,
sameSite: 'Lax',
},
]);

// S01 : lieu et dates, heures locales du pays du double
await page.goto('/');
const form = page.locator('form[role="search"]');
await page.locator('#s01-search-place').selectOption(place(CITY, AREA));
await page.locator('#s01-search-startDate').fill(START.date);
await page.locator('#s01-search-startTime').selectOption(START.time);
await page.locator('#s01-search-endDate').fill(END.date);
await page.locator('#s01-search-endTime').selectOption(END.time);
await form.locator('button[type="submit"]').click();
await expect(page).toHaveURL(/\/search\?/);

// résultats → S03 de l'annonce, dates reprises de la recherche
await page
.locator('[data-testid="search-card"]')
.locator(`a[href^="/listings/${PUBLIC_ID}?"]`)
.first()
.click();
await expect(page).toHaveURL(new RegExp(`/listings/${PUBLIC_ID}\\?`));
const fiche = new URL(page.url());
expect(fiche.searchParams.get('start')).toBe(`${START.date}T${START.time}`);
expect(fiche.searchParams.get('end')).toBe(`${END.date}T${END.time}`);

// S03 → S05 : devis figé de la base, conducteur titulaire, documents acceptés → hold posé
await page.locator('[data-testid="s03-book"] button[type="submit"]').click();
await expect(page).toHaveURL(/\/checkout\/[0-9a-f-]{36}$/);
await page.locator('#s05-driver-first').fill('Lucía');
await page.locator('#s05-driver-last').fill('Gómez');
for (const kind of ['TOS_GUEST', 'CANCELLATION_POLICY', 'GEO_TERMS']) {
await page.locator(`#s05-doc-${kind}`).check();
}
await submitAndSettle(page, page.locator('[data-testid="s05-submit"]'), HOLD_URL);
const holdId = HOLD_URL.exec(new URL(page.url()).pathname)?.[1];
if (holdId === undefined) throw new Error('hold non posé');

// « Pagar {amount} » : total de l'API ; la page hébergée du PSP est la seule sortie du site
const pay = page.locator('[data-testid="s05-pay-submit"]');
await expect(pay).toContainText(TA01_TOTAL);
let hosted = '';
await page.route(/^https:\/\/psp\.fake\.invalid\//, (route) => {
hosted = route.request().url();
return route.fulfill({
status: 200,
contentType: 'text/html',
body: '<!doctype html><title>psp</title><main>psp</main>',
});
});
await pay.click();
await expect(page).toHaveURL(PSP);
expect(offsite).toEqual([hosted]);
offsite.splice(0);
await page.unroute(/^https:\/\/psp\.fake\.invalid\//);

// retour du PSP : en vérification, jamais « confirmé » avant la preuve signée (UX-27)
await page.goto(`/checkout/hold/${holdId}/payment`);
const title = page.locator('[data-testid="s06-title"]');
await expect(title).toHaveAttribute('data-state', 'VERIFYING');
await expect(title).toHaveText(t.t('web.s06.verifying.title'));
await expect(page.locator(MAIN)).not.toContainText(t.t('web.s07.title'));

// webhook FAKE signé et conversion (double) : trip né, S06 confirmé
const r = await fetch(`${API}/__e2e/payment/webhook?hold=${holdId}&event=SUCCEEDED`);
expect(r.status).toBe(200);
await page.goto(`/checkout/hold/${holdId}/payment`);
await expect(title).toHaveAttribute('data-state', 'CONFIRMED');
await expect(title).toHaveText(t.t('web.s07.title'));
await expect(page.locator(MAIN)).toContainText(t.t('web.s06.confirmed.body'));
await expect(page.locator('[data-testid="s07-documents"]')).toHaveText(
t.t('web.s07.documents'),
);
await expect(page.locator('[data-testid="s07-safety"]')).toContainText(
fixedPart(t, 'web.s07.safety', 'brand'),
);
});
});
6 changes: 6 additions & 0 deletions apps/web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ const CONSTANCIA = /trip-constancia\.spec\.ts$/;
* seulement (durée du job e2e ; les deux écrans passent à 390 px et en tablette par SCREENS).
*/
const RECEIPT = /trip-receipt\.spec\.ts$/;
/**
* Parcours doré « réservation » S01 → S06 (US-221) : 360 px et espagnol seulement, un test (durée
* du job e2e ; chaque écran est éprouvé en quatre langues par sa spec propre).
*/
const GOLDEN = /parcours-dore\.spec\.ts$/;
/** Balayage axe + captures de chaque écran du site (US-044). */
const SCREENS = /screens\.spec\.ts$/;
/** Balayage des écrans de la console interne (US-044). */
Expand Down Expand Up @@ -161,6 +166,7 @@ export default defineConfig({
GUEST_TRIPS,
CONSTANCIA,
RECEIPT,
GOLDEN,
SCREENS,
],
use: { ...phone, viewport: { width: 360, height: 780 } },
Expand Down
5 changes: 5 additions & 0 deletions changelog.d/US-221-parcours-dores.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lot: L2
module: Qualité

- Ajouté : parcours dorés de la réservation, de bout en bout, au Panama (USD) et au Paraguay (PYG sans décimale) : recherche, fiche, devis, checkout, paiement par parts (hôte, assureur, plateforme, taxe), preuve du paiement, réservation confirmée, notifications, « Mis viajes », annulation par l'ops, remboursement par part, registre de l'assureur, reçus et contrôle de nuit de l'argent, sous les rôles de production et avec les montants des oracles (US-221)
- Ajouté : parcours du voyageur sur le site, de la recherche à la confirmation du paiement, sur téléphone (US-221)
Loading
Loading