Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 9d99eb89 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

test: stabilize localized rating assertion in search results

Use the activity configuration locale when building expected rating text in
SearchResultsContentTest so the assertion matches the runtime locale on CI
and developer devices.

Also route the test through the common-apps search results path, which is the
branch that actually applies localized rating formatting, instead of the
open-source path that does not render localized ratings.
parent 6c5a45f8
Loading
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onAllNodesWithText
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.core.os.ConfigurationCompat
import androidx.paging.LoadState
import androidx.paging.LoadStates
import androidx.paging.PagingData
@@ -138,14 +139,17 @@ class SearchResultsContentTest {
    fun applicationMapping_setsAuthorRatingAndPrimaryAction() {
        val notAvailable = composeRule.activity.getString(R.string.not_available)
        val openLabel = composeRule.activity.getString(R.string.open)
        val locale = Locale.FRANCE
        val locale = ConfigurationCompat.getLocales(
            composeRule.activity.resources.configuration
        ).get(0) ?: Locale.getDefault()
        val expectedRating = AppUserRatingFormatter.format(4.4, locale) ?: notAvailable
        val hiddenRating = AppUserRatingFormatter.format(4.9, locale) ?: notAvailable

        renderSearchResults(
            tabs = listOf(SearchTabType.OPEN_SOURCE),
            selectedTab = SearchTabType.OPEN_SOURCE,
            fossPagingData = pagingData(
            tabs = listOf(SearchTabType.COMMON_APPS),
            selectedTab = SearchTabType.COMMON_APPS,
            fossPagingData = PagingData.empty(),
            playStorePagingData = pagingData(
                listOf(
                    Application(
                        name = "Rated App",