private static void waitFor(long waitingTime, boolean success) { //Start onView(withId(R.id.toggle_button)) .check(matches(withText(R.string.start))) .perform(click()); //Mack 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); Espresso.registerIdlingResources(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 Espresso.unregisterIdlingResources(idlingResource); }
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); }
/** * Register idling resource to delay for given time. * * @param waitTimeMills Wait time in millisecond. */ public static void startDelay(long waitTimeMills) { // Make sure Espresso does not time out IdlingPolicies.setMasterPolicyTimeout(waitTimeMills * 2, TimeUnit.MILLISECONDS); IdlingPolicies.setIdlingResourceTimeout(waitTimeMills * 2, TimeUnit.MILLISECONDS); sTimeIdlingResource = new Delay(waitTimeMills); Espresso.registerIdlingResources(sTimeIdlingResource); }
@Before public void registerIntentServiceIdlingResource() { unlockScreen(); // Make sure Espresso does not time out IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS); IdlingPolicies.setIdlingResourceTimeout(30, TimeUnit.SECONDS); //Wait the activity to start completely MainActivity activity = mActivityRule.getActivity(); idlingResource = new MainActivityIdlingResource(activity); Espresso.registerIdlingResources(idlingResource); }
public static IdlingResource waitFor(long waitingTime) { // 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); Espresso.registerIdlingResources(idlingResource); return idlingResource; }
@Test public void testLoopback() throws InterruptedException { // The time to write down the data during closing of the program can take a while. IdlingPolicies.setMasterPolicyTimeout(240000, TimeUnit.MILLISECONDS); // During the time we sleep it will record video. Thread.sleep(10000); // Click on hang-up button. onView(withId(R.id.button_call_disconnect)).perform(click()); }
@OnStartTest() public void onStartTest(String featureName, String scenarioName) { IdlingPolicies.setMasterPolicyTimeout(30, TimeUnit.SECONDS); Log.v(runnerConfig.LogTag, "Starting Test: " + featureName + " - " + scenarioName); Intents.init(); }
@NonNull public static IdlingResource waitForDialog(@NonNull FragmentManager fragmentManager, @NonNull String tag) { IdlingPolicies.setMasterPolicyTimeout(3, TimeUnit.SECONDS); IdlingPolicies.setIdlingResourceTimeout(3, TimeUnit.SECONDS); IdlingResource idlingResource = new DialogFragmentIdlingResource(fragmentManager, tag); Espresso.registerIdlingResources(idlingResource); return idlingResource; }
@Override protected void before() throws Throwable { // Raise Idling policy timeout because emulator or network can be really slow. IdlingPolicies.setIdlingResourceTimeout(2, TimeUnit.MINUTES); IdlingPolicies.setMasterPolicyTimeout(2, TimeUnit.MINUTES); if (mDefaultEnabled) { enableForCurrentTestCase(); } }
public BaseIdlingResource() { IdlingPolicies.setIdlingResourceTimeout(DEFAULT_IDLING_TIMEOUT, TimeUnit.MILLISECONDS); }
public BaseIdlingResource(long timeout) { IdlingPolicies.setIdlingResourceTimeout(timeout, TimeUnit.MILLISECONDS); }
@Before public void resetTimeout() { IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS); IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS); }
public void detectIfNoToken() { IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS); IdlingPolicies.setIdlingResourceTimeout(60, TimeUnit.SECONDS); checkToken(); }
public static void setTestTimeoutSeconds(int seconds) { IdlingPolicies.setMasterPolicyTimeout( seconds, TimeUnit.SECONDS); IdlingPolicies.setIdlingResourceTimeout( seconds, TimeUnit.SECONDS); }
@Before public void setUp() { // ensure that espresso doesn't time out while we're intentionally idling. IdlingPolicies.setMasterPolicyTimeout(SplashActivity.DISPLAY_TIME * 2, TimeUnit.MILLISECONDS); IdlingPolicies.setIdlingResourceTimeout(SplashActivity.DISPLAY_TIME * 2, TimeUnit.MILLISECONDS); }
@BeforeClass public static void beforeClass() { IdlingPolicies.setMasterPolicyTimeout(600, TimeUnit.SECONDS); IdlingPolicies.setIdlingResourceTimeout(600, TimeUnit.SECONDS); }
@Before public void espressoPreconditions() { IdlingPolicies.setMasterPolicyTimeout(10, TimeUnit.MINUTES); }