-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#354] [Sample] Add initial HomeScreenTest
- Loading branch information
Showing
4 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ose/app/src/androidTest/java/co/nimblehq/sample/compose/ui/screens/home/HomeScreenTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package co.nimblehq.sample.compose.ui.screens.home | ||
|
||
import androidx.activity.compose.setContent | ||
import androidx.compose.ui.test.* | ||
import androidx.compose.ui.test.junit4.createAndroidComposeRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import co.nimblehq.sample.compose.ui.AppDestination | ||
import co.nimblehq.sample.compose.ui.screens.MainActivity | ||
import org.junit.* | ||
import org.junit.runner.RunWith | ||
|
||
@ExperimentalTestApi | ||
@RunWith(AndroidJUnit4::class) | ||
class HomeScreenTest { | ||
|
||
@get:Rule | ||
val composeRule = createAndroidComposeRule<MainActivity>() | ||
|
||
private var expectedAppDestination: AppDestination? = null | ||
|
||
@Before | ||
fun setup() { | ||
composeRule.activity.setContent { | ||
HomeScreen( | ||
navigator = { destination -> expectedAppDestination = destination } | ||
) | ||
} | ||
} | ||
|
||
@Test | ||
fun when_entering_the_Home_screen__it_shows_UI_correctly() { | ||
composeRule.run { | ||
onNodeWithText("Home").assertIsDisplayed() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters