Skip to content

Commit

Permalink
adding optional argument to start test server with uiautomator support
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajdeep Varma committed Dec 11, 2016
1 parent 2b3eff7 commit b06d673
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ruby-gem/lib/calabash-android/operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,17 @@ def start_test_server_in_background(options={}, &block)

cmd_arr << "#{package_name(@test_server_path)}/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"

cmd = cmd_arr.join(" ")
if options[:with_uiautomator]
cmd_arr.insert(2, "-w")
shutdown_test_server
@adb_shell_pid = Process.spawn(cmd_arr.join(" "), :in => '/dev/null') rescue "Could not execute command to start test server with uiautomator"
else
cmd = cmd_arr.join(" ")

log "Starting test server using:"
log cmd
raise "Could not execute command to start test server" unless system("#{cmd} 2>&1")
log "Starting test server using:"
log cmd
raise "Could not execute command to start test server" unless system("#{cmd} 2>&1")
end

Calabash::Android::Retry.retry :tries => 100, :interval => 0.1 do
raise "App did not start" unless app_running?
Expand Down Expand Up @@ -764,6 +770,10 @@ def start_application(intent)

def shutdown_test_server
begin
unless @adb_shell_pid.nil?
Process.kill("HUP",@adb_shell_pid)
@adb_shell_pid = nil
end
http("/kill")
Timeout::timeout(3) do
sleep 0.3 while app_running?
Expand Down

0 comments on commit b06d673

Please sign in to comment.