angular / angular/components

bug(Autocomplete): unit test using MatAutocompleteHarness fails when karma browser is in the foreground

オープン
#22,428 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る
area: material/autocomplete area: material/testing needs investigation P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### 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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされている再現リポジトリから始めて `npm run test` を実行し、その後、バックグラウンドにある Chrome ウィンドウとフォアグラウンドにある Chrome ウィンドウの違いを再現します。両方の場合で 3 個のオプションを含むはずの `autocompleteHarness.getOptions()` の結果を調査します。Jasmine Chrome ウィンドウが表示されている場合でもバックグラウンドにある場合でも、ユニットテストが一貫してパスすれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend, testing
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。