Created
February 11, 2026 17:14
-
-
Save claudiainbytes/9aba29a29205732decd597440888acfd to your computer and use it in GitHub Desktop.
1. Testing de Flujos de Usuario Completos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Componente completo con múltiples interacciones | |
| describe('Shopping Cart Flow', () => { | |
| it('permite agregar, incrementar y eliminar productos', async () => { | |
| const user = userEvent.setup() | |
| render(<ShoppingApp />) | |
| // Usuario agrega producto | |
| const addButton = screen.getByRole('button', { name: /add to cart/i }) | |
| await user.click(addButton) | |
| // Verifica que aparece en el carrito | |
| expect(screen.getByText(/1 item in cart/i)).toBeInTheDocument() | |
| // Incrementa cantidad | |
| const incrementBtn = screen.getByRole('button', { name: /\+/i }) | |
| await user.click(incrementBtn) | |
| expect(screen.getByText('Quantity: 2')).toBeInTheDocument() | |
| // Elimina producto | |
| const removeBtn = screen.getByRole('button', { name: /remove/i }) | |
| await user.click(removeBtn) | |
| expect(screen.getByText(/cart is empty/i)).toBeInTheDocument() | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment