Giter Club home page Giter Club logo

calabash-android's People

Contributors

ark-konopacki avatar balazsbalazs avatar bootstraponline avatar cheezy avatar dominikdary avatar garuma avatar gw111zz avatar hueseyinbarin avatar igorfedotenkov avatar jmoody avatar joesss avatar john7doe avatar jonasmaturana avatar julioevm avatar justatrick avatar krukow avatar ksperling avatar leviwilson avatar marsinchevskaya avatar midopa avatar mortengregersen avatar mortengrouleff avatar pimterry avatar plaa avatar rajdeepv avatar sobeckley avatar stoneman avatar streetsofboston avatar tobiasroikjer avatar withoutclass avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calabash-android's Issues

Webview Scroll To Error

Android Version: 4.0.3
Device: HTC One S

Keyword "Webview Scroll To" brings uo the following error:

Scrolling to Webview element failed: '{u'bonusInformation': [u'Exception stack
race:\nandroid.view.ViewRootImpl$CalledFromWrongThreadException: Only the origi
al thread that created a view hierarchy can touch its views.\n\tat android.view
ViewRootImpl.checkThread(ViewRootImpl.java:4381)\n\tat android.view.ViewRootImp
.invalidateChild(ViewRootImpl.java:818)\n\tat android.view.ViewRootImpl.invalid
teChildInParent(ViewRootImpl.java:867)\n\tat android.view.ViewGroup.invalidateC
ild(ViewGroup.java:4312)\n\tat android.view.View.invalidate(View.java:8603)\n\t
t android.view.View.awakenScrollBars(View.java:8418)\n\tat android.view.View.aw
kenScrollBars(View.java:8310)\n\tat android.view.View.scrollTo(View.java:8263)
\tat sh.calaba.instrumentationbackend.actions.webview.ScrollTo.execute(ScrollTo
java:26)\n\tat sh.calaba.instrumentationbackend.Command.execute(Command.java:45
\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServe
.java:145)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.serve(Http
erver.java:104)\n\tat sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSe
sion.run(NanoHTTPD.java:412)\n\tat java.lang.Thread.run(Thread.java:864)\n'], u
message': u'Only the original thread that created a view hierarchy can touch it
views.', u'success': False}'

Cannot press views at the top of a scrollable view

I'm using the Press action to press a view by its contentDescription. This view is at the top of a scrollable view. It's impossible to press it because the current Press implementation scrolls to the bottom of the scroll view before finding my view.

I've traced the problem to the usage of searchButton at the beginning of the Press action. It scrolls to the bottom of the view looking for the desired button. It doesn't find my view because I'm looking for a View by content id, which is done later on in the method. Because the scroll view is now at the bottom, my view isn't found.

If I comment out line 21, my view is found. Is this line needed? The only reason I can think of that it's there is because it caches the buttons that it sees when scrolling, but I don't see that behavior documented anywhere.

Allow coverage data to be collected

It's possible to get an app running under calabash to generate emma coverage data if you use the steps from this Stack Overflow question. It'd be good if calabash provided an option so it could be told that it should pass the -e coverage true option to adb shell am instrument.

This could possibly be done with an environment variable that's picked up in the start_test_server_in_background method later.

Test server install fails, missing shared library

Just updated to the latest from master branch, and I'm now getting INSTALL_FAILED_MISSING_SHARED_LIBRARY when "calabash-android run" tries to install the test apk:

