gridium 0.1.20 → 0.1.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b77202e6bee5d80ba570b3b4e7fd9bc7c1dd1c68
4
- data.tar.gz: aab4d3d8350d17a50910935cd27cfe07829f656c
3
+ metadata.gz: bf751acc7432fc7e919c8bc1d1f74f8b5a21029e
4
+ data.tar.gz: 558a5a0eedbc3437dee61396a694269bb1e842d7
5
5
  SHA512:
6
- metadata.gz: 51124171ab972f58911934f438ddb9a7123d598ba439eb40ac41149e2b67e3a2b8f23ac147fb23f5fdc07aee7ff4a24aa1f8c8e48de459e0580640b13d78c5db
7
- data.tar.gz: a16ecd7dbc901c9554966ad23d43d1591dbd7da4c9e92054ceb6f5708ad0cde3a1583536513d933912ebf399b307e179d680689218064992d4653760a91266e5
6
+ metadata.gz: f39e4d62c68af7a47d4809d634305af954366dacdd2d24302bb54352295fc6d4581cf4255924f3d15dfa6ee0c287a99dbc8f17ae1da3ae6a8cb0a2ca8aec6d2f
7
+ data.tar.gz: ac3e6e2828465e3934df04647f07e9f40182f03b1199494da87acd7f12f925a9824d12b8cb7e59da1db4482f0889bc48a1a19ec0069a3db8c0cf83554a218403
data/README.md CHANGED
@@ -153,7 +153,7 @@ It's important to remember that Elements are not actually found on the page, unt
153
153
 
154
154
  ## Contributing
155
155
 
156
- Bug reports and pull requests are welcome on GitHub at https://github.com/sethuster/gridium. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
156
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sethuster/gridium. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
157
157
 
158
158
 
159
159
  ## License
data/lib/element.rb CHANGED
@@ -23,7 +23,7 @@ class Element
23
23
  end
24
24
 
25
25
  def element
26
- if @element.nil? or is_stale?
26
+ if stale?
27
27
  wait = Selenium::WebDriver::Wait.new :timeout => Gridium.config.element_timeout, :interval => 1
28
28
  if Gridium.config.visible_elements_only
29
29
  wait.until { @element = displayed_element }
@@ -49,7 +49,7 @@ class Element
49
49
  found_element = element; #this will always return the last displayed element
50
50
  end
51
51
  end
52
- rescue Exception => e
52
+ rescue StandardError
53
53
  if found_element
54
54
  Log.warn("An element was found, but it was not displayed on the page. Gridium.config.visible_elements_only set to: #{Gridium.config.visible_elements_only} Element: #{self.to_s}")
55
55
  else
@@ -65,17 +65,17 @@ class Element
65
65
  # ================ #
66
66
 
67
67
  # soft failure, will not kill test immediately
68
- def verify(timeout=nil)
68
+ def verify(timeout: nil)
69
69
  Log.debug('Verifying new element...')
70
70
  timeout = Gridium.config.element_timeout if timeout.nil?
71
71
  ElementVerification.new(self, timeout)
72
72
  end
73
73
 
74
74
  # hard failure, will kill test immediately
75
- def wait_until(timeout=nil)
75
+ def wait_until(timeout: nil)
76
76
  Log.debug('Waiting for new element...')
77
77
  timeout = Gridium.config.element_timeout if timeout.nil?
78
- ElementVerification.new(self, timeout, fail_test=true)
78
+ ElementVerification.new(self, timeout, fail_test: true)
79
79
  end
80
80
 
81
81
  def attribute(name)
@@ -83,19 +83,15 @@ class Element
83
83
  end
84
84
 
85
85
  def present?
86
- begin
87
- return element.enabled?
88
- rescue Exception => e
89
- return false
90
- end
86
+ return element.enabled?
87
+ rescue StandardError
88
+ return false
91
89
  end
92
90
 
93
91
  def displayed?
94
- begin
95
- return element.displayed?
96
- rescue Exception => e
97
- return false
98
- end
92
+ return element.displayed?
93
+ rescue StandardError
94
+ return false
99
95
  end
100
96
 
101
97
  def enabled?
@@ -122,7 +118,7 @@ class Element
122
118
  if element.enabled?
123
119
  ElementExtensions.highlight(self) if Gridium.config.highlight_verifications
124
120
  $verification_passes += 1
125
- element.send_keys *args
121
+ element.send_keys(*args)
126
122
  else
127
123
  Log.error('Cannot type into element. Element is not present.')
128
124
  end
@@ -294,14 +290,11 @@ class Element
294
290
 
295
291
  private
296
292
 
297
- def is_stale?
298
- begin
299
- if @element.enabled?
300
- return false
301
- end
302
- rescue Exception => e
303
- Log.warn("Stale element detected.... #{self.to_s}")
304
- return true
305
- end
293
+ def stale?
294
+ return true if @element.nil?
295
+ @element.disabled?
296
+ rescue StandardError
297
+ Log.warn("Stale element detected.... #{self.to_s}")
298
+ return true
306
299
  end
307
- end
300
+ end
@@ -6,7 +6,7 @@ class Gridium::ElementVerification
6
6
  # @param [Integer] timeout
7
7
  # @param [Boolean] not_verification - Whether or not we are 'NOT' verifying something about the element
8
8
  #
9
- def initialize(element, timeout, fail_test=false, element_should_exist=true)
9
+ def initialize(element, timeout, fail_test: false, element_should_exist: true)
10
10
  @element = element # Selement
11
11
  @timeout = timeout
12
12
  @should_exist = element_should_exist
@@ -14,7 +14,7 @@ class Gridium::ElementVerification
14
14
  end
15
15
 
16
16
  def not
17
- ElementVerification.new(@element, @timeout, @fail_test, element_should_exist=false)
17
+ ElementVerification.new(@element, @timeout, @fail_test, element_should_exist: false)
18
18
  end
19
19
 
20
20
  def text(text)
@@ -158,4 +158,4 @@ class Gridium::ElementVerification
158
158
  $verification_passes += 1
159
159
  Log.debug("Verified: '#{@element.name}' (By:(#{@element.by} => '#{@element.locator}')) #{pass_message}")
160
160
  end
161
- end
161
+ end
@@ -1,3 +1,3 @@
1
1
  module Gridium
2
- VERSION = "0.1.20"
2
+ VERSION = "0.1.21"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gridium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Urban
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-03 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler