metallkart-erp/tests/e2e
louis 00e350cac9 fix(products): DETTE-STD-9 shared pricing predicate + DETTE-STD-8-A audit logs (SPEC-STD-9-DETTES)
DETTE-STD-9: shared lineRequiresPricing predicate in src/shared/pricing-line-types.ts
consumed by products.service.ts (badge L51) and orders.service.ts (createStandard
L240 + preview L583) to prevent badge/canCreate divergence.

DETTE-STD-8-A: PRODUCT_DELETE audit in $transaction with snapshot (id/code/name/
smetaId/counts) captured BEFORE cascade. PRODUCT_ARCHIVE audit best-effort.
userId passed from route handlers.

E2E fix: Popconfirm selector scoped via .ant-popover:visible + .first() for
duplicate toast messages (T-STD8-02/03).

13/13 Vitest, 23/23 Playwright products green.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-05 02:18:56 +04:00
..
fixtures feat(orders): Segmented UI + catalog thumbnails in CreateOrderDrawer (SPEC-STD-5) 2026-07-03 09:58:03 +04:00
admin-users.spec.ts fix(admin): email edit in user form + reset password modal (USER-EDIT-FIX-S109) 2026-05-19 14:08:38 +04:00
advisor.spec.ts fix(e2e): stabilize 5 flaky tests + smoke race condition (170/170) 2026-05-18 02:39:14 +04:00
budget-indirect.spec.ts test(e2e): add 12 budget+indirect tests + data-testid + extend seed (PLAYWRIGHT-P1.1C) 2026-05-15 15:22:02 +03:00
builder-detail.spec.ts feat(frontend): AI Builder detail page — 6 tabs, SSE, approve/reject/revert (FRONTEND-BUILDER-3B) 2026-05-18 12:38:30 +04:00
builder.spec.ts feat(frontend): AI Builder page + create drawer + E2E tests (FRONTEND-BUILDER-3A) 2026-05-18 10:57:30 +04:00
cashflow-tab.spec.ts fix(e2e): stabilize 5 flaky tests + smoke race condition (170/170) 2026-05-18 02:39:14 +04:00
copilot.spec.ts feat(copilot): SPEC-M3 — Copilot Août in-app chat module 2026-05-25 19:15:12 +04:00
crit-notif.spec.ts feat: standard products catalogue + critical notifications + cancel cascade (STD-1A→CRIT-NOTIF-3) 2026-05-15 15:22:04 +03:00
dashboard-profitability.spec.ts test(e2e): add 8 dashboard+profitability tests + data-testid + extend seed (PLAYWRIGHT-P1.1E) 2026-05-15 15:22:03 +03:00
documents.spec.ts fix(e2e): stabilize 5 flaky tests + smoke race condition (170/170) 2026-05-18 02:39:14 +04:00
engagement-agenda.spec.ts feat(engagement): SPEC-BLOC-1H — 25 E2E tests engagement + docs + rapport final BLOC-1 2026-05-28 09:36:43 +04:00
engagement-decisions.spec.ts feat(engagement): SPEC-BLOC-1H — 25 E2E tests engagement + docs + rapport final BLOC-1 2026-05-28 09:36:43 +04:00
engagement-pwa-cross.spec.ts feat(engagement): SPEC-BLOC-1H — 25 E2E tests engagement + docs + rapport final BLOC-1 2026-05-28 09:36:43 +04:00
engagement-reminders.spec.ts feat(engagement): SPEC-BLOC-1H — 25 E2E tests engagement + docs + rapport final BLOC-1 2026-05-28 09:36:43 +04:00
engagement-router-admin.spec.ts feat(engagement): SPEC-BLOC-1H — 25 E2E tests engagement + docs + rapport final BLOC-1 2026-05-28 09:36:43 +04:00
engagement-tasks.spec.ts feat(engagement): SPEC-E2E-TASKS-1C — 22 Playwright E2E tests for Tasks module 2026-05-26 22:58:45 +04:00
estimates-list.spec.ts test(e2e): add 10 finance forecast tests + data-testid + extend seed (PLAYWRIGHT-P1.1E-ter) 2026-05-15 15:22:03 +03:00
finance-forecasts.spec.ts test(e2e): add 10 documents-hub tests + data-testid + extend seed (PLAYWRIGHT-P1.1F) 2026-05-15 15:22:03 +03:00
global-setup.ts feat(e2e): set up isolated Playwright infra + 10 smoke tests (PLAYWRIGHT-P0) 2026-05-11 18:26:33 +03:00
global-teardown.ts feat(e2e): set up isolated Playwright infra + 10 smoke tests (PLAYWRIGHT-P0) 2026-05-11 18:26:33 +03:00
help-suggestions.spec.ts ai-const-1c: 4 E2E tests + seed advisor suggestions (170/170) 2026-05-17 21:28:59 +04:00
import-ai-ui.spec.ts test(e2e): add 5 import-ai-ui tests + data-testid (PLAYWRIGHT-P1.1D-ter) 2026-05-15 15:22:03 +03:00
orders.spec.ts feat(orders): Segmented UI + catalog thumbnails in CreateOrderDrawer (SPEC-STD-5) 2026-07-03 09:58:03 +04:00
planning.spec.ts test(e2e): add 8 planning/gantt tests + data-testid + extend seed (PLAYWRIGHT-P1.1G) 2026-05-15 15:22:03 +03:00
products.spec.ts fix(products): DETTE-STD-9 shared pricing predicate + DETTE-STD-8-A audit logs (SPEC-STD-9-DETTES) 2026-07-05 02:18:56 +04:00
purchases.spec.ts fix(e2e): MATERIAL-only pending count + robust PR modal selectors (160/160 green) 2026-05-16 20:49:04 +04:00
README.md feat(e2e): set up isolated Playwright infra + 10 smoke tests (PLAYWRIGHT-P0) 2026-05-11 18:26:33 +03:00
seed-test.ts feat(std-6): promotion UI + 5 E2E tests + display:none bug fix (SPEC-STD-6-UI-PROMOTION) 2026-07-05 00:00:38 +04:00
smeta-revision.spec.ts test(e2e): add 10 smeta-revision tests + data-testid + extend seed (PLAYWRIGHT-P1.1D-bis) 2026-05-15 15:22:03 +03:00
smoke.spec.ts fix(e2e): stabilize 5 flaky tests + smoke race condition (170/170) 2026-05-18 02:39:14 +04:00
std-6-promote.spec.ts feat(std-6): promotion UI + 5 E2E tests + display:none bug fix (SPEC-STD-6-UI-PROMOTION) 2026-07-05 00:00:38 +04:00
std-6-workflow.spec.ts feat(orders): Segmented UI + catalog thumbnails in CreateOrderDrawer (SPEC-STD-5) 2026-07-03 09:58:03 +04:00