Could not install app test_servers/36104e75e0ea8adf668d52cf35c1ba07_0.2.11.apk: pkg: /data/local/tmp/36104e75e0ea8adf668d52cf35c1ba07_0.2.11.apk
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] (RuntimeError)
/home/andreric/git/calabash-android/ruby-gem/lib/calabash-android/operations.rb:140:in `install_app'
/home/andreric/git/calabash-android/ruby-gem/lib/calabash-android/operations.rb:42:in `install_app'
/home/andreric/git/Settings/calabash/features/support/app_installation_hooks.rb:23:in `Before'
unexpected return (LocalJumpError)

Does the test apk now require some shared libraries to be installed on the device (ie a certain version of the Google Add-On API's)?

Moving away from ant as the primary interface

For my testing, I'm interested in the ability to test the behavior of the app when it's never been started before. I have a number of tests that describe this behavior. The current architecture makes this difficult as the test ant target starts the backend and runs all the tests. Once the backend is started, there's no way to test this "fresh start" behavior.

The solution that I'm currently developing is that instead of running ant test to start all of the tests, you run cucumber. In a before hook for each feature where a fresh start is desired, the app is reinstalled and the instrumentation backend is started. This takes a bit longer, especially with the emulator, but the increased testing ability is worth it.

Another side effect is that JRuby cucumber isn't necessary and the tests can be run with the standard Ruby cucumber, which is a bit more up to date.

I haven't finished my changes, but I wanted to mention them here first, as they're somewhat big. I'll push them to my fork sometime soon.

Let me specify the test_server_path when running `calabash-android build`

Hey,

I'm using calabash-android build myApp.apk to build the test server and (as of v0.2.9) this creates the file

test_servers/a3409ed75a6d63bf4c0f63915bf22da0_0.2.9.apk

instead of

features/support/Test.apk

(as it was in earlier versions).

I'd like the possibility to specify the path to where the "Test.apk" is created so I can know which file it creates (I'm using calabash-android build without calabash-android run if that matters).

Cannot launch app on real device using "ant clean test -Dadb.device.arg=-d" command

  • Android: 2.2.1
  • Version: I9000XXJQ1
  • Device: Samsung Galaxy S (connected to PC via USB in debug mode)
  • "build.properties" is configured correctly:
    tested.package_name=com.NAME1.NAME2
    tested.main_activity=com.NAME1.NAME2.ui.ActivityWelcomeLogin
    tested.project.apk=dTestApp.apk
    ("dTestApp.apk" is placed in Calabash root directory)

After command "ant clean test -Dadb.device.arg=-d" app and instumentation backend are installed on device, but no any further actions are made by Calabash:

As a result:

 [exec] Feature: Login feature
 [exec]
 [exec]   Scenario: As a valid user I can log into my app # features\login_dummy.feature:2
 [exec] - waiting for device -
 [exec] 3562 KB/s (317380 bytes in 0.087s)
 [exec] 2855 KB/s (678511 bytes in 0.232s)
 [exec] 2012-04-16 23:18:59 - Is first scenario - reinstalling apps
 [exec] 2012-04-16 23:18:59 - Uninstalling: com.NAME1.NAME2.test
 [exec] 2012-04-16 23:19:12 - Success
 [exec]
 [exec] 2012-04-16 23:19:12 - Uninstalling: com.NAME1.NAME2
 [exec] 2012-04-16 23:19:13 - Success
 [exec]
 [exec] 2012-04-16 23:19:13 - Installing: bin/Test.apk
 [exec] 2012-04-16 23:19:16 - Success
 [exec] 2012-04-16 23:19:16 - Installing: dTestApp.apk
 [exec] 2012-04-16 23:19:19 - Success
 [exec] 2012-04-16 23:19:19 - Starting test server using:
 [exec] 2012-04-16 23:19:19 - "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" -d shell am instrument -w -e class sh.calaba.instrumentationbackend.InstrumentationBackend com.NAME1.NAME2.test/android.test.InstrumentationTestRunner
 [exec] 2012-04-16 23:19:22 -
 [exec] 2012-04-16 23:19:22 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:23 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:24 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:25 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:26 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:27 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:28 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:29 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:30 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 [exec] 2012-04-16 23:19:31 - Got exception:An existing connection was forcibly closed by the remote host.. Retrying!
 ... (a lot of the same strings)...
 [exec] 2012-04-16 23:20:22 - Connection established
 [exec] 2012-04-16 23:20:22 - Action: press - Params: Login
 [exec] 2012-04-16 23:20:22 - Error communicating with test server: An existing connection was forcibly closed by the remote host. - send(2)
 [exec]     When I press "Login"                          # features/step_definitions/press_button_steps.rb:17
 [exec]       An existing connection was forcibly closed by the remote host. - send(2) (Errno::ECONNRESET)

Starting a scenario at a specific activity

public class ClassName extends ActivityInstrumentationTestCase2 {
private Solo solo;

public ClassName() throws ClassNotFoundException {
    super("ActivityYouWant",ActivityYouWant.class);
}

On Robotium,
having your test class set up like this will automatically start your app at that specific activity. This saves quite a bit of time since the android emulator is naturally slow... so being able to skip a bunch of views is something quite beneficial in terms of speed.

run calabash-android on cygwin

I very like calabash android. great job!
but when i try it on cygwin, it always failed due to. "sh: start: command not found"

from the source code, "start" is use to run cmd on windows. but on cygwin, function is_windows? return true.
so need to modify the function.

attached my modification. I change the function is_windows? to check_is_windows?. because there were too much instance of is_windows?

def check_is_windows?
#ENV["OS"] == "Windows_NT"
"windows" == os_family
end

def os_family
case RbConfig::CONFIG['host_os']
when /ix/i, /ux/i, /gnu/i,
/sysv/i, /solaris/i,
/sunos/i, /bsd/i, /cygwin/i
"unix"
when /win/i, /ming/i
"windows"
else
"other"
end
end

Pressing text in the menu is not working

Steps that tries to touch the text on a menu item is not working.
This inludes:

When I select "Home" from the menu

and:

When I press the menu key
And I touch the "Home" text

Formatted output for calabash-android run

calabash-ios output is formatted well with coloration and is easy to spot failed tests, steps etc. calabash-android is verbose and difficult to quickly eyeball the running scenario or failed steps. Can we enable a similar output format on calabash-android?

Error in test hook: java.net.SocketException: Permission denied

Having just pulled the repo, updated build.properties and provided a signed .apk, issuing the command ant test produces the following error:

 [exec] Feature: Login feature
 [exec] 
 [exec]   Scenario: As a valid user I can log into my app # features/login_dummy.feature:2
 [exec] Is first scenario
 [exec] Failure
 [exec] Failure
 [exec] 2446 KB/s (307047 bytes in 0.122s)
 [exec]     pkg: /data/local/tmp/Test.apk
 [exec] Success
 [exec] 2287 KB/s (64877 bytes in 0.027s)
 [exec]     pkg: /data/local/tmp/NotepadSample.apk
 [exec] Success
 [exec] 
 [exec] sh.calaba.instrumentationbackend.InstrumentationBackend:
 [exec] Error in testHook:
 [exec] java.net.SocketException: Permission denied
 [exec]     at org.apache.harmony.luni.platform.OSNetworkSystem.socket(Native Method)
 [exec]     at dalvik.system.BlockGuard$WrappedNetworkSystem.socket(BlockGuard.java:335)
 [exec]     at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:216)
 [exec]     at org.apache.harmony.luni.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:40)
 [exec]     at java.net.ServerSocket.<init>(ServerSocket.java:120)
 [exec]     at java.net.ServerSocket.<init>(ServerSocket.java:74)
 [exec]     at sh.calaba.instrumentationbackend.InstrumentationBackend.createSocets(Unknown Source)
 [exec]     at sh.calaba.instrumentationbackend.InstrumentationBackend.setUp(Unknown Source)
 [exec]     at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
 [exec]     at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
 [exec]     at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529)
 [exec]     at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
 [exec] 
 [exec] Test results for InstrumentationTestRunner=.E
 [exec] Time: 0.15
 [exec] 
 [exec] FAILURES!!!
 [exec] Tests run: 1,  Failures: 0,  Errors: 1
 [exec] 
 [exec] 
 [exec] 
 [exec] Wed Mar 14 22:17:25 -0700 2012 - Got exception:end of file reached. Retrying!
 [exec] Wed Mar 14 22:17:26 -0700 2012 - Got exception:end of file reached. Retrying!
 [exec] Wed Mar 14 22:17:27 -0700 2012 - Got exception:end of file reached. Retrying!
 [exec] Wed Mar 14 22:17:28 -0700 2012 - Got exception:end of file reached. Retrying!
 [exec] Wed Mar 14 22:17:29 -0700 2012 - Got exception:end of file reached. Retrying!
 [exec] Wed Mar 14 22:17:30 -0700 2012 - Got exception:end of file reached. Retrying!
...


 uname -a
 Darwin $HOSTNAME 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 


 ruby -v
 ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11]

WebView actions fail on Android 4.1.1

The method WebView.getWebChromeClient has been removed in Android 4.1.1. It was originally marked with "@hide API council approval" and had been worked around in Calabash by using reflection. In Jelly Bean it has been removed which causes a failure:

  Step unsuccessful: java.lang.NoSuchMethodException: getWebChromeClient [] (RuntimeError)

This affects all actions that use a WebView.

Android 4.0.4 still contains the method, compare
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.4_r2.1/android/webkit/WebView.java/
and
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/android/webkit/WebView.java/

The location to fix this is in CalabashChromeClient, which abstracts access to the WebChromeClient. I don't know how to fix it though.

ant error

Hi,

I am using windows 7 to setup this. I was able to configure the part till it's install the apk file to running AVD but it fails on dex

I am getting this error

-dex:
[exec]
[exec] UNEXPECTED TOP-LEVEL EXCEPTION:
[exec] java.lang.RuntimeException: bin: file not found
[exec] at com.android.dx.util.FileUtils.readFile(FileUtils.java:55)
[exec] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:134)
[exec] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[exec] at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[exec] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[exec] at com.android.dx.command.dexer.Main.run(Main.java:206)
[exec] at com.android.dx.command.dexer.Main.main(Main.java:174)
[exec] at com.android.dx.command.Main.main(Main.java:95)
[exec] 1 error; aborting

in the build.xml file I need to change the dx to dx.bat but I still get this error. Any pointer what could be the issue.

thank you
-imohan

Examples for pre-defined steps

The calabash-android canned steps is missing examples.

For instance, in this canned step: Then /^I wait for the "([^\"]*)" screen to appear$/, it is difficult to know what to pass as the parameter.

Support for MapView

I've submitted a MapViewUtils class to robotium:
http://code.google.com/p/robotium/issues/detail?id=291

Once released, the following should be supported:

 When /^I centre the map at (-?\d+\.\d+), (-?\d+\.\d+)$/ do | lat, lon |
   performAction('set_map_center', lat, lon)
 end

 When /^(?:I )?set the zoom level to (\d+)$/ do | zoom |
   performAction('set_map_zoom', zoom)
 end

 When /^(?:I )?zoom (in|out) on the map$/ do | zoom |
   performAction('set_map_zoom', zoom)
 end

 Then /^I should see the following markers:$/ do | marker_table |
   verify_markers( marker_table )
 end

 Then /^I should see the following (\d+) markers:$/ do | number_of_markers, marker_table |
   verify_n_markers( number_of_markers, marker_table )
 end
 require 'json'

 def verify_markers( expected_marker_table )
   result = performAction('get_map_markers')
   actual_table = result['bonusInformation']

   actual_table.each_with_index do | marker_info, index |
     # eg: {"latitude":-12.345678, "longitude":123.456789, "title":"Test Marker"}
     marker_info = JSON.parse( marker_info )
     actual_table[index] = marker_info
   end

   expected_marker_table.diff!(actual_table)
 end


 def verify_n_markers( number_of_markers, expected_marker_table )
   result = performAction('get_map_markers', number_of_markers)
   actual_table = result['bonusInformation']

   actual_table.each_with_index do | marker_info, index |
     marker_info = JSON.parse( marker_info )
     actual_table[index] = marker_info
   end

   expected_marker_table.diff!(actual_table)
 end
 package sh.calaba.instrumentationbackend.actions.map;

 import java.util.List;

 import sh.calaba.instrumentationbackend.InstrumentationBackend;
 import sh.calaba.instrumentationbackend.Result;
 import sh.calaba.instrumentationbackend.actions.Action;

 import com.google.android.maps.ItemizedOverlay;

 /**
  * Allows the test script to retreive a list of markers on {@link ItemizedOverlay}s.
  * The optional arg can be used to require a specific number of markers
  * 
  * @author Nicholas Albion
  */
 public class GetMapMarkers implements Action {

     @Override
     public Result execute(String... args) {
         List<String> markers = InstrumentationBackend.solo.getMapMarkerItems();

         Result result;
         if( args.length != 0 ) {
            int expectedNumberOfStops = Integer.parseInt(args[0]);

            if( expectedNumberOfStops != markers.size() ) {
                result = new Result(false, "Expected " + expectedNumberOfStops + " markers, but found " + markers.size());
            } else {
                result = Result.successResult();
            }
        } else {
            result = Result.successResult();
        }

        for (String markerJson : markers) {
//          Log.i("get_map_markers", markerJson);
            result.addBonusInformation(markerJson);
        }
        return result;
    }

    @Override
    public String key() {
        return "get_map_markers";
    }
}
package sh.calaba.instrumentationbackend.actions.map;

import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.actions.Action;

/**
 * Center on lat, lon
 */
public class SetMapCenter implements Action {

    @Override
    public Result execute(String... args) {
        InstrumentationBackend.solo.setMapCenter( Double.parseDouble(args[0]), Double.parseDouble(args[1]) );
        return Result.successResult();
    }

    @Override
    public String key() {
        return "set_map_center";
    }
}
package sh.calaba.instrumentationbackend.actions.map;

import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.actions.Action;

public class SetMapZoom implements Action {

    @Override
    public Result execute(String... args) {
        if( "in".equals(args[0]) ) {
            return new Result( InstrumentationBackend.solo.zoomInOnMap() );
        } else if( "out".equals(args[0]) ) {
            return new Result( InstrumentationBackend.solo.zoomOutOnMap() );
        }

        int zoomLevel = Integer.parseInt(args[0]);
        int newZoom = InstrumentationBackend.solo.setMapZoom( zoomLevel );

        if( newZoom == zoomLevel ) {
            return Result.successResult();
        } else {
            return new Result(false, "Requested zoom level: " + zoomLevel + " but current zoom level is " + newZoom);
        }
    }

    @Override
    public String key() {
        return "set_map_zoom";
    }
}

clear the value in webview element

Hi,

I had to clear the login name in the webview and then enter the valid name.

I created a step that invokes action(key) "set_text" or "enter_text_by_selector" and passed an empty string as "". But this doesn't clear the login element.

Should there be a new action defined in instrumentation_backend to clear the value for elements in webview similar to ClearTextByIndex.java or ClearTextFieldByContentDescription.java or can the existing set_text/enter_text_by_selector action be fixed to clear the value of an element.

Thanks.

Cannot send '&' character as command parameter

When I try to send an ampersand '&' in a command parameter to the execute_javascript function causes the following error:

  Step unsuccessful: Unexpected end-of-input: was expecting closing quote for a string value
   at [Source: java.io.StringReader@41ac23d8; line: 1, column: 93] (RuntimeError)

My guess is that the arguments are passed as HTTP query string or post parameters and not encoded properly. This would cause the ampersand to break the URL parameter into two.

Failing command example:

performAction('execute_javascript', '&')

Calabash build error

I cloned the latest version of calabash android this morning (2012-04-09) and while running the
build clean test
command I run into the issue that calabash-js is missing.

After cloning the JS project from https://github.com/calabash/calabash-js.git and putting into the instrumentation_backend folder the build went through.

Sign test app with -sigalg=SHA1withDSA

I'm building my app using Maven 3 (so that I can optionally instrument for coverage data collection using EMMA).

When I attempt to build the calabash-android test app using ant (1.8.2) I get an error:

jarsigner error: java.security.SignatureException: private key algorithm is not compatible with signature algorithm

I found a post at Stack Overflow that says that (under JDK 7) the sigalg should be set to SHA1withDSA. Even though I'm using Java 6 on OS X, this seems to fix the problem for me.

Would changing from MD5withRSA to SHA1withDSA cause any problems for anybody else?

test-server/build.xml:

...
<target nam="-sign">
  <exec executable="jarsigner">
    <arg value="-sigalg"/>
    <arg value="SHA1withDSA"/>
    ....

test-server\build.xml:31: taskdef ApkBuilderTask can't find SealedApkException

When running "calabash-android build" to build the test server, an exception is thrown by Ant:

build.xml:31: taskdef A class needed by class com.android.ant.ApkBuilderTask cannot be found: com/android/sdklib/build/SealedApkException

I have had to edit %RUBY_HOME%\lib\ruby\gems\1.9.1\gems\calabash-android-0.1.0\test-server\build.xml:

<path id="android.antlibs">
    <pathelement path="${env.ANDROID_HOME}/tools/lib/anttasks.jar" />
    <pathelement path="${env.ANDROID_HOME}/tools/lib/sdklib.jar" />
    <pathelement path="${env.ANDROID_HOME}/tools/lib/androidprefs.jar" />
</path>

...the "androidprefs.jar" may not be necessary, but I figured while I'm there I may as well...

The test-server now successfully builds

Parity on pre-defined steps b/w calabash-ios and calabash-android

The predefined steps in Android and iOS are slightly different. Example: Android uses "press" instead of "touch".

I understand I can run custom steps to ensure parity, but for first-timers, it would be great if the predefined steps were same so that we can reuse feature files across iOS and Android.

Intermittent ADB hangs while installing apps

Every once in a while, ADB hangs while installing either the instrumentation app or the app to be tested. This has only happened using the emulator from calabash so far. I think it may be related to this issue. I'm thinking of resolving it using the retriable gem and giving ADB a 30-60s timeout and 2-3 retries any time an app is uninstalled or installed. That should at least guarantee that a test run completes when running on our CI system. Thoughts?

Scroll functionality doesn't work in Android2.3 emulator

Jonas is aware of this issue.

The below scenario works on 2.3 device but not on 2.3 emulator.

Scenario: Accept the terms of agreement
Then I should see "United States"
Then I touch the "United States" text

The step "Then I should see "United States"" should scroll the list view and click on the text "United States". But the scroll doesn't work.
As well I changed the country name to "Australia" which is visible on the screen. Even then the above scenario failed.

Note:- The same works on Android 2.2 and also on 2.3 device

Code signing problems in calabash-android build when user name has a space in it

For version 0.0.6 of calabash-android gem

OK, so this is a corner case, however I discovered the following problem when switching from the older build.properties used in the pre-gemified way of using calabash-android to the newer .calabash_settings file and wanted to see if we could improve the new code so it robustly works even when the user's home folder / directory has a space in the name.

The subtle difference that broke the signjar ant task is where the older file uses key.store=${user.home}/.android/debug.keystore
while the newer file uses the full path name (which happens to have a space as my user name is "Julian Harty"
"keystore_location":"C:/Users/Julian Harty/.android/debug.keystore",

The problem is that when the space is encountered in the build script (the temporary build.xml created in a temporary folder) it uses C:\Users\Julian as the path to the debug keystore. This is an incomplete and invalid path so the signing fails.

My workaround was to use the equivalent short directory name of Julian~1 in .calabash_settings in place of Julian Harty

Could you find a way to make the new code work at least as well as the new code please? :)

For the record here are copies of the contents of my old and new files. Note: they're actually in different directories on my windows computer so don't interfere with each other.

build.properties
tested.package_name=com.ader
tested.main_activity=com.ader.ui.HomeScreen
tested.project.apk=c:\myopensourceprojects\DaisyProject\trunk\bin\DaisyReader.apk

You might have to update these values

android.api.level=8

key.store=${user.home}/.android/debug.keystore
key.store.password=android
key.alias=androiddebugkey
key.alias.password=android

.calabash_settings
{
"package_name":"com.ader",
"activity_name":"com.ader.ui.HomeScreen",
"app_path":"C:/myopensourceprojects/DaisyProject/trunk/bin",
"api_level":"8",
"keystore_location":"C:/Users/Julian~1/.android/debug.keystore",
"keystore_password":"android",
"keystore_alias":"androiddebugkey",
"keystore_alias_password":"android"

}

Class conflicts between libraries used by calabash and by app

My app also includes jackson-core, which leads to the following error at runtime (explanation here):

E/AndroidRuntime(  765): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

My current workaround is to exclude that jar from the staged libraries like below, but it's not a general fix. It won't work if you don't use jackson-core in your app.

<target name="-stage.libs">
  <copy todir="${bin.dir}/libs">
    <fileset dir="instrumentation_backend/libs" excludes="jackson-core-asl-1.9.1.jar" />
  </copy>
</target>

Tests fail if device has screen lock on

Based on discussion on the list: https://groups.google.com/d/topic/calabash-android/o6lUuEOuGtE/discussion

When the screen is locked on the phone, all the tests fail. On Samsung Galaxy phones it's impossible to set the screen lock delay to be longer than 10 minutes, so you have to manually unlock the screen before any tests are run.

Wakey Droid is a minimalist app that allows waking up the phone from the command line using adb (which just starts the app). As a workaround, you could install the app on the phone and run the adb command before the tests, but this seems like something that should be part of Calabash.

The source code for Wakey Droid is available (http://bitmote.com/index.php?pages/Wakey-Droid) and is only ~20 lines long. I tried to hack together an action that would do the same, but it didn't work. I omitted the setContentView and postDelayed parts, which evidently are necessary, or some of the XML configuration. However this looks like a promising way to implement this functionality.

'click_on_view_by_id' doesn't work

HI,
Thanks for coming up with calabash.

I have written a sample scenario that refers to the predefined canned step. But I noticed an error message.

step that I invoked in scenario:-
Then I press view with id "com.clfarm.mobile.R.id.home_label"

Refers to canned step:-
Then /^I press view with id "([^\"]*)"$/ do |view_id|
performAction('click_on_view_by_id',view_id)
end

Error:-
getViewById: Looking for view com.clfarm.mobile.R.id.home_label which does not have an id (RuntimeError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:62:in `timeout'

