cuke_master 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cuke_master/steps.rb +34 -6
- data/lib/cuke_master/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ce1860b98075600fd4bd08947c7817e7df499ff
|
4
|
+
data.tar.gz: ae1d87ac953f37a4b767719374d1749aea909575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbdbb6ddde0664b5a06daea8d49e10b77a15b9a60486c58fd08077ff59ae7b094107f1ac4d0d4cfdd8238cd7da483f4160500a057f99b39c16b4b602c7b38729
|
7
|
+
data.tar.gz: d793d2fd59f20c0ce1bc6687f959d3de93170bebe3e79c405ffe5f59ec1072dc3fa67f84cb1b84684a0ac5a9122a77603cd7c1a950350c498a1bc460b7a88984
|
data/lib/cuke_master/steps.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
190
|
-
|
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
|
-
|
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
|
-
|
195
|
-
|
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
|
data/lib/cuke_master/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|