cuke_master 0.1.6 → 0.1.7

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: a867e55853fd00f55a00ba95414a086979ed9892
4
- data.tar.gz: a732a3d9008864e0bcac4e2936236b529d7fe16f
3
+ metadata.gz: 4ce1860b98075600fd4bd08947c7817e7df499ff
4
+ data.tar.gz: ae1d87ac953f37a4b767719374d1749aea909575
5
5
  SHA512:
6
- metadata.gz: 4e90e00e5c5b5f0b4ea41ac0c3c2fe42f65f3c4076eef1e37d052cadd6cca3303c2d3bcc22620d265aec37775deca140a2c0c4b6a1fd2b7d25fa9f5191a1865b
7
- data.tar.gz: 53defeb22f1eb9937478c86b0a7d5ec3f66211919e310382b461e4aeea505c34b77add8fd1698b5f203740ac28396d928914572d2d7c6e3c04de72c8e607fe0d
6
+ metadata.gz: dbdbb6ddde0664b5a06daea8d49e10b77a15b9a60486c58fd08077ff59ae7b094107f1ac4d0d4cfdd8238cd7da483f4160500a057f99b39c16b4b602c7b38729
7
+ data.tar.gz: d793d2fd59f20c0ce1bc6687f959d3de93170bebe3e79c405ffe5f59ec1072dc3fa67f84cb1b84684a0ac5a9122a77603cd7c1a950350c498a1bc460b7a88984
@@ -169,7 +169,11 @@ attribute "([^"]*)" value "([^"]*)"$/) do |option, attribute, value|
169
169
  select = first(:xpath, ".//select[contains(@#{attribute}, '#{value}')]")
170
170
 
171
171
  if select.nil?
172
- raise "No such select found with attribute \"#{attribute}\" ~= \"#{value}\""
172
+ select = first(:xpath, ".//select[contains(@#{attribute}, '#{value}')]",
173
+ visible: false)
174
+ if select.ni?
175
+ raise "No such select found with attribute \"#{attribute}\" ~= \"#{value}\""
176
+ end
173
177
  end
174
178
 
175
179
  option = select.find(:xpath, "option[contains(text(), '#{option}')]")
@@ -186,13 +190,37 @@ attribute "([^"]*)" value "([^"]*)"$/) do |option, position, attribute, value|
186
190
  select = selects[@pos_number[position.to_sym] - 1]
187
191
 
188
192
  if select.nil?
189
- raise "No such select found with attribute \"#{attribute}\" ~= \"#{value}\""
190
- end
193
+ selects = all(:xpath, ".//select[contains(@#{attribute}, '#{value}')]",
194
+ visible: false)
195
+ select = selects[@pos_number[position.to_sym] - 1]
196
+ if select.nil?
197
+ raise "No such select found with attribute \"#{attribute}\" ~= \"#{value}\""
198
+ end
191
199
 
192
- option = select.find(:xpath, "option[contains(text(), '#{option}')]")
200
+ page.execute_script \
201
+ "var select =
202
+ document.evaluate(
203
+ \"#{select.path}\",
204
+ document,
205
+ null,
206
+ XPathResult.FIRST_ORDERED_NODE_TYPE,
207
+ null).singleNodeValue;
208
+ for(let child in select.children) {
209
+ if(select.children[child].innerHTML == \"#{option}\") {
210
+ select.children[child].selected = \"selected\";
211
+ }
212
+ };
213
+ var evt = document.createEvent(\"HTMLEvents\");
214
+ evt.initEvent('change', false, true);
215
+ select.dispatchEvent(evt);"
216
+ else
217
+ option =
218
+ select
219
+ .find(:xpath, "option[contains(text(), '#{option}')]")
193
220
 
194
- raise "No option found with text #{option}" if option.nil?
195
- option.select_option
221
+ raise "No option found with text #{option}" if option.nil?
222
+ option.select_option
223
+ end
196
224
  end
197
225
 
198
226
  # 3.8 Select a date in date picker
@@ -1,3 +1,3 @@
1
1
  module CukeMaster
2
- VERSION = '0.1.6'.freeze
2
+ VERSION = '0.1.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Huynh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler