lib/calabash-android/operations.rb in calabash-android-0.4.2 vs lib/calabash-android/operations.rb in calabash-android-0.4.3.pre1

- old
+ new

@@ -57,12 +57,12 @@ def install_app(app_path) default_device.install_app(app_path) end def uninstall_apps - default_device.uninstall_app("sh.calaba.android.test") - default_device.uninstall_app(ENV["PACKAGE_NAME"]) + default_device.uninstall_app(package_name(default_device.test_server_path)) + default_device.uninstall_app(package_name(default_device.app_path)) end def wake_up default_device.wake_up() end @@ -146,19 +146,22 @@ puts "Please take a look in your hooks file for calls to this methods." puts "(Hooks are stored in features/support)" end class Device + attr_reader :app_path, :test_server_path, :serial, :server_port, :test_server_port - def initialize(cucumber_world, serial, server_port, app_path, test_server_path) + def initialize(cucumber_world, serial, server_port, app_path, test_server_path, test_server_port = 7102) + @cucumber_world = cucumber_world @serial = serial @server_port = server_port @app_path = app_path @test_server_path = test_server_path + @test_server_port = test_server_port - forward_cmd = "#{adb_command} forward tcp:#{server_port} tcp:7102" + forward_cmd = "#{adb_command} forward tcp:#{@server_port} tcp:#{@test_server_port}" log forward_cmd log `#{forward_cmd}` end def reinstall_apps() @@ -314,12 +317,14 @@ if keyguard_enabled? wake_up end + puts "app_path: #{@app_path}" env_options = {:target_package => options[:target_package] || package_name(@app_path), :main_activity => options[:main_activity] || main_activity(@app_path), + :test_server_port => @test_server_port, :debug => options[:debug] || false, :class => options[:class] || "sh.calaba.instrumentationbackend.InstrumentationBackend"} cmd_arr = [adb_command, "shell am instrument"] @@ -327,10 +332,10 @@ cmd_arr << "-e" cmd_arr << key.to_s cmd_arr << val.to_s end - cmd_arr << "sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner" + cmd_arr << "#{package_name(@test_server_path)}/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner" cmd = cmd_arr.join(" ") log "Starting test server using:" log cmd