Module: ImperiusGem
- Defined in:
- lib/thing.rb,
lib/device.rb
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.connect(device_id = "") ⇒ Object
class
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/device.rb', line 58 def self.connect(device_id="") devices=`adb devices`.split( /\r?\n/ )[1..-1].map!{|d| d.split("\t")[0]} device_id = devices[0] if (device_id.to_s == '') port = ((rand()*10000)+1000).to_i puts "using port #{port} with device #{device_id}".green.on_white `adb -s #{device_id} forward tcp:#{port} tcp:#{port}` Thread.new { `adb -s #{device_id} shell uiautomator runtest UiAutoServer.jar -c TestServer -e port #{port}` } d = Device.new("http://localhost:#{port}") d.setPackages(["com.android.uiautomator.core"]) at_exit { d.terminate } end |