Add a basic UI test

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-08-26 23:35:00 +05:30
parent 6e246ed246
commit 2c0b4fc072
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 30 additions and 0 deletions

View file

@ -75,4 +75,5 @@ dependencies {
testImplementation 'junit:junit:4.13' testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation "androidx.ui:ui-test:$compose_version"
} }

View file

@ -0,0 +1,29 @@
package dev.msfjarvis.todo
import androidx.ui.test.android.createAndroidComposeRule
import androidx.ui.test.assertIsDisplayed
import androidx.ui.test.onNodeWithText
import dev.msfjarvis.todo.ui.TodoTheme
import org.junit.Before
import org.junit.Rule
import org.junit.Test
class MainActivityTest {
@get:Rule
val composeTestRule = createAndroidComposeRule<MainActivity>(disableTransitions = true)
@Before
fun setUp() {
composeTestRule.setContent {
TodoTheme {
TodoApp()
}
}
}
@Test
fun test_default_item() {
onNodeWithText("Default item").assertIsDisplayed()
}
}