android / android/android-test

swipeLeft broke in androidx.test.espresso:espresso-core:3.5.0-alpha04

Open
#1,670 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

### Description

I'm trying to upgrade past androidx.test.espresso:espresso-core:3.5.0-alpha04 but something changed with swipeLeft() in that release. Although that [release introduced slowSwipeLeft()](https://github.com/android/android-test/commit/91d7cbc9392971ce33d5cba2649beed0b7b7a6ca), from looking at the change list, swipeLeft()'s behavior did not actually change, just its javadoc. So I'm thinking something else changed in that release.

### Steps to Reproduce

1. Create a Maplibre or Mapbox application. Here is how to initialize the mapView:

```
private lateinit var llMapViewContainer: ViewGroup
```
...
```
mapView = MapView(requireContext())
mapView!!.getMapAsync { mapboxMap: MapboxMap ->
mapboxMap.uiSettings.isAttributionEnabled = false
}
mapView!!.contentDescription = "myMapView"

mapViewContainer.addView(mapView)

mapView!!.onCreate(null)

mapView!!.onStart()
```

3. Register an OnMoveListener like this:

```
mapboxMap.addOnMoveListener(object : MapboxMap.OnMoveListener {
override fun onMoveBegin(detector: MoveGestureDetector) {
Log.d("mytag", "MapboxOnMoveListener onMoveBegin")
}

override fun onMove(detector: MoveGestureDetector) {
Log.d("mytag", "MapboxOnMoveListener onMove")
}

override fun onMoveEnd(detector: MoveGestureDetector) {
Log.d("mytag", "MapboxOnMoveListener onMoveEnd")
}
})
```

4. Depend on androidx.test.espresso:espresso-core:3.5.0-alpha04
5. Write an integration test that performs a`onView(withContentDescription("myMapView")).perform(swipeLeft())`
6. Observe that none of the "mytag" log messages appear in the logs even though they do if you downgrade to androidx.test.espresso:espresso-core:3.5.0-alpha03

### Expected Results

swipeLeft() should not only update the user interface but the component that I've registered a listener on (a Maplibre/Mapbox MapView in my case) should get notified so that it can call my callbacks on move start, on move, and on move end.

See at time 32 seconds in this [video](https://www.youtube.com/watch?v=yVacnzMTZFE) on the left side of the screen (uses androidx.test.espresso:espresso-core: prior to 3.5.0-alpha04) it shows how swipeLeft caused Maplibre's MapView to call my [onMoveEnd callback](https://maplibre.org/maplibre-gl-native/android/api/com/mapbox/mapboxsdk/maps/MapboxMap.OnMoveListener.html#onMoveEnd-com.mapbox.android.gestures.MoveGestureDetector-).

### Actual Results

The undesirable behavior I'm seeing is that although swipeLeft() causes a swipe gesture on a component (a Maplibre/Mapbox MapView in my case), that component no longer calls the callbacks it's supposed to call whenever it responds to a swipe (MapboxMap.OnMoveListener callbacks). The only change in code base is an upgrade from androidx.test.espresso:espresso-core:3.5.0-alpha03 to androidx.test.espresso:espresso-core:3.5.0-alpha04. I have not changed the version of Maplibre/Mapbox. So it has to be something in androidx.test.espresso:espresso-core:3.5.0-alpha04 that caused this behavior change.

See at time 32 seconds in this [video](https://www.youtube.com/watch?v=yVacnzMTZFE) on the right side of the screen it shows how swipeLeft no longer causes Maplibre's MapView to call my [onMoveEnd callback](https://maplibre.org/maplibre-gl-native/android/api/com/mapbox/mapboxsdk/maps/MapboxMap.OnMoveListener.html#onMoveEnd-com.mapbox.android.gestures.MoveGestureDetector-).

### AndroidX Test and Android OS Versions

Comparison of androidx.test.espresso:espresso-core:3.5.0-alpha03 which behaved correctly to androidx.test.espresso:espresso-core:3.5.0-alpha04 which does not behave corectly.

### Link to a public git repo demonstrating the problem:

See [video](https://www.youtube.com/watch?v=yVacnzMTZFE) referenced above at time 32 seconds which shows how `swipeLeft()` differed between androidx.test.espresso:espresso-core:3.5.0-alpha03 and androidx.test.espresso:espresso-core:3.5.0-alpha04.

Contributor guide

Open the contributing guide

Research direction

Start by comparing Espresso swipeLeft() behavior between espresso-core 3.5.0-alpha03 and 3.5.0-alpha04, using the MapView setup and OnMoveListener shown in the issue. Reproduce the integration test with onView(withContentDescription("myMapView")).perform(swipeLeft()) and inspect whether the three listener callbacks appear in the logs. Done means the newer version produces the expected callbacks without changing the Maplibre/Mapbox version.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.