Skip to content

Instantly share code, notes, and snippets.

@Elvis10ten
Last active November 24, 2017 12:16
Show Gist options
  • Save Elvis10ten/d9c6199c8547ea750a9d24755d8faffd to your computer and use it in GitHub Desktop.
Save Elvis10ten/d9c6199c8547ea750a9d24755d8faffd to your computer and use it in GitHub Desktop.
package com.mobymagic.shazamclone.discover
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.assertion.ViewAssertions.matches
import android.support.test.espresso.matcher.ViewMatchers.isDisplayed
import android.support.test.espresso.matcher.ViewMatchers.withId
import android.support.test.filters.LargeTest
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
import com.mobymagic.shazamclone.R
import org.junit.Assert.*
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
// Read more about test sizes here: https://plus.google.com/+AndroidDevelopers/posts/TPy1EeSaSg8
@LargeTest
class DiscoverActivityTest {
// Required to expose the property as a field, if not you will get an error when you try to run the test
@JvmField
@Rule
val mDiscoverActivityTestRule = ActivityTestRule<DiscoverActivity>(DiscoverActivity::class.java)
@Test
fun onViewLoadedShowDiscoverFragment() {
// Simply looks for a view that has the id 'discoverFragmentView' and checks to see if it is displayed (shown)
onView(withId(R.id.discoverFragmentView)).check(matches(isDisplayed()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment