Sha256: e57f2e60185317cd45dd74445b91eddce5cf3ff3c4ca5c9c8e51e3bde17d9f5b
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
package sh.calaba.instrumentationbackend.actions.view; import sh.calaba.instrumentationbackend.InstrumentationBackend; import sh.calaba.instrumentationbackend.Result; import sh.calaba.instrumentationbackend.TestHelpers; import sh.calaba.instrumentationbackend.actions.Action; import android.view.View; public class WaitForView implements Action { @Override public Result execute(String... args) { String text = args[0]; long endTime = System.currentTimeMillis() + 60000; while (System.currentTimeMillis() < endTime) { if (InstrumentationBackend.solo.searchButton(text) || searchForViewWithContentDescription(text)) { return Result.successResult(); } else { try { Thread.sleep(500); } catch (InterruptedException e) { return Result.fromThrowable(e); } } } return new Result(false, "Timed out while waiting for view with text or contentDescription:'" + text + "'"); } @Override public String key() { return "wait_for_view"; } private boolean searchForViewWithContentDescription(String description) { View view = TestHelpers.getViewByDescription(description); if (view != null) { return true; } else { return false; } } }
Version data entries
2 entries across 2 versions & 1 rubygems