concretesolutions / kappuccino

A kotlin library to simplify how to do espresso tests on Android.
Apache License 2.0
109 stars 20 forks source link

Update intent matcher doc on README #108

Open heitorcolangelo opened 6 years ago

heitorcolangelo commented 6 years ago

The samples and explanation of how we use Kappuccino to match intents are not up-to-date. Also, it can be improved, for example (not up-to-date yet, just refactoring):

@Test
fun intentMatcherTest() {
    val WHATS_PACKAGE_NAME = "com.whatsapp"
    val PLAY_STORE_URL = "https://play.google.com/store/apps/details?id="
    Intents.init()

    val matcher = allOf {
        action(Intent.ACTION_VIEW)
        url(PLAY_STORE_URL + WHATS_PACKAGE_NAME)
    }

    matchIntent {
        matcher
        result {
           ok()
        }
    }

    click {
        id(R.id.btn_start_activity)
    }

    matchIntent {
        matcher
    }

    Intents.release()
}