features/step_definitions/adb_steps.rb in ADB-0.5.5 vs features/step_definitions/adb_steps.rb in ADB-0.5.6
- old
+ new
@@ -1,8 +1,8 @@
APK_FILE_NAME = 'features/support/ApiDemos.apk'
TEMP_FILE_NAME = 'cuke_test_file.txt'
-TEMP_FILE_REMOTE_LOCATION = '/sdcard/'
+TEMP_FILE_REMOTE_LOCATION = '/sdcard'
When /^the adb server is started$/ do
start_server
end
@@ -21,10 +21,11 @@
Given /^I am connected to the local device$/ do
connect
end
Then /^I should see the device "(.*?)"$/ do |device|
+puts devices
devices.should include device
end
Then /^I should be able to install the sample application$/ do
sn = devices[0]
@@ -78,31 +79,41 @@
Then /^I should be able to push a file to the local device$/ do
# be sure that the file doesn't already exist
sn = devices[0]
wait_for_device({:serial => sn}, 60)
remount({:serial => sn})
+
+ shell("mount -o rw,remount #{TEMP_FILE_REMOTE_LOCATION}", {:serial => sn})
+
shell("rm #{TEMP_FILE_NAME}", {:serial => sn})
shell("ls #{TEMP_FILE_NAME}", {:serial => sn})
+
+
last_stdout.should include 'No such file or directory'
# create the temp file
File.open(TEMP_FILE_NAME, 'w'){ |f| f.write('Temporary file for adb testing. If found, please delete.') }
# push the file
- push(TEMP_FILE_NAME, "#{TEMP_FILE_REMOTE_LOCATION}#{TEMP_FILE_NAME}", {:serial => sn})
+ push(TEMP_FILE_NAME, "#{TEMP_FILE_REMOTE_LOCATION}/#{TEMP_FILE_NAME}", {:serial => sn})
last_stderr.should_not include 'failed to copy'
end
Then /^I should be able to pull a file from the local device$/ do
# confirm that the file exists on the device and not locally
sn = devices[0]
wait_for_device({:serial => sn}, 60)
remount({:serial => sn})
- shell("touch #{TEMP_FILE_REMOTE_LOCATION}#{TEMP_FILE_NAME}", {:serial => sn})
+ shell("touch #{TEMP_FILE_REMOTE_LOCATION}/#{TEMP_FILE_NAME}", {:serial => sn})
# pull the file
- pull "#{TEMP_FILE_REMOTE_LOCATION}#{TEMP_FILE_NAME}", #{TEMP_FILE_NAME}", {:serial => sn})
+ pull "#{TEMP_FILE_REMOTE_LOCATION}/#{TEMP_FILE_NAME}", "#{TEMP_FILE_NAME}", {:serial => sn}
# confirm that the file was created
File.exists?(TEMP_FILE_NAME).should == true
end
+
+Then(/^I can list the installed packages$/) do
+ list_packages
+ last_stdout.should include 'com.leandog.brazenhead'
+end
\ No newline at end of file