androidx.test.filters.LargeTest Java Examples

The following examples show how to use androidx.test.filters.LargeTest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginUITest.java    From adamant-android with GNU General Public License v3.0 6 votes vote down vote up
@Test
@LargeTest
public void uiShowLoginFragment() throws Exception {
    LoginScreen activity = activityRule.getActivity();

    onView(withId(R.id.activity_login_btn_login)).perform(click());

    FragmentManager supportFragmentManager = activity.getSupportFragmentManager();
    FragmentIdlingResource dialogFragmentIdlingResource = new FragmentIdlingResource(
            LoginScreen.BOTTOM_LOGIN_TAG,
            supportFragmentManager
    );

    idlingBlock(dialogFragmentIdlingResource, () -> {
        onView(withId(R.id.fragment_login_et_passphrase))
                .check(matches(isDisplayed()));
    });
}
 
Example #2
Source File: TextInputLayoutIconsTest.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
@Test
@LargeTest
public void testSaveAndRestorePasswordVisibility() throws Throwable {
  // Type some text on the EditText
  onView(withId(R.id.textinput_edittext_pwd)).perform(typeText(INPUT_TEXT));
  onView(withId(R.id.textinput_password)).check(isPasswordToggledVisible(false));

  // Toggle password to be shown as plain text
  onView(withId(R.id.textinput_password)).perform(clickIcon(true));
  onView(withId(R.id.textinput_password)).check(isPasswordToggledVisible(true));

  RecreatableAppCompatActivity activity = activityTestRule.getActivity();
  ActivityUtils.recreateActivity(activityTestRule, activity);
  ActivityUtils.waitForExecution(activityTestRule);

  // Check that the password is still toggled to be shown as plain text
  onView(withId(R.id.textinput_password)).check(isPasswordToggledVisible(true));
}
 
Example #3
Source File: TestSizeTest.java    From android-test with Apache License 2.0 6 votes vote down vote up
@Test
public void isAnyTestSize_ContainsPlatformAndRunnerFilterAnnotations() {
  assertThat(TestSize.isAnyTestSize(SmallTest.class), equalTo(true));
  assertThat(TestSize.isAnyTestSize(MediumTest.class), equalTo(true));
  assertThat(TestSize.isAnyTestSize(LargeTest.class), equalTo(true));

  assertThat(
      TestSize.isAnyTestSize(android.test.suitebuilder.annotation.SmallTest.class),
      equalTo(true));
  assertThat(
      TestSize.isAnyTestSize(android.test.suitebuilder.annotation.MediumTest.class),
      equalTo(true));
  assertThat(
      TestSize.isAnyTestSize(android.test.suitebuilder.annotation.LargeTest.class),
      equalTo(true));
}
 
Example #4
Source File: LoginUINetworkTest.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@Test
@LargeTest
public void uiNetSuccessLogin() throws Exception {

    LoginScreen activity = activityRule.getActivity();
    FragmentManager supportFragmentManager = activity.getSupportFragmentManager();

    FragmentIdlingResource dialogFragmentIdlingResource = new FragmentIdlingResource(
            LoginScreen.BOTTOM_LOGIN_TAG,
            supportFragmentManager
    );

    onView(withId(R.id.activity_login_btn_login)).perform(click());

    idlingBlock(dialogFragmentIdlingResource, () -> {
        onView(withId(R.id.fragment_login_et_passphrase))
                .check(matches(isDisplayed()));

        onView(withId(R.id.fragment_login_et_passphrase))
                .perform(typeText(InstrumentedTestConstants.PASSPHRASE))
                .perform(closeSoftKeyboard());

        onView(withId(R.id.fragment_login_btn_enter)).perform(click());
    });

    String mainActivity = MainScreen.class.getName();
    ActivityIdlingResosurce activityIdlingResosurce = new ActivityIdlingResosurce(mainActivity);

    idlingBlock(activityIdlingResosurce, () -> {
        intended(hasComponent(MainScreen.class.getName()));
    });
}
 
Example #5
Source File: LoginUITest.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@Test
@LargeTest
public void uiShowRegistrationScreen() {
    onView(withId(R.id.activity_login_ib_node_list)).check(matches(isDisplayed()));
    onView(withId(R.id.activity_login_ib_node_list)).perform(click());
    intended(hasComponent(NodesListScreen.class.getName()));
}
 
