wda_lib 0.0.19 → 0.0.20

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: e7bd726e001942bb862ef2a84530479e09931b7a
4
- data.tar.gz: 9995494131ba577468193824c67a0a038391fd9e
3
+ metadata.gz: 19883542a4fe2fc7642ded024233e0b232f07d56
4
+ data.tar.gz: 2af914564729ff76ff75974d1a21907c269b27a7
5
5
  SHA512:
6
- metadata.gz: 340e97cdc8d0cabfbd4fc5c2432fbb0422b6e2de21406571098be320ddb3aa0bea6501eba7247cd598ea166e5ab4b4cabf60d523a705e888a61f0bbedd4867fa
7
- data.tar.gz: 72404538b6fb11a977ec3a9f4299b94b6f67f7fefcfd54aa6bd6b951c71ac766bfe84a82e487005f63a1c2e935c8014f66c5c23a404296c23fd6043c734219b2
6
+ metadata.gz: aae9e4320f23268979f7cc2aba7af70fd6a7c846da858ebeca93fca8302f4a8e33759b0044d0f94b758b210755b8799a0c30654b120d413d25758e06a60bea28
7
+ data.tar.gz: d9e6af8060a6d7f0451b6aeea05f2d14189ea04652b795b4b9562fb6cf68f893e261f90b4985858ade51479361869d157295b8da75a97136b18befd1f369acb6
@@ -10,24 +10,28 @@ module Selenium
10
10
  #
11
11
  # http://www.w3.org/TR/2015/WD-webdriver-20150918/#list-of-endpoints
12
12
  #
13
- unfrozen_COMMANDS = COMMANDS.dup
14
- unfrozen_COMMANDS.merge!({
15
- get_page_source_json: [:get, 'source/json'.freeze],
16
- get_page_source_xml: [:get, 'source/xml'.freeze],
17
- session_status: [:get, 'status'.freeze],
18
- get_element_rect: [:get, 'session/:session_id/element/:id/rect'.freeze],
19
- is_element_accessible: [:get, 'session/:session_id/element/:id/accessible'.freeze],
20
- element_accessibility_container: [:get, 'session/:session_id/element/:id/accessibilityContainer'.freeze],
21
- double_click_element: [:post, 'session/:session_id/element/:id/doubleTap'.freeze],
22
- two_finger_click_element: [:post, 'session/:session_id/element/:id/twoFingerTap'.freeze],
23
- touch_and_hold_element: [:post, 'session/:session_id/element/:id/touchAndHold'.freeze],
24
- scroll_element: [:post, 'session/:session_id/uiaElement/:id/scroll'.freeze],
25
- drag_from_to_for_duration: [:post, 'session/:session_id/uiaTarget/:uuid/dragfromtoforduration'.freeze],
26
- tap: [:post, 'session/:session_id/doubleTap/:id'.freeze],
27
- tap_and_hold: [:post, 'session/:session_id/touchAndHold'.freeze],
28
- double_tap: [:post, 'session/:session_id/doubleTap'.freeze]
29
- })
30
- COMMANDS = unfrozen_COMMANDS.freeze
13
+ patched_commands = {
14
+ get_page_source_json: [:get, 'source/json'.freeze],
15
+ get_page_source_xml: [:get, 'source/xml'.freeze],
16
+ session_status: [:get, 'status'.freeze],
17
+ get_element_rect: [:get, 'session/:session_id/element/:id/rect'.freeze],
18
+ is_element_accessible: [:get, 'session/:session_id/element/:id/accessible'.freeze],
19
+ element_accessibility_container: [:get, 'session/:session_id/element/:id/accessibilityContainer'.freeze],
20
+ double_click_element: [:post, 'session/:session_id/element/:id/doubleTap'.freeze],
21
+ two_finger_click_element: [:post, 'session/:session_id/element/:id/twoFingerTap'.freeze],
22
+ touch_and_hold_element: [:post, 'session/:session_id/element/:id/touchAndHold'.freeze],
23
+ scroll_element: [:post, 'session/:session_id/uiaElement/:id/scroll'.freeze],
24
+ drag_from_to_for_duration: [:post, 'session/:session_id/uiaTarget/:uuid/dragfromtoforduration'.freeze],
25
+ tap: [:post, 'session/:session_id/doubleTap/:id'.freeze],
26
+ tap_and_hold: [:post, 'session/:session_id/touchAndHold'.freeze],
27
+ double_tap: [:post, 'session/:session_id/doubleTap'.freeze]
28
+ }
29
+
30
+ PATCHED_COMMANDS = patched_commands.merge!(COMMANDS).freeze
31
+
32
+ def commands(command)
33
+ PATCHED_COMMANDS[command]
34
+ end
31
35
  end
32
36
  end # Remote
33
37
  end # WebDriver
data/lib/wda_lib/debug.rb CHANGED
@@ -52,8 +52,16 @@ class WDA
52
52
  end
53
53
 
54
54
  app.nil?? (fail "Can't find app :#{app_name}") : app
55
-
56
55
  end
57
56
 
57
+ def exists
58
+ exists = true
59
+ begin
60
+ yield # search for element
61
+ rescue
62
+ exists = false # error means it's not there
63
+ end
64
+ exists
65
+ end
58
66
  end
59
67
  end
@@ -3,5 +3,5 @@
3
3
  # Copyright © 2016 Zenly. All rights reserved.
4
4
  #
5
5
  class WDA
6
- VERSION = '0.0.19'
6
+ VERSION = '0.0.20'
7
7
  end
data/lib/wda_lib.rb CHANGED
@@ -27,7 +27,6 @@ class WDA
27
27
  include ::WDA::Type
28
28
  include ::WDA::Error
29
29
 
30
-
31
30
  Point = Struct.new(:x, :y)
32
31
  Dimension = Struct.new(:width, :height)
33
32
 
@@ -62,11 +61,12 @@ class WDA
62
61
  @url = @base_url
63
62
  @server_host = parsed_url.host
64
63
  @server_port = parsed_url.port
65
- @timeout = 10
64
+ @default_timeout = opts.fetch :default_timeout, 10
65
+ @timeout = @default_timeout
66
66
  @listener = opts.fetch :listener, nil
67
67
  status
68
68
  window_size
69
- p capabilities(opts)
69
+ capabilities(opts)
70
70
  @http_client ||= Selenium::WebDriver::Remote::Http::Default.new(open_timeout: 999_999, read_timeout: 999_999)
71
71
  @driver = Selenium::WebDriver.for(:remote,
72
72
  http_client: @http_client,
@@ -115,4 +115,15 @@ class WDA
115
115
  def delete(path)
116
116
  WDA.delete(path)
117
117
  end
118
+
119
+ def set_wait(timeout = nil)
120
+ if timeout.nil?
121
+ @timeout = @default_timeout
122
+ elsif timeout < 1
123
+ @timeout = 1
124
+ else
125
+ @timeout = timeout.to_i
126
+ end
127
+ return @timeout
128
+ end
118
129
  end
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.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - MIN Yi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-03 00:00:00.000000000 Z
11
+ date: 2017-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake