2.0.0-alpha02
DanielJette
released this
29 Dec 19:49
·
496 commits
to main
since this release
2.0.0-alpha02
Compose Extension Library
Changed
-
ComposableScreenshotRule
now has an additional constructor argument,composeTestRule
. This provides you with a default instance ofComposeTestRule
or allows you to provide your own instance. With thiscomposeTestRule
instance, you can now use theComposeTestRule
semantics to interact with the UI hierarchy prior to taking screenshots.@get:Rule val rule = ComposableScreenshotRule(composeTestRule = createAndroidComposeRule(ComposableTestActivity::class.java)) @ScreenshotInstrumentation @Test fun default() { rule .setCompose { var text by remember { mutableStateOf("") } TextField( value = text, onValueChange = { text = it }, modifier = Modifier.testTag("field") ) } .setComposeActions { composeTestRule -> composeTestRule.onNodeWithTag("field").performTextInput("testify") } .assertSame() }
Added
ComposableTestActivity
now supports resource wrapping. This means that Testify can configure the font scale and locale for tests. Compose screenshot tests will now respect thelocale
andfontScale
configuration parameters. Usage:rule .setCompose { Text("Example") } .setLocale(Locale.FRANCE) .setFontScale(2.0f)