3,333 questions
0
votes
1
answer
72
views
Espresso.onIdle() return error java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
After updating Kotlin to 2.2.0, my autotest started failing on the start screen with the following error in Espresso class on compose view:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
...
0
votes
0
answers
25
views
How to test Android app with Entra ID login (Espresso) and verify data saving on server?
I am developing an Android app that uses Microsoft Entra ID login for authentication.
After a successful login, the app fetches some user data and also allows saving additional data to the server.
I ...
0
votes
0
answers
27
views
Testing warm start deeplinks using ActivityScenario
I'm trying to switch from the deprecated ActivityTestRule to ActivityScenarioRule but facing an issue with some of the tests. I found out that I need to move from startActivity to ActivityScenario....
0
votes
1
answer
83
views
Android Espresso - Issues with rotating emulator via onDevice().setScreenOrientation due to network/proxy/grpc issues
I want to be able to call a function during Espresso UI testing to rotate the device from portrait to landscape.
I followed this guide from the docs exactly. I have a brand new API 34 emulator, my SDK ...
0
votes
1
answer
93
views
composeRule.onNode(isDialog()).assertIsNotDisplayed() fails. OK, how do I find what Compose Dialog is displayed?
I'm writing an Android app using Jetpack Compose. It has some dialogs. I am testing with Espresso that they disappear when appropriate. When everything's working right, I can test that all dialogs ...
0
votes
0
answers
37
views
Espresso perform click not working on API 35 but manual click does
I have a large app with hundreds of UI tests, and moving from an emulator on API 34 to 35 causes exactly one failure.
A simple perform(click()) call on spanned text does not work, yet does not fail. ...
0
votes
1
answer
31
views
ProGuard causing instrumentation test to fail when using Espresso's IdlingResource: "isIdleNow() is returning true, but a message ... was never sent"
I have an instrumentation test that's using UriIdlingResource from Espresso to keep track of when the app is running API requests in the background so that the test code can wait until the app is idle ...
1
vote
1
answer
43
views
Android Espresso: How do I find the last (Non-ListView) table entry and extract View values?
I am trying to get into android espresso and have been given an .apk to try things out. Setting aside the legwork how I managed to get the test to run, I am now trying to figure out how to find the ...
0
votes
1
answer
36
views
How to set a value on a Slider and trigger onChange or OnSliderTouchListener during Espresso testing?
When testing with Espresso, setting a value on a Slider directly does not trigger the onChange or OnSliderTouchListener callbacks.
I haven't found any official documentation or reliable information ...
0
votes
0
answers
19
views
How to change device settings before android autotest starts(Disable animations). Kotlin API level 35 [duplicate]
can you tell me how I can change the emulator settings before running Android tests. I want to disable animations on the device before starting the test. But I can't find a way how.
0
votes
0
answers
33
views
Espresso 3.4.0: Certificate transparency failed
When I upgrade the Espresso Accessibility from 3.3.0 to 3.4.0 and higher, I get the following error which makes the test unable to launch the app:
SSLHandshakeException: Certificate transparency ...
0
votes
1
answer
122
views
In which package are androidx.test.core.app.DeviceCapture.takeScreenshot or androidx.test.espresso.screenshot.captureToBitmap located
I'm trying to update my screenshot routine used in the instrumentation tests of multiple projects using the new suggested method. Which is, of course, more complicated then the pervious version.
There ...
0
votes
1
answer
166
views
java.lang.IllegalStateException: Cannot move to state "RESUMED" since the Activity has been destroyed already
I have updated my test cases dependencies from this to this(as given below in code snippet ), since then I am facing this error of java.lang.NullPointerException: Cannot run onActivity since Activity ...
0
votes
2
answers
57
views
Unable to Run Kaspresso Sample: Execution failed for task ':samples:kaspresso-sample:connectedDebugAndroidTest'
I am trying to run the official Kaspresso sample project from the GitHub repository: Kaspresso on GitHub. However, when I attempt to execute the sample tests, I encounter the following error:
...
2
votes
1
answer
304
views
Does Hilt still require kaptAndroidTest when ksp is enabled for Android (Instrumentation) tests?
I'm working on an Android project where I'm using Hilt for dependency injection and have recently enabled KSP (Kotlin Symbol Processing) to replace KAPT (Kotlin Annotation Processing Tool). My setup ...
0
votes
1
answer
57
views
Flaky Espresso test sometimes throws AmbiguousViewMatcherException
I ran into an issue at work where an Espresso test failed once about every 10-20 times. When it failed, it was with an AmbiguousViewMatcherException. What seemed to be happening is that when slides ...
0
votes
1
answer
82
views
Access MockWebServer from outside of the JVM
I am writing Espresso UI tests with okhttp3.mockwebserver.MockWebServer. I am facing an issue, that my MockWebServer is not accessible from the application running in AVD.
This works:
Access the ...
0
votes
0
answers
38
views
Unable to display mocked location in Google Maps during Espresso tests on Android
I am using Espresso tests to test my Android (targetSDKVersion: 34) app. The app includes a module that uses Google Maps and location services. I want to mock the location to simulate user movement ...
0
votes
1
answer
52
views
How to synchronize Python scripts and Espresso tests for E2E testing with Firebase Realtime Database?
I have developed an Android app that integrates with Firebase Firestore and Realtime Database. I now want to perform End-to-End (E2E) tests that involve Firebase.
Test Setup:
I am using Espresso for ...
0
votes
1
answer
37
views
Espresso Test for Activity with Forced Portrait Mode Fails Orientation Assertion
I am testing an Android app using Espresso, and I have an activity that should only be displayed in portrait mode. To enforce this, I programmatically lock the activity in portrait mode when it is ...
0
votes
1
answer
138
views
Code Coverage For Android Integration Tests In Multi-Module App
I am looking for some help generating a code coverage report for Android integration tests in a multi-module project. Specifically I have an app module along with a mix of android and java library ...
0
votes
1
answer
19
views
Integer gives NPE in launchFragmentInContainer bundle in espresso testing
I have a fragment which waits for an integer from args. The code itself works fine, but when I want to write a UI test for this fragment it gives me a
java.lang.NullPointerException: null cannot be ...
3
votes
0
answers
175
views
Can't test Flow<PagingData<T>>.cachedIn
In my viewmodel I get a Flow<PagingData> by calling the use case in charge of doing it, and then caching it, as recommend it by android developer's guide, like this:
val bestRatedRepos: Flow<...
2
votes
1
answer
124
views
androidTest (instrumented): How to click the ALLOW button on Android 8.0 (API 26)?
For an instrumented androidTest test, I need to click the ALLOW "button" as popped up by the system when the app starts on a device running Android 8 (API 26):
(Note: on Android 14 (API 34) ...
3
votes
1
answer
135
views
Android instrumented tests not all played on some devices
I have an Android app with 225 espresso tests.
Up to now, I have always been able to run all tests in a raw on all devices (Samsung smartphones and tablets, from Android 7 to 14)
I now have a brand ...
2
votes
1
answer
170
views
androidTest vs Appium -- are both needed in a given project?
The formal Android Developers documentation provides an enlightening introduction to the Fundamentals of testing Android apps.
I managed to successfully create 3 different types of test setups in ...
-1
votes
1
answer
39
views
Android Espresso Integration Test How To Run Code Before onCreate method of Activity?
How do i run code before onCreate called in my test activity?
@Before is called after onCreate which causes problems.
Im using
public ActivityScenarioRule<MyActivity> activityScenarioRule = new ...
1
vote
1
answer
230
views
androidx.test.espresso.screenshot.captureToBitmap with 3.6.x
Starting with Android Espresso libs 3.6.0 the captureToBitmap was changed
Previous with 3.5.x:
fun ViewInteraction.captureToBitmap(): Bitmap {
using it
onView(isRoot()).captureToBitmap()....
0
votes
1
answer
49
views
NoMatchingViewException error during Espresso test
I am doing an instrumentation test of Fragment is displayed or not. When I start the test it execute, I am able to see FragmentLogin view in physical device but test fail by saying androidx.test....
1
vote
0
answers
143
views
Why Android enforces me to use Hilt if I want to test @AndroidEntryPoint annotated classes (UI TEST) but hilt can not provide Activity object
I am trying to test a Main Activity class that is @AndroidEntryPoint using Hilt Testing in my Android application. The PermissionHelper class is defined as follows:
public class PermissionHelper {
...
1
vote
3
answers
620
views
Test not setup properly error in Jetpack Compose UI test using BDD (Cucumber)
I m trying to write a UI test using BDD + Compose but I keep getting the following error:
Test not setup properly. Use a ComposeTestRule in your test to be able to interact with composables
I have ...
2
votes
0
answers
124
views
How to use Android Espresso's intenting with Credential Manager
After migration to Credential Manager I can't find a way how to test sign-in scenarios for different cases.
When I used to use GoogleSignIn it was simple. The following code helped me:
protected fun ...
0
votes
0
answers
64
views
Espresso UI Tests Fail to Display Components with 0dp Width or Height in ConstraintLayout
I am encountering an issue with my Android application's UI tests using Espresso. When I run a UI test, almost nothing is visible on the screen. However, when I normally launch the application on a ...
0
votes
0
answers
17
views
Get SpinnerText from Espresso
After I select an item from spinner using index how do I get the name of the item selected and then compare it with the results shown on page.
I tried a custom matcher to get spinner text but it ...
0
votes
1
answer
98
views
Is it possible to specify multiple annotations into the --test-targets command
According to the firebase documentation I should be able to specify multiple test target filters - https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run#--test-targets
I've specified ...
1
vote
0
answers
77
views
Unable to find button via uiatuomator android benchmarking for a multimodular project
I have a multimodular project and I want to test benchmarking
These are my modules
:app [variant : debug, release ; flavors: prod, stage] [globalPackageName]
:presentation [loginPackageName]
:data
:...
1
vote
1
answer
46
views
Espresso does not match the found intents
I tried to mock the following using Matcher<Intent> on Android Espresso:
Intent { act=android.intent.action.CHOOSER (has extras) } handling packages:[[android, com.android.systemui]], extras:
[...
0
votes
1
answer
129
views
How to test with Espresso if the popup of an AutoCompleteTextView is open or not in my Android activity
I have an AutoCompleteTextView in my Android Activity
In my espresso test, I want to check if the popup with the proposals is opened or closed.
How can I do that?
I have tried many ideas, including:
...
0
votes
0
answers
99
views
Using Android Espresso to check Toast Messages
I'm having trouble checking if a Toast is present on the screen using Android Espresso.
Are there any other ways to do this?
In my specific case, the Toast is triggered on the login screen, but it's ...
3
votes
0
answers
81
views
java.lang.NoClassDefFoundError: Landroidx/concurrent/futures/CallbackToFutureAdapter$Resolver in Espresso UI Test
I'm encountering the following exception while running an Android Espresso UI test in Android Studio:
Java:
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/concurrent/futures/...
3
votes
1
answer
70
views
Click a PopupMenu button with Espresso?
Is there a way to click an item in an inflated PopupMenu anchored to a ListView item?
I have a PopupMenu that is created by clicking a button inside a ListView. I need to click an item inside the ...
5
votes
3
answers
2k
views
"Record espresso test" option is not enabled in Android Studio
The "Record espresso test" option is greyed out in Android Studio.
What are possible reasons for this?
I have installed the Espresso test dependencies and I have an emulator running.
0
votes
1
answer
60
views
Android: Parse JSON as gradle argument
I would need to parse the JSON as a gradle parameter to supply UI tests by that data. What I am currently doing in build.gradle:
def getJson() {
project.getProperties().get('getJson')
}
and then I am ...
4
votes
0
answers
795
views
Android espresso tests clash with ActivityScenario causing "main thread" error (Kotlin)
I have the following sample code:
@get:Rule
val activityRule = ActivityScenarioRule<KeyActivity>(intent)
@Test
fun test()
{
activityRule.scenario.onActivity {
...
0
votes
1
answer
157
views
CI Targeted Espresso tests
Is there a way that we can automatically and selectively run only relevant test cases per PR?
My company has Espresso test integrated in CI/CD pipeline so that each PR needs to go through espresso ...
0
votes
1
answer
124
views
Proper Espresso test setup for Fragment with RecyclerView using Databinding
I've been facing an issue when trying to run instrumented tests for a fragment.
With the code below, the test starts but looks like it never launches the fragment, gets stuck on loading. I need to ...
1
vote
3
answers
820
views
In an Espresso test, how can I wait for coroutines launch()ed by a scope from rememberCoroutineScope()?
My Android app is using Jetpack Compose. Inside one of my @Composable functions, I get a coroutine scope:
@Composable
fun MyComposable() {
val scope = rememberCoroutineScope()
// ...
Then, I ...
1
vote
0
answers
879
views
How to use compose test rule inside java test class with mix of compose and xml views
I am attempting to write UI tests for certain views, where some tests are already implemented in Java. I also aim to include tests for Compose views. However, in my attempts, using either test tags or ...
0
votes
1
answer
118
views
Espresso check content of next fragment in AndroidX Navigation
I'm testing the login feature with Espresso and it's correctly working as long as I check that the navigation action would bring the user to the fragment ith correct id.
@Test
fun loginLogout() {
...
2
votes
0
answers
272
views
Espresso test in an hybrid (Compose + XML) project
When i run my espresso test (see below) it cannot find a view by a given Text ("FindMeText"). Is it possible to execute some action on a Composable using espresso?
According to android docu ...