android / android/android-test

Feature request: Espresso.openContextualActionModeOverflowMenu() should also work for DialogFragments

Open
#582 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
Espresso.openContextualActionModeOverflowMenu() assumes that the "more options" ("...") menu button is part of the normal main Fragment. It does not work when that button is part of a DialogFragment that has been opened on top of the main Fragment.
This is most likely due to the fact that for onView() instructions (which are used within openContextualActionModeOverflowMenu() ) to work correctly for DialogFragments, they must be used in combination with ".inRoot(isDialog())". However, ".inRoot(isDialog())" is never called in openContextualActionModeOverflowMenu.
It would be desirable if openContextualActionModeOverflowMenu could also be used for DialogFragments in such a szenario.

### Steps to Reproduce
- Start the test in a normal Fragment
- within the test, navigate to the DialogFragment that contains the "..." button
- call Espresso.openContextualActionModeOverflowMenu()

### Expected Results
Espresso.openContextualActionModeOverflowMenu() should correctly open the menu.

### Actual Results
"androidx.test.espresso.NoMatchingViewException" is thrown

Contributor guide

Open the contributing guide

Research direction

Start by locating Espresso.openContextualActionModeOverflowMenu() and inspect how its onView instructions select the menu button. Reproduce the issue with a DialogFragment and the reported NoMatchingViewException; done means the method opens the contextual overflow menu in that dialog scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.