test: add screenshot test for LobstersBottomNav

Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
This commit is contained in:
Aditya Wasan 2021-02-27 20:32:29 +05:30
parent f5bc2ebb59
commit ce7abc7afb
No known key found for this signature in database
GPG key ID: 6D6DF3BF15DE79B5
3 changed files with 32 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -0,0 +1,32 @@
package dev.msfjarvis.lobsters.ui.navigation
import androidx.compose.ui.graphics.asAndroidBitmap
import androidx.compose.ui.test.captureToImage
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onRoot
import com.karumi.shot.ScreenshotTest
import dev.msfjarvis.lobsters.ui.main.LobstersBottomNav
import dev.msfjarvis.lobsters.ui.theme.LobstersTheme
import org.junit.Rule
import org.junit.Test
class LobstersBottomNavTest : ScreenshotTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun bottomNavIsRenderedCorrectlyOnScreen() {
composeTestRule.setContent {
LobstersTheme {
LobstersBottomNav(
currentDestination = Destination.startDestination,
navigateToDestination = { /*TODO*/ },
jumpToIndex = { /*TODO*/ }
)
}
}
compareScreenshot(composeTestRule.onRoot().captureToImage().asAndroidBitmap())
}
}