wda_lib 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ba7a44e70f2924d9b630eb1ca715ae792e5f663
4
- data.tar.gz: df7b8eb9560b8027d11e290e0b0d9e7fba0e1890
3
+ metadata.gz: 07987c97d03d838bf2580f5648e565524c82bfc4
4
+ data.tar.gz: b32511cec615e2e441d0a2a6a30efbf5bbb16132
5
5
  SHA512:
6
- metadata.gz: b3725bf02993100bc8f5fc89db2386faa65d9690474903f9c7b2f096d551a945aa38747a391616fb8519f5940c61961c37fe95e2362296e519ccb76336fa0bbb
7
- data.tar.gz: 2c8a16bd2a210972e0176fbe48e5e6f943db7e2ec3b0d0aaf0722983e6c6474d39d12f8a2bf2e70f02566ead3c7bbec856165d46d0cff5fcc8d1b44daa11813f
6
+ metadata.gz: a81c08df02ebf498febfd30f9e12b9d1af95e1fd3cd02582e2dc4ceba4559679cc7f6ac60d44eb5d09cc03b7d3e493aee3fe0956df7b6ab1f588b1641f3b13c1
7
+ data.tar.gz: ec5b3ef0156df7025d6846b97bf1b0d64ae6bd3ad33c89429ed6af446b1422c7c51e269681d8d419983f20c58b99acc304167a0cbca1a1670588e2f9c40e1fc7
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ### wda_lib
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/wda_lib.svg)](https://badge.fury.io/rb/wda_lib)
4
+
3
5
  A simple ruby lib of binding methods for [WebDriverAgent](https://github.com/facebook/WebDriverAgent)
4
6
 
5
7
  ## Install
data/lib/wda_lib/debug.rb CHANGED
@@ -34,22 +34,20 @@ class WDA
34
34
  app = nil
35
35
  homescreen
36
36
  while !app_found && max < 10 do
37
- swipe(@win_x*4/5, 10, @win_y/2, @win_y/2)
38
37
  max += 1
39
- texts(app_name).each do |e|
38
+ icons(app_name).each do |e|
40
39
  app = e
41
40
  if e.displayed?
42
- app_found = true
41
+ app_found = true
43
42
  break
44
43
  end
45
44
  end
45
+ break if app_found = true
46
+ swipe(@win_x*4/5, 10, @win_y/2, @win_y/2)
46
47
  end
47
48
 
48
- if app.nil?
49
- fail "Can't find app :#{app_name}"
50
- else
51
- app
52
- end
49
+ app.nil?? (fail "Can't find app :#{app_name}") : app
50
+
53
51
  end
54
52
 
55
53
  end
@@ -1,6 +1,5 @@
1
1
  require 'base64'
2
2
 
3
-
4
3
  class WDA
5
4
  module Screenshot
6
5
  # Take a screenshot and save to the given path. Format: png.
@@ -11,7 +10,7 @@ class WDA
11
10
  # @return screenshot result [Hash]
12
11
  def screenshot(path, scale = 100)
13
12
  path.include?('.png')? path : path += '.png'
14
- p response = get(@base_url + '/screenshot?scale=' + scale)
13
+ response = get(@base_url + '/screenshot?scale=' + scale)
15
14
  begin
16
15
  File.open(path, 'wb') {|f| f.write Base64.decode64(response['value']) }
17
16
  rescue IOError => e
@@ -4,7 +4,7 @@ class WDA
4
4
  # Get current status
5
5
  # @return [Obj]
6
6
  def status
7
- p @status = get(@base_url + '/status')
7
+ @status = get(@base_url + '/status')
8
8
  @platform_name = @status['value']['os']['name']
9
9
  @platform_version = @status['value']['os']['version']
10
10
  update_status(@status)
@@ -37,14 +37,15 @@ class WDA
37
37
  # This is not realy needed since we can find and click app icon to start app
38
38
  # @return [self]
39
39
  def launch_app(app_name_or_id)
40
+ p "Launching app #{app_name_or_id}"
40
41
  fail 'Either app name or bundle id should be given for launch app' if app_name_or_id.nil?
41
42
  if app_name_or_id.include?('.') # Given value is app's bundle id
42
43
  @bundle_id = app_name_or_id
43
44
  @session_id = nil # Prepare to create new session
44
45
  @session_valid = false # Prepare to create new session
45
- capabilities
46
-
46
+ post(@base_url + '/session', { desiredCapabilities: { bundleId: app_name_or_id }})
47
47
  ## Temporarily disabled
48
+ # capabilities
48
49
  # @driver = Selenium::WebDriver::Driver.for(:remote, :url => @base_url, :desired_capabilities => @caps[:desiredCapabilities])
49
50
  status
50
51
  else
@@ -58,7 +59,9 @@ class WDA
58
59
  # @return [self]
59
60
  def restart(app_name_or_id = nil)
60
61
  quit
62
+ sleep 0.5
61
63
  launch_app(app_name_or_id ||= @bundle_id )
64
+ sleep 0.5
62
65
  end
63
66
 
64
67
  # Exit current app by delete session with given session_id
@@ -1,3 +1,3 @@
1
1
  class WDA
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
  end
data/wda_lib.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
  s.homepage =
19
- 'http://rubygems.org/gems/wda_lib'
19
+ 'https://github.com/znly/wda'
20
20
  s.license = 'MIT'
21
21
 
22
22
  s.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wda_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - MIN Yi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-17 00:00:00.000000000 Z
11
+ date: 2016-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -108,7 +108,7 @@ files:
108
108
  - lib/wda_lib/type.rb
109
109
  - lib/wda_lib/version.rb
110
110
  - wda_lib.gemspec
111
- homepage: http://rubygems.org/gems/wda_lib
111
+ homepage: https://github.com/znly/wda
112
112
  licenses:
113
113
  - MIT
114
114
  metadata: {}