@Test @Suppress // Checking activity has been destroyed doesn't always work public void clickOnSubmit_ActivityCloses() { // Whether we have feedback data or not, the activity closes upon submitting onView(withText(R.string.session_feedback_submitlink)).perform(scrollTo()); onView(withText(R.string.session_feedback_submitlink)).check(matches(isDisplayed())); onView(withText(R.string.session_feedback_submitlink)).perform(click()); assertTrue(mActivityRule.getActivity().isDestroyed()); }
@Test @Suppress // Test isn't deterministic when run as part of the full test suite. public void day2Selected() { // Given a current time 3 hours after the start of the second day // Then the second day is selected onView(withText(MyScheduleMockItems.SESSION_TITLE_BEFORE)).check(matches(isDisplayed())); }
@Test @Suppress // Test isn't deterministic when run as part of the full test suite. public void viewDay2_sessionVisible() { // Given day 2 visible // Then the session in the second day is displayed onView(withText(MyScheduleMockItems.SESSION_TITLE_BEFORE)).check(matches(isDisplayed())); }
/** * It should keep state of keepHint after activity recreation :-/ * It's the regression test */ @Test @Suppress // TODO public void keepHintAfterRotationTest() throws InterruptedException { // ====================================== // if initial state was keepHint(false) // given onView(withId(phone_input)) .perform(new HintViewAction("9997055671")) .perform(keepHints) .perform(typeText("999")) .check(matches(withText("+7(999)705-56-71"))) .perform(dontKeepHints); // rotating screen final TestActivity a1 = mActivityTestRule.getActivity(); a1.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Thread.sleep(2500); final TestActivity a2 = mActivityTestRule.getActivity(); a2.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Thread.sleep(2500); if (a1 != a2) { throw new InvalidParameterException("a1 != a2"); } // tests onView(withId(phone_input)) .check(matches(withText("+7(999)"))); // ====================================== // and if initial state was keepHint(true) onView(withId(phone_input)) .perform(clearText()) // after previous test .perform(new HintViewAction("1234567890")) .perform(keepHints) .perform(typeText("999")) .check(matches(withText("+7(999)456-78-90"))) ; // rotating screen mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Thread.sleep(5000); mActivityTestRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Thread.sleep(2500); // tests onView(withId(phone_input)) .check(matches(withText("+7(999)456-78-90"))); }