Skip to content

Commit cd5a25d

Browse files
Update android tests
1 parent 7fc8c55 commit cd5a25d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ruby_lib_android/Rakefile

+10
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ def bash cmd
2121
end
2222
end
2323

24+
def wait_for_valid_device
25+
while `adb shell echo "ping"`.strip != 'ping'
26+
`adb kill-server`
27+
`adb devices`
28+
sleep 5
29+
end
30+
end
31+
2432
# rake android['single_text_name']
2533
# rake android
2634
def run_android test_file=nil
35+
wait_for_valid_device
2736
path = File.expand_path('appium.txt', Rake.application.original_dir)
2837
ENV['APPIUM_TXT'] = path
2938
puts "Rake appium.txt path is: #{path}"
@@ -55,6 +64,7 @@ end
5564

5665
desc 'ADB uninstall apk'
5766
task :adb_uninstall do
67+
wait_for_valid_device
5868
# uninstall old api
5969
cmd = 'adb uninstall com.example.android.apis'
6070
run_sh cmd

ruby_lib_android/lib/android/specs/android/helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
t 'find_eles_attr' do
1919
act = find_eles_attr :text
20-
exp = ['API Demos', 'Action Bar', 'Activity', 'Alarm', 'Alert Dialogs', 'Device Admin', 'Fragment', 'Launcher Shortcuts', 'Loader', 'Menu', 'Notification', 'Search', 'Service', 'Text-To-Speech', 'Voice Recognition']
20+
exp = ['API Demos', 'Accessibility', 'Animation', 'App', 'Content', 'Graphics', 'Media', 'NFC', 'OS', 'Preference', 'Text', 'Views']
2121
act.must_equal exp
2222
end
2323

ruby_lib_android/lib/run.rb

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
one_test = File.join(File.dirname(one_test),
5252
File.basename(one_test, '.*') + '.rb')
5353
one_test = File.join(dir, test_dir + 'specs/', one_test)
54+
one_test = File.expand_path one_test
5455
raise "\nTest #{one_test} does not exist.\n" unless File.exists?(one_test)
5556
# require support (common.rb)
5657
Dir.glob(File.join dir, test_dir + '/*.rb') do |test|

0 commit comments

Comments
 (0)