E2E Tests — Playwright

Prérequis

  • PostgreSQL 16 avec base erp_test créée
  • .env.test à la racine du projet (copier .env.test.example)
  • Chromium Playwright installé (npx playwright install chromium)

Lancement sur PC (Windows)

# 1. Créer la DB (une seule fois, avec superuser postgres)
$env:PGPASSWORD='postgres123'
& 'D:\PostgreSQL\16\bin\psql.exe' -U postgres -d postgres -h localhost -c "CREATE DATABASE erp_test OWNER metallkart;"

# 2. Pousser le schéma
$env:DATABASE_URL = "postgresql://metallkart:MK_PG_local_2026!@localhost:5432/erp_test"
npx prisma db push --skip-generate

# 3. Copier et remplir .env.test
cp .env.test.example .env.test

# 4. Lancer les tests (le backend/frontend de dev sur 3001/5173 peut rester actif)
npm run test:e2e

# Variantes
npm run test:e2e:headed   # avec navigateur visible
npm run test:e2e:ui       # interface Playwright UI
npm run test:e2e:debug    # mode debug pas-à-pas

Lancement sur VPS

ssh root@76.13.55.81
cd /opt/erp/metallkart-erp

# 1. Créer la DB
docker exec postgres-staging psql -U metallkart -d postgres -c "CREATE DATABASE erp_test OWNER metallkart;"

# 2. Pousser le schéma
DATABASE_URL="postgresql://metallkart:MK_PG_local_2026!@postgres-staging:5432/erp_test" \
  npx prisma db push --skip-generate

# 3. Préparer .env.test
cp .env.test.example .env.test
sed -i 's|<REPLACE_ME>|MK_PG_local_2026!|' .env.test
sed -i 's|localhost:5432|postgres-staging:5432|' .env.test

# 4. Installer Chromium si nécessaire
npx playwright install chromium

# 5. Lancer
npm run test:e2e

Architecture

  • erp_test : DB dédiée, truncate+reseed à chaque run
  • Port 3002 : backend test (pas 3001 dev)
  • Port 5174 : frontend test (pas 5173 dev)
  • erp_local : jamais touché par les tests

Dataset seedé

  • 3 users (admin, commercial, acheteur) — mot de passe Test_2026!
  • 2 clients (1 avec contrat SIGNED, 1 sans)
  • 2 fournisseurs (1 avec contrat, 1 sans)
  • 2 orders (1 DRAFT #1001, 1 IN_PRODUCTION #1002 avec smeta)
  • 1 tender OPEN, 1 PO DRAFT, 1 purchase lot
  • 59 articles d'aide