Sha256: ae4e0ba5ecab2fd440bbf6f97e859bcbae0328bf61ffd6ae1cb609304612905c

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

require 'rubygems'
require 'rake'

task :default => :android

# Run sh and ignore exception
def run_sh cmd
  begin
    sh cmd
  rescue
  end
end

# Run cmd. On failure run install and try again.
def bash cmd
  sh cmd do |successful, result|
    # exitstatus 7 means bundle install failed
    # exitstatus 1 means the test failed
    if !successful && result.exitstatus === 7
      Rake::Task['install'].execute
      run_sh cmd
    end
  end
end

def wait_for_valid_device
  while `adb shell echo "ping"`.strip != 'ping'
    `adb kill-server`
    `adb devices`
    sleep 5
  end
end

# rake android['single_text_name']
# rake android
def run_android test_file=nil
  wait_for_valid_device
  path              = File.expand_path('appium.txt', Rake.application.original_dir)
  ENV['APPIUM_TXT'] = path
  puts "Rake appium.txt path is: #{path}"
  cmd = 'bundle exec ruby ./lib/run.rb android'
  cmd += %Q( "#{test_file}") if test_file
  bash cmd
end

# Run a single test with:
# rake android['android/element/generic']
#
# Run all tests with:
# rake android
desc 'Run the Android tests'
task :android, :args, :test_file do |args, test_file|
  run_android test_file[:args]
end

desc 'Run the Android tests without uninstalling'
task :droid, :args, :test_file do |args, test_file|
  run_android test_file[:args]
end

desc 'Run bundle install'
task :install do
  sh 'bundle install'
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appium_lib-3.0.3 android_tests/Rakefile
appium_lib-3.0.2 android_tests/Rakefile
appium_lib-3.0.1 android_tests/Rakefile
appium_lib-3.0.0 android_tests/Rakefile
appium_lib-2.1.0 android_tests/Rakefile
appium_lib-2.0.0 android_tests/Rakefile