bug(MatSnackBarHarness): Testing a snack bar with a duration
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
#### Reproduction
https://stackblitz.com/edit/components-issue-v9512z?file=src%2Fapp%2Fexample-test.spec.ts
Steps to reproduce:
1. Try to e.g. `await harness.getMessage()` a snack bar that was opened with a `duration`. You can see this simply by following the link above, which will run that automatically.
#### Expected Behavior
The harness returns the message in the snack bar.
#### Actual Behavior
The test hangs for the duration that the snack bar is open, then fails with "Failed to find element".
#### Environment
- Angular: 9.1.5
- CDK/Material: 9.2.2
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
#### Commentary
Using the same test code, I can test a snack bar that was opened without a duration. But if my production code _does_ use a duration it does not appear possible to test it with the harness. Am I missing something? I assume assigning a duration is a common use-case.
Guía de contribución
Línea de trabajo
Comienza con la reproducción vinculada de StackBlitz, especialmente con src/app/example-test.spec.ts, y sigue MatSnackBarHarness.getMessage() cuando la snack bar tiene una duración. Compárala con una snack bar sin duración. Se considera terminado cuando el harness recupera el mensaje en lugar de esperar a que se descarte y fallar con "Failed to find element".
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- testing
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100