I know there are a lot of questions around this, but I can not find anything to help me :(
I tried using Espresso to create a UI test for an Android application. After beating problems with dependencies (because some libraries are included twice in different versions depending on other libraries), I still cannot create working tests ...
I know about IdlingResource, but reading, the espresso waits out of the box until the main thread and AsyncTaskPool are idle before running any tests.
To contact him, I created a simple application containing two activities: a pop-up window and the main action. A popup window contains something like this to wait for three seconds before launching mainActivity
new Handler().postDelayed(new Runnable() { @Override public void run() { finish(); Intent intent = new Intent(SplashScreenActivity.this, MainActivity.class); startActivity(intent); } }, 3000);
I also tried using AsyncTask for this, but nothing works correctly, because each test fails.
The test checks whether a TextView containing specific text is displayed in the form:
onView(withText("DummyText")).check(matches(notNullValue()));
I thought it would not be so difficult to create a simple test ...
Because I have to test against api> = 16 I need espresso. Only for me I tested it using uiAutomator (I know this for api> = 18), but there is such clever logic to wait for something to be shown ..... and it works fine ...
source share