bug(Autocomplete): unit test using MatAutocompleteHarness fails when karma browser is in the foreground
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
#### Reproduction
* Clone repo: https://github.com/DmitryEfimenko/mat-autocomplete-harness-issue
* install deps
Steps to reproduce:
1. In the console: `npm run test`
1. Make sure NOT to bring the opened Chrome window showing Jasmine tests into the visibility
If it opens in front, quickly click on some other window to bring the Chrome window to the background
1. Observe: test succeeds
1. make a small change in test (change spec name) to trigger test re-run
1. Observe: test still succeeds
1. Bring the Chrome window showing Jasmine tests into the visibility
1. Observe: test fail
Recording:
https://user-images.githubusercontent.com/2098175/113951456-76f5b680-97c8-11eb-9893-5cca66ac1a8c.mp4
#### Expected Behavior
Unit test should pass.
Specifically, `autocompleteHarness.getOptions()` should return 3 options instead of 0
#### Actual Behavior
Unit test only passes while the Jasmine Chrome window is in the background
#### Environment
- Angular: 11.2.8
- CDK/Material: 11.2.7
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Tested on:
- Windows
- Mac
#### Notes
I have created a StackBlitz repository with basically the same code, but can't reproduce the issue there:
https://stackblitz.com/edit/harness-issue-2m77t5?file=src/app/autocomplete-harness-example.spec.ts
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với repository tái hiện được liên kết và chạy `npm run test`, sau đó tái hiện sự khác biệt giữa cửa sổ Chrome ở chế độ nền và ở chế độ tiền cảnh. Điều tra kết quả của `autocompleteHarness.getOptions()`, kết quả này phải chứa 3 tùy chọn trong cả hai trường hợp. Hoàn tất khi unit test luôn pass, dù cửa sổ Jasmine Chrome đang hiển thị hay ở chế độ nền.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend, testing
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100