bug(MatSnackBarHarness): Testing a snack bar with a duration
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
#### 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.
贡献指南
调研方向
从链接的 StackBlitz 复现开始,尤其是 src/app/example-test.spec.ts,并跟踪 snack bar 具有持续时间时的 MatSnackBarHarness.getMessage()。将其与没有持续时间的 snack bar 进行比较。当 harness 获取到消息,而不是等待其关闭并以 "Failed to find element" 失败时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- testing
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100