当我登陆页面时,我不断收到此错误.有什么可以解决这个问题?
android.support.test.espresso.AppNotIdleException: Looped for 4539 iterations over 60 SECONDS. The following Idle Conditions failed .
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:580)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:92)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:56)
at android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)
at android.support.test.espresso.ViewInteraction.check(ViewInteraction.java:158)
Run Code Online (Sandbox Code Playgroud) 我试图获得一个实例WebView,以便我可以调用evaluateJavascript()它.我编写了一个自定义匹配器,然后尝试将其分配WebView给静态变量,如下所示:
public static WebView view1;
public static Matcher<View> isJavascriptEnabled1() {
return new BoundedMatcher<View, WebView>(WebView.class) {
@Override
public void describeTo(Description description) {
description.appendText("WebView with JS enabled");
}
@Override
public boolean matchesSafely(WebView webView) {
view1 =webView;
return webView.getSettings().getJavaScriptEnabled();
}
};
}
Run Code Online (Sandbox Code Playgroud)
在我的测试课中,我打电话给:
CustomMatcher.isJavascriptEnabled1();
CustomMatcher.view1.evaluateJavascript("$('.status dl dd').get(0).innerText.replace('pts.', '').replace(',', '').trim()\"]",new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
Log.d("LogName", s); // Prints asd
}
Run Code Online (Sandbox Code Playgroud)
});
我收到错误: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.webkit.WebView.evaluateJavascript(java.lang.String, android.webkit.ValueCallback)' on a null …
我有一个包含所有测试类的 test.espresso 包。我试图从命令行运行一个测试类,但它最终运行了所有测试类。
adb shell am instrument -w \ com.demo.app.test/android.support.test.runner.AndroidJUnitRunner
我如何只运行一个测试类。我想使用bamboo(就像jenkins)在单独的作业中单独运行所有测试类。