Sha256: fb170620ddb00fe774bf55e7eb840f9b510032898dc54100c6b6c6ce75448709

Contents?: true

Size: 1.41 KB

Versions: 28

Compression:

Stored size: 1.41 KB

Contents

require 'rubygems'
require 'rake'
require 'rubocop/rake_task'

task default: :android

# Run sh and ignore exception
# rubocop:disable Lint/HandleExceptions
def run_sh(cmd)
  sh cmd
rescue
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
  cmd = 'bundle exec ruby ./lib/run.rb android'
  cmd += %( "#{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

desc 'Execute RuboCop static code analysis'
RuboCop::RakeTask.new(:rubocop) do |t|
  t.patterns = %w(**/*.rb)
  t.options = %w(-D)
  t.fail_on_error = false
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
appium_lib-9.4.5 android_tests/Rakefile
appium_lib-9.4.4 android_tests/Rakefile
appium_lib-9.4.3 android_tests/Rakefile
appium_lib-9.4.2 android_tests/Rakefile
appium_lib-9.4.1 android_tests/Rakefile
appium_lib-9.4.0 android_tests/Rakefile
appium_lib-9.3.8 android_tests/Rakefile
appium_lib-9.3.7 android_tests/Rakefile
appium_lib-9.3.6 android_tests/Rakefile
appium_lib-9.3.5 android_tests/Rakefile
appium_lib-9.3.4 android_tests/Rakefile
appium_lib-9.3.3 android_tests/Rakefile
appium_lib-9.3.2 android_tests/Rakefile
appium_lib-9.3.1 android_tests/Rakefile
appium_lib-9.3.0 android_tests/Rakefile
appium_lib-9.2.0 android_tests/Rakefile
appium_lib-9.1.3 android_tests/Rakefile
appium_lib-9.1.2 android_tests/Rakefile
appium_lib-9.1.1 android_tests/Rakefile
appium_lib-9.1.0 android_tests/Rakefile