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

Testing: Add UI Tests #85

Open
igorwojda opened this issue Apr 19, 2020 · 5 comments
Open

Testing: Add UI Tests #85

igorwojda opened this issue Apr 19, 2020 · 5 comments
Labels
🙋‍♂️claimed Someone is working on this issue enhancement New feature or request ✍️ready to grab You can start working on this issue

Comments

@igorwojda
Copy link
Owner

We could add some UI test to the project (Espresso?)

eg. basic tests like

  • run the app
  • navigate to details of first item
  • navigate to favourites/profile
@igorwojda igorwojda added enhancement New feature or request ✍️ready to grab You can start working on this issue labels Apr 19, 2020
@igorwojda igorwojda changed the title Add UI Tests Testing: Add UI Tests Apr 19, 2020
@sfeatherstone
Copy link
Contributor

I would like to pick this one up

@igorwojda
Copy link
Owner Author

igorwojda commented Jun 8, 2020

Go for it - just write the tests and I will update pipeline (with Github Actions) to run them on each PR

BTW I was experimenting with Barista and I was really happy with the results - the tests where clean and quite expressive:

    @Test
    fun whenUserEntersNameHeCanJoinTheMeeting() {
        // Given
        launchFragmentInMaterialContainer<IntroFragment>()
        writeTo(R.id.userNameEditText, "Bob")

        // When
        clickOn(R.id.joinMeetingButton)

        // Then
        testNavHostControllerRule.currentDestination?.id shouldBeEqualTo R.id.joinMeetingFragment
    }

    @Test
    fun whenUserJoinsMeetingWithoutEnteringNameDisplayError() {
        // Given
        launchFragmentInMaterialContainer<IntroFragment>()

        // When
        clickOn(R.id.joinMeetingButton)

        //  Then
        assertError(R.id.userNameTextInputLayout, R.string.user_name_is_required)
    }

launchFragmentInMaterialContainer is my helper to run fragments in the material theme without setting it each time (when component requires it tests crashed because default test theme is not material theme):

inline fun <reified F : Fragment> launchFragmentInMaterialContainer(
    fragmentArgs: Bundle? = null,
    @StyleRes themeResId: Int = R.style.Theme_AppTheme,
    factory: FragmentFactory? = null
): FragmentScenario<F> {
    return launchFragmentInContainer<F>(fragmentArgs, themeResId, factory)
}

@igorwojda igorwojda added the 🙋‍♂️claimed Someone is working on this issue label Jun 8, 2020
@igorwojda
Copy link
Owner Author

FYI
I have converted project to GitHub Actios - now UI tests will run witch each PR (although there are not good UI tests yet)

@sfeatherstone
Copy link
Contributor

This is blocked by issue #109. UI tests will not run in dynamic modules without the upgrade

@igorwojda
Copy link
Owner Author

igorwojda commented Feb 9, 2021

Sorry for long hold. #109 is adressed. @sfeatherstone feel free to grad this issue if you are still ager to write some UI tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋‍♂️claimed Someone is working on this issue enhancement New feature or request ✍️ready to grab You can start working on this issue
Projects
None yet
Development

No branches or pull requests

2 participants