Java Code Examples for android.support.test.espresso.Espresso#unregisterIdlingResources()

The following examples show how to use android.support.test.espresso.Espresso#unregisterIdlingResources() . 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: StepDefinitions.java    From CleanGUITestArchitecture with MIT License 5 votes vote down vote up
/**
 * All the clean up of application's data and state after each scenario must happen here
 * The last call of this method should always be the call to parent's tear down method
 */
@After
public void tearDown() throws Exception {
    LoginActivity.setIdlingNotificationListener(null);
    Espresso.unregisterIdlingResources(mCountingIdlingResourceListener.getCountingIdlingResource());
    ActivityFinisher.finishOpenActivities(); // Required for testing App with multiple activities
    letScreenOfTestDeviceTurnOff();
}
 
Example 2
Source File: MainActivityTest.java    From Cappuccino with Apache License 2.0 5 votes vote down vote up
@Test
public void testEspressoWay() throws Exception {
    // Instantiate and register the IdlingResource
    CappuccinoIdlingResource idlingResource = new CappuccinoIdlingResource(mActivityTestRule.getActivity());
    Espresso.registerIdlingResources(idlingResource);

    // This view animates in
    onView(withId(R.id.text_hello)).check(matches(isDisplayed()));

    // Unregister the IdlingResource
    Espresso.unregisterIdlingResources(idlingResource);
}
 
Example 3
Source File: FeedActivityTest.java    From dev-summit-architecture-demo with Apache License 2.0 5 votes vote down vote up
@After
public void unregisterIdlingResource() {
    if (mIdlingResource != null) {
        Espresso.unregisterIdlingResources(mIdlingResource);
        mIdlingResource = null;
    }
}
 
Example 4
Source File: SampleListStepDefinitions.java    From material-activity-chooser with Apache License 2.0 5 votes vote down vote up
@After
public void after() {
    Espresso.unregisterIdlingResources(mBottomSheetIdlingResource);
    try {
        InstrumentationRegistry.getTargetContext().unregisterReceiver(mTestBroadcastReceiver);
    } catch (IllegalArgumentException ignored){}
}
 
Example 5
Source File: StepperNavigationActions.java    From android-material-stepper with Apache License 2.0 5 votes vote down vote up
@Override
public final void perform(UiController uiController, View view) {
    final StepperLayout stepperLayout = (StepperLayout) view;
    final ViewPager viewPager = (ViewPager) stepperLayout.findViewById(com.stepstone.stepper.R.id.ms_stepPager);
    // Add a custom tracker listener
    final CustomViewPagerListener customListener = new CustomViewPagerListener();
    viewPager.addOnPageChangeListener(customListener);

    // Note that we're running the following block in a try-finally construct. This
    // is needed since some of the actions are going to throw (expected) exceptions. If that
    // happens, we still need to clean up after ourselves to leave the system (Espresso) in a good
    // state.
    try {
        // Register our listener as idling resource so that Espresso waits until the
        // wrapped action results in the view pager getting to the STATE_IDLE state
        Espresso.registerIdlingResources(customListener);

        uiController.loopMainThreadUntilIdle();

        performAction(stepperLayout);

        uiController.loopMainThreadUntilIdle();

        customListener.mNeedsIdle = true;
        uiController.loopMainThreadUntilIdle();
        customListener.mNeedsIdle = false;
    } finally {
        // Unregister our idling resource
        Espresso.unregisterIdlingResources(customListener);
        // And remove our tracker listener from ViewPager
        viewPager.removeOnPageChangeListener(customListener);
    }
}
 
Example 6
Source File: NoteDetailScreenTest.java    From androidtestdebug with MIT License 4 votes vote down vote up
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void unregisterIdlingResource() {
    Espresso.unregisterIdlingResources(
            mNoteDetailActivityTestRule.getActivity().getCountingIdlingResource());
}
 
Example 7
Source File: ThreadActivityTest.java    From NYBus with Apache License 2.0 4 votes vote down vote up
@After
public void unregisterIdlingResource() {
    if (mIdlingResource != null) {
        Espresso.unregisterIdlingResources(mIdlingResource);
    }
}
 
