public void testLoadUserHappyCaseViews() { onView(withId(R.id.rl_retry)).check(matches(not(isDisplayed()))); onView(withId(R.id.rl_progress)).check(matches(not(isDisplayed()))); onView(withId(R.id.tv_fullname)).check(matches(isDisplayed())); onView(withId(R.id.tv_email)).check(matches(isDisplayed())); onView(withId(R.id.tv_description)).check(matches(isDisplayed())); }
@Test public void testLithographyIsVisibleAndClickable() { onView(componentHostWithText(containsString("Lithography"))) .check(matches(allOf(isDisplayed(), isClickable()))); }
@Test public void testTreePropPropagation() { onView( componentHost( allOf(withText(containsString("root:leaf")), withTagValue(is((Object) 0))))) .check(matches(isDisplayed())); onView(componentHostWithText(containsString("root:top:bottom:leaf"))) .check(matches(isDisplayed())); onView(componentHostWithText(containsString("root:top:leaf"))).check(matches(isDisplayed())); } }
private void assertToastIsShown(String text) { onView(withText(text)) .inRoot(withDecorView(not(is(mActivity.getActivity().getWindow().getDecorView())))) .check(matches(isDisplayed())); } }
@Test public void testRenderCompleteEventTriggered() { onView(componentHostWithText(is("Hello World"))).check(matches(isDisplayed())); assertToastIsShown(TTIMarkerSectionSpec.RENDER_MARKER); }
@Test public void testPlaygroundLaunches() { onView(componentHostWithText(containsString("Playground"))) .check(matches(isDisplayed())) .perform(click()); intended(allOf( toPackage("com.facebook.samples.litho"), hasComponent(hasClassName(DemoListActivity.class.getName())), hasExtras(hasEntry(equalTo("demoName"), equalTo("Playground"))))); } }
@Test public void testTreePropPropagation() { onView( componentHost( allOf(withText(containsString("rootdiff:top:leaf")), withTagValue(is((Object) 0))))) .check(matches(isDisplayed())); } }
@Test public void testSetup() { onView(withId(R.id.camera)) .check(matches(isDisplayed())); try { onView(withId(R.id.texture_view)) .check(matches(isDisplayed())); } catch (NoMatchingViewException e) { onView(withId(R.id.surface_view)) .check(matches(isDisplayed())); } }
@Test public void testTestKeyLookup() { onView(withTestKey("main_screen")) .check(matches(isDisplayed())); }
@Test public void testPlaygroundIsVisibleAndClickable() { onView(componentHostWithText(containsString("Playground"))) .check(matches(isDisplayed())) .check(matches(isClickable())); } }
@Test public void shouldHideLoadingWhenComicSeriesIsLoaded() throws Exception { givenValidComicSeries(); startActivity(); onView((withId(R.id.loading))).check(matches(not(isDisplayed()))); }
@Test public void shouldHideLoadingWhenCharacterIsLoaded() throws Exception { givenAValidCharacter(); startActivity(); onView((withId(R.id.loading))).check(matches(not(isDisplayed()))); }
@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())); } }
@Test public void shouldHideLoadingWhenDataIsLoaded() throws Exception { givenEmptyCharacters(); givenEmptyComicSeries(); startActivity(); onView(allOf(withId(R.id.loading), withAncestor(withId(R.id.fragment_characters)))).check( matches(not(isDisplayed()))); }
@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 shouldShowFakeDataBarWhenMarvelKeysHasNotBeenProvided() throws Exception { givenFakeDataIsEnable(); givenEmptyCharacters(); givenEmptyComicSeries(); startActivity(); onView(withId(R.id.tv_disclaimer)).check(matches(isDisplayed())); }
@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 checkIfActivityIsLaunched() { onView(withText(R.string.app_name)).check(matches(isDisplayed())); } }
@Test public void venuesShow() { main.launchActivity(null); for (int position = 0; position < mVenues.size(); position++) { Venue venue = mVenues.get(position); onView(withId(R.id.recycler_view_venues)) .perform(RecyclerViewActions.scrollToPosition(position)); onView(withText(venue.label)) .check(matches(isDisplayed())); } }