watir 6.13.0 → 6.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +141 -0
- data/.travis.yml +6 -0
- data/CHANGES.md +12 -0
- data/Gemfile +4 -10
- data/README.md +64 -49
- data/Rakefile +28 -16
- data/lib/watir.rb +13 -15
- data/lib/watir/adjacent.rb +15 -13
- data/lib/watir/after_hooks.rb +8 -10
- data/lib/watir/alert.rb +7 -8
- data/lib/watir/aliases.rb +2 -2
- data/lib/watir/attribute_helper.rb +18 -20
- data/lib/watir/browser.rb +42 -75
- data/lib/watir/capabilities.rb +19 -10
- data/lib/watir/cell_container.rb +0 -2
- data/lib/watir/container.rb +4 -4
- data/lib/watir/cookies.rb +7 -8
- data/lib/watir/element_collection.rb +37 -22
- data/lib/watir/elements/area.rb +0 -2
- data/lib/watir/elements/button.rb +1 -3
- data/lib/watir/elements/cell.rb +0 -1
- data/lib/watir/elements/checkbox.rb +5 -7
- data/lib/watir/elements/date_field.rb +5 -9
- data/lib/watir/elements/date_time_field.rb +6 -10
- data/lib/watir/elements/dlist.rb +2 -4
- data/lib/watir/elements/element.rb +201 -99
- data/lib/watir/elements/file_field.rb +3 -4
- data/lib/watir/elements/font.rb +2 -4
- data/lib/watir/elements/form.rb +0 -2
- data/lib/watir/elements/hidden.rb +3 -4
- data/lib/watir/elements/html_elements.rb +24 -76
- data/lib/watir/elements/iframe.rb +57 -71
- data/lib/watir/elements/image.rb +3 -4
- data/lib/watir/elements/input.rb +0 -2
- data/lib/watir/elements/link.rb +2 -5
- data/lib/watir/elements/list.rb +4 -4
- data/lib/watir/elements/option.rb +3 -6
- data/lib/watir/elements/radio.rb +4 -6
- data/lib/watir/elements/row.rb +0 -1
- data/lib/watir/elements/select.rb +41 -43
- data/lib/watir/elements/svg_elements.rb +0 -116
- data/lib/watir/elements/table.rb +1 -2
- data/lib/watir/elements/table_cell.rb +2 -3
- data/lib/watir/elements/text_field.rb +4 -6
- data/lib/watir/exception.rb +0 -1
- data/lib/watir/extensions/nokogiri.rb +2 -4
- data/lib/watir/generator.rb +3 -3
- data/lib/watir/generator/base.rb +10 -10
- data/lib/watir/generator/base/generator.rb +26 -29
- data/lib/watir/generator/base/idl_sorter.rb +34 -32
- data/lib/watir/generator/base/spec_extractor.rb +132 -114
- data/lib/watir/generator/base/util.rb +1 -3
- data/lib/watir/generator/base/visitor.rb +140 -140
- data/lib/watir/generator/html.rb +4 -4
- data/lib/watir/generator/html/generator.rb +2 -4
- data/lib/watir/generator/html/spec_extractor.rb +33 -33
- data/lib/watir/generator/html/visitor.rb +14 -14
- data/lib/watir/generator/svg.rb +3 -3
- data/lib/watir/generator/svg/generator.rb +1 -3
- data/lib/watir/generator/svg/spec_extractor.rb +35 -35
- data/lib/watir/generator/svg/visitor.rb +14 -14
- data/lib/watir/has_window.rb +2 -4
- data/lib/watir/js_execution.rb +7 -9
- data/lib/watir/js_snippets.rb +3 -3
- data/lib/watir/js_snippets/attributeValues.js +11 -0
- data/lib/watir/legacy_wait.rb +7 -12
- data/lib/watir/locators.rb +9 -11
- data/lib/watir/locators/button/locator.rb +2 -3
- data/lib/watir/locators/button/selector_builder.rb +9 -9
- data/lib/watir/locators/button/selector_builder/xpath.rb +1 -1
- data/lib/watir/locators/button/validator.rb +2 -2
- data/lib/watir/locators/cell/locator.rb +0 -2
- data/lib/watir/locators/cell/selector_builder.rb +3 -5
- data/lib/watir/locators/element/locator.rb +85 -64
- data/lib/watir/locators/element/selector_builder.rb +40 -38
- data/lib/watir/locators/element/selector_builder/xpath.rb +20 -18
- data/lib/watir/locators/element/validator.rb +1 -1
- data/lib/watir/locators/row/locator.rb +0 -2
- data/lib/watir/locators/row/selector_builder.rb +6 -9
- data/lib/watir/locators/text_area/selector_builder.rb +1 -1
- data/lib/watir/locators/text_field/locator.rb +1 -3
- data/lib/watir/locators/text_field/selector_builder.rb +5 -5
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +1 -1
- data/lib/watir/locators/text_field/validator.rb +3 -2
- data/lib/watir/logger.rb +11 -21
- data/lib/watir/navigation.rb +49 -0
- data/lib/watir/radio_set.rb +17 -18
- data/lib/watir/row_container.rb +3 -5
- data/lib/watir/screenshot.rb +2 -4
- data/lib/watir/user_editable.rb +13 -8
- data/lib/watir/version.rb +3 -0
- data/lib/watir/wait.rb +56 -55
- data/lib/watir/wait/timer.rb +1 -3
- data/lib/watir/window.rb +36 -45
- data/lib/watir/xpath_support.rb +1 -3
- data/lib/watirspec.rb +11 -11
- data/lib/watirspec/guards.rb +10 -7
- data/lib/watirspec/implementation.rb +3 -4
- data/lib/watirspec/rake_tasks.rb +30 -29
- data/lib/watirspec/remote_server.rb +3 -3
- data/lib/watirspec/runner.rb +1 -2
- data/lib/watirspec/server.rb +3 -0
- data/lib/watirspec/server/app.rb +14 -6
- data/spec/implementation_spec.rb +9 -9
- data/spec/locator_spec_helper.rb +3 -4
- data/spec/spec_helper.rb +3 -7
- data/spec/unit/container_spec.rb +9 -10
- data/spec/unit/element_locator_spec.rb +224 -219
- data/spec/unit/logger_spec.rb +4 -4
- data/spec/unit/unit_helper.rb +0 -2
- data/spec/unit/wait_spec.rb +26 -28
- data/spec/watirspec/adjacent_spec.rb +130 -130
- data/spec/watirspec/after_hooks_spec.rb +63 -63
- data/spec/watirspec/alert_spec.rb +6 -6
- data/spec/watirspec/attributes_spec.rb +6 -6
- data/spec/watirspec/browser_spec.rb +161 -162
- data/spec/watirspec/click_spec.rb +9 -9
- data/spec/watirspec/cookies_spec.rb +15 -14
- data/spec/watirspec/drag_and_drop_spec.rb +15 -16
- data/spec/watirspec/element_hidden_spec.rb +19 -21
- data/spec/watirspec/elements/area_spec.rb +18 -21
- data/spec/watirspec/elements/areas_spec.rb +13 -15
- data/spec/watirspec/elements/button_spec.rb +96 -99
- data/spec/watirspec/elements/buttons_spec.rb +17 -19
- data/spec/watirspec/elements/checkbox_spec.rb +102 -100
- data/spec/watirspec/elements/checkboxes_spec.rb +13 -15
- data/spec/watirspec/elements/collections_spec.rb +35 -37
- data/spec/watirspec/elements/date_field_spec.rb +46 -47
- data/spec/watirspec/elements/date_fields_spec.rb +13 -15
- data/spec/watirspec/elements/date_time_field_spec.rb +62 -57
- data/spec/watirspec/elements/date_time_fields_spec.rb +14 -15
- data/spec/watirspec/elements/dd_spec.rb +46 -48
- data/spec/watirspec/elements/dds_spec.rb +13 -15
- data/spec/watirspec/elements/del_spec.rb +27 -28
- data/spec/watirspec/elements/dels_spec.rb +13 -15
- data/spec/watirspec/elements/div_spec.rb +89 -91
- data/spec/watirspec/elements/divs_spec.rb +17 -19
- data/spec/watirspec/elements/dl_spec.rb +52 -54
- data/spec/watirspec/elements/dls_spec.rb +13 -15
- data/spec/watirspec/elements/dt_spec.rb +46 -48
- data/spec/watirspec/elements/dts_spec.rb +13 -15
- data/spec/watirspec/elements/element_spec.rb +240 -189
- data/spec/watirspec/elements/elements_spec.rb +16 -16
- data/spec/watirspec/elements/em_spec.rb +38 -40
- data/spec/watirspec/elements/ems_spec.rb +13 -15
- data/spec/watirspec/elements/filefield_spec.rb +45 -46
- data/spec/watirspec/elements/filefields_spec.rb +13 -15
- data/spec/watirspec/elements/font_spec.rb +11 -13
- data/spec/watirspec/elements/form_spec.rb +13 -15
- data/spec/watirspec/elements/forms_spec.rb +13 -15
- data/spec/watirspec/elements/frame_spec.rb +48 -50
- data/spec/watirspec/elements/frames_spec.rb +13 -15
- data/spec/watirspec/elements/hidden_spec.rb +23 -25
- data/spec/watirspec/elements/hiddens_spec.rb +13 -15
- data/spec/watirspec/elements/hn_spec.rb +22 -24
- data/spec/watirspec/elements/hns_spec.rb +13 -13
- data/spec/watirspec/elements/iframe_spec.rb +106 -74
- data/spec/watirspec/elements/iframes_spec.rb +16 -18
- data/spec/watirspec/elements/image_spec.rb +30 -32
- data/spec/watirspec/elements/images_spec.rb +13 -15
- data/spec/watirspec/elements/input_spec.rb +4 -5
- data/spec/watirspec/elements/ins_spec.rb +27 -29
- data/spec/watirspec/elements/inses_spec.rb +13 -15
- data/spec/watirspec/elements/label_spec.rb +17 -19
- data/spec/watirspec/elements/labels_spec.rb +13 -15
- data/spec/watirspec/elements/li_spec.rb +23 -25
- data/spec/watirspec/elements/link_spec.rb +45 -48
- data/spec/watirspec/elements/links_spec.rb +14 -16
- data/spec/watirspec/elements/lis_spec.rb +13 -15
- data/spec/watirspec/elements/list_spec.rb +14 -15
- data/spec/watirspec/elements/map_spec.rb +19 -20
- data/spec/watirspec/elements/maps_spec.rb +13 -15
- data/spec/watirspec/elements/meta_spec.rb +10 -10
- data/spec/watirspec/elements/metas_spec.rb +13 -15
- data/spec/watirspec/elements/ol_spec.rb +20 -21
- data/spec/watirspec/elements/ols_spec.rb +13 -15
- data/spec/watirspec/elements/option_spec.rb +63 -63
- data/spec/watirspec/elements/p_spec.rb +27 -26
- data/spec/watirspec/elements/pre_spec.rb +24 -25
- data/spec/watirspec/elements/pres_spec.rb +13 -15
- data/spec/watirspec/elements/ps_spec.rb +13 -15
- data/spec/watirspec/elements/radio_spec.rb +96 -97
- data/spec/watirspec/elements/radios_spec.rb +13 -15
- data/spec/watirspec/elements/select_list_spec.rb +244 -237
- data/spec/watirspec/elements/select_lists_spec.rb +15 -16
- data/spec/watirspec/elements/span_spec.rb +32 -31
- data/spec/watirspec/elements/spans_spec.rb +13 -15
- data/spec/watirspec/elements/strong_spec.rb +23 -24
- data/spec/watirspec/elements/strongs_spec.rb +13 -15
- data/spec/watirspec/elements/table_nesting_spec.rb +15 -14
- data/spec/watirspec/elements/table_spec.rb +61 -62
- data/spec/watirspec/elements/tables_spec.rb +15 -17
- data/spec/watirspec/elements/tbody_spec.rb +25 -26
- data/spec/watirspec/elements/tbodys_spec.rb +17 -19
- data/spec/watirspec/elements/td_spec.rb +20 -22
- data/spec/watirspec/elements/tds_spec.rb +9 -11
- data/spec/watirspec/elements/text_field_spec.rb +55 -56
- data/spec/watirspec/elements/text_fields_spec.rb +15 -16
- data/spec/watirspec/elements/textarea_spec.rb +2 -2
- data/spec/watirspec/elements/textareas_spec.rb +1 -1
- data/spec/watirspec/elements/tfoot_spec.rb +22 -23
- data/spec/watirspec/elements/tfoots_spec.rb +19 -19
- data/spec/watirspec/elements/thead_spec.rb +21 -23
- data/spec/watirspec/elements/theads_spec.rb +19 -19
- data/spec/watirspec/elements/tr_spec.rb +20 -22
- data/spec/watirspec/elements/trs_spec.rb +17 -19
- data/spec/watirspec/elements/ul_spec.rb +17 -19
- data/spec/watirspec/elements/uls_spec.rb +13 -14
- data/spec/watirspec/html/data_attributes.html +1 -0
- data/spec/watirspec/radio_set_spec.rb +100 -99
- data/spec/watirspec/relaxed_locate_spec.rb +19 -43
- data/spec/watirspec/screenshot_spec.rb +4 -4
- data/spec/watirspec/special_chars_spec.rb +2 -4
- data/spec/watirspec/support/rspec_matchers.rb +85 -22
- data/spec/watirspec/user_editable_spec.rb +84 -85
- data/spec/watirspec/wait_spec.rb +74 -95
- data/spec/watirspec/window_switching_spec.rb +131 -132
- data/spec/watirspec_helper.rb +12 -9
- data/support/travis.sh +4 -0
- data/support/version_differ.rb +12 -13
- data/watir.gemspec +29 -22
- metadata +76 -50
@@ -1,14 +1,13 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "SelectList" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'SelectList' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
|
7
6
|
end
|
8
7
|
|
9
8
|
# Exists method
|
10
|
-
describe
|
11
|
-
it
|
9
|
+
describe '#exists?' do
|
10
|
+
it 'returns true if the select list exists' do
|
12
11
|
expect(browser.select_list(id: 'new_user_country')).to exist
|
13
12
|
expect(browser.select_list(id: /new_user_country/)).to exist
|
14
13
|
expect(browser.select_list(name: 'new_user_country')).to exist
|
@@ -19,7 +18,7 @@ describe "SelectList" do
|
|
19
18
|
expect(browser.select_list(xpath: "//select[@id='new_user_country']")).to exist
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
21
|
+
it 'returns the first select if given no args' do
|
23
22
|
expect(browser.select_list).to exist
|
24
23
|
end
|
25
24
|
|
@@ -44,8 +43,8 @@ describe "SelectList" do
|
|
44
43
|
end
|
45
44
|
|
46
45
|
# Attribute methods
|
47
|
-
describe
|
48
|
-
it
|
46
|
+
describe '#class_name' do
|
47
|
+
it 'returns the class name of the select list' do
|
49
48
|
expect(browser.select_list(name: 'new_user_country').class_name).to eq 'country'
|
50
49
|
end
|
51
50
|
|
@@ -54,9 +53,9 @@ describe "SelectList" do
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
describe
|
58
|
-
it
|
59
|
-
expect(browser.select_list(index: 0).id).to eq
|
56
|
+
describe '#id' do
|
57
|
+
it 'returns the id of the element' do
|
58
|
+
expect(browser.select_list(index: 0).id).to eq 'new_user_country'
|
60
59
|
end
|
61
60
|
|
62
61
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -64,9 +63,9 @@ describe "SelectList" do
|
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
|
-
describe
|
68
|
-
it
|
69
|
-
expect(browser.select_list(index: 0).name).to eq
|
66
|
+
describe '#name' do
|
67
|
+
it 'returns the name of the element' do
|
68
|
+
expect(browser.select_list(index: 0).name).to eq 'new_user_country'
|
70
69
|
end
|
71
70
|
|
72
71
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -74,8 +73,8 @@ describe "SelectList" do
|
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
77
|
-
describe
|
78
|
-
it
|
76
|
+
describe '#multiple?' do
|
77
|
+
it 'knows whether the select list allows multiple selections' do
|
79
78
|
expect(browser.select_list(index: 0)).to_not be_multiple
|
80
79
|
expect(browser.select_list(index: 1)).to be_multiple
|
81
80
|
end
|
@@ -85,12 +84,12 @@ describe "SelectList" do
|
|
85
84
|
end
|
86
85
|
end
|
87
86
|
|
88
|
-
describe
|
87
|
+
describe '#value' do
|
89
88
|
not_compliant_on :safari do
|
90
|
-
it
|
91
|
-
expect(browser.select_list(index: 0).value).to eq
|
89
|
+
it 'returns the value of the selected option' do
|
90
|
+
expect(browser.select_list(index: 0).value).to eq '2'
|
92
91
|
browser.select_list(index: 0).select(/Sweden/)
|
93
|
-
expect(browser.select_list(index: 0).value).to eq
|
92
|
+
expect(browser.select_list(index: 0).value).to eq '3'
|
94
93
|
end
|
95
94
|
end
|
96
95
|
|
@@ -99,12 +98,12 @@ describe "SelectList" do
|
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
102
|
-
describe
|
101
|
+
describe '#text' do
|
103
102
|
not_compliant_on :safari do
|
104
|
-
it
|
105
|
-
expect(browser.select_list(index: 0).text).to eq
|
103
|
+
it 'returns the text of the selected option' do
|
104
|
+
expect(browser.select_list(index: 0).text).to eq 'Norway'
|
106
105
|
browser.select_list(index: 0).select(/Sweden/)
|
107
|
-
expect(browser.select_list(index: 0).text).to eq
|
106
|
+
expect(browser.select_list(index: 0).text).to eq 'Sweden'
|
108
107
|
end
|
109
108
|
|
110
109
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -113,8 +112,8 @@ describe "SelectList" do
|
|
113
112
|
end
|
114
113
|
end
|
115
114
|
|
116
|
-
describe
|
117
|
-
it
|
115
|
+
describe '#respond_to?' do
|
116
|
+
it 'returns true for all attribute methods' do
|
118
117
|
expect(browser.select_list(index: 0)).to respond_to(:class_name)
|
119
118
|
expect(browser.select_list(index: 0)).to respond_to(:id)
|
120
119
|
expect(browser.select_list(index: 0)).to respond_to(:name)
|
@@ -123,12 +122,12 @@ describe "SelectList" do
|
|
123
122
|
end
|
124
123
|
|
125
124
|
# Access methods
|
126
|
-
describe
|
127
|
-
it
|
125
|
+
describe '#enabled?' do
|
126
|
+
it 'returns true if the select list is enabled' do
|
128
127
|
expect(browser.select_list(name: 'new_user_country')).to be_enabled
|
129
128
|
end
|
130
129
|
|
131
|
-
it
|
130
|
+
it 'returns false if the select list is disabled' do
|
132
131
|
expect(browser.select_list(name: 'new_user_role')).to_not be_enabled
|
133
132
|
end
|
134
133
|
|
@@ -137,61 +136,61 @@ describe "SelectList" do
|
|
137
136
|
end
|
138
137
|
end
|
139
138
|
|
140
|
-
describe
|
141
|
-
it
|
139
|
+
describe '#disabled?' do
|
140
|
+
it 'returns true if the select list is disabled' do
|
142
141
|
expect(browser.select_list(index: 2)).to be_disabled
|
143
142
|
end
|
144
143
|
|
145
|
-
it
|
144
|
+
it 'returns false if the select list is enabled' do
|
146
145
|
expect(browser.select_list(index: 0)).to_not be_disabled
|
147
146
|
end
|
148
147
|
|
149
|
-
it
|
148
|
+
it 'should raise UnknownObjectException when the select list does not exist' do
|
150
149
|
expect { browser.select_list(index: 1337).disabled? }.to raise_unknown_object_exception
|
151
150
|
end
|
152
151
|
end
|
153
152
|
|
154
153
|
# Other
|
155
|
-
describe
|
156
|
-
it
|
157
|
-
option = browser.select_list(name:
|
154
|
+
describe '#option' do
|
155
|
+
it 'returns an instance of Option' do
|
156
|
+
option = browser.select_list(name: 'new_user_country').option(text: 'Denmark')
|
158
157
|
expect(option).to be_instance_of(Watir::Option)
|
159
|
-
expect(option.value).to eq
|
158
|
+
expect(option.value).to eq '1'
|
160
159
|
end
|
161
160
|
end
|
162
161
|
|
163
|
-
describe
|
164
|
-
it
|
165
|
-
options = browser.select_list(name:
|
166
|
-
expect(options.map(&:text)).to eq [
|
162
|
+
describe '#options' do
|
163
|
+
it 'returns all the options' do
|
164
|
+
options = browser.select_list(name: 'new_user_country').options
|
165
|
+
expect(options.map(&:text)).to eq ['Denmark', 'Norway', 'Sweden', 'United Kingdom', 'USA', 'Germany']
|
167
166
|
end
|
168
167
|
end
|
169
168
|
|
170
|
-
describe
|
169
|
+
describe '#selected_options' do
|
171
170
|
it "should raise UnknownObjectException if the select list doesn't exist" do
|
172
171
|
expect { browser.select_list(name: 'no_such_name').selected_options }.to raise_unknown_object_exception
|
173
172
|
end
|
174
173
|
|
175
|
-
it
|
176
|
-
expect(browser.select_list(name:
|
177
|
-
expect(browser.select_list(name:
|
174
|
+
it 'gets the currently selected item(s)' do
|
175
|
+
expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Norway']
|
176
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN NO]
|
178
177
|
end
|
179
178
|
end
|
180
179
|
|
181
|
-
describe
|
180
|
+
describe '#clear' do
|
182
181
|
not_compliant_on :safari do
|
183
|
-
it
|
184
|
-
browser.select_list(name:
|
185
|
-
expect(browser.select_list(name:
|
182
|
+
it 'clears the selection when possible' do
|
183
|
+
browser.select_list(name: 'new_user_languages').clear
|
184
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options).to be_empty
|
186
185
|
end
|
187
186
|
end
|
188
187
|
|
189
|
-
it
|
188
|
+
it 'does not clear selections if the select list does not allow multiple selections' do
|
190
189
|
expect {
|
191
|
-
browser.select_list(name:
|
190
|
+
browser.select_list(name: 'new_user_country').clear
|
192
191
|
}.to raise_error(/you can only clear multi-selects/)
|
193
192
|
|
194
|
-
expect(browser.select_list(name:
|
193
|
+
expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Norway']
|
195
194
|
end
|
196
195
|
|
197
196
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -199,24 +198,24 @@ describe "SelectList" do
|
|
199
198
|
end
|
200
199
|
|
201
200
|
not_compliant_on :safari do
|
202
|
-
it
|
203
|
-
browser.select_list(name:
|
201
|
+
it 'fires onchange event' do
|
202
|
+
browser.select_list(name: 'new_user_languages').clear
|
204
203
|
expect(messages.size).to eq 2
|
205
204
|
end
|
206
205
|
|
207
206
|
it "doesn't fire onchange event for already cleared option" do
|
208
|
-
browser.select_list(name:
|
207
|
+
browser.select_list(name: 'new_user_languages').option.clear
|
209
208
|
expect(messages.size).to eq 0
|
210
209
|
end
|
211
210
|
end
|
212
211
|
end
|
213
212
|
|
214
|
-
describe
|
215
|
-
it
|
213
|
+
describe '#include?' do
|
214
|
+
it 'returns true if the given option exists by text' do
|
216
215
|
expect(browser.select_list(name: 'new_user_country')).to include('Denmark')
|
217
216
|
end
|
218
217
|
|
219
|
-
it
|
218
|
+
it 'returns true if the given option exists by label' do
|
220
219
|
expect(browser.select_list(name: 'new_user_country')).to include('Germany')
|
221
220
|
end
|
222
221
|
|
@@ -226,326 +225,334 @@ describe "SelectList" do
|
|
226
225
|
end
|
227
226
|
|
228
227
|
not_compliant_on :safari do
|
229
|
-
describe
|
230
|
-
it
|
228
|
+
describe '#selected?' do
|
229
|
+
it 'returns true if the given option is selected by text' do
|
231
230
|
browser.select_list(name: 'new_user_country').select('Denmark')
|
232
231
|
expect(browser.select_list(name: 'new_user_country')).to be_selected('Denmark')
|
233
232
|
end
|
234
233
|
|
235
|
-
it
|
234
|
+
it 'returns false if the given option is not selected by text' do
|
236
235
|
expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Sweden')
|
237
236
|
end
|
238
237
|
|
239
|
-
it
|
238
|
+
it 'returns true if the given option is selected by label' do
|
240
239
|
browser.select_list(name: 'new_user_country').select('Germany')
|
241
240
|
expect(browser.select_list(name: 'new_user_country')).to be_selected('Germany')
|
242
241
|
end
|
243
242
|
|
244
|
-
it
|
243
|
+
it 'returns false if the given option is not selected by label' do
|
245
244
|
expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Germany')
|
246
245
|
end
|
247
246
|
|
248
247
|
it "raises UnknownObjectException if the option doesn't exist" do
|
249
|
-
expect { browser.select_list(name: 'new_user_country').selected?('missing_option') }
|
248
|
+
expect { browser.select_list(name: 'new_user_country').selected?('missing_option') }
|
249
|
+
.to raise_unknown_object_exception
|
250
250
|
end
|
251
251
|
end
|
252
252
|
end
|
253
253
|
|
254
|
-
describe
|
255
|
-
context
|
256
|
-
it
|
257
|
-
browser.select_list(name:
|
258
|
-
browser.select_list(name:
|
259
|
-
expect(browser.select_list(name:
|
254
|
+
describe '#select' do
|
255
|
+
context 'when finding by value' do
|
256
|
+
it 'selects an option with a String' do
|
257
|
+
browser.select_list(name: 'new_user_languages').clear
|
258
|
+
browser.select_list(name: 'new_user_languages').select('2')
|
259
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
|
260
260
|
end
|
261
261
|
|
262
|
-
it
|
263
|
-
browser.select_list(name:
|
264
|
-
expect { browser.select_list(name:
|
265
|
-
expect(browser.select_list(name:
|
262
|
+
it 'selects an option with a Regexp' do
|
263
|
+
browser.select_list(name: 'new_user_languages').clear
|
264
|
+
expect { browser.select_list(name: 'new_user_languages').select(/1|3/) }.to have_deprecated_select_by
|
265
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish NO]
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
269
|
-
context
|
270
|
-
it
|
271
|
-
browser.select_list(name:
|
272
|
-
expect(browser.select_list(name:
|
269
|
+
context 'when finding by text' do
|
270
|
+
it 'selects an option with a String' do
|
271
|
+
browser.select_list(name: 'new_user_country').select('Denmark')
|
272
|
+
expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
|
273
273
|
end
|
274
274
|
|
275
|
-
it
|
276
|
-
browser.select_list(name:
|
277
|
-
expect(browser.select_list(name:
|
275
|
+
it 'selects an option with a Regexp' do
|
276
|
+
browser.select_list(name: 'new_user_country').select(/Denmark/)
|
277
|
+
expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
-
context
|
282
|
-
it
|
283
|
-
browser.select_list(name:
|
284
|
-
browser.select_list(name:
|
285
|
-
expect(browser.select_list(name:
|
281
|
+
context 'when finding by label' do
|
282
|
+
it 'selects an option with a String' do
|
283
|
+
browser.select_list(name: 'new_user_languages').clear
|
284
|
+
browser.select_list(name: 'new_user_languages').select('NO')
|
285
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
|
286
286
|
end
|
287
287
|
|
288
|
-
it
|
289
|
-
browser.select_list(name:
|
290
|
-
browser.select_list(name:
|
291
|
-
expect(browser.select_list(name:
|
288
|
+
it 'selects an option with a Regexp' do
|
289
|
+
browser.select_list(name: 'new_user_languages').clear
|
290
|
+
browser.select_list(name: 'new_user_languages').select(/^N/)
|
291
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
295
|
-
it
|
296
|
-
browser.select_list(name:
|
297
|
-
browser.select_list(name:
|
298
|
-
browser.select_list(name:
|
299
|
-
expect(browser.select_list(name:
|
295
|
+
it 'selects multiple options successiveley' do
|
296
|
+
browser.select_list(name: 'new_user_languages').clear
|
297
|
+
browser.select_list(name: 'new_user_languages').select('Danish')
|
298
|
+
browser.select_list(name: 'new_user_languages').select('Swedish')
|
299
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
|
300
300
|
end
|
301
301
|
|
302
|
-
it
|
303
|
-
browser.select_list(name:
|
304
|
-
browser.select_list(name:
|
305
|
-
expect(browser.select_list(name:
|
302
|
+
it 'selects each item in an Array' do
|
303
|
+
browser.select_list(name: 'new_user_languages').clear
|
304
|
+
browser.select_list(name: 'new_user_languages').select(%w[Danish Swedish])
|
305
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
|
306
306
|
end
|
307
307
|
|
308
|
-
it
|
309
|
-
browser.select_list(name:
|
310
|
-
browser.select_list(name:
|
311
|
-
expect(browser.select_list(name:
|
308
|
+
it 'selects each item in a parameter list' do
|
309
|
+
browser.select_list(name: 'new_user_languages').clear
|
310
|
+
browser.select_list(name: 'new_user_languages').select('Danish', 'Swedish')
|
311
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
|
312
312
|
end
|
313
313
|
|
314
|
-
bug
|
315
|
-
it
|
316
|
-
browser.select_list(id:
|
317
|
-
expect(browser.select_list(id:
|
314
|
+
bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255957', :firefox do
|
315
|
+
it 'selects empty options' do
|
316
|
+
browser.select_list(id: 'delete_user_username').select('')
|
317
|
+
expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
|
318
318
|
end
|
319
319
|
end
|
320
320
|
|
321
|
-
it
|
322
|
-
expect(browser.select_list(name:
|
321
|
+
it 'returns the value selected' do
|
322
|
+
expect(browser.select_list(name: 'new_user_languages').select('Danish')).to eq 'Danish'
|
323
323
|
end
|
324
324
|
|
325
325
|
not_compliant_on :safari do
|
326
|
-
it
|
327
|
-
browser.select_list(id:
|
326
|
+
it 'fires onchange event when selecting an item' do
|
327
|
+
browser.select_list(id: 'new_user_languages').select('Danish')
|
328
328
|
expect(messages).to eq ['changed language']
|
329
329
|
end
|
330
330
|
|
331
331
|
it "doesn't fire onchange event when selecting an already selected item" do
|
332
|
-
browser.select_list(id:
|
333
|
-
browser.select_list(id:
|
332
|
+
browser.select_list(id: 'new_user_languages').clear # removes the two pre-selected options
|
333
|
+
browser.select_list(id: 'new_user_languages').select('English')
|
334
334
|
expect(messages.size).to eq 3
|
335
335
|
|
336
|
-
browser.select_list(id:
|
336
|
+
browser.select_list(id: 'new_user_languages').select('English')
|
337
337
|
expect(messages.size).to eq 3
|
338
338
|
end
|
339
339
|
|
340
|
-
it
|
340
|
+
it 'returns an empty string when selecting an option that disappears when selected' do
|
341
341
|
expect(browser.select_list(id: 'obsolete').select('sweden')).to eq ''
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
345
|
-
it
|
345
|
+
it 'selects options with a single-quoted value' do
|
346
346
|
browser.select_list(id: 'single-quote').select("'foo'")
|
347
347
|
end
|
348
348
|
|
349
349
|
compliant_on :relaxed_locate do
|
350
350
|
it 'waits to select an option' do
|
351
|
-
browser.goto WatirSpec.url_for(
|
351
|
+
browser.goto WatirSpec.url_for('wait.html')
|
352
352
|
browser.a(id: 'add_select').click
|
353
353
|
select_list = browser.select_list(id: 'languages')
|
354
|
-
|
355
|
-
begin
|
356
|
-
start_time = ::Time.now
|
357
|
-
expect { select_list.select('No') }.to raise_error Watir::Exception::NoValueFoundException
|
358
|
-
expect(::Time.now - start_time).to be > 2
|
359
|
-
ensure
|
360
|
-
Watir.default_timeout = 30
|
361
|
-
end
|
354
|
+
expect { select_list.select('No') }.to wait_and_raise_no_value_found_exception
|
362
355
|
end
|
363
356
|
end
|
364
357
|
|
365
358
|
it "raises NoValueFoundException if the option doesn't exist" do
|
366
|
-
expect { browser.select_list(name:
|
367
|
-
|
359
|
+
expect { browser.select_list(name: 'new_user_country').select('missing_option') }
|
360
|
+
.to raise_no_value_found_exception
|
361
|
+
expect { browser.select_list(name: 'new_user_country').select(/missing_option/) }
|
362
|
+
.to raise_no_value_found_exception
|
368
363
|
end
|
369
364
|
|
370
|
-
it
|
371
|
-
expect { browser.select_list(name:
|
365
|
+
it 'raises ObjectDisabledException if the option is disabled' do
|
366
|
+
expect { browser.select_list(name: 'new_user_languages').select('Russian') }
|
367
|
+
.to raise_object_disabled_exception
|
372
368
|
end
|
373
369
|
|
374
|
-
it
|
375
|
-
expect { browser.select_list(id:
|
370
|
+
it 'raises a TypeError if argument is not a String, Regexp or Numeric' do
|
371
|
+
expect { browser.select_list(id: 'new_user_languages').select({}) }.to raise_error(TypeError)
|
376
372
|
end
|
377
373
|
end
|
378
374
|
|
379
|
-
describe
|
380
|
-
context
|
381
|
-
it
|
382
|
-
browser.select_list(name:
|
383
|
-
browser.select_list(name:
|
384
|
-
expect(browser.select_list(name:
|
375
|
+
describe '#select!' do
|
376
|
+
context 'when finding by value' do
|
377
|
+
it 'selects an option with a String' do
|
378
|
+
browser.select_list(name: 'new_user_languages').clear
|
379
|
+
browser.select_list(name: 'new_user_languages').select!('2')
|
380
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
|
385
381
|
end
|
386
382
|
|
387
|
-
it
|
388
|
-
browser.select_list(name:
|
389
|
-
browser.select_list(name:
|
390
|
-
expect(browser.select_list(name:
|
383
|
+
it 'selects an option with a Regex' do
|
384
|
+
browser.select_list(name: 'new_user_languages').clear
|
385
|
+
browser.select_list(name: 'new_user_languages').select!(/2/)
|
386
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
|
391
387
|
end
|
392
388
|
end
|
393
389
|
|
394
|
-
context
|
395
|
-
it
|
396
|
-
browser.select_list(name:
|
397
|
-
expect(browser.select_list(name:
|
390
|
+
context 'when finding by text' do
|
391
|
+
it 'selects an option with a String' do
|
392
|
+
browser.select_list(name: 'new_user_country').select!('Denmark')
|
393
|
+
expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
|
398
394
|
end
|
399
395
|
|
400
|
-
it
|
401
|
-
browser.select_list(name:
|
402
|
-
expect(browser.select_list(name:
|
396
|
+
it 'selects an option with a Regexp' do
|
397
|
+
browser.select_list(name: 'new_user_country').select!(/Denmark/)
|
398
|
+
expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
|
403
399
|
end
|
404
400
|
end
|
405
401
|
|
406
|
-
context
|
407
|
-
it
|
408
|
-
browser.select_list(name:
|
409
|
-
browser.select_list(name:
|
410
|
-
expect(browser.select_list(name:
|
402
|
+
context 'when finding by label' do
|
403
|
+
it 'selects an option with a String' do
|
404
|
+
browser.select_list(name: 'new_user_languages').clear
|
405
|
+
browser.select_list(name: 'new_user_languages').select!('NO')
|
406
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
|
411
407
|
end
|
412
408
|
|
413
|
-
it
|
414
|
-
browser.select_list(name:
|
415
|
-
browser.select_list(name:
|
416
|
-
expect(browser.select_list(name:
|
409
|
+
it 'selects an option with a Regexp' do
|
410
|
+
browser.select_list(name: 'new_user_languages').clear
|
411
|
+
browser.select_list(name: 'new_user_languages').select!(/NO/)
|
412
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq ['NO']
|
417
413
|
end
|
418
414
|
end
|
419
415
|
|
420
|
-
it
|
421
|
-
browser.select_list(name:
|
422
|
-
browser.select_list(name:
|
423
|
-
browser.select_list(name:
|
424
|
-
expect(browser.select_list(name:
|
416
|
+
it 'selects multiple items successively' do
|
417
|
+
browser.select_list(name: 'new_user_languages').clear
|
418
|
+
browser.select_list(name: 'new_user_languages').select!('Danish')
|
419
|
+
browser.select_list(name: 'new_user_languages').select!('Swedish')
|
420
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
|
425
421
|
end
|
426
422
|
|
427
|
-
it
|
428
|
-
browser.select_list(name:
|
429
|
-
browser.select_list(name:
|
430
|
-
expect(browser.select_list(name:
|
423
|
+
it 'selects each item in an Array' do
|
424
|
+
browser.select_list(name: 'new_user_languages').clear
|
425
|
+
browser.select_list(name: 'new_user_languages').select!(%w[Danish Swedish])
|
426
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
|
431
427
|
end
|
432
428
|
|
433
|
-
it
|
434
|
-
browser.select_list(name:
|
435
|
-
browser.select_list(name:
|
436
|
-
expect(browser.select_list(name:
|
429
|
+
it 'selects each item in a parameter list' do
|
430
|
+
browser.select_list(name: 'new_user_languages').clear
|
431
|
+
browser.select_list(name: 'new_user_languages').select!('Danish', 'Swedish')
|
432
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
|
437
433
|
end
|
438
434
|
|
439
|
-
bug
|
440
|
-
it
|
441
|
-
browser.select_list(id:
|
442
|
-
expect(browser.select_list(id:
|
435
|
+
bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255957', :firefox do
|
436
|
+
it 'selects empty options' do
|
437
|
+
browser.select_list(id: 'delete_user_username').select!('')
|
438
|
+
expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
|
443
439
|
end
|
444
440
|
end
|
445
441
|
|
446
|
-
it
|
447
|
-
browser.select_list(name:
|
448
|
-
expect(browser.select_list(name:
|
442
|
+
it 'returns the value selected' do
|
443
|
+
browser.select_list(name: 'new_user_languages').clear
|
444
|
+
expect(browser.select_list(name: 'new_user_languages').select!('Danish')).to eq 'Danish'
|
449
445
|
end
|
450
446
|
|
451
|
-
it
|
447
|
+
it 'selects options with a single-quoted value' do
|
452
448
|
browser.select_list(id: 'single-quote').select!("'foo'")
|
453
449
|
end
|
454
450
|
|
455
|
-
it
|
456
|
-
browser.select_list(name:
|
457
|
-
browser.select_list(name:
|
458
|
-
selected_options = browser.select_list(name:
|
459
|
-
expect(selected_options).not_to include(
|
460
|
-
expect(selected_options).to include(
|
451
|
+
it 'selects exact matches when using String' do
|
452
|
+
browser.select_list(name: 'new_user_languages').clear
|
453
|
+
browser.select_list(name: 'new_user_languages').select!('Latin')
|
454
|
+
selected_options = browser.select_list(name: 'new_user_languages').selected_options.map(&:text)
|
455
|
+
expect(selected_options).not_to include('Azeri - Latin')
|
456
|
+
expect(selected_options).to include('Latin')
|
461
457
|
end
|
462
458
|
|
463
459
|
it "raises NoValueFoundException if the option doesn't exist" do
|
464
|
-
expect { browser.select_list(id:
|
465
|
-
|
460
|
+
expect { browser.select_list(id: 'new_user_country').select!('missing_option') }
|
461
|
+
.to raise_no_value_found_exception
|
462
|
+
expect { browser.select_list(id: 'new_user_country').select!(/missing_option/) }
|
463
|
+
.to raise_no_value_found_exception
|
466
464
|
end
|
467
465
|
|
468
|
-
it
|
469
|
-
browser.select_list(id:
|
470
|
-
expect { browser.select_list(id:
|
466
|
+
it 'raises ObjectDisabledException if the option is disabled' do
|
467
|
+
browser.select_list(id: 'new_user_languages').clear
|
468
|
+
expect { browser.select_list(id: 'new_user_languages').select!('Russian') }
|
469
|
+
.to raise_object_disabled_exception
|
471
470
|
end
|
472
471
|
|
473
|
-
it
|
474
|
-
browser.select_list(id:
|
475
|
-
expect { browser.select_list(id:
|
472
|
+
it 'raises a TypeError if argument is not a String, Regexp or Numeric' do
|
473
|
+
browser.select_list(id: 'new_user_languages').clear
|
474
|
+
expect { browser.select_list(id: 'new_user_languages').select!({}) }.to raise_error(TypeError)
|
476
475
|
end
|
477
476
|
end
|
478
477
|
|
479
|
-
describe
|
480
|
-
it
|
481
|
-
browser.select_list(name:
|
482
|
-
browser.select_list(name:
|
483
|
-
|
478
|
+
describe '#select_all' do
|
479
|
+
it 'selects multiple options based on text' do
|
480
|
+
browser.select_list(name: 'new_user_languages').clear
|
481
|
+
browser.select_list(name: 'new_user_languages').select_all(/ish/)
|
482
|
+
list = %w[Danish EN Swedish]
|
483
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
484
484
|
end
|
485
485
|
|
486
|
-
it
|
487
|
-
browser.select_list(name:
|
488
|
-
browser.select_list(name:
|
489
|
-
|
486
|
+
it 'selects multiple options based on labels' do
|
487
|
+
browser.select_list(name: 'new_user_languages').clear
|
488
|
+
browser.select_list(name: 'new_user_languages').select_all(/NO|EN/)
|
489
|
+
list = %w[EN NO]
|
490
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
490
491
|
end
|
491
492
|
|
492
|
-
it
|
493
|
-
browser.select_list(name:
|
494
|
-
browser.select_list(name:
|
495
|
-
|
493
|
+
it 'selects all options in an Array' do
|
494
|
+
browser.select_list(name: 'new_user_languages').clear
|
495
|
+
browser.select_list(name: 'new_user_languages').select_all([/ish/, /Latin/])
|
496
|
+
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
497
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
496
498
|
end
|
497
499
|
|
498
|
-
it
|
499
|
-
browser.select_list(name:
|
500
|
-
browser.select_list(name:
|
501
|
-
|
500
|
+
it 'selects all options in a parameter list' do
|
501
|
+
browser.select_list(name: 'new_user_languages').clear
|
502
|
+
browser.select_list(name: 'new_user_languages').select_all(/ish/, /Latin/)
|
503
|
+
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
504
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
502
505
|
end
|
503
506
|
|
504
|
-
it
|
505
|
-
expect(browser.select_list(name:
|
507
|
+
it 'returns the first matching value if there are multiple matches' do
|
508
|
+
expect(browser.select_list(name: 'new_user_languages').select_all(/ish/)).to eq 'Danish'
|
506
509
|
end
|
507
510
|
end
|
508
511
|
|
509
|
-
describe
|
510
|
-
it
|
511
|
-
browser.select_list(name:
|
512
|
-
browser.select_list(name:
|
513
|
-
|
512
|
+
describe '#select_all!' do
|
513
|
+
it 'selects multiple options based on value' do
|
514
|
+
browser.select_list(name: 'new_user_languages').clear
|
515
|
+
browser.select_list(name: 'new_user_languages').select_all!(/\d+/)
|
516
|
+
list = %w[Danish EN NO Russian]
|
517
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
514
518
|
end
|
515
519
|
|
516
|
-
it
|
517
|
-
browser.select_list(name:
|
518
|
-
browser.select_list(name:
|
519
|
-
|
520
|
+
it 'selects multiple options based on text' do
|
521
|
+
browser.select_list(name: 'new_user_languages').clear
|
522
|
+
browser.select_list(name: 'new_user_languages').select_all!(/ish/)
|
523
|
+
list = %w[Danish EN Swedish]
|
524
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
520
525
|
end
|
521
526
|
|
522
|
-
it
|
523
|
-
browser.select_list(name:
|
524
|
-
browser.select_list(name:
|
525
|
-
|
527
|
+
it 'selects multiple options based on labels' do
|
528
|
+
browser.select_list(name: 'new_user_languages').clear
|
529
|
+
browser.select_list(name: 'new_user_languages').select_all!(/NO|EN/)
|
530
|
+
list = %w[EN NO]
|
531
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
526
532
|
end
|
527
533
|
|
528
|
-
it
|
529
|
-
browser.select_list(name:
|
530
|
-
browser.select_list(name:
|
531
|
-
|
534
|
+
it 'selects all options in an Array' do
|
535
|
+
browser.select_list(name: 'new_user_languages').clear
|
536
|
+
browser.select_list(name: 'new_user_languages').select_all!([/ish/, /Latin/])
|
537
|
+
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
538
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
532
539
|
end
|
533
540
|
|
534
|
-
it
|
535
|
-
browser.select_list(name:
|
536
|
-
browser.select_list(name:
|
537
|
-
|
541
|
+
it 'selects all options in a parameter list' do
|
542
|
+
browser.select_list(name: 'new_user_languages').clear
|
543
|
+
browser.select_list(name: 'new_user_languages').select_all!(/ish/, /Latin/)
|
544
|
+
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
545
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
538
546
|
end
|
539
547
|
|
540
|
-
it
|
541
|
-
expect(browser.select_list(name:
|
548
|
+
it 'returns the first matching value if there are multiple matches' do
|
549
|
+
expect(browser.select_list(name: 'new_user_languages').select_all!(/ish/)).to eq 'Danish'
|
542
550
|
end
|
543
551
|
end
|
544
552
|
|
545
553
|
# deprecate?
|
546
554
|
not_compliant_on :safari do
|
547
|
-
describe
|
555
|
+
describe '#select_value' do
|
548
556
|
end
|
549
557
|
end
|
550
|
-
|
551
558
|
end
|