Java Code Examples for android.support.test.espresso.NoActivityResumedException

The following are top voted examples for showing how to use android.support.test.espresso.NoActivityResumedException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: adyen-android   File: PaymentAppTest.java   View source code 5 votes vote down vote up
private void cancelCreditCardPayment() throws Exception {
    Espresso.pressBack();
    EspressoTestUtils.waitForView(R.id.activity_payment_method_selection);
    Espresso.pressBack();
    EspressoTestUtils.waitForView(R.id.verificationTextView);
    try {
        // Actually this should not be required. However without pressing back one last time; the
        // activity cannot be started in the next test. To avoid it; we kill the PaymentResultActivity as well.
        Espresso.pressBack();
    } catch (final NoActivityResumedException expected) {
        // expected
    }
}
 
Example 2
Project: 2016.2-WikiLegis   File: LoginFragmentTest.java   View source code 5 votes vote down vote up
private void goBackN() {
    final int N = 50; // how many times to hit back button
    try {
        for (int i = 0; i < N; i++)
            Espresso.pressBack();
    } catch (NoActivityResumedException e) {
        Log.e("TAG", "Closed all activities", e);
    }
}
 
Example 3
Project: TextSecureSMP   File: EspressoUtil.java   View source code 5 votes vote down vote up
public static void closeAllActivities() throws Exception {
  for (int i = 0; i < 10; i++) {
    try {

      pressBack();

    } catch (NoActivityResumedException e) {
      Log.d(TAG, "you made me do this, android");
      return;
    }
  }

  throw new IllegalStateException("what are you doing with 10 open activities?!");
}