Created
April 14, 2018 11:32
-
-
Save tomkoptel/0972ebb829ae55c77700ca0d4de3442c to your computer and use it in GitHub Desktop.
Demonstrates usage of CoroutinesIdlingResourceRule in our UI test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.test.espresso.Espresso.onView | |
import android.support.test.espresso.assertion.ViewAssertions.matches | |
import android.support.test.espresso.matcher.ViewMatchers.* | |
import android.support.test.runner.AndroidJUnit4 | |
import android.view.View | |
import org.junit.Rule | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
// https://gist.github.com/tomkoptel/1101b2bb61f3daf251e3d627ee533b92 | |
import com.sample.CoroutinesIdlingResourceRule | |
@RunWith(AndroidJUnit4::class) | |
class MainActivityTest { | |
val launchRule = ActivityTestRule<MainActivity>(MainActivity::class.java) | |
val coroutinesRule = CoroutinesIdlingResourceRule() | |
@JvmField @Rule val chain = RuleChain.outerRule(coroutinesRule).around(launchRule) | |
@Test | |
fun some_test() { | |
onView(withId(R.id.text)).check(matches(withText("Result"))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment