Fixed queue test

This commit is contained in:
ByteHamster 2019-10-20 21:58:11 +02:00
parent f1f91478b6
commit 381732c582
1 changed files with 7 additions and 3 deletions

View File

@ -15,17 +15,20 @@ import org.junit.runner.RunWith;
import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription; import static androidx.test.espresso.matcher.ViewMatchers.withContentDescription;
import static androidx.test.espresso.matcher.ViewMatchers.withText; import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.endsWith;
/** /**
* User interface tests for queue fragment * User interface tests for queue fragment.
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class QueueFragmentTest { public class QueueFragmentTest {
@Rule @Rule
public IntentsTestRule<MainActivity> mActivityRule = new IntentsTestRule<>(MainActivity.class, false, false); public IntentsTestRule<MainActivity> activityRule = new IntentsTestRule<>(MainActivity.class, false, false);
@Before @Before
public void setUp() { public void setUp() {
@ -33,12 +36,13 @@ public class QueueFragmentTest {
EspressoTestUtils.makeNotFirstRun(); EspressoTestUtils.makeNotFirstRun();
EspressoTestUtils.clearDatabase(); EspressoTestUtils.clearDatabase();
EspressoTestUtils.setLastNavFragment(QueueFragment.TAG); EspressoTestUtils.setLastNavFragment(QueueFragment.TAG);
mActivityRule.launchActivity(new Intent()); activityRule.launchActivity(new Intent());
} }
@Test @Test
public void testLockEmptyQueue() { public void testLockEmptyQueue() {
onView(withContentDescription(R.string.lock_queue)).perform(click()); onView(withContentDescription(R.string.lock_queue)).perform(click());
onView(allOf(withClassName(endsWith("Button")), withText(R.string.lock_queue))).perform(click());
onView(withContentDescription(R.string.unlock_queue)).perform(click()); onView(withContentDescription(R.string.unlock_queue)).perform(click());
} }