android / android/android-test

isDisplayingAtLeast does not check whether a parent obscures the view

Offen
#463 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
1.2k
Forks
342
Ø Merge
11 Std. 29 Min.
Gemergte PRs (30 T.)
2

Beschreibung

### Description

According to the [documentation](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.html#isdisplayingatleast) isDisplayingAtLeast:

> Returns a matcher which accepts a view so long as a given percentage of that view's area **is not obscured by any parent view** and is thus visible to the user.

That's not what happens. It actuality the matcher only checks whether a sufficient portion of the view area is within the boundaries of the screen. It's evident from examining the code of `IsDisplayingAtLeastMatcher#matchesSafely`.

### Steps to Reproduce

Make the parent view clip a portion of the child view, e.g.:

```jsx

```

only 74% of the child view will be visible to the user, the bottom 26% will be clipped by the parent. Both views will render within the boundaries of the screen.

### Expected Results

`isDisplayingAtLeast(75)` should fail.

### Actual Results

`isDisplayingAtLeast(75)` passes even though only 74% is displayed.

### AndroidX Test and Android OS Versions

Android 9, espresso-core 3.1.1

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne bei IsDisplayingAtLeastMatcher#matchesSafely und reproduziere den bereitgestellten Fall der Beschneidung von Parent/Child. Verfolge, wie der angezeigte Bereich berechnet wird, und überprüfe anschließend, dass isDisplayingAtLeast(75) fehlschlägt, wenn der Parent 26 % des Childs beschneidet, während ein nicht verdeckter Fall weiterhin erfolgreich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
mobile-dev, testing
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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