Example 8
Source File: Step4CalculatorActivityFinalTest.java    From android-agera with Apache License 2.0 4 votes vote down vote up
@After
public void unregisterIdlingResource() {
    if (mIdlingResource != null) {
        Espresso.unregisterIdlingResources(mIdlingResource);
    }
}
 
Example 9
Source File: AddNoteScreenTest.java    From androidtestdebug with MIT License 4 votes vote down vote up
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void unregisterIdlingResource() {
    Espresso.unregisterIdlingResources(
            mAddNoteIntentsTestRule.getActivity().getCountingIdlingResource());
}
 
Example 10
Source File: AddNoteScreenTest.java    From androidtestdebug with MIT License 4 votes vote down vote up
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void unregisterIdlingResource() {
    Espresso.unregisterIdlingResources(
            mAddNoteIntentsTestRule.getActivity().getCountingIdlingResource());
}
 
Example 11
Source File: RepositoriesEmptyTest.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
    if (idlingResource != null) {
        Espresso.unregisterIdlingResources(idlingResource);
    }
}
 
Example 12
Source File: NoteDetailScreenTest.java    From androidtestdebug with MIT License 4 votes vote down vote up
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void unregisterIdlingResource() {
    Espresso.unregisterIdlingResources(
            mNoteDetailActivityTestRule.getActivity().getCountingIdlingResource());
}
 
Example 13
Source File: BaseTests.java    From PatternedTextWatcher with MIT License 4 votes vote down vote up
@After public void tearDown() {
  Espresso.unregisterIdlingResources(viewDirtyIdler);
}
 
Example 14
Source File: SplashActivityTestUI.java    From openshop.io-android with MIT License 4 votes vote down vote up
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void unregisterIdlingResource() {
    Espresso.unregisterIdlingResources(MyApplication.getInstance().getCountingIdlingResource());
}
 
Example 15
Source File: PageObject.java    From photoviewer with Apache License 2.0 4 votes vote down vote up
private void tearDownIdlingResources() {
  Espresso.unregisterIdlingResources(mOkHttp3IdlingResource);
}
 
Example 16
Source File: RealServerTest.java    From AndroidHttpMockingExamples with Apache License 2.0 4 votes vote down vote up
@After
public void tearDown() {
    Espresso.unregisterIdlingResources(idlingResource);
}
 
Example 17
Source File: BaseTestLocker.java    From redux-android-sample with Apache License 2.0 4 votes vote down vote up
public void unregisterIdlingResource() {
    mHandler.removeCallbacks(mForceIsIdleNow);
    Espresso.unregisterIdlingResources(this);
}
 
Example 18
Source File: TestEspressoCalcActivity.java    From Equate with GNU General Public License v3.0 4 votes vote down vote up
@After
public void unregisterIntentServiceIdlingResource() {
	if (mPagerIdle != null)
		Espresso.unregisterIdlingResources(mPagerIdle);
}
 
Example 19
Source File: HugeEventActivityTest.java    From NYBus with Apache License 2.0 4 votes vote down vote up
@After
public void unregisterIdlingResource() {
    if (mIdlingResource != null) {
        Espresso.unregisterIdlingResources(mIdlingResource);
    }
}
 
Example 20
Source File: Cappuccino.java    From Cappuccino with Apache License 2.0 3 votes vote down vote up
/**
 * Convenience method for {@link Espresso#unregisterIdlingResources(android.support.test.espresso.IdlingResource...)
 * Espresso#registerIdlingResources(IdlingResource...)}, which is the twin of {@link #registerIdlingResource(String)}.
 *
 * @param name The name associated with the {@link CappuccinoIdlingResource} you wish to
 *             unregister.
 * @throws CappuccinoException if there is no {@code CappuccinoResourceWatcher} associated
 *                             with the given {@param name}.
 */
public static void unregisterIdlingResource(@NonNull String name) {
    throwIfAbsent(name);

    CappuccinoIdlingResource idlingResource = mIdlingResourceRegistry.get(name);
    Espresso.unregisterIdlingResources(idlingResource);
    mIdlingResourceRegistry.remove(name);
}