Skip to content

Commit

Permalink
Fix steps and feature for support on travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbyler committed Mar 21, 2013
1 parent 74d56a3 commit b5a575c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion features/ADB.feature
Expand Up @@ -32,7 +32,7 @@ Feature: Using the ADB module
Given the adb server is started
And I am connected to the local device
When I change the devices date and time to 08/10/2012 11:25
Then the device time should be Aug 10 11:25:00 EDT 2012
Then the device time should be Aug 10 11:25:00

Scenario: Forwarding ports
Given the adb server is started
Expand Down
13 changes: 9 additions & 4 deletions features/step_definitions/adb_steps.rb
@@ -1,6 +1,6 @@
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
Expand Down Expand Up @@ -81,15 +81,20 @@
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
Expand All @@ -99,10 +104,10 @@
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
Expand Down

0 comments on commit b5a575c

Please sign in to comment.