Created
August 26, 2017 22:41
-
-
Save mandemeskel/a772b9f2913361692931e4ce5d4fe0da to your computer and use it in GitHub Desktop.
Refactored test for button that becomes invisible when clicked, using Android Studio 3.
This file contains 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
package io.enfant.maggie; | |
import android.support.test.rule.ActivityTestRule; | |
import android.support.test.runner.AndroidJUnit4; | |
import android.test.suitebuilder.annotation.LargeTest; | |
import org.junit.Before; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import static android.support.test.espresso.Espresso.onView; | |
import static android.support.test.espresso.action.ViewActions.click; | |
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | |
import static android.support.test.espresso.matcher.ViewMatchers.withId; | |
import static android.support.test.espresso.assertion.ViewAssertions.matches; | |
import static org.hamcrest.Matchers.not; | |
@LargeTest | |
@RunWith(AndroidJUnit4.class) | |
public class RecordBtnTests { | |
@Rule | |
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class); | |
@Before | |
public void runBeforeTest() { | |
onView(withId(R.id.btnRecord)).perform(click()); | |
} | |
@Test | |
public void recordBtnIsInvisible() { | |
onView(withId(R.id.btnRecord)).check(matches(not(isDisplayed()))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment