lib/calabash-android/operations.rb in calabash-android-0.3.1 vs lib/calabash-android/operations.rb in calabash-android-0.3.2.pre1
- old
+ new
@@ -163,14 +163,10 @@
def uninstall_app(package_name)
log "Uninstalling: #{package_name}"
log `#{adb_command} uninstall #{package_name}`
end
- def shutdown_test_server
- http("/kill")
- end
-
def perform_action(action, *arguments)
log "Action: #{action} - Params: #{arguments.join(', ')}"
params = {"command" => action, "arguments" => arguments}
@@ -273,18 +269,14 @@
""
end
end
def start_test_server_in_background
- cmd = "#{adb_command} shell am instrument -w -e target_package #{ENV["PACKAGE_NAME"]} -e main_activity #{ENV["MAIN_ACTIVITY"]} -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
+ cmd = "#{adb_command} shell am instrument -e target_package #{ENV["PACKAGE_NAME"]} -e main_activity #{ENV["MAIN_ACTIVITY"]} -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
log "Starting test server using:"
log cmd
- if is_windows?
- system(%Q(start /MIN cmd /C #{cmd}))
- else
- `#{cmd} 1>&2 &`
- end
+ raise "Could not execute command to start test server" unless system("#{cmd} 2>&1")
begin
retriable :tries => 10, :interval => 3 do
log "Checking if instrumentation backend is ready"
ready = http("/ready")
@@ -300,9 +292,13 @@
rescue
msg = "Unable to make connection to Calabash Test Server at http://127.0.0.1:#{@server_port}/\n"
msg << "Please check the logcat output for more info about what happened\n"
raise msg
end
+ end
+
+ def shutdown_test_server
+ http("/kill")
end
def log(message)
$stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}" if (ARGV.include? "-v" or ARGV.include? "--verbose")
end