wda_lib 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wda_lib/debug.rb +1 -1
- data/lib/wda_lib/find_element.rb +26 -0
- data/lib/wda_lib/session.rb +15 -2
- data/lib/wda_lib/version.rb +1 -1
- data/lib/wda_lib.rb +0 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4297f9169a3990320cd044cf27ebcc55647fcec9
|
4
|
+
data.tar.gz: d1a4b4c8972b8c00e547a1d5d63df1e0700402aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3c826a5c1fc911c4d0674faf1d3a4eab0740876d44beb9f0a34f8ccb41833045985edd61f0887f7138e2ddf6d46d14ede102aa22ab73bb516834793afe6c394
|
7
|
+
data.tar.gz: 73954363c11f6f82640939a2348816f0eff7be234d558b095fd722d5779a4209d17d4b389bf02ddd450e76bf273305056db432e6377f55877ceae2cb4745d4cd
|
data/lib/wda_lib/debug.rb
CHANGED
data/lib/wda_lib/find_element.rb
CHANGED
@@ -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]
|
data/lib/wda_lib/session.rb
CHANGED
@@ -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
|
data/lib/wda_lib/version.rb
CHANGED
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
|