wda_lib 0.0.12 → 0.0.13

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: 07987c97d03d838bf2580f5648e565524c82bfc4
4
- data.tar.gz: b32511cec615e2e441d0a2a6a30efbf5bbb16132
3
+ metadata.gz: 4297f9169a3990320cd044cf27ebcc55647fcec9
4
+ data.tar.gz: d1a4b4c8972b8c00e547a1d5d63df1e0700402aa
5
5
  SHA512:
6
- metadata.gz: a81c08df02ebf498febfd30f9e12b9d1af95e1fd3cd02582e2dc4ceba4559679cc7f6ac60d44eb5d09cc03b7d3e493aee3fe0956df7b6ab1f588b1641f3b13c1
7
- data.tar.gz: ec5b3ef0156df7025d6846b97bf1b0d64ae6bd3ad33c89429ed6af446b1422c7c51e269681d8d419983f20c58b99acc304167a0cbca1a1670588e2f9c40e1fc7
6
+ metadata.gz: c3c826a5c1fc911c4d0674faf1d3a4eab0740876d44beb9f0a34f8ccb41833045985edd61f0887f7138e2ddf6d46d14ede102aa22ab73bb516834793afe6c394
7
+ data.tar.gz: 73954363c11f6f82640939a2348816f0eff7be234d558b095fd722d5779a4209d17d4b389bf02ddd450e76bf273305056db432e6377f55877ceae2cb4745d4cd
data/lib/wda_lib/debug.rb CHANGED
@@ -42,7 +42,7 @@ class WDA
42
42
  break
43
43
  end
44
44
  end
45
- break if app_found = true
45
+ break if app_found
46
46
  swipe(@win_x*4/5, 10, @win_y/2, @win_y/2)
47
47
  end
48
48
 
@@ -292,6 +292,32 @@ class WDA
292
292
  end
293
293
  end
294
294
 
295
+ # Find SearchField by given index or value
296
+ # @param value [String, Integer]
297
+ # If value is integer then return the SearchField at that index
298
+ # If value is string then return the first SearchField which has given value as name
299
+ # @return [Hash, Element]
300
+ def searchfield(value = 0)
301
+ if value.is_a? Numeric
302
+ finds(:xpath, "//XCUIElementTypeSearchField")[value]
303
+ else
304
+ find :xpath, "//XCUIElementTypeSearchField[@name='#{value}']"
305
+ end
306
+ end
307
+
308
+ # Find icons by given index or value
309
+ # @param value [String, Integer]
310
+ # If value is integer then return the SearchField at that index
311
+ # If value is string then return the all SearchFields which have given value as name
312
+ # @return [Array] All found SearchFields
313
+ def searchfields(value = nil)
314
+ if value.nil?
315
+ finds(:xpath, "//XCUIElementTypeSearchField")
316
+ else
317
+ finds :xpath, "//XCUIElementTypeSearchField[@name='#{value}']"
318
+ end
319
+ end
320
+
295
321
  ########### This is calling selenium find_element* methods##########
296
322
  # Find element with given type and value, return first found element
297
323
  # @param args [*args]
@@ -10,6 +10,17 @@ class WDA
10
10
  update_status(@status)
11
11
  end
12
12
 
13
+ # Update current running sessionId to @session_id
14
+ # @param session_response [object] : http GET session response body
15
+ # @return session_reponse [object]
16
+ def update_status(status_response)
17
+ @session_valid = true
18
+ @session_id = status_response['sessionId']
19
+ @url = @base_url + "/session/#{@session_id}"
20
+ capabilities
21
+ status_response
22
+ end
23
+
13
24
  # Get current valid session
14
25
  # @return [Session]
15
26
  def session
@@ -37,7 +48,7 @@ class WDA
37
48
  # This is not realy needed since we can find and click app icon to start app
38
49
  # @return [self]
39
50
  def launch_app(app_name_or_id)
40
- p "Launching app #{app_name_or_id}"
51
+ p "Launching app: #{app_name_or_id}"
41
52
  fail 'Either app name or bundle id should be given for launch app' if app_name_or_id.nil?
42
53
  if app_name_or_id.include?('.') # Given value is app's bundle id
43
54
  @bundle_id = app_name_or_id
@@ -47,11 +58,11 @@ class WDA
47
58
  ## Temporarily disabled
48
59
  # capabilities
49
60
  # @driver = Selenium::WebDriver::Driver.for(:remote, :url => @base_url, :desired_capabilities => @caps[:desiredCapabilities])
50
- status
51
61
  else
52
62
  app_name = app_name_or_id
53
63
  find_app(app_name).click
54
64
  end
65
+ status
55
66
  self
56
67
  end
57
68
 
@@ -60,6 +71,7 @@ class WDA
60
71
  def restart(app_name_or_id = nil)
61
72
  quit
62
73
  sleep 0.5
74
+ status
63
75
  launch_app(app_name_or_id ||= @bundle_id )
64
76
  sleep 0.5
65
77
  end
@@ -71,6 +83,7 @@ class WDA
71
83
  (session_id.nil?)? sessionId = @session_id : sessionId = session_id
72
84
  @base_url + '/session/' + sessionId
73
85
  delete(@base_url + '/session/' + sessionId)
86
+ status
74
87
  end
75
88
 
76
89
  # Same as quit, but delete default @session_id
@@ -1,3 +1,3 @@
1
1
  class WDA
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
data/lib/wda_lib.rb CHANGED
@@ -4,7 +4,6 @@ require 'httparty'
4
4
  require 'selenium-webdriver'
5
5
  Dir[File.dirname(__FILE__) + '/selenium_patch/*.rb'].each {|file| require_relative file }
6
6
 
7
-
8
7
  class WDA
9
8
 
10
9
  include HTTParty
@@ -75,17 +74,6 @@ class WDA
75
74
  @caps = { desiredCapabilities: selenium_capabilities }
76
75
  end
77
76
 
78
- # Update current running sessionId to @session_id
79
- # @param session_response [object] : http GET session response body
80
- # @return session_reponse [object]
81
- def update_status(status_response)
82
- @session_valid = true
83
- @session_id = status_response['sessionId']
84
- @url = @base_url + "/session/#{@session_id}"
85
- capabilities
86
- status_response
87
- end
88
-
89
77
  # HTTP methods for dealing with all supported motheds in FB WDA
90
78
  # I don't like to write such pieces of code, it removes all query params and headers,
91
79
  # But as FB WDA is doing like this, this can simplify codes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wda_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - MIN Yi