Example #6
Source File: CustomSnackbarTest.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Test
@LargeTest
public void testBasicContent() throws Throwable {
  // Verify different combinations of snackbar content (title / subtitle and action)
  // We can't test duration here because timing can be flaky when run in the emulator.

  // Indefinite duration
  verifySnackbarContent(
      makeCustomSnackbar()
          .setTitle(TITLE_TEXT)
          .setSubtitle(SUBTITLE_TEXT)
          .setDuration(Snackbar.LENGTH_INDEFINITE),
      TITLE_TEXT,
      SUBTITLE_TEXT);
}
 
Example #7
Source File: TabLayoutWithViewPagerTest.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Test
@LargeTest
public void testMinMaxTabWidth() {
  verifyMinMaxTabWidth(
      R.layout.tab_layout_bound_minmax,
      R.dimen.tab_width_limit_small,
      R.dimen.tab_width_limit_large);
}
 
Example #8
Source File: BottomNavigationViewTest.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
@Test
@LargeTest
public void testNavigationSelectionListener() {
  BottomNavigationView.OnNavigationItemSelectedListener mockedListener =
      mock(BottomNavigationView.OnNavigationItemSelectedListener.class);
  bottomNavigation.setOnNavigationItemSelectedListener(mockedListener);

  // Make the listener return true to allow selecting the item.
  when(mockedListener.onNavigationItemSelected(any(MenuItem.class))).thenReturn(true);
  onView(
          allOf(
              withText(menuStringContent.get(R.id.destination_profile)),
              isDescendantOfA(withId(R.id.bottom_navigation)),
              isDisplayed()))
      .perform(click());
  // Verify our listener has been notified of the click
  verify(mockedListener, times(1))
      .onNavigationItemSelected(bottomNavigation.getMenu().findItem(R.id.destination_profile));
  // Verify the item is now selected
  assertTrue(bottomNavigation.getMenu().findItem(R.id.destination_profile).isChecked());

  // Select the same item again
  onView(
          allOf(
              withText(menuStringContent.get(R.id.destination_profile)),
              isDescendantOfA(withId(R.id.bottom_navigation)),
              isDisplayed()))
      .perform(click());
  // Verify our listener has been notified of the click
  verify(mockedListener, times(2))
      .onNavigationItemSelected(bottomNavigation.getMenu().findItem(R.id.destination_profile));
  // Verify the item is still selected
  assertTrue(bottomNavigation.getMenu().findItem(R.id.destination_profile).isChecked());

  // Make the listener return false to disallow selecting the item.
  when(mockedListener.onNavigationItemSelected(any(MenuItem.class))).thenReturn(false);
  onView(
          allOf(
              withText(menuStringContent.get(R.id.destination_people)),
              isDescendantOfA(withId(R.id.bottom_navigation)),
              isDisplayed()))
      .perform(click());
  // Verify our listener has been notified of the click
  verify(mockedListener, times(1))
      .onNavigationItemSelected(bottomNavigation.getMenu().findItem(R.id.destination_people));
  // Verify the previous item is still selected
  assertFalse(bottomNavigation.getMenu().findItem(R.id.destination_people).isChecked());
  assertTrue(bottomNavigation.getMenu().findItem(R.id.destination_profile).isChecked());

  // Set null listener to test that the next click is not going to notify the
  // previously set listener and will allow selecting items.
  bottomNavigation.setOnNavigationItemSelectedListener(null);

  // Click one of our items
  onView(
          allOf(
              withText(menuStringContent.get(R.id.destination_home)),
              isDescendantOfA(withId(R.id.bottom_navigation)),
              isDisplayed()))
      .perform(click());
  // Verify that our previous listener has not been notified of the click
  verifyNoMoreInteractions(mockedListener);
  // Verify the correct item is now selected.
  assertTrue(bottomNavigation.getMenu().findItem(R.id.destination_home).isChecked());
}
 
Example #9
Source File: TabLayoutWithViewPagerTest.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
@Test
@LargeTest
public void testMinTabWidth() {
  verifyMinMaxTabWidth(R.layout.tab_layout_bound_min, R.dimen.tab_width_limit_medium, 0);
}
 
Example #10
Source File: TabLayoutWithViewPagerTest.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
@Test
@LargeTest
public void testMaxTabWidth() {
  verifyMinMaxTabWidth(R.layout.tab_layout_bound_max, 0, R.dimen.tab_width_limit_medium);
}
 
Example #11
Source File: TestSizeTest.java    From android-test with Apache License 2.0 4 votes vote down vote up
@LargeTest
@Test
public void runnerFilterLargeSize() {}