Я просто хочу проверить нажатие на кнопку
вот подробности:
Код: Выделить всё
@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
class HomeUITest {
@get:Rule(order = 0)
var hiltRule = HiltAndroidRule(this)
// use createAndroidComposeRule() if you need access to
// an activity
@get:Rule(order = 1)
val composeTestRule = createComposeRule()
lateinit var loginViewModel: LoginViewModel
@Before
fun setUp() {
hiltRule.inject()
composeTestRule.setContent {
DanamonAppTheme {
LoginPageScreen()
}
}
}
@Test
fun myUIComponentTest() = runTest {
composeTestRule.onNodeWithText("Login").performClick()
}
}
Код: Выделить всё
Hilt test, com.kelvin.pastisystem.HomeUITest, cannot use a @HiltAndroidApp application
but found com.kelvinquantic.danamon.MainApplication. To fix, configure the test to use
HiltTestApplication or a custom Hilt test application generated with
@CustomTestApplication.
Код: Выделить всё
@HiltAndroidApp
class MainApplication : Application() {
...
Подробнее здесь: https://stackoverflow.com/questions/780 ... and-junit4