Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Migration to navigation component #132

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

zcelaloglu
Copy link
Collaborator

there is one more thing needs to be done before closing this PR is adding test cases for newly added fragment by using FragmentScenario

close #131

@zcelaloglu
Copy link
Collaborator Author

Hey @odaridavid, I'm working on fragment testing and getting an error related to permission that I found on stackoverflow

Installation failed due to: ''cmd package install-create -r -t --user current --full --dont-kill -t -g -S 1403340' returns error 'Unknown failure: Security exception: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag
java.lang.SecurityException: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag

after I have found a meaningful answer on stackoverflow, I added necessary permission to manifest but it still complains

<uses-permission android:name="android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS"
        tools:ignore="ProtectedPermissions" />

I also want to share all changes related to test cases:

navigation = '2.3.2'(upgrade from 2.2.2 in order to be able to use TestNavController)
fragmentTestVersion = '1.2.5'

            fragmentTest          : "androidx.fragment:fragment-testing:$fragmentTestVersion",
            navigationTest        : "androidx.navigation:navigation-testing:$navigation"

the first test case:

@Test
    fun shouldDisplayDataOnSearch() {

        val navController =
            TestNavHostController(ApplicationProvider.getApplicationContext())
                .apply { setGraph(R.navigation.nav_graph) }

        launchFragmentInContainer<DashboardFragment>().onFragment {
            Navigation.setViewNavController(it.requireView(), navController)
        }

        onView(withId(R.id.search_edit_text)).perform(typeText(EXISTING_SEARCH_PARAMS))
        onView(withId(R.id.search_results_recycler_view)).check(matches(isDisplayed()))
    }

@odaridavid
Copy link
Owner

Hmm ,I have no clue what this is about though adding permissions for the sake of testing doesn't seem right,I'll check out what you are trying to do and get more context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate from multiple activities to single activity multiple fragments by using Jetpack Navigation component
2 participants