Java Code Examples for android.support.test.espresso.Espresso#registerIdlingResources()
The following examples show how to use
android.support.test.espresso.Espresso#registerIdlingResources() .
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: RxAndroidJUnitRunner.java From ribot-app-android with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle arguments) { super.onCreate(arguments); RxIdlingResource rxIdlingResource = new RxIdlingResource(); RxJavaPlugins.getInstance() .registerObservableExecutionHook(new RxIdlingExecutionHook(rxIdlingResource)); Espresso.registerIdlingResources(rxIdlingResource); }
Example 2
Source File: HugeEventActivityTest.java From NYBus with Apache License 2.0 | 5 votes |
@Before public void registerIdlingResource() { List<View> viewList = Arrays.asList(mActivityRule.getActivity() .findViewById(R.id.textView)); mIdlingResource = new ViewIdlingResource(viewList); Espresso.registerIdlingResources(mIdlingResource); }
Example 3
Source File: BaseTests.java From PatternedTextWatcher with MIT License | 5 votes |
@Before public void setUp() throws Exception { editText = activityRule.getActivity().editText; TestActivity activity = activityRule.getActivity(); viewDirtyIdler = new ViewDirtyIdlingResource(activity); Espresso.registerIdlingResources(viewDirtyIdler); }
Example 4
Source File: MainActivityTests.java From PhilHackerNews with MIT License | 5 votes |
@Before public void registerIdlingResource() { PhilHackerNewsApplication application = (PhilHackerNewsApplication) mActivityTestRule.getActivity().getApplication(); application.getObjectGraph().inject(this); mSyncAdapterIdlingResource = new SyncAdapterIdlingResource(mDataSynchronizer); Espresso.registerIdlingResources(mSyncAdapterIdlingResource); }
Example 5
Source File: LoginInstrumentedTest.java From flowless with Apache License 2.0 | 5 votes |
@Before public void setup() { Espresso.registerIdlingResources(EspressoIdlingResource.getIdlingResource()); mainActivityActivityTestRule.launchActivity(null); Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); MainActivity mainActivity = mainActivityActivityTestRule.getActivity(); instrumentation.runOnMainSync(() -> { Flow.get(mainActivity.getBaseContext()).setHistory(History.single(LoginKey.create()), Direction.REPLACE); }); ServiceProvider serviceProvider = ServiceProvider.get(mainActivity.getBaseContext()); LoginComponent loginComponent = serviceProvider.getService(LoginKey.create(), DaggerService.TAG); loginPresenter = loginComponent.loginPresenter(); }
Example 6
Source File: RepositoriesInstrumentedTest.java From flowless with Apache License 2.0 | 5 votes |
@Before public void setup() { Espresso.registerIdlingResources(EspressoIdlingResource.getIdlingResource()); mainPage = new MainPage(); repositoriesPage = new RepositoriesPage(); mainActivityActivityTestRule.launchActivity(null); Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); MainActivity mainActivity = mainActivityActivityTestRule.getActivity(); instrumentation.runOnMainSync(() -> { Flow.get(mainActivity.getBaseContext()).setHistory(History.single(RepositoriesKey.create()), Direction.REPLACE); }); }
Example 7
Source File: StepperNavigationActions.java From android-material-stepper with Apache License 2.0 | 5 votes |
@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 8
Source File: GroupSetTest.java From Android with MIT License | 5 votes |
@Test public void runTest()throws Exception{ ElapsedTimeIdlingResource idlingResource = new ElapsedTimeIdlingResource(1000 * 1); Espresso.registerIdlingResources(idlingResource); groupNameTest(); myNameTest(); qrcodeTest(); managerTest(); checkTest(); otherTest(); }
Example 9
Source File: MainActivityTest.java From Cappuccino with Apache License 2.0 | 5 votes |
@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 10
Source File: Step4CalculatorActivityFinalTest.java From android-agera with Apache License 2.0 | 4 votes |
@Before public void registerIdlingResource() { mIdlingResource = newThreadPoolIdlingResource(CalculatorExecutor.EXECUTOR, "resultRepo"); Espresso.registerIdlingResources(mIdlingResource); }
Example 11
Source File: TimeIdlingResource.java From AndroidSchool with Apache License 2.0 | 4 votes |
@NonNull public static IdlingResource timeout(long waitTimeMs) { IdlingResource idlingResource = new TimeIdlingResource(waitTimeMs); Espresso.registerIdlingResources(idlingResource); return idlingResource; }
Example 12
Source File: SampleListStepDefinitions.java From material-activity-chooser with Apache License 2.0 | 4 votes |
@Before public void before() { Espresso.registerIdlingResources(mBottomSheetIdlingResource); Intent dummyIntent = new Intent(DUMMY_ACTION); mStubbedEmptyViewActionPendingIntent = PendingIntent.getBroadcast(InstrumentationRegistry.getTargetContext(), TEST_REQUEST_CODE, dummyIntent, PendingIntent.FLAG_UPDATE_CURRENT); }
Example 13
Source File: BaseTestLocker.java From redux-android-sample with Apache License 2.0 | 4 votes |
/** Register idling resources don't stop flow when junit asserts is used **/ public void registerIdlingResource() { Espresso.registerIdlingResources(this); }
Example 14
Source File: RealServerTest.java From AndroidHttpMockingExamples with Apache License 2.0 | 4 votes |
@Before public void setUp() { idlingResource = OkHttp3IdlingResource.create("OkHttp", InjectionFactory.okHttpClient); Espresso.registerIdlingResources(idlingResource); }
Example 15
Source File: ChangeTextBehaviorTest.java From testing-cin with MIT License | 4 votes |
@Before public void registerIdlingResource() { mIdlingResource = mActivityRule.getActivity().getIdlingResource(); // To prove that the test fails, omit this call: Espresso.registerIdlingResources(mIdlingResource); }
Example 16
Source File: Cappuccino.java From Cappuccino with Apache License 2.0 | 3 votes |
/** * Convenience method for {@link Espresso#registerIdlingResources(android.support.test.espresso.IdlingResource...) * Espresso#registerIdlingResources(IdlingResource...)}, which first instantiates an {@link CappuccinoIdlingResource}, * then registers it with {@code Espresso}. * * @param name The name from which to generate an {@code CappuccinoIdlingResource}. * @throws CappuccinoException if there is no {@code CappuccinoResourceWatcher} associated * with the given {@param name}. */ public static void registerIdlingResource(@NonNull String name) { throwIfAbsent(name); CappuccinoIdlingResource idlingResource = new CappuccinoIdlingResource(name); mIdlingResourceRegistry.put(name, idlingResource); Espresso.registerIdlingResources(idlingResource); }
Example 17
Source File: SplashActivityNoConnectionTestUI.java From openshop.io-android with MIT License | 2 votes |
/** * Prepare your test fixture for this test. In this case we register an IdlingResources with * Espresso. IdlingResource resource is a great way to tell Espresso when your app is in an * idle state. This helps Espresso to synchronize your test actions, which makes tests significantly * more reliable. */ @Before public void registerIdlingResource() { Espresso.registerIdlingResources(MyApplication.getInstance().getCountingIdlingResource()); }
Example 18
Source File: SplashActivityTestUI.java From openshop.io-android with MIT License | 2 votes |
/** * Prepare your test fixture for this test. In this case we register an IdlingResources with * Espresso. IdlingResource resource is a great way to tell Espresso when your app is in an * idle state. This helps Espresso to synchronize your test actions, which makes tests significantly * more reliable. */ @Before public void registerIdlingResource() { Espresso.registerIdlingResources(MyApplication.getInstance().getCountingIdlingResource()); // SettingsMy.setActualShop(null); USE this and look how to start activity with different intent. }
Example 19
Source File: NoteDetailScreenTest.java From androidtestdebug with MIT License | 2 votes |
/** * Convenience method to register an IdlingResources with Espresso. IdlingResource resource is * a great way to tell Espresso when your app is in an idle state. This helps Espresso to * synchronize your test actions, which makes tests significantly more reliable. */ private void registerIdlingResource() { Espresso.registerIdlingResources( mNoteDetailActivityTestRule.getActivity().getCountingIdlingResource()); }
Example 20
Source File: AddNoteScreenTest.java From androidtestdebug with MIT License | 2 votes |
/** * Prepare your test fixture for this test. In this case we register an IdlingResources with * Espresso. IdlingResource resource is a great way to tell Espresso when your app is in an * idle state. This helps Espresso to synchronize your test actions, which makes tests significantly * more reliable. */ @Before public void registerIdlingResource() { Espresso.registerIdlingResources( mAddNoteIntentsTestRule.getActivity().getCountingIdlingResource()); }