AdevintaSpain / AdevintaSpain/Barista

`sleep` does not work when a `DialogFragment` is open and the test is running on Android 11+

オープン
#503 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Kotlin
スター
1.7k
フォーク
119
PR マージ指標
30日以内にマージされた PR はありません

説明

**Library Version:**

4.3.0

**Describe the Bug:**

When calling `sleep` while a `DialogFragment` is open, the test fails every time on Android 11+ with an error "Waited for the root of the view hierarchy to have window focus and not request layout for 10 seconds"

I believe this may be related to issue https://github.com/android/android-test/issues/751
In the code, `sleep` is calling `isRoot` to look for the root view, but this doesn't work properly if a `DialogFragment` is open.

**Steps to reproduce the bug:**
1. Open a `DialogFragment`, for example I'm using a `BottomSheetDialogFragment`
2. After it opens, call `sleep`
3. See that the test fails

**Expected Behavior:**

I expected `sleep` to work as normal.

One option might be to be able to pass a view matcher to `sleep`, which could be of a view you know to exist. Or else just match any view using some generic matcher like `withClassName(any())` or something.

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

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

評価

この issue はまだ評価されていません。

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

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