lib/calabash-android/operations.rb in calabash-android-0.3.2.pre1 vs lib/calabash-android/operations.rb in calabash-android-0.3.2.pre2
- old
+ new
@@ -31,14 +31,10 @@
end
def default_device
Device.default_device(self)
end
- def shutdown_test_server
- default_device.shutdown_test_server
- end
-
def performAction(action, *arguments)
default_device.perform_action(action, *arguments)
end
def install_app(app_path)
@@ -48,14 +44,22 @@
def uninstall_apps
default_device.uninstall_app("sh.calaba.android.test")
default_device.uninstall_app(ENV["PACKAGE_NAME"])
end
+ def wake_up
+ default_device.wake_up()
+ end
+
def start_test_server_in_background
default_device.start_test_server_in_background()
end
+ def shutdown_test_server
+ default_device.shutdown_test_server
+ end
+
def screenshot_embed(options={:prefix => nil, :name => nil, :label => nil})
default_device.screenshot_embed(options)
end
def screenshot(options={:prefix => nil, :name => nil})
@@ -266,9 +270,16 @@
if @serial
"-s #{@serial}"
else
""
end
+ end
+
+ def wake_up
+ wake_up_cmd = "#{adb_command} shell am start -a android.intent.action.MAIN -n sh.calaba.android.test/sh.calaba.instrumentationbackend.WakeUp"
+ log "Waking up device using:"
+ log wake_up_cmd
+ raise "Could not wake up the device" unless system(wake_up_cmd)
end
def start_test_server_in_background
cmd = "#{adb_command} shell am instrument -e target_package #{ENV["PACKAGE_NAME"]} -e main_activity #{ENV["MAIN_ACTIVITY"]} -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
log "Starting test server using:"