android / android/android-test

Espresso longClick is performed in subsequent activities (in AVD, API 29)

Offen
#663 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Java
Sterne
1.2k
Forks
342
Ø Merge
11 Std. 29 Min.
Gemergte PRs (30 T.)
2

Beschreibung

Description

Espresso longClick is performed in subsequent activities. This happens in AVD with API level 29. Same tests ran against real device works fine (same API level).

Steps to Reproduce

Assume you have following app:

  • main activity have a view that has a longClick listener that sends you to second activity
  • second activity have a view that has a longClick listener that sends you to third activity

When you try to perform longClick on that view in main acitivity with Espresso, the long click is carried over to second activity and it's triggered again, resulting in loading third activity
When the same scenario is done with ui-automator, long click works fine.

Please also note that it's reproducible in AVD. On real device (tried on Samsung Galaxy S10) it works fine.

Expected Results

longClick should only be performed on single view.

Actual Results

Espresso longClick is performed in subsequent activities

androidx.test.espresso.PerformException: Error performing 'long click' on view 'with id: com.example.espressoviewaction:id/text'.
...
Caused by: java.lang.RuntimeException: Couldn't click at: 539.5,1153.5 precision: 16.0, 16.0 . Tapper: LONG coordinate provider: CENTER precision describer: FINGER. Tried 3 times. With Rollback? false
...

AndroidX Test and Android OS Versions
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'

Tried on API 29

Link to a public git repo demonstrating the problem:

Example app and both espresso and ui-automator tests can be found here: https://github.com/pmichalskiGD/EspressoViewAction

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Führe zunächst das öffentliche Repository EspressoViewAction auf einem API-29-AVD aus und vergleiche seine Espresso- und UI-Automator-Tests. Verfolge, wie der Long Click zugestellt wird, wenn die erste Activity zur zweiten wechselt. Als erledigt gilt die Aufgabe, wenn ein Long Click nur die View in der aktuellen Activity auslöst und die Reproduktion die dritte Activity nicht mehr erreicht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
mobile-dev, testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.