# TRAZA - Sprint 6: Pruebas E2E **Proyecto:** MiChangarrito **Sprint:** 6 **Fecha:** 2026-01-10 **Estado:** COMPLETADO --- ## OBJETIVO Implementar framework de pruebas end-to-end (E2E) con Playwright para el frontend de MiChangarrito. --- ## ARCHIVOS CREADOS ### 1. Configuracion Playwright **Archivo:** `apps/frontend/playwright.config.ts` | Configuracion | Valor | |---------------|-------| | Test Directory | ./e2e | | Base URL | http://localhost:3140 | | Parallel Execution | Si | | Retries (CI) | 2 | | Reporter | HTML + List | **Proyectos configurados:** - Chromium (Desktop Chrome) - Firefox (Desktop Firefox) - WebKit (Desktop Safari) - Mobile Chrome (Pixel 5) - Mobile Safari (iPhone 12) ### 2. Tests de Autenticacion **Archivo:** `apps/frontend/e2e/auth.spec.ts` | Test Suite | Tests | |------------|-------| | Autenticacion | 10 tests | | Registro | 2 tests | **Cobertura:** - Visualizacion pagina login - Validacion campos requeridos - Filtrado numeros en telefono - Limite 10 digitos telefono - Filtrado numeros en PIN - Error credenciales invalidas - Estado de carga - Navegacion a registro - Redireccion rutas protegidas - Pagina de registro ### 3. Tests de Navegacion **Archivo:** `apps/frontend/e2e/navigation.spec.ts` | Test Suite | Tests | |------------|-------| | Navegacion Publica | 3 tests | | UI Responsiva | 3 tests | | Accesibilidad | 4 tests | | Performance | 1 test | **Cobertura:** - Carga de aplicacion - Rutas invalidas - Titulo correcto - Adaptacion mobile (375x667) - Adaptacion tablet (768x1024) - Adaptacion desktop (1920x1080) - Labels de campos - Navegacion teclado - Envio con Enter - Tiempo de carga < 3s ### 4. Tests de POS **Archivo:** `apps/frontend/e2e/pos.spec.ts` | Test Suite | Tests | |------------|-------| | Sin Autenticacion | 1 test | | UI Basica | 1 test | | Flujo de Venta | 1 test | | Carrito | 1 test | | Busqueda Productos | 1 test | | Metodos Pago | 1 test | | Recibos | 1 test | | Inventario | 1 test | ### 5. Tests de Pedidos **Archivo:** `apps/frontend/e2e/orders.spec.ts` | Test Suite | Tests | |------------|-------| | Sin Autenticacion | 3 tests | | Estructura Datos | 3 tests | | Sistema Fiado | 1 test | | Historial | 2 tests | | Clientes | 2 tests | | Metodos Pago | 1 test | | Configuracion | 1 test | | Rutas Completas | 2 tests | ### 6. Fixtures de Datos **Archivo:** `apps/frontend/e2e/fixtures/test-data.ts` | Export | Descripcion | |--------|-------------| | TEST_USER | Usuario de prueba | | TEST_PRODUCT | Producto de prueba | | TEST_CUSTOMER | Cliente de prueba | | TEST_ORDER | Pedido de prueba | | ROUTES | Rutas de la aplicacion | --- ## MODIFICACIONES ### package.json **Scripts agregados:** ```json { "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui", "test:e2e:headed": "playwright test --headed", "test:e2e:report": "playwright show-report" } ``` **Dependencia agregada:** ```json { "@playwright/test": "^1.50.1" } ``` --- ## RESUMEN DE COBERTURA | Categoria | Archivos | Tests | |-----------|----------|-------| | Autenticacion | 1 | 12 | | Navegacion | 1 | 11 | | POS | 1 | 8 | | Pedidos | 1 | 15 | | **Total** | **4** | **46** | --- ## COMANDOS DE EJECUCION ```bash # Instalar dependencias cd apps/frontend npm install # Instalar navegadores Playwright npx playwright install # Ejecutar todos los tests npm run test:e2e # Ejecutar con UI interactiva npm run test:e2e:ui # Ejecutar con navegador visible npm run test:e2e:headed # Ver reporte HTML npm run test:e2e:report ``` --- ## NOTAS 1. Los tests estan disenados para ejecutarse sin backend 2. Tests que requieren autenticacion verifican redireccion a login 3. Tests de datos verifican estructura de fixtures 4. Se recomienda agregar tests con backend mock en futuras iteraciones --- **Autor:** Agente Orquestador **Version:** 1.0.0