• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IdlingRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.support.test.espresso.IdlingRegistry的典型用法代码示例。如果您正苦于以下问题:Java IdlingRegistry类的具体用法?Java IdlingRegistry怎么用?Java IdlingRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IdlingRegistry类属于android.support.test.espresso包,在下文中一共展示了IdlingRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: waitFor

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
private static void waitFor(long waitingTime, boolean success) {
  // Start
  onView(withId(R.id.toggle_button))
      .check(matches(withText(R.string.start)))
      .perform(click());

  // Make sure Espresso does not time out
  IdlingPolicies.setMasterPolicyTimeout(waitingTime * 2, TimeUnit.MILLISECONDS);
  IdlingPolicies.setIdlingResourceTimeout(waitingTime * 2, TimeUnit.MILLISECONDS);

  // Now we wait
  IdlingResource idlingResource = new ElapsedTimeIdlingResource(waitingTime);
  IdlingRegistry.getInstance().register(idlingResource);

  // Stop and verify
  onView(withId(R.id.toggle_button))
      .check(matches(withText(R.string.stop)))
      .perform(click());
  onView(withId(R.id.result))
      .check(matches(withText(success ? R.string.success: R.string.failure)));

  // Clean up
  IdlingRegistry.getInstance().unregister(idlingResource);
}
 
开发者ID:chiuki,项目名称:espresso-samples,代码行数:25,代码来源:MainActivityTest.java


示例2: setupRxScheduler

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
private static void setupRxScheduler() {
	CountingIdlingResource idlingResource = new CountingIdlingResource("rxJava");
	IdlingRegistry.getInstance().register(idlingResource);

	RxJavaTestScheduler.init(s -> Schedulers.from(runnable -> {
		idlingResource.increment();
		new Thread(() -> {
			runnable.run();
			idlingResource.decrement();
		}).start();
	}));
}
 
开发者ID:leocabral,项目名称:lacomida,代码行数:13,代码来源:AbstractEspressoTestCase.java


示例3: testFabButtonAndList

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Test
public void testFabButtonAndList() {
    IdlingResource ir = new RecyclerViewScrollingIdlingResource((RecyclerView) activity.findViewById(R.id.list));
    IdlingRegistry.getInstance().register(ir);
    Matcher listMatcher = withId(R.id.list);
    onView(listMatcher).perform(smoothScrollTo(12));
    onView(withId(R.id.fab)).perform(click());
    onView(listMatcher).perform(smoothScrollTo(0));
    onView(withId(R.id.fab)).perform(click());
    IdlingRegistry.getInstance().unregister(ir);
}
 
开发者ID:DimaKoz,项目名称:meat-grinder,代码行数:12,代码来源:MainActivityTest.java


示例4: setUp

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Intents.init();

    mIdlingResource = mActivityRule.getActivity().getIdlingResource();
    IdlingRegistry.getInstance().register(mIdlingResource);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:8,代码来源:AuthTest.java


示例5: tearDown

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDown() {
    Intents.release();

    if (mIdlingResource != null) {
        IdlingRegistry.getInstance().unregister(mIdlingResource);
    }
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:9,代码来源:AuthTest.java


示例6: name

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Test
public void name() {
  IdlingResource idlingResource = OkHttp3IdlingResource.create(
      "okhttp", OkHttpProvider.getOkHttpInstance());
  IdlingRegistry.getInstance().register(idlingResource);

  onView(withId(R.id.name))
      .check(matches(withText("Chiu-Ki Chan")));

  IdlingRegistry.getInstance().unregister(idlingResource);
}
 
开发者ID:chiuki,项目名称:espresso-samples,代码行数:12,代码来源:MainActivityTest.java


示例7: unregisterIdlingResource

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void unregisterIdlingResource() {
    IdlingRegistry.getInstance().unregister(
            mAddTaskIntentsTestRule.getActivity().getCountingIdlingResource());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:AddEditTaskScreenTest.java


示例8: tearDown

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
/**
 * Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
 */
@After
public void tearDown() throws Exception {
    IdlingRegistry.getInstance().unregister(
            mTasksActivityTestRule.getActivity().getCountingIdlingResource());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:TasksScreenTest.java


示例9: registerOkHttp

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
public static void registerOkHttp(OkHttpClient client) {
    IdlingRegistry.getInstance().register(OkHttp3IdlingResource.create("okhttp", client));
}
 
开发者ID:iamBedant,项目名称:InstantAppStarter,代码行数:4,代码来源:IdlingResources.java


示例10: registerIdlingResource

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void registerIdlingResource() {
    IdlingRegistry.getInstance().register(EspressoIdlingResource.getIdlingResource());
}
 
开发者ID:Frank1234,项目名称:FireBaseTest,代码行数:5,代码来源:HomeScreenTest.java


示例11: unregisterIdlingResource

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void unregisterIdlingResource() {
    IdlingRegistry.getInstance().unregister(EspressoIdlingResource.getIdlingResource());
}
 
开发者ID:Frank1234,项目名称:FireBaseTest,代码行数:5,代码来源:HomeScreenTest.java


示例12: setUp

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void setUp() {
    loadingIdlingResource = new SessionLoadedIdlingResource();
    IdlingRegistry.getInstance().register(loadingIdlingResource);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:6,代码来源:PageVisitTest.java


示例13: tearDown

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
    IdlingRegistry.getInstance().unregister(loadingIdlingResource);

    mActivityTestRule.getActivity().finishAndRemoveTask();
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:7,代码来源:PageVisitTest.java


示例14: setUpIdlingResources

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void setUpIdlingResources() {
    loadingIdlingResource = new SessionLoadedIdlingResource();
    IdlingRegistry.getInstance().register(loadingIdlingResource);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:6,代码来源:ScreenshotTest.java


示例15: tearDownIdlingResources

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDownIdlingResources() {
    IdlingRegistry.getInstance().unregister(loadingIdlingResource);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:5,代码来源:ScreenshotTest.java


示例16: tearDown

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
    mActivityTestRule.getActivity().finishAndRemoveTask();

    IdlingRegistry.getInstance().unregister(loadingIdlingResource);
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:7,代码来源:ToggleBlockTest.java


示例17: enableForCurrentTestCase

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
/**
 * Enable IdlingResource for the current test case (useful when defaultEnabled = false).
 */
public void enableForCurrentTestCase() {
    IdlingRegistry.getInstance().register(mFirebaseOperationIdlingResource);
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:7,代码来源:FirebaseOperationInProgressRule.java


示例18: after

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Override
protected void after() {
    IdlingRegistry.getInstance().unregister(mFirebaseOperationIdlingResource);
    // TODO(dotdoom): move this to a more appropriate place
    CrashlyticsTestExtension.sendReportsNow();
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:7,代码来源:FirebaseOperationInProgressRule.java


示例19: registerOkHttp

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
public static void registerOkHttp(OkHttpClient client) {
  IdlingRegistry.getInstance().register(OkHttp3IdlingResource.create(
      "okhttp", client));
}
 
开发者ID:chiuki,项目名称:espresso-samples,代码行数:5,代码来源:IdlingResources.java


示例20: registerIdlingResource

import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
/**
 * 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() {
    IdlingRegistry.getInstance().register(
            mAddTaskIntentsTestRule.getActivity().getCountingIdlingResource());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:AddEditTaskScreenTest.java



注:本文中的android.support.test.espresso.IdlingRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Nodes类代码示例发布时间:2022-05-22
下一篇:
Java SchedulerAppReport类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap