gridium 1.1.17 → 1.1.20

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/element.rb +2 -2
  3. data/lib/page.rb +20 -7
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3cd34ee0c8012768432f48c83e1ad9d690f3ac7
4
- data.tar.gz: eaa3429b997c786c47d9080e8ce0c249e6480987
3
+ metadata.gz: 4aca24b0651f872bf562fd3ed0c942b87e642294
4
+ data.tar.gz: 42f21919a492043b5d6b7795625f4c2413c7aa94
5
5
  SHA512:
6
- metadata.gz: 054c8e990bc956d6e99041835edf9fb7c1da9fe952bff759afe4993a67634dc4b0f5478a042ccdd6d2dd8658abfff92171af27d794ab3fd9427f752094e7a0f4
7
- data.tar.gz: e48f724a66786952f620a2e7aae6a0db5f8cd9ff2db6c830c22254a4c3466656a653a8d76df66d8161b2044a828e54be67ad4c6921605667c2a0f254580ac80e
6
+ metadata.gz: 6ef11a4aed69775333bfa1d8fc4fa6bfde6b40c7d34a8df3b6638543890fc7be12c40f9907a4a07e2f0c28d4130efc3c0dd9dbbfc31cdc44de2d24974e74fd1f
7
+ data.tar.gz: eae99ef9001f83128cf01ea69c49c885c5a46cad358a69e8c0568c03d8caacd6345d84518934c1c191682ff87ecc5a3d950b2999caadd280b14341bfa9bb9cc3
data/lib/element.rb CHANGED
@@ -225,11 +225,11 @@ class Element
225
225
  end
226
226
 
227
227
  # Raw webdriver mouse over
228
- def mouse_over
228
+ def mouse_over(x: 0, y: 0)
229
229
  Log.debug("[GRIDIUM::Element] Triggering mouse over for (#{self.to_s})...")
230
230
  if element.enabled?
231
231
  $verification_passes += 1
232
- ElementExtensions.mouse_over(self)
232
+ ElementExtensions.mouse_over(self, x: x, y: y)
233
233
  else
234
234
  Log.error('[GRIDIUM::Element] Cannot mouse over. Element is not present.')
235
235
  end
data/lib/page.rb CHANGED
@@ -119,16 +119,29 @@ module Gridium
119
119
  root.find_elements(by, locator)
120
120
  end
121
121
 
122
- def find(by, locator)
123
- Element.new("Page Find Element", by, locator)
122
+ def find(by, locator, opts = {})
123
+ Element.new("Page Find Element", by, locator, opts)
124
124
  end
125
125
 
126
126
  def first(by, locator)
127
127
  all(by, locator).first
128
128
  end
129
129
 
130
+ #
131
+ # mouse/hover over request 'text' at options coordinates and optional index
132
+ # @param [String] text
133
+ # @param [Integer] x - optional x coordinate
134
+ # @param [Integer] y - optional y coordinate
135
+ # @param [Integer] index - optional index, if multiple instances of 'text' are found
136
+ #
137
+ def mouse_over(text, x: 0, y: 0, index: 1)
138
+ Element.new("Clicking #{text}", :xpath, "(//*[text()=\"#{text}\"])[#{index}]").mouse_over(x: x, y: y)
139
+ end
140
+
141
+ alias_method :hover, :mouse_over
142
+
130
143
  def click_on(text)
131
- Element.new("Clicking #{text}", :xpath, "//*[text()='#{text}']").click
144
+ Element.new("Clicking #{text}", :xpath, "//*[text()=\"#{text}\"]").click
132
145
  end
133
146
 
134
147
  # Click the link on the page
@@ -136,9 +149,9 @@ module Gridium
136
149
  # @param [Integer] link_index (optional) - With multiple links on the page with the same name, click on the specified link index
137
150
  def click_link(link_text, link_index: nil)
138
151
  if link_index
139
- Element.new("Clicking #{link_text} Link (#{link_index})", :xpath, "(//a[contains(., '#{link_text}')])[#{link_index}]").click
152
+ Element.new("Clicking #{link_text} Link (#{link_index})", :xpath, "(//a[contains(., \"#{link_text}\")])[#{link_index}]").click
140
153
  else
141
- Element.new("Clicking #{link_text} Link", :xpath, "//a[contains(., '#{link_text}')]").click
154
+ Element.new("Clicking #{link_text} Link", :xpath, "//a[contains(., \"#{link_text}\")]").click
142
155
  end
143
156
  end
144
157
 
@@ -148,9 +161,9 @@ module Gridium
148
161
  def click_button(button_name, button_index: nil)
149
162
  #The button maybe a link that looks like a button - we want to handle both
150
163
  if button_index
151
- button = Element.new("Clicking #{button_name} button (#{button_index})", :xpath, "(//button[contains(., '#{button_name}')])[#{button_index}]")
164
+ button = Element.new("Clicking #{button_name} button (#{button_index})", :xpath, "(//button[contains(., \"#{button_name}\")])[#{button_index}]")
152
165
  else
153
- button = Element.new("Clicking #{button_name} button", :xpath, "//button[contains(., '#{button_name}')]")
166
+ button = Element.new("Clicking #{button_name} button", :xpath, "//button[contains(., \"#{button_name}\")]")
154
167
  end
155
168
  begin
156
169
  button.click
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: 1.1.17
4
+ version: 1.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Urban
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler