@Test public void asyncButtonHasStartText() { onView(withId(R.id.async_work)).check(matches(withText(R.string.start_async_work))); } }
private void assertToastIsShown(String text) { onView(withText(text)) .inRoot(withDecorView(not(is(mActivity.getActivity().getWindow().getDecorView())))) .check(matches(isDisplayed())); } }
@Test public void manualEntryReturnsCardData() { onView(withText("Expiry")).perform(click()); onView(withText("CVV")).perform(click()); onView(withText("Postal Code")).perform(click()); onView(withText("Cardholder Name")).perform(click()); onView(withText("Force keyboard entry (bypass scan)")).perform(click()); onView(withText("Scan Credit Card using Card.io")).perform(click()); fillInCardForm(); onView(withText(LocalizedStrings.getString(StringKey.DONE))).perform(click()); onView(withId(R.id.result)).check(matches(withText(containsString("1111")))); onView(withId(R.id.result)).check(matches(withText(containsString("Expiry: 12/2022")))); onView(withId(R.id.result)).check(matches(withText(containsString("CVV: 123")))); onView(withId(R.id.result)).check(matches(withText(containsString("Postal Code: 95131")))); onView(withId(R.id.result)).check(matches(withText(containsString("Cardholder Name: John Doe")))); }
@Test public void cancelInManualEntryExistsActivity() { onView(withText("Force keyboard entry (bypass scan)")).perform(click()); onView(withText("Scan Credit Card using Card.io")).perform(click()); onView(withText("Card Number")).check(matches(isDisplayed())); onView(withText(LocalizedStrings.getString(StringKey.CANCEL))).perform(click()); onView(withText("Force keyboard entry (bypass scan)")).check(matches(isDisplayed())); }
@Test public void canEnterManualEntryFromScanActivity() { onView(withText("Expiry")).perform(click()); onView(withText("CVV")).perform(click()); onView(withText("Postal Code")).perform(click()); onView(withText("Cardholder Name")).perform(click()); onView(withText("Scan Credit Card using Card.io")).perform(click()); onDevice().acceptRuntimePermission(Manifest.permission.CAMERA); onView(withText(LocalizedStrings.getString(StringKey.KEYBOARD))).check(matches(isDisplayed())); onView(withText(LocalizedStrings.getString(StringKey.KEYBOARD))).perform(click()); fillInCardForm(); onView(withText(LocalizedStrings.getString(StringKey.DONE))).perform(click()); }
@Test public void tinypinyin_should_work(){ onView(withId(R.id.mTvText)).check(matches(withText("ZHONGGUOCHONGQING"))); } }
@Test public void sendTenDollars() { spoon.screenshot(amountActivityRule.getActivity(), "amount_empty"); onView(withText("1")).perform(click()); onView(withText("0")).perform(click()); spoon.screenshot(amountActivityRule.getActivity(), "amount_ten"); onView(withText("Send")).perform(click()); spoon.screenshot(amountActivityRule.getActivity(), "send_clicked"); }
@Test public void shouldShowErrorIfSomethingWrongHappens() throws Exception { givenExceptionObtainingComicSeries(); startActivity(); onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("¯\\_(ツ)_/¯"))).check( matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))); }
@Test public void shouldShowConnectionErrorIfHaveConnectionTroubles() throws Exception { givenConnectionExceptionObtainingComicSeries(); startActivity(); onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("Connection troubles. Ask to Ironman!"))).check( matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))); }
@Test public void shouldShowsErrorIfSomethingWrongHappend() throws Exception { givenExceptionObtainingACharacter(); startActivity(); onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("¯\\_(ツ)_/¯"))).check( matches(isDisplayed())); }
@Test public void shouldShowsConnectionErrorIfHasConnectionTroubles() throws Exception { givenConnectionExceptionObtainingACharacter(); startActivity(); onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("Connection troubles. Ask to Ironman!"))).check( matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))); }
@Test public void shouldShowConnectionErrorIfHaveConnectionTroubles() throws Exception { givenConnectionExceptionObtainingCharacters(); givenEmptyComicSeries(); startActivity(); onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("Connection troubles. Ask to Ironman!"))).check( matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))); }
@Test public void shouldShowErrorIfSomethingWrongHappens() throws Exception { givenExceptionObtainingCharacters(); givenEmptyComicSeries(); startActivity(); onView(allOf(withId(android.support.design.R.id.snackbar_text), withText("¯\\_(ツ)_/¯"))).check( matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))); }
@Test public void shouldShowCharacterDetailWhenCharacterIsLoaded() throws Exception { Character character = givenAValidCharacter(); startActivity(); onView(withId(R.id.tv_character_name)).check(matches(withText(character.getName()))); onView(withId(R.id.tv_description)).check(matches(withText(character.getDescription()))); }
@Test public void shouldShowComicSeriesDetailWhenComicSeriesIsLoaded() throws Exception { ComicSeries comicSeries = givenValidComicSeries(); startActivity(); onView(withId(R.id.tv_toolbar_title)).check(matches(withText(comicSeries.getName()))); onView(withId(R.id.tv_description)).check(matches(withText(comicSeries.getDescription()))); }
@Test public void scrollToBottom() { onData(anything()) .inAdapterView(withId(android.R.id.list)) .atPosition(24) .check(matches(withText("purus"))); }
@Test public void sendNothing() { spoon.screenshot(amountActivityRule.getActivity(), "amount_empty"); onView(withText("Send")).perform(click()); spoon.screenshot(amountActivityRule.getActivity(), "send_clicked"); } }
@Test public void sanityTest() { onView(withId(R.id.clear)).perform(click()); onView(withId(R.id.add)).perform(click()); onView(withId(R.id.edit)).perform(clearText(), typeText(FIRST_TEXT)); onView(withText(R.string.add)).inRoot(isDialog()).perform(click()); onView(withId(R.id.add)).perform(click()); onView(withId(R.id.edit)).perform(clearText(), typeText(SECOND_TEXT)); onView(withText(R.string.add)).inRoot(isDialog()).perform(click()); onView(withText(COL_FIRST_TEXT)).perform(click()); onView(withId(R.id.edit)).perform(clearText(), typeText(THIRD_TEXT)); onView(withText(R.string.edit)).inRoot(isDialog()).perform(click()); onView(withText(COL_SECOND_TEXT)).perform(longClick()); onView(withId(R.id.clear)).perform(click()); } }
@Test public void checkViewsDisplay() { main.launchActivity(LoginActivity.getStartIntent(component.getContext())); onView(withId(R.id.et_email)) .check(matches(isDisplayed())); onView(withId(R.id.et_password)) .check(matches(isDisplayed())); onView(withId(R.id.btn_server_login)) .check(matches(isDisplayed())); onView(withText(R.string.login)) .check(matches(isDisplayed())); onView(withId(R.id.ib_google_login)) .check(matches(isDisplayed())); onView(withId(R.id.ib_fb_login)) .check(matches(isDisplayed())); } }