Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollToIndex
import androidx.compose.ui.test.performScrollToKey
import com.google.common.truth.Truth
import com.serranoie.app.minus.R
import com.serranoie.app.minus.domain.model.PeriodMappingMode
Expand Down Expand Up @@ -95,6 +95,8 @@ class ChangelogE2ETest {
onNotificationTimeChange = { _, _ -> },
onRecurrentNotificationTimeChange = { _, _ -> },
onOpenExactAlarmSettings = {},
notificationPermissionGranted = true,
onOpenNotificationSettings = {},
periodMappingMode = PeriodMappingMode.ACTIVE_BUDGET,
onPeriodMappingModeChange = {},
onExportCsv = {},
Expand Down Expand Up @@ -137,20 +139,6 @@ class ChangelogE2ETest {
private fun closeContentDesc(): String =
composeTestRule.activity.getString(R.string.changelog_close)

@Test
fun when_settings_is_displayed_then_what_is_new_item_is_visible() {
setSettingsContent()
composeTestRule.waitForIdle()
composeTestRule.mainClock.advanceTimeBy(500)
composeTestRule.waitForIdle()

composeTestRule.onNodeWithTag("SettingsScreen").performScrollToIndex(Int.MAX_VALUE)
composeTestRule.waitForIdle()

composeTestRule.onAllNodesWithText(whatsNewTitle()).onFirst().assertIsDisplayed()
composeTestRule.onAllNodesWithText(whatsNewSubtitle()).onFirst().assertIsDisplayed()
}

@Test
fun when_tapping_what_is_new_then_onNavigateToChangelog_callback_fires() {
var navigatedCount = 0
Expand All @@ -159,7 +147,8 @@ class ChangelogE2ETest {
composeTestRule.mainClock.advanceTimeBy(500)
composeTestRule.waitForIdle()

composeTestRule.onNodeWithTag("SettingsScreen").performScrollToIndex(Int.MAX_VALUE)
composeTestRule.onNodeWithTag("SettingsScreen")
.performScrollToKey("settings_app_info_section")
composeTestRule.waitForIdle()

composeTestRule.onAllNodesWithText(whatsNewTitle()).onFirst().performClick()
Expand Down Expand Up @@ -306,7 +295,8 @@ class ChangelogE2ETest {
composeTestRule.mainClock.advanceTimeBy(500)
composeTestRule.waitForIdle()

composeTestRule.onNodeWithTag("SettingsScreen").performScrollToIndex(Int.MAX_VALUE)
composeTestRule.onNodeWithTag("SettingsScreen")
.performScrollToKey("settings_app_info_section")
composeTestRule.waitForIdle()

composeTestRule.onAllNodesWithText(whatsNewTitle()).assertCountEquals(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class MainScreenE2ETest {
onDelete = { capturedIntents += "Delete" },
onApply = { capturedIntents += "Apply" },
onOperatorInput = { capturedIntents += "Operator:$it" },
modifier = Modifier.fillMaxSize().height(400.dp),
modifier = Modifier
.fillMaxSize()
.height(400.dp),
)
}
}
Expand Down Expand Up @@ -333,7 +335,8 @@ class MainScreenE2ETest {
animState = AnimState.EDITING,
)

composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("123"))).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("123"))).onLast()
.assertIsDisplayed()
}

@Test
Expand Down Expand Up @@ -401,7 +404,8 @@ class MainScreenE2ETest {
budgetSettings = sampleBudgetSettings(totalBudget = BigDecimal("500.00")),
)

composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("500.00"))).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("500.00"))).onLast()
.assertIsDisplayed()
}

@Test
Expand All @@ -417,7 +421,8 @@ class MainScreenE2ETest {
budgetSettings = sampleBudgetSettings(totalBudget = BigDecimal("500.00")),
)

composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("450.00"))).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("450.00"))).onLast()
.assertIsDisplayed()
}

@Test
Expand All @@ -437,7 +442,8 @@ class MainScreenE2ETest {
viewPeriod = BudgetPeriod.WEEKLY,
)

composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("700.00"))).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("700.00"))).onLast()
.assertIsDisplayed()
}

@Test
Expand Down Expand Up @@ -556,7 +562,8 @@ class MainScreenE2ETest {
animState = AnimState.EDITING,
)

composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("123"))).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText(formatExpected(BigDecimal("123"))).onLast()
.assertIsDisplayed()
composeTestRule.onAllNodesWithText("1", substring = true).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText("2", substring = true).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText("3", substring = true).onLast().assertIsDisplayed()
Expand Down Expand Up @@ -700,6 +707,7 @@ class MainScreenE2ETest {
composeTestRule.mainClock.advanceTimeBy(300)

val totalBudgetLabel = composeTestRule.activity.getString(R.string.total_budget)
composeTestRule.onAllNodesWithText(totalBudgetLabel, substring = true).onLast().assertIsDisplayed()
composeTestRule.onAllNodesWithText(totalBudgetLabel, substring = true).onLast()
.assertIsDisplayed()
}
}
Loading
Loading