HakAl / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Enhancement with Patch: Provide ability to viewMatch Spinner for selected item's toString #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
onView(withId(R.id.my_spinner)).matches(withText(R.string.my_string))
onView(withId(R.id.my_spinner)).matches(withText("My String"))

What is the expected output? What do you see instead?
Expecting to see exceptions thrown when selected value of the spinner does not 
match. Currently seeing the following exception thrown:

com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler$As
sertionFailedWithCauseError: 'with text: is "My String"' doesn't match the 
selected view.
Expected: with text: is "My String"
Got: "Spinner{id=2131099680, res-name=my_spinner, visibility=VISIBLE, 
width=261, height=73, has-focus=false, has-focusable=true, 
has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, 
is-focusable=true, is-layout-requested=false, is-selected=false, 
root-is-layout-requested=false, has-input-connection=false, x=0.0, y=217.0, 
child-count=1}"

What version of the product are you using? On what operating system?
1.1 with Android Emulators

Please provide any additional information below.

Provided patch with following usage:
withSpinnerText(resource || String)

Patch adds appropriate methods to ViewMatchers.java and appropriate tests to 
ViewMatchersTest.java

Original issue reported on code.google.com by p.pr...@blueesoteric.com on 2 Jul 2014 at 8:59

Attachments:

GoogleCodeExporter commented 9 years ago
I have applied the WithSpinnerTextPatch patch my espresso lib but when I try to 
compile the source I get the following error:

[INFO] TestKit ............................................ SUCCESS [  0.002 s]
[INFO] Google Instrumentation TestRunner .................. SUCCESS [ 25.849 s]
[INFO] Google Instrumentation TestRunner-Runtime .......... SUCCESS [  0.172 s]
[INFO] Espresso Parent Project ............................ SUCCESS [  0.001 s]
[INFO] Espresso Testing Framework ......................... FAILURE [  2.754 s]
[INFO] Test App For UI Testing ............................ SKIPPED
[INFO] Tests For the Espresso Test Framework .............. SKIPPED
[INFO] Espresso Contrib Library ........................... SKIPPED
[INFO] Tests for the Espresso Contrib Library ............. SKIPPED
[INFO] Tests For the Test App ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.403 s
[INFO] Finished at: 2014-07-18T07:20:17-07:00
[INFO] Final Memory: 19M/241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
1:compile (default-compile) on project espresso: Compilation failure: Compilatio
n failure:
[ERROR] /C:/Users/hales/android-test-kit/espresso/lib/src/main/java/com/google/a
ndroid/apps/common/testing/ui/espresso/matcher/ViewMatchers.java:[802,49] cannot
 find symbol
[ERROR] symbol:   class Spinner
[ERROR] location: class com.google.android.apps.common.testing.ui.espresso.match
er.ViewMatchers

I get that it cant find the spinner class. do I need to add a dependency to the 
pom.xml file to get it to build with maven? Thanks in advance...

Original comment by scottrh...@gmail.com on 18 Jul 2014 at 2:33

GoogleCodeExporter commented 9 years ago
Sorry about that, embarrassingly that was apparently an early patch I made 
instead of the correct one. I've attached the correct patch here, though maybe 
someone can help me figure this part out. I've got the compile working, but 
every time I run verify, I run into problems at the Tests for espresso test 
framework part, due to the Hamcrest dependencies issue (noted in several other 
issues on this site). I've tried various solutions from changing to 
hamcrest-all to using excludes in different areas to try to resolve all it, all 
with either no luck or creating more errors.

Original comment by p.pr...@blueesoteric.com on 20 Jul 2014 at 12:46

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for your contribution. Sorry, running tests in this build is a mess 
(which should be resolved in the upcoming 1.2 release).

Original comment by vale...@google.com on 19 Nov 2014 at 10:02

GoogleCodeExporter commented 9 years ago

Original comment by vale...@google.com on 19 Nov 2014 at 10:02

GoogleCodeExporter commented 9 years ago
Fixed in Espresso 2.0

Original comment by vale...@google.com on 20 Dec 2014 at 4:33