xiezefan/android-test-kit

openActionBarOverflowOrOptionsMenu does not work with non-english locale & proguard used

Opened this issue · 1 comments

What steps will reproduce the problem?
1. build a simple test with openActionBarOverflowOrOptionsMenu()
2. use proguard for test build 
2. set device/avd to non english locale (in my case german)
3. run test

or:
1. checkout https://github.com/issuerepro/android-proguard-testing
2. use english avd/device
3. run gradlew connectedcheck
4. set to non-english
5. run gradlew connectedcheck again

What is the expected output?
passing test

What do you see instead?
*.MainActivityTest > testImprint[Galaxy_Nexus_API_21_with_Google(AVD) - 5.0.2] 
FAILED
        android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: ((is displayed on the screen to the user and with content description: is "More options") or (is displayed on the screen to the user and with class name: a string ending with "OverflowMenuButton"))

What version of the product are you using? On what operating system?
- com.android.support.test.espresso:espresso-core:2.0
- com.android.support.test:testing-support-lib:0.1
- com.android.tools.build:gradle:1.2.0-beta4
- API 21 AVD

Please provide any additional information below.
the test passes when running without obfuscation.

i think the issue is in the "OVERFLOW_BUTTON_MATCHER" in Espress.class
it checks for a view with descrtiption "More options" or a view with classname 
ending in"OverflowMenuButton". the first one is invalidated by the non engish 
locale and i asume the second one by the obfuscation.


best would be - if it exists - to use an android.R.strings.XXX id instead of 
the hardcoded "More options".

Original issue reported on code.google.com by kujans...@gmail.com on 18 Apr 2015 at 8:06

Original comment by nkors...@google.com on 5 May 2015 at 5:34

  • Changed state: Accepted