watir-formhandler 2.6.1 → 2.7.0
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 +4 -4
- data/README.md +11 -9
- data/lib/watir-formhandler/container.rb +26 -19
- data/lib/watir-formhandler/option_group.rb +5 -2
- data/spec/container_spec.rb +93 -53
- data/spec/html/form.html +5 -2
- metadata +16 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d1521feb2905d31223a4bd195a0e9f47515c7724
|
|
4
|
+
data.tar.gz: 80aae55990ee6c1280a63665c1bd017b7b957271
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b6fdfc3386724a26b1391181f9debcd5cf16b396423c2777766e6cc17c8f92537df9e6ef773b4684c4f2bf53f9b7f7cf9a3d20e62ed5a236f8917ce34c5e211
|
|
7
|
+
data.tar.gz: 5ba987627b5da309ca87a7b45bc0085af76d0a97485b02ffa2f3e108785fdfb30103694de06a00b611c1afd6b01cd9dd6ead3223d586b1af57cf8a36e3d0042a
|
data/README.md
CHANGED
|
@@ -110,19 +110,14 @@ its current value.
|
|
|
110
110
|
### OptionGroup
|
|
111
111
|
|
|
112
112
|
A new Container sub class, which represents a group of radio buttons and/or checkboxes. Such a group
|
|
113
|
-
may always be referred to,
|
|
114
|
-
|
|
113
|
+
may always be referred to, but since 2.7.0 the group will also be automatically returned by #field of
|
|
114
|
+
the described label is pointing to anything else but a regular input field.
|
|
115
115
|
|
|
116
116
|
browser = Watir::Browser.new('example_site')
|
|
117
117
|
form = browser.form(id: 'my_form')
|
|
118
118
|
|
|
119
|
-
form.field('OptionsGroupElement') # will return the
|
|
120
|
-
#
|
|
121
|
-
|
|
122
|
-
form.field('OptionsGroupElement', include_groups: true) # returns OptionGroup node to which
|
|
123
|
-
# the Checkbox/Radio with label
|
|
124
|
-
# 'OptiongsGroupElement' belongs to.
|
|
125
|
-
|
|
119
|
+
form.field('OptionsGroupElement') # will return the the collection of checkboxes and radios
|
|
120
|
+
# as OptionGroup instance
|
|
126
121
|
|
|
127
122
|
|
|
128
123
|
### :start_node
|
|
@@ -138,6 +133,13 @@ methods directly on your Watir::Browser instance.
|
|
|
138
133
|
|
|
139
134
|
### Latest Changes
|
|
140
135
|
|
|
136
|
+
#### Version 2.7.0
|
|
137
|
+
|
|
138
|
+
* Updated minimum watir-webdriver version to 0.7.0
|
|
139
|
+
* Tests passed with selenium-webdriver 2.46.2, compatible with Firefox 38.0, Chromium 43
|
|
140
|
+
* Changed OptionGroup to behave like a normal element now
|
|
141
|
+
* OptionGroup will now automatically be returned by #field and used by the respective methods.
|
|
142
|
+
|
|
141
143
|
#### Version 2.6.1
|
|
142
144
|
|
|
143
145
|
* Fixed documentation of #value_of method
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
module Watir
|
|
2
2
|
module Container
|
|
3
|
+
|
|
4
|
+
FORM_FIELDS = [Input, Select, TextArea]
|
|
5
|
+
|
|
3
6
|
# Searches for the specified label and returns the form field belonging to it, identified by the
|
|
4
7
|
# 'for' attribute of the label. Alternatively, you may pass a Watir::Label.
|
|
5
8
|
# @param [String, Watir::Label] label the label for which to find the form field.
|
|
6
9
|
# @param [Watir::Element] start_node the node where to start searching for the label.
|
|
7
|
-
# @param [Boolean] include_groups whether to detect the group of a given label.
|
|
8
10
|
# @param [Boolean] placeholder whether to handle label as Watir::Label or as placeholder
|
|
9
11
|
# attribute for an input field.
|
|
10
12
|
# @param [Boolean] id assumes the given label is an HTML ID and searches for it.
|
|
11
13
|
#
|
|
12
|
-
# @return [Watir::Element] form field of the given label.
|
|
13
|
-
|
|
14
|
+
# @return [Watir::Element] form field of the given label. If the field is
|
|
15
|
+
# no form field, it will be assumed to be an
|
|
16
|
+
# OptionGroup.
|
|
17
|
+
def field(label, start_node: nil, placeholder: false, id: false)
|
|
14
18
|
start_node ||= self
|
|
15
19
|
|
|
16
20
|
if placeholder
|
|
@@ -19,7 +23,7 @@ module Watir
|
|
|
19
23
|
start_node.element(id: label).to_subtype
|
|
20
24
|
else
|
|
21
25
|
field_label = label.respond_to?(:for) ? label : start_node.label(text: label)
|
|
22
|
-
determine_field(start_node, field_label
|
|
26
|
+
determine_field(start_node, field_label)
|
|
23
27
|
end
|
|
24
28
|
end
|
|
25
29
|
|
|
@@ -29,14 +33,12 @@ module Watir
|
|
|
29
33
|
# @param [String, Watir::Label] label the label for which to find the form field.
|
|
30
34
|
# @param [String, Boolean, Array] value to be set.
|
|
31
35
|
# @param [Watir::Element] start_node the node where to start searching for the label.
|
|
32
|
-
# @param [Boolean] include_groups whether to detect the group of a given label.
|
|
33
36
|
# @param [Boolean] placeholder whether to handle label as Watir::Label or as placeholder
|
|
34
37
|
# attribute for an input field.
|
|
35
38
|
# @param [Boolean] id assumes the given label is an HTML ID and searches for it.
|
|
36
|
-
def fill_in(label, value, start_node: nil,
|
|
39
|
+
def fill_in(label, value, start_node: nil, placeholder: false, id: false)
|
|
37
40
|
field(label,
|
|
38
41
|
start_node: start_node,
|
|
39
|
-
include_groups: include_groups,
|
|
40
42
|
placeholder: placeholder,
|
|
41
43
|
id: id
|
|
42
44
|
).set(value)
|
|
@@ -47,15 +49,13 @@ module Watir
|
|
|
47
49
|
# parameters as the #field method.
|
|
48
50
|
# @param [String, Watir::Label] label the label for which to find the form field.
|
|
49
51
|
# @param [Watir::Element] start_node the node where to start searching for the label.
|
|
50
|
-
# @param [Boolean] include_groups whether to detect the group of a given label.
|
|
51
52
|
# @param [Boolean] placeholder whether to handle label as Watir::Label or as placeholder
|
|
52
53
|
# attribute for an input field.
|
|
53
54
|
# @param [Boolean] id assumes the given label is an HTML ID and searches for it.
|
|
54
55
|
# @return [String, Boolean, Array] current value of the field.
|
|
55
|
-
def value_of(label, start_node: nil,
|
|
56
|
+
def value_of(label, start_node: nil, placeholder: false, id: false)
|
|
56
57
|
field(label,
|
|
57
58
|
start_node: start_node,
|
|
58
|
-
include_groups: include_groups,
|
|
59
59
|
placeholder: placeholder,
|
|
60
60
|
id: id
|
|
61
61
|
).field_value
|
|
@@ -65,22 +65,29 @@ module Watir
|
|
|
65
65
|
# Returns an OptionGroup
|
|
66
66
|
# @return [OptionGroup] the selected OptionGroup
|
|
67
67
|
def option_group(*args)
|
|
68
|
-
selector = args.first.respond_to?(:elements)
|
|
68
|
+
selector = if args.first.respond_to?(:elements)
|
|
69
|
+
args.first
|
|
70
|
+
else
|
|
71
|
+
extract_selector(args)
|
|
72
|
+
end
|
|
69
73
|
OptionGroup.new(self, selector)
|
|
70
74
|
end
|
|
71
75
|
Watir.extend_tag_to_class(:option_group, OptionGroup)
|
|
72
76
|
|
|
73
77
|
|
|
74
|
-
|
|
75
78
|
private
|
|
76
|
-
def determine_field(start_node, label
|
|
77
|
-
if include_groups
|
|
78
|
-
group_member_count = label.parent.checkboxes.count + label.parent.radios.count
|
|
79
|
-
return option_group(label.parent) if group_member_count > 1
|
|
80
|
-
end
|
|
81
|
-
|
|
79
|
+
def determine_field(start_node, label)
|
|
82
80
|
found_field = start_node.element(id: label.for)
|
|
83
|
-
found_field ? found_field.to_subtype : nil
|
|
81
|
+
typed_field = found_field ? found_field.to_subtype : nil
|
|
82
|
+
|
|
83
|
+
is_group?(typed_field) ? option_group(found_field) : typed_field
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def is_group?(field_to_inspect)
|
|
88
|
+
FORM_FIELDS.reduce(true) do |is_group, field_class|
|
|
89
|
+
is_group & !field_to_inspect.is_a?(field_class)
|
|
90
|
+
end
|
|
84
91
|
end
|
|
85
92
|
end
|
|
86
93
|
end
|
|
@@ -12,8 +12,6 @@ module Watir
|
|
|
12
12
|
def initialize(parent, selector)
|
|
13
13
|
stripped_selector = selector.respond_to?(:selector) ? selector.selector : selector
|
|
14
14
|
super parent, stripped_selector
|
|
15
|
-
|
|
16
|
-
@element = selector if selector.respond_to?(:selector)
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
|
|
@@ -83,6 +81,11 @@ module Watir
|
|
|
83
81
|
end
|
|
84
82
|
|
|
85
83
|
|
|
84
|
+
def tag_name
|
|
85
|
+
'option_group'
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
|
|
86
89
|
private
|
|
87
90
|
def select(options_to_select, value_to_set)
|
|
88
91
|
options_to_select.each{ |option| @options[option].set(value_to_set) }
|
data/spec/container_spec.rb
CHANGED
|
@@ -8,6 +8,10 @@ module Watir
|
|
|
8
8
|
|
|
9
9
|
before(:each) { browser.goto(local_url(FORM_PAGE)) }
|
|
10
10
|
|
|
11
|
+
def field_label(text)
|
|
12
|
+
browser.label(text: text)
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
describe '#option_group' do
|
|
12
16
|
context 'using a selector' do
|
|
13
17
|
it "returns a Watir::OptionGroup for id: 'checkboxset'" do
|
|
@@ -22,7 +26,7 @@ module Watir
|
|
|
22
26
|
context 'using a node' do
|
|
23
27
|
it 'returns a Watir::OptionGroup for a given Watir::Element' do
|
|
24
28
|
fieldset = browser.fieldset(id: 'checkboxset')
|
|
25
|
-
expect(browser.option_group(fieldset).tag_name).to eq('
|
|
29
|
+
expect(browser.option_group(fieldset).tag_name).to eq('option_group')
|
|
26
30
|
end
|
|
27
31
|
end
|
|
28
32
|
end # #option_group
|
|
@@ -44,11 +48,13 @@ module Watir
|
|
|
44
48
|
describe 'with a start node' do
|
|
45
49
|
context 'specifying the label with a string' do
|
|
46
50
|
it 'searches the label within given Watir::Element' do
|
|
47
|
-
|
|
48
|
-
start_node
|
|
51
|
+
start_node = browser.div(id: 'main_content')
|
|
52
|
+
start_node.exists?
|
|
53
|
+
searched_field = start_node.element(id: 'checkbox')
|
|
54
|
+
|
|
49
55
|
|
|
50
|
-
expect(start_node).to receive(:label).with(text: 'Checkbox')
|
|
51
56
|
expect(start_node).to receive(:element).with(id: 'checkbox')
|
|
57
|
+
.and_return(searched_field)
|
|
52
58
|
browser.field('Checkbox', start_node: start_node)
|
|
53
59
|
end
|
|
54
60
|
|
|
@@ -61,10 +67,13 @@ module Watir
|
|
|
61
67
|
|
|
62
68
|
context 'specifying the label with a Watir::Label' do
|
|
63
69
|
it 'searches the label within given Watir::Element' do
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
start_node = browser.div(id: 'main_content')
|
|
71
|
+
field_label = start_node.label(text: 'Checkbox')
|
|
72
|
+
searched_field = start_node.element(id: 'checkbox')
|
|
66
73
|
|
|
67
74
|
expect(start_node).to receive(:element).with(id: 'checkbox')
|
|
75
|
+
.and_return(searched_field)
|
|
76
|
+
|
|
68
77
|
browser.field(field_label, start_node: start_node)
|
|
69
78
|
end
|
|
70
79
|
|
|
@@ -105,16 +114,8 @@ module Watir
|
|
|
105
114
|
end
|
|
106
115
|
|
|
107
116
|
context 'if fields are grouped' do
|
|
108
|
-
it 'returns Watir::OptionGroup for
|
|
109
|
-
expect(browser.field('
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
it 'returns Watir::OptionGroup for grouped radio buttons' do
|
|
113
|
-
expect(browser.field('Radio1', include_groups: true)).to be_a(Watir::OptionGroup)
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it 'returns Watir::OptionGroup for grouped chckboxes and radio buttons' do
|
|
117
|
-
expect(browser.field('Checkbox5', include_groups: true)).to be_a(Watir::OptionGroup)
|
|
117
|
+
it 'returns Watir::OptionGroup for fieldset' do
|
|
118
|
+
expect(browser.field('Checkboxset')).to be_a(Watir::OptionGroup)
|
|
118
119
|
end
|
|
119
120
|
end
|
|
120
121
|
end # describe sybtype
|
|
@@ -185,7 +186,7 @@ module Watir
|
|
|
185
186
|
|
|
186
187
|
it 'fills a Watir::OptionGroup' do
|
|
187
188
|
options = %w(Checkbox5 Radio7)
|
|
188
|
-
browser.fill_in('
|
|
189
|
+
browser.fill_in('Radios and Checkboxes', options)
|
|
189
190
|
option_group = browser.option_group(id: 'radio_and_checkbox')
|
|
190
191
|
expect(option_group.selected_options.count).to eq(2)
|
|
191
192
|
expect(option_group.selected_options).to eq(options)
|
|
@@ -194,31 +195,38 @@ module Watir
|
|
|
194
195
|
|
|
195
196
|
|
|
196
197
|
describe 'with a start node' do
|
|
197
|
-
before(:all){ @browser.refresh
|
|
198
|
-
let(:start_node){ browser.element(id: 'main_content') }
|
|
198
|
+
before(:all) { @browser.refresh }
|
|
199
|
+
let(:start_node) { browser.element(id: 'main_content') }
|
|
200
|
+
|
|
199
201
|
|
|
200
202
|
it 'fills a Watir::Checkbox from start node' do
|
|
201
|
-
expect(start_node).to receive(:label)
|
|
203
|
+
expect(start_node).to receive(:label)
|
|
204
|
+
.and_return(field_label('Checkbox'))
|
|
202
205
|
browser.fill_in('Checkbox', true, start_node: start_node)
|
|
203
206
|
expect(browser.checkboxes.first).to be_checked
|
|
204
207
|
end
|
|
205
208
|
|
|
206
209
|
it 'fills a Watir::Radio from start node' do
|
|
207
|
-
expect(start_node).to receive(:label)
|
|
210
|
+
expect(start_node).to receive(:label)
|
|
211
|
+
.and_return(field_label('Radio'))
|
|
208
212
|
browser.fill_in('Radio', true, start_node: start_node)
|
|
209
213
|
expect(browser.radios.first).to be_checked
|
|
210
214
|
end
|
|
211
215
|
|
|
212
216
|
it 'fills a Watir::Select with single select from start node' do
|
|
213
|
-
expect(start_node).to receive(:label)
|
|
217
|
+
expect(start_node).to receive(:label)
|
|
218
|
+
.and_return(field_label('Select'))
|
|
214
219
|
browser.fill_in('Select', 'Test2', start_node: start_node)
|
|
215
220
|
expect(browser.selects.first.selected_options.count).to eq(1)
|
|
216
|
-
|
|
221
|
+
|
|
222
|
+
expect(browser.selects.first.selected_options.first.text)
|
|
223
|
+
.to eq('Test2')
|
|
217
224
|
end
|
|
218
225
|
|
|
219
226
|
it 'fills a Watir::Select with multiple select from start node' do
|
|
220
227
|
options = %w(Option2 Option3)
|
|
221
|
-
expect(start_node).to receive(:label)
|
|
228
|
+
expect(start_node).to receive(:label)
|
|
229
|
+
.and_return(field_label('Multi Select'))
|
|
222
230
|
browser.fill_in('Multi Select', options, start_node: start_node)
|
|
223
231
|
|
|
224
232
|
multiselect = browser.select(id: 'multiselect')
|
|
@@ -227,27 +235,39 @@ module Watir
|
|
|
227
235
|
end
|
|
228
236
|
|
|
229
237
|
it 'fills a Watir::TextField from start node' do
|
|
230
|
-
expect(start_node).to receive(:label)
|
|
238
|
+
expect(start_node).to receive(:label)
|
|
239
|
+
.and_return(field_label('Text Field'))
|
|
231
240
|
browser.fill_in('Text Field', 'test text', start_node: start_node)
|
|
232
241
|
expect(browser.text_fields.first.value).to eq('test text')
|
|
233
242
|
end
|
|
234
243
|
|
|
235
244
|
it 'fills a Watir::TextArea from start node' do
|
|
236
|
-
expect(start_node).to receive(:label)
|
|
245
|
+
expect(start_node).to receive(:label)
|
|
246
|
+
.and_return(field_label('Text Area'))
|
|
237
247
|
browser.fill_in('Text Area', 'test text', start_node: start_node)
|
|
238
248
|
expect(browser.textareas.first.value).to eq('test text')
|
|
239
249
|
end
|
|
240
250
|
|
|
241
251
|
it 'fills a Watir::FileField from start node' do
|
|
242
|
-
expect(start_node).to receive(:label)
|
|
243
|
-
|
|
252
|
+
expect(start_node).to receive(:label)
|
|
253
|
+
.and_return(field_label('File'))
|
|
254
|
+
browser.fill_in('File',
|
|
255
|
+
File.join(HTML_DIR, FORM_PAGE),
|
|
256
|
+
start_node: start_node
|
|
257
|
+
)
|
|
244
258
|
expect(browser.file_fields.first.value).to eq(FORM_PAGE)
|
|
245
259
|
end
|
|
246
260
|
|
|
247
261
|
it 'fills a Watir::OptionGroup from start node' do
|
|
248
262
|
options = %w(Checkbox5 Radio7)
|
|
249
|
-
expect(start_node).to receive(:label)
|
|
250
|
-
|
|
263
|
+
expect(start_node).to receive(:label)
|
|
264
|
+
.and_return(
|
|
265
|
+
field_label('Radios and Checkboxes')
|
|
266
|
+
)
|
|
267
|
+
browser.fill_in('Radios and Checkboxes',
|
|
268
|
+
options,
|
|
269
|
+
start_node: start_node
|
|
270
|
+
)
|
|
251
271
|
|
|
252
272
|
option_group = browser.option_group(id: 'radio_and_checkbox')
|
|
253
273
|
expect(option_group.selected_options.count).to eq(2)
|
|
@@ -325,8 +345,8 @@ module Watir
|
|
|
325
345
|
|
|
326
346
|
it 'returns value of Watir::OptionGroup' do
|
|
327
347
|
options = %w(Checkbox5 Radio7)
|
|
328
|
-
browser.fill_in('
|
|
329
|
-
expect(browser.value_of('
|
|
348
|
+
browser.fill_in('Radios and Checkboxes', options)
|
|
349
|
+
expect(browser.value_of('Radios and Checkboxes')).to eq(options)
|
|
330
350
|
end
|
|
331
351
|
end # desribe: without a start node
|
|
332
352
|
|
|
@@ -337,55 +357,73 @@ module Watir
|
|
|
337
357
|
|
|
338
358
|
it 'returns value of Watir::Checkbox from start node' do
|
|
339
359
|
browser.fill_in('Checkbox', true, start_node: start_node)
|
|
340
|
-
expect(start_node).to receive(:label)
|
|
360
|
+
expect(start_node).to receive(:label)
|
|
361
|
+
.and_return(field_label('Checkbox'))
|
|
341
362
|
expect(browser.value_of('Checkbox', start_node: start_node)).to be true
|
|
342
363
|
end
|
|
343
364
|
|
|
344
365
|
it 'returns value of Watir::Radio from start node' do
|
|
345
366
|
browser.fill_in('Radio', true, start_node: start_node)
|
|
346
|
-
expect(start_node).to receive(:label).and_return(
|
|
367
|
+
expect(start_node).to receive(:label).and_return(field_label('Radio'))
|
|
347
368
|
expect(browser.value_of('Radio', start_node: start_node)).to be true
|
|
348
369
|
end
|
|
349
370
|
|
|
350
371
|
it 'returns value of Watir::Select with single select from start node' do
|
|
351
372
|
browser.fill_in('Select', 'Test2', start_node: start_node)
|
|
352
|
-
expect(start_node).to receive(:label)
|
|
353
|
-
|
|
373
|
+
expect(start_node).to receive(:label)
|
|
374
|
+
.and_return(field_label('Select'))
|
|
375
|
+
expect(browser.value_of('Select', start_node: start_node))
|
|
376
|
+
.to eq('Test2')
|
|
354
377
|
end
|
|
355
378
|
|
|
356
379
|
it 'returns value of Watir::Select with multiple select from start node' do
|
|
357
380
|
options = %w(Option2 Option3)
|
|
358
381
|
browser.fill_in('Multi Select', options, start_node: start_node)
|
|
359
|
-
expect(start_node).to receive(:label)
|
|
360
|
-
|
|
382
|
+
expect(start_node).to receive(:label)
|
|
383
|
+
.and_return(field_label('Multi Select'))
|
|
384
|
+
expect(browser.value_of('Multi Select', start_node: start_node))
|
|
385
|
+
.to eq(options)
|
|
361
386
|
end
|
|
362
387
|
|
|
363
388
|
it 'returns value of Watir::TextField from start node' do
|
|
364
389
|
browser.fill_in('Text Field', 'test text', start_node: start_node)
|
|
365
|
-
expect(start_node).to receive(:label)
|
|
366
|
-
|
|
390
|
+
expect(start_node).to receive(:label)
|
|
391
|
+
.and_return(field_label('Text Field'))
|
|
392
|
+
expect(browser.value_of('Text Field', start_node: start_node))
|
|
393
|
+
.to eq('test text')
|
|
367
394
|
end
|
|
368
395
|
|
|
369
396
|
it 'returns value of Watir::TextArea from start node' do
|
|
370
397
|
browser.fill_in('Text Area', 'test text', start_node: start_node)
|
|
371
|
-
expect(start_node).to receive(:label)
|
|
372
|
-
|
|
398
|
+
expect(start_node).to receive(:label)
|
|
399
|
+
.and_return(field_label('Text Area'))
|
|
400
|
+
expect(browser.value_of('Text Area', start_node: start_node))
|
|
401
|
+
.to eq('test text')
|
|
373
402
|
end
|
|
374
403
|
|
|
375
404
|
it 'returns value of Watir::FileField from start node' do
|
|
376
|
-
browser.fill_in('File',
|
|
377
|
-
|
|
378
|
-
|
|
405
|
+
browser.fill_in('File',
|
|
406
|
+
File.join(HTML_DIR, FORM_PAGE),
|
|
407
|
+
start_node: start_node
|
|
408
|
+
)
|
|
409
|
+
expect(start_node).to receive(:label)
|
|
410
|
+
.and_return(field_label('File'))
|
|
411
|
+
expect(browser.value_of('File', start_node: start_node))
|
|
412
|
+
.to eq(FORM_PAGE)
|
|
379
413
|
end
|
|
380
414
|
|
|
381
415
|
it 'returns value of Watir::OptionGroup from start node' do
|
|
382
416
|
options = %w(Checkbox5 Radio7)
|
|
383
|
-
browser.fill_in('
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
417
|
+
browser.fill_in('Radios and Checkboxes',
|
|
418
|
+
options,
|
|
419
|
+
start_node: start_node
|
|
420
|
+
)
|
|
421
|
+
expect(start_node).to receive(:label)
|
|
422
|
+
.and_return(
|
|
423
|
+
field_label('Radios and Checkboxes')
|
|
424
|
+
)
|
|
425
|
+
expect(browser
|
|
426
|
+
.value_of('Radios and Checkboxes', start_node: start_node)
|
|
389
427
|
).to eq(options)
|
|
390
428
|
end
|
|
391
429
|
end # descibe: with a start node
|
|
@@ -394,12 +432,14 @@ module Watir
|
|
|
394
432
|
describe 'with placeholder: true' do
|
|
395
433
|
it 'returns value of Watir::TextField with given text' do
|
|
396
434
|
browser.fill_in('Placeholder Text', 'Test Text', placeholder: true)
|
|
397
|
-
expect(browser.value_of('Placeholder Text', placeholder: true))
|
|
435
|
+
expect(browser.value_of('Placeholder Text', placeholder: true))
|
|
436
|
+
.to eq('Test Text')
|
|
398
437
|
end
|
|
399
438
|
|
|
400
439
|
it 'returns value of Watir::TextArea with given text' do
|
|
401
440
|
browser.fill_in('Placeholder Area', 'Test Text', placeholder: true)
|
|
402
|
-
expect(browser.value_of('Placeholder Area', placeholder: true))
|
|
441
|
+
expect(browser.value_of('Placeholder Area', placeholder: true))
|
|
442
|
+
.to eq('Test Text')
|
|
403
443
|
end
|
|
404
444
|
end# with placeholder: true
|
|
405
445
|
|
data/spec/html/form.html
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
<br />
|
|
52
52
|
<br />
|
|
53
53
|
|
|
54
|
+
<label for="checkboxset">Checkboxset</label><br />
|
|
54
55
|
<fieldset id="checkboxset">
|
|
55
56
|
<label for="checkbox1">
|
|
56
57
|
<input type="checkbox" id="checkbox1">Checkbox1
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
</label><br />
|
|
67
68
|
</fieldset><br />
|
|
68
69
|
|
|
70
|
+
<label for="radioset">Radioset</label><br />
|
|
69
71
|
<fieldset id="radioset" class="radioset">
|
|
70
72
|
<label for="radio1">
|
|
71
73
|
<input type="radio" name="radioset" id="radio1">Radio1
|
|
@@ -78,9 +80,10 @@
|
|
|
78
80
|
</label><br />
|
|
79
81
|
<label for="radio4">
|
|
80
82
|
<input type="radio" name="radioset" id="radio4">Radio4
|
|
81
|
-
</label
|
|
82
|
-
</fieldset
|
|
83
|
+
</label><br />
|
|
84
|
+
</fieldset><br />
|
|
83
85
|
|
|
86
|
+
<label for="radio_and_checkbox">Radios and Checkboxes</label><br />
|
|
84
87
|
<fieldset id="radio_and_checkbox">
|
|
85
88
|
<label for="checkbox5">
|
|
86
89
|
<input type="checkbox" id="checkbox5">Checkbox5
|
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: watir-formhandler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yves Komenda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: watir
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - '
|
|
17
|
+
- - '>='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: 5.0.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - '
|
|
24
|
+
- - '>='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 5.0.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: watir-webdriver
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - '
|
|
31
|
+
- - '>='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.
|
|
33
|
+
version: 0.7.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - '
|
|
38
|
+
- - '>='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.
|
|
40
|
+
version: 0.7.0
|
|
41
41
|
description: Adds some convenience methods to fill out forms in Watir.
|
|
42
42
|
email:
|
|
43
43
|
- b_d_v@web.de
|
|
@@ -89,20 +89,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
version: '0'
|
|
90
90
|
requirements: []
|
|
91
91
|
rubyforge_project:
|
|
92
|
-
rubygems_version: 2.
|
|
92
|
+
rubygems_version: 2.4.8
|
|
93
93
|
signing_key:
|
|
94
94
|
specification_version: 4
|
|
95
95
|
summary: Watir formhandler
|
|
96
96
|
test_files:
|
|
97
|
-
- spec/
|
|
97
|
+
- spec/radio_spec.rb
|
|
98
|
+
- spec/file_field_spec.rb
|
|
98
99
|
- spec/watir_spec.rb
|
|
99
|
-
- spec/option_group_spec.rb
|
|
100
100
|
- spec/container_spec.rb
|
|
101
|
-
- spec/
|
|
102
|
-
- spec/check_box_spec.rb
|
|
103
|
-
- spec/text_field_spec.rb
|
|
101
|
+
- spec/option_group_spec.rb
|
|
104
102
|
- spec/html/form.html
|
|
103
|
+
- spec/text_area_spec.rb
|
|
104
|
+
- spec/check_box_spec.rb
|
|
105
|
+
- spec/select_spec.rb
|
|
105
106
|
- spec/spec_helper.rb
|
|
106
|
-
- spec/
|
|
107
|
-
- spec/radio_spec.rb
|
|
107
|
+
- spec/text_field_spec.rb
|
|
108
108
|
has_rdoc:
|