android / android/testing-samples

Does Espresso work with viewBinding { enabled = true }

Open
#314 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.3k
Forks
3.6k
PR merge metrics
No merged PRs in 30d

Description

My espresso tests were working fine before I updated to AS 3.6 with
```
viewBinding {
enabled = true
}
```

Now, when I do something like this it is not working:

```
public static void tapCard(String PageName) throws Throwable {
Lets.performAndTakeSS(On.LocationsListDetails.CARDS_RECYCLER_VIEW, RecyclerViewActions.scrollTo(hasDescendant(EspressoMatchers.withText(EspressoMatchers.endsWith(PageName)))));
Lets.performAndTakeSS(On.LocationsListDetails.CARDS_RECYCLER_VIEW, RecyclerViewActions.actionOnItem(hasDescendant(EspressoMatchers.withText(EspressoMatchers.endsWith(PageName))), click()));
}
```

Am I supposed to change anything to work with viewbinding? Seeing this issue especially with Fragments.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Espresso failure after enabling viewBinding in the shown configuration, focusing on the tapCard helper and the fragment cases mentioned. Compare the behavior before and after viewBinding is enabled; done should establish whether a change is required for these Espresso interactions and document or verify the working behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.