robolectric icon indicating copy to clipboard operation
robolectric copied to clipboard

Setting width or height in qualifier cause dialog with text field in compose test to freeze

Open vincent-paing opened this issue 10 months ago • 4 comments

Description

Compose test for Dialog and text field freeze with AppIdleException when specific size of width and height are configured in qualifier.

Steps to Reproduce

Run the following test and wait for a few minute, test will fail after app has timeout waiting for idle state

@RunWith(AndroidJUnit4::class)
@Config(qualifiers = "w360dp-h640dp", sdk = [30, 31, 32, 33])
@GraphicsMode(GraphicsMode.Mode.NATIVE)
class ExampleTest {

  @get:Rule
  val composeTestRule = createComposeRule()

  @Test
  fun freezingTest() {
    composeTestRule.setContent {
      Mdc3Theme {
        Dialog(onDismissRequest = {}) {
          BasicTextField(value = "some value", onValueChange = {
          })
        }
      }
    }
  }
}

Removing the qualifier fixed the problem. The test freeze only if the text field is inside Dialog, maybe a specific interaction between Dialog and TextField.

Robolectric & Android Version

Robolectric : 4.10.3 Android version: All version maybe but I tested on 30 - 33.

vincent-paing avatar Sep 06 '23 16:09 vincent-paing