features/my_first.feature:15:in `Then I press view with id "com.clfarm.mobile.R.id.home_label"'

I have earlier relied on robotium and was able to access this id. BUt couldn't do it with calabash.
solo.getCurrentActivity().clickOnView(b.findViewById(com.clfarm.mobile.R.id.home_label));

dump_body_html is throwing an exception

called the dump_body_html action from the client:
04-09 17:10:59.095: I/IntrumentationBackend(4197): Got command:'Command:'Line:null,dump_body_html', arguments:'[]'

This has created an issue on the server:
04-09 17:10:59.134: W/webview(4197): java.lang.Throwable: Warning: A WebView method was called on thread 'Instr: android.test.InstrumentationTestRunner'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.

and this message is displayed as well:
04-09 17:11:01.074: E/Web Console(4197): Uncaught TypeError: Cannot read property 'innerHTML' of null at null:1

and finally:

04-09 17:11:29.314: I/IntrumentationBackend(4197): Result:Success: false, message: Timed out waiting for result for JavaScript

No License file in Calabash

I'm currently evaluating the use of Calabash but cannot find what license the code is release under.
A BSD or MIT license would be useful for us if it hasn't been decided yet.

ant test - broken

Sometimes running ant test will give this error:

 [exec] 
 [exec] UNEXPECTED TOP-LEVEL EXCEPTION:
 [exec] com.android.dx.util.DexException: Multiple dex files define Lcom/jayway/android/robotium/solo/ActivityUtils;
 [exec]     at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:581)
 [exec]     at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:539)
 [exec]     at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:520)
 [exec]     at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
 [exec]     at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
 [exec]     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:297)
 [exec]     at com.android.dx.command.dexer.Main.run(Main.java:229)
 [exec]     at com.android.dx.command.dexer.Main.main(Main.java:174)
 [exec]     at com.android.dx.command.Main.main(Main.java:95)

A temporary workaround is to always do ant clean test.

Scenario Outline not working

As noted by Jonas, there's currently an issue with scenario outlines in Calabash-android as well as Calabash-ios:

https://groups.google.com/forum/?fromgroups#!topic/calabash-android/c_RT3UnYO7Y

 unexpected return (LocalJumpError)
 /features/support/app_life_cycle_hooks.rb:4:in `Before'

 uninitialized class variable @@client in Calabash::Android::Operations (NameError)

