-
Notifications
You must be signed in to change notification settings - Fork 0
Test UI
Ali Sadeghi edited this page Jan 6, 2026
·
7 revisions
Generates Compose UI tests.
// feature/login/src/androidTest/kotlin/presentation/ui/LoginScreenTest.kt
@RunWith(AndroidJUnit4::class)
class LoginScreenTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun loginScreen_initialState_showsForm() {
composeTestRule.setContent {
XTheme {
LoginScreen(
onLoginSuccess = {},
onBackClick = {}
)
}
}
composeTestRule.onNodeWithText("Email").assertIsDisplayed()
composeTestRule.onNodeWithText("Password").assertIsDisplayed()
composeTestRule.onNodeWithText("Login").assertIsDisplayed()
}
@Test
fun loginScreen_enterCredentials_enablesButton() {
composeTestRule.setContent {
XTheme {
LoginScreen(
onLoginSuccess = {},
onBackClick = {}
)
}
}
composeTestRule.onNodeWithText("Email").performTextInput("test@example.com")
composeTestRule.onNodeWithText("Password").performTextInput("password123")
composeTestRule.onNodeWithText("Login").assertIsEnabled()
}
@Test
fun loginScreen_loadingState_showsIndicator() {
// Test loading state
}
}Back to Agents