Questions tagged [android-espresso]

Espresso is a library which is used to write Android UI tests. It is also known as Google's Testing Tools For Android

Also called android-test-kit, Espresso helps to create faster UI tests for Android.

The core API is small, predictable, and easy to learn and yet remains open for customization. Espresso tests state expectations, interactions, and assertions clearly without the distraction of boilerplate content, custom infrastructure, or messy implementation details getting in the way.

Espresso tests run optimally fast! Leave your waits, syncs, sleeps, and polls behind and let Espresso gracefully manipulate and assert on the application UI when it is at rest. Enjoy writing and executing your tests today - try a shot of Espresso!

Useful links

3335 questions
2
votes
1 answer

Obtain EditText string with Espresso

I am trying to automate some tests with Espresso. I can not find a way to get the string of an EditText element. I have tried onView(withId(R.id.edit_message)).toString() but it does not work. I cant seem to save the EditText element into a…
2
votes
1 answer

TypeText doesn't work

Trying to test my sign in with espresso. If i click just on my field, then all work is well. ViewInteraction linearLayout = onView( allOf(childAtPosition( allOf(withId(R.id.nameEditText), …
Inkognito
  • 197
  • 15
2
votes
2 answers

How to access child view of recycler view in android espresso?

I am writing Espresso unit testing for Recycler view. In recycler view I have text view which is clickable. I want to perform click event on text view in espresso testing. So how to access that text view?
Newts
  • 1,354
  • 14
  • 23
2
votes
0 answers

Espresso test not asserting when launching activity twice

I am running an instrumentation test to check if a dialog is shown when setting specific parameters on intent @Test public void shouldShowNotificationContentWhenActivityIsDestroyed() { final String NOTIFICATION_TITLE = "Título"; final String…
Nicolás Arias
  • 1,053
  • 1
  • 12
  • 29
2
votes
1 answer

Android Espresso tests (written in Kotlin) cannot see main classes and packages

I have an issue with Kotlin Espresso tests. I have applied Kotlin-Android Gradle plugin in the module's build script, and the tests run without issues in Android Studio (the test class is annotated and run by AndroidJUnit4 runner), but running the…
Javad
  • 5,755
  • 4
  • 41
  • 51
2
votes
3 answers
2
votes
2 answers

Android UI unit-tests: how to find dynamically added checkbox?

In my android app, I have a ListView of custom items (made of a clickable title + one checkbox without text). Those items are dynamically added. How can I check one of those checkboxes in my unit tests using Espresso or a similar framework ? I…
Julien__
  • 1,962
  • 1
  • 15
  • 25
2
votes
1 answer

Android Espresso perform click on first match

Is there a method firstMatch() in the Espresso library? Right now I am getting this exception android.support.test.espresso.AmbiguousViewMatcherException matches multiple views in the hierarchy. I have a RecyclerView and some of the items are…
Murat Karagöz
  • 35,401
  • 16
  • 78
  • 107
2
votes
2 answers

Create or launch Android emulator from terminal with animations disabled for Espresso testing

Does anyone know if it is possible to either create or launch an Android emulator from the terminal with the animation scale set to 0 so that I can automate the running of Espresso tests? The only command I can find in the 'emulator' documentation…
user3265561
  • 812
  • 7
  • 22
2
votes
1 answer

Android Espresso - Testing on different Activities

I'm writing tests for my Android App with the Espresso framework. This seems to work fine so far. Problem is that I sometimes have to change the Activity. In this specific case clicking a button opens the Google PlacePicker for selecting a certain…
2
votes
0 answers

How can I cast MenuItem to ActionMenuItem in espresso?

onView(withId(com.help.R.id.menu_item)).check(matches(CustomMatchers.withActionIconDrawableNumberOflayers(2))); Here I am using a Custom Matcher to check the number of layers on the menu item. public static Matcher
2
votes
1 answer

Android: how to use Espresso 2.2.2 with Support 25.0.0?

How can I get this working? I read many similar strategies, alas. Using a support lib higher than 23.1.1 fails times and again. dependencies { compile 'com.android.support:design:25.0.0' compile 'com.android.support:support-v4:25.0.0' compile…
2
votes
1 answer

Warning:Conflict with dependency 'com.android.support:support-annotations' (25.0.1)

Okay, I know, a similar question has been asked several times but I can't find a solution for my problem. I need to test my application. So I followed a tutorial telling me to add Android runnter support. androidTestCompile…
Tobias Reich
  • 4,952
  • 3
  • 47
  • 90
2
votes
1 answer
2
votes
0 answers

How to access the context in Test Activity while using Mockito and Dagger 2

I have a class String.java which has a method public String getTermsandCondition(Context context) { String versionName = SystemUtils.getAppVersionName(context); return "version:"+ versionName; } So i'm using this method in my MainActivity.Java…
Osama Aftab
  • 1,161
  • 9
  • 15