John Gallagher proposed a fix for ios, which doesn't seem to fix the problem on android
https://groups.google.com/forum/?fromgroups#!topic/calabash-ios/ICA4f24eSsY

@scenario_is_outline = (scenario.class == Cucumber::Ast::OutlineTable::ExampleRow) 

calabash-android build fails in compilation

Jonas, thanks for the excellent improvements by gemifying the setup of calabash-android. I may have encountered some teething problems with the calabash-android scripts. This one is where the build fails to compile the Java test driver app.

I encountered similar problems on my Mac book (running OS X 10.7) and on my Windows 7 64-bit laptop (where the following error log comes from). [I'm creating an Ubuntu VM and will test on that shortly).
I'm running Java 6 on both machines.

The gory detail follows:

C:\myopensourceprojects\DaisyProject\branches\calabashtests>calabash-android run
Could not find the test server
Should I run calabash-android build for you?
Please answer yes (y) or no (n)
y
Buildfile: C:\Users\JULIAN~1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\build.xml

clean:

-check.preconditions:

-init:

package:

-compile:

-stage:
[mkdir] Created dir: C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging
[mkdir] Created dir: C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\bin

-prepare.manifest:
[copy] Copying 1 file to C:\Users\JULIAN~1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging

-prepare.testserver:
[copy] Copying 480 files to C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging
[copy] Copying 2 files to C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\assets
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\build.xml:113: warning: 'includeantruntime' was not set, defaultin
g to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 467 source files to C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\bin
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:6: package javax.xml.datatype does not exist
[javac] import javax.xml.datatype.DatatypeConfigurationException;
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:7: package javax.xml.datatype does not exist
[javac] import javax.xml.datatype.DatatypeFactory;
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:8: package javax.xml.datatype does not exist
[javac] import javax.xml.datatype.Duration;
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:9: package javax.xml.datatype does not exist
[javac] import javax.xml.datatype.XMLGregorianCalendar;
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:10: package javax.xml.namespace does not exist
[javac] import javax.xml.namespace.QName;
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:35: cannot find symbol
[javac] symbol : class DatatypeFactory
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers
[javac] final static DatatypeFactory _dataTypeFactory;
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:71: cannot find symbol
[javac] symbol : class Duration
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers
[javac] extends FromStringDeserializer
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:76: cannot find symbol
[javac] symbol : class Duration
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.DurationDeserializer
[javac] protected Duration _deserialize(String value, DeserializationContext ctxt)
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:84: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers
[javac] extends StdScalarDeserializer
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:89: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.GregorianCalendarDeserializer
[javac] public XMLGregorianCalendar deserialize(JsonParser jp, DeserializationContext ctxt)
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:103: cannot find symbol
[javac] symbol : class QName
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers
[javac] extends FromStringDeserializer
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:108: cannot find symbol
[javac] symbol : class QName
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.QNameDeserializer
[javac] protected QName _deserialize(String value, DeserializationContext ctxt)
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:9: package javax.xml.datatype does not exist
[javac] import javax.xml.datatype.Duration;
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:10: package javax.xml.datatype does not exist
[javac] import javax.xml.datatype.XMLGregorianCalendar;
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:11: package javax.xml.namespace does not exist
[javac] import javax.xml.namespace.QName;
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:55: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLSerializers
[javac] public static class XMLGregorianCalendarSerializer extends SerializerBase
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:62: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLSerializers.XMLGregorianCalendarSerializer
[javac] public void serialize(XMLGregorianCalendar value, JsonGenerator jgen, SerializerProvider provider)
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\instrumentationbackend\TestHelpers.java:64:
cannot find symbol
[javac] symbol : method getContentDescription()
[javac] location: class android.view.View
[javac] String viewDescription = view.getContentDescription() + "";
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\instrumentationbackend\actions\view\Press.ja
va:36: cannot find symbol
[javac] symbol : method getContentDescription()
[javac] location: class android.view.View
[javac] String viewDescription = view.getContentDescription() != null ? view.getContentDescription().toString() : "";
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\instrumentationbackend\actions\view\Press.ja
va:36: cannot find symbol
[javac] symbol : method getContentDescription()
[javac] location: class android.view.View
[javac] String viewDescription = view.getContentDescription() != null ? view.getContentDescription().toString() : "";
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\instrumentationbackend\actions\webview\Calab
ashChromeClient.java:64: cannot find symbol
[javac] symbol : variable SDK_INT
[javac] location: class android.os.Build.VERSION
[javac] if (Build.VERSION.SDK_INT < 14) { //before Ice cream sandwich
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:38: cannot find symbol
[javac] symbol : variable DatatypeFactory
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers
[javac] _dataTypeFactory = DatatypeFactory.newInstance();
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:39: cannot find symbol
[javac] symbol : class DatatypeConfigurationException
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers
[javac] } catch (DatatypeConfigurationException e) {
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:73: cannot find symbol
[javac] symbol : class Duration
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.DurationDeserializer
[javac] public DurationDeserializer() { super(Duration.class); }
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:86: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.GregorianCalendarDeserializer
[javac] public GregorianCalendarDeserializer() { super(XMLGregorianCalendar.class); }
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:105: cannot find symbol

BUILD FAILED
C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\build.xml:119: The following error occurred while executing this line:
C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\build.xml:113: Compile failed; see the compiler error output for details.

Total time: 14 seconds
[javac] symbol : class QName
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.QNameDeserializer
[javac] public QNameDeserializer() { super(QName.class); }
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLDeserial
izers.java:111: cannot find symbol
[javac] symbol : variable QName
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLDeserializers.QNameDeserializer
[javac] return QName.valueOf(value);
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:45: cannot find symbol
[javac] symbol : class Duration
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLSerializers
[javac] _serializers.put(Duration.class, tss);
[javac] ^
[javac] C:\Users\JULIAN1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:46: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLSerializers
[javac] _serializers.put(XMLGregorianCalendar.class, new XMLGregorianCalendarSerializer());
[javac] ^
[javac] C:\Users\JULIAN
1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:47: cannot find symbol
[javac] symbol : class QName
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLSerializers
[javac] _serializers.put(QName.class, tss);
[javac] ^
[javac] C:\Users\JULIAN~1\AppData\Local\Temp\d20120506-6972-1rx502t\test-server\staging\src\sh\calaba\org\codehaus\jackson\map\ext\CoreXMLSerializ
ers.java:58: cannot find symbol
[javac] symbol : class XMLGregorianCalendar
[javac] location: class sh.calaba.org.codehaus.jackson.map.ext.CoreXMLSerializers.XMLGregorianCalendarSerializer
[javac] super(XMLGregorianCalendar.class);
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 31 errors
Could not build the test server. Please see the output above.

C:\myopensourceprojects\DaisyProject\branches\calabashtests>

GET /screenshot crashes if there is no View

I suspect this line crashing my InstrumentationBackend from time to time (if there is no view displayed at the moment of the request):

https://github.com/calabash/calabash-android/blob/master/ruby-gem/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java#L86

.get(0) throws ArrayIndexOutOfBoundsException and i get the following error:

sh.calaba.instrumentationbackend.InstrumentationBackend:..INSTRUMENTATION_RESULT: shortMsg=java.lang.IndexOutOfBoundsException
INSTRUMENTATION_RESULT: longMsg=java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
INSTRUMENTATION_CODE: 0

Broken on Windows. Need to run things in background

Clearly something like this:
system("#{adb_command} shell am instrument -w -e class sh.calaba.instrumentationbackend.InstrumentationBackend #{ENV['TEST_PACKAGE_NAME']}/android.test.InstrumentationTestRunner 1>&2 &")
doesn't work on Windows.

All the shelling out should be fixed to work on Windows as well.

Output of steps on console lags considerably compared to running test

When I start running my calabash tests, I see that the steps logging is behind the executed test on-emulator. For instance, when I start a scenario, it would be on this message "sh.calaba.instrumentationbackend.InstrumentationBackend: " for atleast 5 seconds before it outputs the first few steps (in a batch). On calabash-ios, there is a lag, but it not as noticeable.

It is not a big deal, but will help non-programmers relate the console output with whats going on the screen.

New screenshot method crashes emulator

I'm just getting around to testing the new screenshot method from #69 and it looks like it reliably crashes the instrumentation backend in my 2.2 and 2.3 emulators. I haven't tried any other versions. The old one worked fine for me, even if it is less elegant than /screenshot.

What do you think about an environment variable or some configuration flag to select which screenshot method to use?

  • /screenshot
  • screenShotTaker.jar
  • None

Webview touch - API Level 13

When touching an element in a webview with API Level 13 (Android 3.2) an exception gets raised, because 'mActualScale' is not found.
Maybe the error is in::

https://github.com/calabash/calabash-android/blob/master/ruby-gem/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/CalabashChromeClient.java

Line 63::

if (Build.VERSION.SDK_INT < 14) { //before Ice cream sandwich
mActualScaleField = WebView.class.getDeclaredField("mActualScale");
} else {

Here is the output::

curl -S - X POSt -d {"command":"touch", "arguments": ["css",".myBtn"]}

{"bonusInformation":["Exception stack trace:\njava.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchFieldException: No field 'mActualScale' in class android.webkit.WebView\n\tat sh.calaba.instrumentationbackend.actions.webview.Touch.execute(Touch.java:34)\n\tat sh.calaba.instrumentationbackend.Command.execute(Command.java:45)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.runCommand(HttpServer.java:76)\n\tat sh.calaba.instrumentationbackend.actions.HttpServer.serve(HttpServer.java:52)\n\tat sh.calaba.instrumentationbackend.actions.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:402)\n\tat java.lang.Thread.run(Thread.java:1020)\nCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchFieldException: No field 'mActualScale' in class android.webkit.WebView\n\tat sh.calaba.instrumentationbackend.actions.webview.QueryHelper.getScreenCoordinatesForCenter(QueryHelper.java:70)\n\tat sh.calaba.instrumentationbackend.actions.webview.Touch.execute(Touch.java:30)\n\t... 5 more\nCaused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: No field 'mActualScale' in class android.webkit.WebView\n\tat sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient.getScale(CalabashChromeClient.java:75)\n\tat sh.calaba.instrumentationbackend.actions.webview.QueryHelper.getScreenCoordinatesForCenter(QueryHelper.java:59)\n\t... 6 more\nCaused by: java.lang.NoSuchFieldException: No field 'mActualScale' in class android.webkit.WebView\n\tat java.lang.Class.findFieldByName(Class.java:818)\n\tat java.lang.Class.getDeclaredField(Class.java:612)\n\tat sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient.getScale(CalabashChromeClient.java:64)\n\t... 7 more\n"],"message":"java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchFieldException: No field 'mActualScale' in class android.webkit.WebView","success":false}

java -jar screenShotTaker.jar times out for large screens

Hey,

i'm automating a tablet app (that is it has a large screen) using calabash server and all I get from taking screenshots is a timeout (i've destilled it to this):

$> time java -jar screenShotTaker.jar my_funky_screenshot.png
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.android.ddmlib.TimeoutException
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:648)
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:616)
    at com.android.ddmlib.AdbHelper.getFrameBuffer(AdbHelper.java:326)
    at com.android.ddmlib.Device.getScreenshot(Device.java:270)
    at com.android.screenshot.ScreenShotTaker.getDeviceImage(ScreenShotTaker.java:34)
    at com.android.screenshot.Screenshot.takeScreenshot(Screenshot.java:122)
    at com.android.screenshot.Screenshot.main(Screenshot.java:39)
    ... 5 more
  • is the sourcecode to that .jar somewhere available ?
  • what is the timeout's value ? can this be set by the user and/or extended to a failsafe (higher) value ?
  • why doesn't it terminate after it got the error ? Looks like it's implemented with catch (Exception e) { e.printStackTrace(); } .. i'd favor a System.exit(1) in the catch block.

so long,
Filip

validate the response

There are canned steps defined in https://github.com/calabash/calabash-android/tree/master/ruby-gem/lib/calabash-android/steps location

Is there a way to check the result after invoking performAction() function.
For example, I invoke a step that invokes performAction(assert_text, text, true) and I want to check if the result is successful(true). If false, then I want to set a loop till the method returns true.

Is this something doable. I didn't find any information regarding capturing and processing return values.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.