Closed angeliaw closed 10 years ago
Same here. The strange thing is that it sometimes works. Here's what calabash-android console gives:
irb(main):003:0> performAction('assert_text', 'some_text', true)
RuntimeError: Step unsuccessful: java.lang.NullPointerException
from /home/meredrica/.gem/ruby/2.0.0/gems/calabash-android-0.4.14/lib/calabash-android/operations.rb:278:in `block in perform_action'
from /usr/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
from /home/meredrica/.gem/ruby/2.0.0/gems/calabash-android-0.4.14/lib/calabash-android/operations.rb:267:in `perform_action'
from /home/meredrica/.gem/ruby/2.0.0/gems/calabash-android-0.4.14/lib/calabash-android/operations.rb:52:in `performAction'
from (irb):3
from /usr/bin/irb:12:in `<main>'
irb(main):004:0>
the text is absolutely there and I can find it with query
Could you post the relevant stacktrace from logcat?
here you go:
D/dalvikvm( 245): GC_CONCURRENT freed 1956K, 26% free 16256K/21703K, paused 6ms+8ms, total 235ms
I/System.out(10392): URI: //
I/System.out(10392): params: {json={"command":"assert_text","arguments":["some_text"]}
I/System.out(10392): }
I/System.out(10392): header: {content-type=application/json;charset=utf-8, user-agent=HTTPClient/1.0 (2.3.4.1, ruby 2.0.0 (2013-06-27)), host=127.0.0.1:34780, date=Tue, 12 Nov 2013 20:56:51 GMT, content-length=51, accept=*/*}
I/System.out(10392): params: {json={"command":"assert_text","arguments":["some_text"]}
I/System.out(10392): }
I/System.out(10392): ProP json = {"command":"assert_text","arguments":["some_text"]}
I/System.out(10392): files: {}
I/System.out(10392): command: {"command":"assert_text","arguments":["some_text"]}
I/InstrumentationBackend(10392): Got command:'Command:'Line:null,assert_text', arguments:'[some_text]'
W/System.err(10392): java.lang.RuntimeException: java.lang.NullPointerException
W/System.err(10392): at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:128)
W/System.err(10392): at com.jayway.android.robotium.solo.Searcher.searchWithTimeoutFor(Searcher.java:77)
W/System.err(10392): at com.jayway.android.robotium.solo.Solo.searchText(Solo.java:549)
W/System.err(10392): at sh.calaba.instrumentationbackend.actions.text.AssertText.execute(AssertText.java:14)
W/System.err(10392): at sh.calaba.instrumentationbackend.Command.execute(Command.java:47)
W/System.err(10392): at sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:241)
W/System.err(10392): at sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:198)
W/System.err(10392): at sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:450)
W/System.err(10392): at java.lang.Thread.run(Thread.java:856)
W/System.err(10392): Caused by: java.lang.NullPointerException
W/System.err(10392): at java.io.Reader.<init>(Reader.java:64)
W/System.err(10392): at java.io.InputStreamReader.<init>(InputStreamReader.java:122)
W/System.err(10392): at java.io.InputStreamReader.<init>(InputStreamReader.java:59)
W/System.err(10392): at com.jayway.android.robotium.solo.WebUtils.getJavaScriptAsString(WebUtils.java:315)
W/System.err(10392): at com.jayway.android.robotium.solo.WebUtils.prepareForStartOfJavascriptExecution(WebUtils.java:142)
W/System.err(10392): at com.jayway.android.robotium.solo.WebUtils.executeJavaScriptFunction(WebUtils.java:248)
W/System.err(10392): at com.jayway.android.robotium.solo.WebUtils.getTextViewsFromWebView(WebUtils.java:57)
W/System.err(10392): at com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:119)
W/System.err(10392): at com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:107)
W/System.err(10392): at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:204)
W/System.err(10392): at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:126)
W/System.err(10392): ... 8 more
I/System.out(10392): result:{"bonusInformation":["Exception stack trace:\njava.lang.RuntimeException: java.lang.NullPointerException\n\tat com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:128)\n\tat com.jayway.android.robotium.solo.Searcher.searchWithTimeoutFor(Searcher.java:77)\n\tat com.jayway.android.robotium.solo.Solo.searchText(Solo.java:549)\n\tat sh.calaba.instrumentationbackend.actions.text.AssertText.execute(AssertText.java:14)\n\tat sh.calaba.instrumentationbackend.Command.execute(Command.java:47)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:241)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:198)\n\tat sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:450)\n\tat java.lang.Thread.run(Thread.java:856)\nCaused by: java.lang.NullPointerException\n\tat java.io.Reader.<init>(Reader.java:64)\n\tat java.io.InputStreamReader.<init>(InputStreamReader.java:122)\n\tat java.io.InputStreamReader.<init>(InputStreamReader.java:59)\n\tat com.jayway.android.robotium.solo.WebUtils.getJavaScriptAsString(WebUtils.java:315)\n\tat com.jayway.android.robotium.solo.WebUtils.prepareForStartOfJavascriptExecution(WebUtils.java:142)\n\tat com.jayway.android.robotium.solo.WebUtils.executeJavaScriptFunction(WebUtils.java:248)\n\tat com.jayway.android.robotium.solo.WebUtils.getTextViewsFromWebView(WebUtils.java:57)\n\tat com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:119)\n\tat com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:107)\n\tat com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:204)\n\tat com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:126)\n\t... 8 more\n"],"message":"java.lang.NullPointerException","success":false}
The screen has an admob view, a map, the actionbar compat and some textviews and imageviews, if that's any useful info. It might be the admob view that's causing problems since the stack looks like robotium tries to look for text in a webview
thank you very much. we rolled back to 0.4.6 instead for testing, now it seems to work fine on latest version.
@angelia Do you mean that the problem is gone in the newer version of Calabash? Which version are you running?
Thanks
I'm seeing the same issue on calabash-android 0.4.21, running on Windows XP.
Message in terminal is [depo] C:\projects\depo\ui-bootstrap-native-android>calabash-android run target\cordova-project\platforms\android\bin\Deponativepackaged-deb ug-unaligned.apk *\ WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows Feature: Smoke test
Scenario: As a normal user I can see the intro screen # features\smoketest.feature:3 90 KB/s (556654 bytes in 5.984s) 60 KB/s (767288 bytes in 12.296s) When I launch the app # features/step_definitions/depo_steps.rb:1 Then I see "Welcome to DEPO" # calabash-android-0.4.21/lib/calabash-android/steps/assert_steps.rb:5 Action 'assert_text' unsuccessful: java.lang.NullPointerException: lock == null (RuntimeError) features\smoketest.feature:5:in `Then I see "Welcome to DEPO"'
Failing Scenarios: cucumber features\smoketest.feature:3 # Scenario: As a normal user I can see the intro screen
1 scenario (1 failed) 2 steps (1 failed, 1 passed) 0m53.624s
Excerpt from logcat:
W/System.err( 3128): java.lang.RuntimeException: java.lang.NullPointerException: lock == null
W/System.err( 3128): at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:128)
W/System.err( 3128): at com.jayway.android.robotium.solo.Searcher.searchWithTimeoutFor(Searcher.java:77)
W/System.err( 3128): at com.jayway.android.robotium.solo.Solo.searchText(Solo.java:555)
W/System.err( 3128): at sh.calaba.instrumentationbackend.actions.text.AssertText.execute(AssertText.java:14)
W/System.err( 3128): at sh.calaba.instrumentationbackend.Command.execute(Command.java:47)
W/System.err( 3128): at sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:243)
W/System.err( 3128): at sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:200)
W/System.err( 3128): at sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:454)
W/System.err( 3128): at java.lang.Thread.run(Thread.java:856)
W/System.err( 3128): Caused by: java.lang.NullPointerException: lock == null
W/System.err( 3128): at java.io.Reader.
This seems like a duplicate of #293, my application has an embedded WebView.
The action assert_text was removed in the latest release of calabash-android. The new ruby wrapper assert_text(text, should_find=true)
can be used as a direct alternative and it should not cause a NPE. The document migrating to calabash-android 0.5 contains more information about the removed actions.
Then I should see "text" while trying to run above sentence in feature, it failed with below exception.
Step unsuccessful: java.lang.NullPointerException (RuntimeError) /Users/.../.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/timeout.rb:69:in `timeout'
Calabash-android -v 0.4.11