Fix issue 25 and minor refactoring (#64)
This commit is contained in:
parent
fa202ff162
commit
94e3827d7c
@ -80,11 +80,11 @@ dependencies {
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${rootProject.extra["lifecycle_version"]}")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${rootProject.extra["lifecycle_version"]}")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:${rootProject.extra["lifecycle_version"]}")
|
||||
implementation("androidx.navigation:navigation-compose:2.5.3")
|
||||
implementation("androidx.navigation:navigation-compose:2.6.0")
|
||||
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.05.01"))
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
androidTestImplementation("androidx.navigation:navigation-testing:2.5.3")
|
||||
androidTestImplementation("androidx.navigation:navigation-testing:2.6.0")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-intents:3.5.1")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
|
||||
|
||||
@ -76,25 +76,25 @@ class CupcakeOrderScreenTest {
|
||||
@Test
|
||||
fun selectOptionScreen_verifyContent() {
|
||||
// Given list of options
|
||||
val flavours = listOf("Vanilla", "Chocolate", "Hazelnut", "Cookie", "Mango")
|
||||
val flavors = listOf("Vanilla", "Chocolate", "Hazelnut", "Cookie", "Mango")
|
||||
// And subtotal
|
||||
val subTotal = "$100"
|
||||
val subtotal = "$100"
|
||||
|
||||
// When SelectOptionScreen is loaded
|
||||
composeTestRule.setContent {
|
||||
SelectOptionScreen(subtotal = subTotal, options = flavours)
|
||||
SelectOptionScreen(subtotal = subtotal, options = flavors)
|
||||
}
|
||||
|
||||
// Then all the options are displayed on the screen.
|
||||
flavours.forEach { flavour ->
|
||||
composeTestRule.onNodeWithText(flavour).assertIsDisplayed()
|
||||
flavors.forEach { flavor ->
|
||||
composeTestRule.onNodeWithText(flavor).assertIsDisplayed()
|
||||
}
|
||||
|
||||
// And then the subtotal is displayed correctly.
|
||||
composeTestRule.onNodeWithText(
|
||||
composeTestRule.activity.getString(
|
||||
R.string.subtotal_price,
|
||||
subTotal
|
||||
subtotal
|
||||
)
|
||||
).assertIsDisplayed()
|
||||
|
||||
@ -148,6 +148,6 @@ class CupcakeOrderScreenTest {
|
||||
R.string.subtotal_price,
|
||||
fakeOrderUiState.price
|
||||
)
|
||||
)
|
||||
).assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user