watir 6.16.5 → 6.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +32 -107
  3. data/.travis.yml +24 -21
  4. data/CHANGES.md +16 -0
  5. data/Gemfile +3 -1
  6. data/Rakefile +3 -3
  7. data/appveyor.yml +2 -1
  8. data/lib/watir-webdriver.rb +1 -1
  9. data/lib/watir.rb +0 -1
  10. data/lib/watir/adjacent.rb +8 -10
  11. data/lib/watir/after_hooks.rb +4 -4
  12. data/lib/watir/browser.rb +5 -1
  13. data/lib/watir/capabilities.rb +9 -6
  14. data/lib/watir/cookies.rb +1 -1
  15. data/lib/watir/elements/element.rb +59 -46
  16. data/lib/watir/elements/file_field.rb +1 -0
  17. data/lib/watir/elements/iframe.rb +2 -2
  18. data/lib/watir/elements/link.rb +0 -9
  19. data/lib/watir/elements/radio.rb +1 -1
  20. data/lib/watir/elements/select.rb +2 -2
  21. data/lib/watir/generator/base/spec_extractor.rb +4 -4
  22. data/lib/watir/js_execution.rb +1 -1
  23. data/lib/watir/legacy_wait.rb +1 -1
  24. data/lib/watir/locators/element/selector_builder.rb +11 -12
  25. data/lib/watir/locators/element/selector_builder/xpath.rb +40 -13
  26. data/lib/watir/locators/text_field/selector_builder/xpath.rb +3 -1
  27. data/lib/watir/logger.rb +5 -2
  28. data/lib/watir/version.rb +1 -1
  29. data/lib/watir/window.rb +1 -1
  30. data/lib/watirspec.rb +1 -1
  31. data/lib/watirspec/guards.rb +1 -1
  32. data/lib/watirspec/rake_tasks.rb +2 -0
  33. data/lib/watirspec/runner.rb +4 -0
  34. data/spec/unit/container_spec.rb +1 -1
  35. data/spec/unit/logger_spec.rb +5 -7
  36. data/spec/unit/selector_builder/button_spec.rb +16 -15
  37. data/spec/unit/selector_builder/element_spec.rb +58 -9
  38. data/spec/unit/selector_builder/text_field_spec.rb +14 -14
  39. data/spec/watirspec/after_hooks_spec.rb +64 -78
  40. data/spec/watirspec/alert_spec.rb +69 -79
  41. data/spec/watirspec/browser_spec.rb +48 -46
  42. data/spec/watirspec/cookies_spec.rb +52 -37
  43. data/spec/watirspec/drag_and_drop_spec.rb +14 -38
  44. data/spec/watirspec/elements/button_spec.rb +2 -0
  45. data/spec/watirspec/elements/buttons_spec.rb +1 -1
  46. data/spec/watirspec/elements/checkbox_spec.rb +8 -4
  47. data/spec/watirspec/elements/date_field_spec.rb +18 -9
  48. data/spec/watirspec/elements/date_time_field_spec.rb +3 -4
  49. data/spec/watirspec/elements/div_spec.rb +62 -54
  50. data/spec/watirspec/elements/element_spec.rb +60 -78
  51. data/spec/watirspec/elements/elements_spec.rb +12 -3
  52. data/spec/watirspec/elements/filefield_spec.rb +25 -50
  53. data/spec/watirspec/elements/form_spec.rb +6 -8
  54. data/spec/watirspec/elements/frame_spec.rb +10 -13
  55. data/spec/watirspec/elements/iframe_spec.rb +17 -12
  56. data/spec/watirspec/elements/iframes_spec.rb +2 -2
  57. data/spec/watirspec/elements/link_spec.rb +18 -9
  58. data/spec/watirspec/elements/links_spec.rb +11 -3
  59. data/spec/watirspec/elements/option_spec.rb +15 -17
  60. data/spec/watirspec/elements/select_list_spec.rb +66 -80
  61. data/spec/watirspec/elements/text_field_spec.rb +8 -4
  62. data/spec/watirspec/elements/tr_spec.rb +0 -9
  63. data/spec/watirspec/html/forms_with_input_elements.html +1 -0
  64. data/spec/watirspec/html/iframes.html +3 -0
  65. data/spec/watirspec/html/non_control_elements.html +4 -4
  66. data/spec/watirspec/html/right_click.html +12 -0
  67. data/spec/watirspec/html/wait.html +1 -1
  68. data/spec/watirspec/relaxed_locate_spec.rb +16 -20
  69. data/spec/watirspec/support/rspec_matchers.rb +7 -6
  70. data/spec/watirspec/user_editable_spec.rb +1 -1
  71. data/spec/watirspec/wait_spec.rb +13 -17
  72. data/spec/watirspec/window_switching_spec.rb +162 -163
  73. data/spec/watirspec_helper.rb +7 -5
  74. data/watir.gemspec +4 -5
  75. metadata +14 -16
  76. data/lib/watir/elements/area.rb +0 -10
@@ -37,12 +37,21 @@ describe 'Elements' do
37
37
  it 'finds elements by visible text' do
38
38
  browser.goto WatirSpec.url_for('non_control_elements.html')
39
39
  container = browser.div(id: 'visible_text')
40
+
40
41
  expect(container.elements(visible_text: 'all visible').count).to eq(1)
41
42
  expect(container.elements(visible_text: /all visible/).count).to eq(1)
42
- expect(container.elements(visible_text: 'some visible').count).to eq(1)
43
43
  expect(container.elements(visible_text: /some visible/).count).to eq(1)
44
- expect(container.elements(visible_text: 'none visible').count).to eq(0)
45
- expect(container.elements(visible_text: /none visible/).count).to eq(0)
44
+ end
45
+
46
+ bug 'Safari is not filtering out hidden text', :safari do
47
+ it 'finds elements in spite of hidden text' do
48
+ browser.goto WatirSpec.url_for('non_control_elements.html')
49
+ container = browser.div(id: 'visible_text')
50
+
51
+ expect(container.elements(visible_text: 'some visible').count).to eq(1)
52
+ expect(container.elements(visible_text: 'none visible').count).to eq(0)
53
+ expect(container.elements(visible_text: /none visible/).count).to eq(0)
54
+ end
46
55
  end
47
56
  end
48
57
  end
@@ -92,66 +92,41 @@ describe 'FileField' do
92
92
  # Manipulation methods
93
93
 
94
94
  describe '#set' do
95
- not_compliant_on :safari do
96
- bug 'https://github.com/mozilla/geckodriver/issues/858', :firefox do
97
- it 'is able to set a file path in the field and click the upload button and fire the onchange event' do
98
- browser.goto WatirSpec.url_for('forms_with_input_elements.html')
95
+ it 'is able to set a file path in the field and click the upload button and fire the onchange event' do
96
+ browser.goto WatirSpec.url_for('forms_with_input_elements.html')
99
97
 
100
- path = File.expand_path(__FILE__)
101
- element = browser.file_field(name: 'new_user_portrait')
98
+ element = browser.file_field(name: 'new_user_portrait')
99
+ element.upload __FILE__
102
100
 
103
- element.set path
101
+ expect(element.value).to include(File.basename(__FILE__)) # only some browser will return the full path
102
+ expect(messages.first).to include(File.basename(__FILE__))
104
103
 
105
- expect(element.value).to include(File.basename(path)) # only some browser will return the full path
106
- expect(messages.first).to include(File.basename(path))
107
-
108
- browser.button(name: 'new_user_submit').click
109
- end
110
- end
104
+ browser.button(name: 'new_user_submit').click
105
+ end
111
106
 
112
- it 'raises an error if the file does not exist' do
113
- expect {
114
- browser.file_field.set(File.join(Dir.tmpdir, 'unlikely-to-exist'))
115
- }.to raise_error(Errno::ENOENT)
116
- end
107
+ it 'raises an error if the file does not exist' do
108
+ expect {
109
+ browser.file_field.set(File.join(Dir.tmpdir, 'unlikely-to-exist'))
110
+ }.to raise_error(Errno::ENOENT)
117
111
  end
118
112
  end
119
113
 
120
- not_compliant_on :safari do
121
- describe '#value=' do
122
- bug 'https://github.com/mozilla/geckodriver/issues/858', :firefox do
123
- it 'is able to set a file path in the field and click the upload button and fire the onchange event' do
124
- browser.goto WatirSpec.url_for('forms_with_input_elements.html')
125
-
126
- path = File.expand_path(__FILE__)
127
- element = browser.file_field(name: 'new_user_portrait')
114
+ describe '#value=' do
115
+ it 'is able to set a file path in the field and click the upload button and fire the onchange event' do
116
+ browser.goto WatirSpec.url_for('forms_with_input_elements.html')
128
117
 
129
- element.value = path
130
- expect(element.value).to include(File.basename(path)) # only some browser will return the full path
131
- end
132
- end
133
-
134
- not_compliant_on :internet_explorer, :firefox, :chrome do
135
- it 'does not raise an error if the file does not exist' do
136
- path = File.join(Dir.tmpdir, 'unlikely-to-exist')
137
- browser.file_field.value = path
138
-
139
- expected = path
140
- expected.tr!('/', '\\') if Selenium::WebDriver::Platform.windows?
118
+ path = File.expand_path(__FILE__)
119
+ element = browser.file_field(name: 'new_user_portrait')
141
120
 
142
- # only some browsers will return the full path
143
- expect(browser.file_field.value).to include(File.basename(expected))
144
- end
145
- end
121
+ element.value = path
122
+ expect(element.value).to include(File.basename(path)) # only some browser will return the full path
123
+ end
146
124
 
147
- not_compliant_on :internet_explorer, %i[chrome windows] do
148
- bug 'Raises InvalidArgumentError: File not found', :firefox do
149
- it 'does not alter its argument' do
150
- value = File.expand_path '.travis.yml'
151
- browser.file_field.value = value
152
- expect(value).to match(/\.travis\.yml$/)
153
- end
154
- end
125
+ not_compliant_on :internet_explorer, %i[chrome windows] do
126
+ it 'does not alter its argument' do
127
+ value = File.expand_path '.travis.yml'
128
+ browser.file_field.value = value
129
+ expect(value).to match(/\.travis\.yml$/)
155
130
  end
156
131
  end
157
132
  end
@@ -51,14 +51,12 @@ describe 'Form' do
51
51
  expect(browser.text).to include('Semantic table')
52
52
  end
53
53
 
54
- not_compliant_on :safari do
55
- it 'triggers onsubmit event and takes its result into account' do
56
- form = browser.form(name: 'user_new')
57
- form.submit
58
- expect(form).to exist
59
- expect(messages.size).to eq 1
60
- expect(messages[0]).to eq 'submit'
61
- end
54
+ it 'triggers onsubmit event and takes its result into account' do
55
+ form = browser.form(name: 'user_new')
56
+ form.submit
57
+ expect(form).to exist
58
+ expect(messages.size).to eq 1
59
+ expect(messages[0]).to eq 'submit'
62
60
  end
63
61
 
64
62
  compliant_on :relaxed_locate do
@@ -9,13 +9,11 @@ describe 'Frame' do
9
9
  browser.goto(WatirSpec.url_for('frames.html'))
10
10
  end
11
11
 
12
- not_compliant_on :safari do
13
- it 'handles crossframe javascript' do
14
- expect(browser.frame(id: 'frame_1').text_field(name: 'senderElement').value).to eq 'send_this_value'
15
- expect(browser.frame(id: 'frame_2').text_field(name: 'recieverElement').value).to eq 'old_value'
16
- browser.frame(id: 'frame_1').button(id: 'send').click
17
- expect(browser.frame(id: 'frame_2').text_field(name: 'recieverElement').value).to eq 'send_this_value'
18
- end
12
+ it 'handles crossframe javascript' do
13
+ expect(browser.frame(id: 'frame_1').text_field(name: 'senderElement').value).to eq 'send_this_value'
14
+ expect(browser.frame(id: 'frame_2').text_field(name: 'recieverElement').value).to eq 'old_value'
15
+ browser.frame(id: 'frame_1').button(id: 'send').click
16
+ expect(browser.frame(id: 'frame_2').text_field(name: 'recieverElement').value).to eq 'send_this_value'
19
17
  end
20
18
 
21
19
  describe '#exist?' do
@@ -50,14 +48,13 @@ describe 'Frame' do
50
48
  end
51
49
 
52
50
  bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255946', :firefox do
53
- not_compliant_on :safari do
54
- it 'handles nested frames' do
55
- browser.goto(WatirSpec.url_for('nested_frames.html'))
51
+ it 'handles nested frames' do
52
+ browser.goto(WatirSpec.url_for('nested_frames.html'))
56
53
 
57
- browser.frame(id: 'two').frame(id: 'three').link(id: 'four').click
54
+ browser.frame(id: 'two').frame(id: 'three').link(id: 'four').click
58
55
 
59
- Watir::Wait.until { browser.title == 'definition_lists' }
60
- end
56
+ Watir::Wait.until { browser.title == 'definition_lists' }
57
+ expect { browser.goto(WatirSpec.url_for('nested_frames.html')) }.to_not raise_exception
61
58
  end
62
59
  end
63
60
 
@@ -78,12 +78,17 @@ describe 'IFrame' do
78
78
  expect(browser.iframe(xpath: "//iframe[@id='no_such_id']")).to_not exist
79
79
  end
80
80
 
81
- it 'returns false if an element in an iframe does exist' do
81
+ it 'returns true if an element in an iframe does exist' do
82
82
  expect(browser.iframe.element(css: '#senderElement')).to exist
83
83
  expect(browser.iframe.element(id: 'senderElement')).to exist
84
84
  end
85
85
 
86
- it 'returns true if an element in an iframe does not exist' do
86
+ it 'returns true for multiple elements that exist in an iframe with a parent selector' do
87
+ expect(browser.div(class: 'wrapper').iframe.element(id: 'first_grandson')).to exist
88
+ expect(browser.div(class: 'wrapper').iframe.element(id: 'second_grandson')).to exist
89
+ end
90
+
91
+ it 'returns false if an element in an iframe does not exist' do
87
92
  expect(browser.iframe.element(css: '#no_such_id')).to_not exist
88
93
  expect(browser.iframe.element(id: 'no_such_id')).to_not exist
89
94
  end
@@ -112,13 +117,11 @@ describe 'IFrame' do
112
117
  end
113
118
 
114
119
  bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255946', :firefox do
115
- not_compliant_on :safari do
116
- it 'handles nested iframes' do
117
- browser.goto(WatirSpec.url_for('nested_iframes.html'))
118
- browser.iframe(id: 'two').iframe(id: 'three').link(id: 'four').click
120
+ it 'handles nested iframes' do
121
+ browser.goto(WatirSpec.url_for('nested_iframes.html'))
122
+ browser.iframe(id: 'two').iframe(id: 'three').link(id: 'four').click
119
123
 
120
- Watir::Wait.until { browser.title == 'definition_lists' }
121
- end
124
+ Watir::Wait.until { browser.title == 'definition_lists' }
122
125
  end
123
126
  end
124
127
 
@@ -141,10 +144,12 @@ describe 'IFrame' do
141
144
  end
142
145
  end
143
146
 
144
- it 'switches between iframe and parent when needed' do
145
- browser.iframe(id: 'iframe_1').elements.each do |element|
146
- element.text
147
- browser.h1.text
147
+ bug 'Safari returns NoSuchElementError instead of Stale Error', :safari do
148
+ it 'switches between iframe and parent when needed' do
149
+ browser.iframe(id: 'iframe_1').elements.each do |element|
150
+ element.text
151
+ browser.h1.text
152
+ end
148
153
  end
149
154
  end
150
155
 
@@ -13,13 +13,13 @@ describe 'IFrames' do
13
13
 
14
14
  describe 'eql?' do
15
15
  it 'matches equality of iframe with that from a collection' do
16
- expect(browser.iframes.last).to eq browser.iframe(id: 'iframe_2')
16
+ expect(browser.iframes.last).to eq browser.iframe(id: 'iframe_3')
17
17
  end
18
18
  end
19
19
 
20
20
  describe '#length' do
21
21
  it 'returns the correct number of iframes' do
22
- expect(browser.iframes.length).to eq 2
22
+ expect(browser.iframes.length).to eq 3
23
23
  end
24
24
  end
25
25
 
@@ -143,11 +143,13 @@ describe 'Link' do
143
143
  expect { browser.link(index: 1337).click }.to raise_unknown_object_exception
144
144
  end
145
145
 
146
- it 'clicks a link with no text content but an img child' do
147
- browser.goto WatirSpec.url_for('images.html')
148
- browser.link(href: /definition_lists.html/).click
149
- Watir::Wait.while { browser.title == 'Images' || browser.title == '' }
150
- expect(browser.title).to eq 'definition_lists'
146
+ bug 'Safari throws a not interactable error', :safari do
147
+ it 'clicks a link with no text content but an img child' do
148
+ browser.goto WatirSpec.url_for('images.html')
149
+ browser.link(href: /definition_lists.html/).click
150
+ Watir::Wait.while { browser.title == 'Images' || browser.title == '' }
151
+ expect(browser.title).to eq 'definition_lists'
152
+ end
151
153
  end
152
154
  end
153
155
 
@@ -157,18 +159,25 @@ describe 'Link' do
157
159
 
158
160
  expect(browser.link(visible_text: 'all visible')).to exist
159
161
  expect(browser.link(visible_text: /all visible/)).to exist
160
- expect(browser.link(visible_text: 'some visible')).to exist
161
162
  expect(browser.link(visible_text: /some visible/)).to exist
162
- expect(browser.link(visible_text: 'none visible')).not_to exist
163
- expect(browser.link(visible_text: /none visible/)).not_to exist
164
163
 
165
164
  expect(browser.link(visible_text: 'Link 2', class: 'external')).to exist
166
165
  expect(browser.link(visible_text: /Link 2/, class: 'external')).to exist
167
166
  end
168
167
 
168
+ bug 'Safari is not filtering out hidden text', :safari do
169
+ it 'finds links in spite of hidden text' do
170
+ browser.goto WatirSpec.url_for('non_control_elements.html')
171
+
172
+ expect(browser.link(visible_text: 'some visible')).to exist
173
+ expect(browser.link(visible_text: 'none visible')).not_to exist
174
+ expect(browser.link(visible_text: /none visible/)).not_to exist
175
+ end
176
+ end
177
+
169
178
  it 'raises exception unless value is a String or a RegExp' do
170
179
  browser.goto WatirSpec.url_for('non_control_elements.html')
171
- msg = /expected one of \[String, Regexp\], got 7\:(Fixnum|Integer)/
180
+ msg = /expected one of \[String, Regexp\], got 7:Integer/
172
181
  expect { browser.link(visible_text: 7).exists? }.to raise_exception(TypeError, msg)
173
182
  end
174
183
  end
@@ -46,10 +46,18 @@ describe 'Links' do
46
46
  container = browser.div(id: 'visible_text')
47
47
  expect(container.links(visible_text: 'all visible').count).to eq(1)
48
48
  expect(container.links(visible_text: /all visible/).count).to eq(1)
49
- expect(container.links(visible_text: 'some visible').count).to eq(1)
50
49
  expect(container.links(visible_text: /some visible/).count).to eq(1)
51
- expect(container.links(visible_text: 'none visible').count).to eq(0)
52
- expect(container.links(visible_text: /none visible/).count).to eq(0)
50
+ end
51
+
52
+ bug 'Safari is not filtering out hidden text', :safari do
53
+ it 'finds links in spite of hidden text' do
54
+ browser.goto WatirSpec.url_for('non_control_elements.html')
55
+ container = browser.div(id: 'visible_text')
56
+
57
+ expect(container.links(visible_text: 'some visible').count).to eq(1)
58
+ expect(container.links(visible_text: 'none visible').count).to eq(0)
59
+ expect(container.links(visible_text: /none visible/).count).to eq(0)
60
+ end
53
61
  end
54
62
  end
55
63
  end
@@ -66,26 +66,24 @@ describe 'Option' do
66
66
  end
67
67
 
68
68
  describe '#select' do
69
- not_compliant_on :safari do
70
- it 'selects the chosen option (page context)' do
71
- browser.option(text: 'Denmark').select
72
- expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
73
- end
69
+ it 'selects the chosen option (page context)' do
70
+ browser.option(text: 'Denmark').select
71
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
72
+ end
74
73
 
75
- it 'selects the chosen option (select_list context)' do
76
- browser.select_list(name: 'new_user_country').option(text: 'Denmark').select
77
- expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
78
- end
74
+ it 'selects the chosen option (select_list context)' do
75
+ browser.select_list(name: 'new_user_country').option(text: 'Denmark').select
76
+ expect(browser.select_list(name: 'new_user_country').selected_options.map(&:text)).to eq ['Denmark']
77
+ end
79
78
 
80
- it 'selects the option when found by text (page context)' do
81
- browser.option(text: 'Sweden').select
82
- expect(browser.option(text: 'Sweden')).to be_selected
83
- end
79
+ it 'selects the option when found by text (page context)' do
80
+ browser.option(text: 'Sweden').select
81
+ expect(browser.option(text: 'Sweden')).to be_selected
82
+ end
84
83
 
85
- it 'selects the option when found by text (select_list context)' do
86
- browser.select_list(name: 'new_user_country').option(text: 'Sweden').select
87
- expect(browser.select_list(name: 'new_user_country').option(text: 'Sweden')).to be_selected
88
- end
84
+ it 'selects the option when found by text (select_list context)' do
85
+ browser.select_list(name: 'new_user_country').option(text: 'Sweden').select
86
+ expect(browser.select_list(name: 'new_user_country').option(text: 'Sweden')).to be_selected
89
87
  end
90
88
 
91
89
  it 'raises UnknownObjectException if the option does not exist (page context)' do
@@ -75,12 +75,10 @@ describe 'SelectList' do
75
75
  end
76
76
 
77
77
  describe '#value' do
78
- not_compliant_on :safari do
79
- it 'returns the value of the selected option' do
80
- expect(browser.select_list(index: 0).value).to eq '2'
81
- browser.select_list(index: 0).select(/Sweden/)
82
- expect(browser.select_list(index: 0).value).to eq '3'
83
- end
78
+ it 'returns the value of the selected option' do
79
+ expect(browser.select_list(index: 0).value).to eq '2'
80
+ browser.select_list(index: 0).select(/Sweden/)
81
+ expect(browser.select_list(index: 0).value).to eq '3'
84
82
  end
85
83
 
86
84
  it "raises UnknownObjectException if the select list doesn't exist" do
@@ -89,16 +87,14 @@ describe 'SelectList' do
89
87
  end
90
88
 
91
89
  describe '#text' do
92
- not_compliant_on :safari do
93
- it 'returns the text of the selected option' do
94
- expect(browser.select_list(index: 0).text).to eq 'Norway'
95
- browser.select_list(index: 0).select(/Sweden/)
96
- expect(browser.select_list(index: 0).text).to eq 'Sweden'
97
- end
90
+ it 'returns the text of the selected option' do
91
+ expect(browser.select_list(index: 0).text).to eq 'Norway'
92
+ browser.select_list(index: 0).select(/Sweden/)
93
+ expect(browser.select_list(index: 0).text).to eq 'Sweden'
94
+ end
98
95
 
99
- it "raises UnknownObjectException if the select list doesn't exist" do
100
- expect { browser.select_list(index: 1337).text }.to raise_unknown_object_exception
101
- end
96
+ it "raises UnknownObjectException if the select list doesn't exist" do
97
+ expect { browser.select_list(index: 1337).text }.to raise_unknown_object_exception
102
98
  end
103
99
  end
104
100
 
@@ -168,11 +164,9 @@ describe 'SelectList' do
168
164
  end
169
165
 
170
166
  describe '#clear' do
171
- not_compliant_on :safari do
172
- it 'clears the selection when possible' do
173
- browser.select_list(name: 'new_user_languages').clear
174
- expect(browser.select_list(name: 'new_user_languages').selected_options).to be_empty
175
- end
167
+ it 'clears the selection when possible' do
168
+ browser.select_list(name: 'new_user_languages').clear
169
+ expect(browser.select_list(name: 'new_user_languages').selected_options).to be_empty
176
170
  end
177
171
 
178
172
  it 'does not clear selections if the select list does not allow multiple selections' do
@@ -187,16 +181,14 @@ describe 'SelectList' do
187
181
  expect { browser.select_list(name: 'no_such_name').clear }.to raise_unknown_object_exception
188
182
  end
189
183
 
190
- not_compliant_on :safari do
191
- it 'fires onchange event' do
192
- browser.select_list(name: 'new_user_languages').clear
193
- expect(messages.size).to eq 2
194
- end
184
+ it 'fires onchange event' do
185
+ browser.select_list(name: 'new_user_languages').clear
186
+ expect(messages.size).to eq 2
187
+ end
195
188
 
196
- it "doesn't fire onchange event for already cleared option" do
197
- browser.select_list(name: 'new_user_languages').option.clear
198
- expect(messages.size).to eq 0
199
- end
189
+ it "doesn't fire onchange event for already cleared option" do
190
+ browser.select_list(name: 'new_user_languages').option.clear
191
+ expect(messages.size).to eq 0
200
192
  end
201
193
  end
202
194
 
@@ -214,30 +206,28 @@ describe 'SelectList' do
214
206
  end
215
207
  end
216
208
 
217
- not_compliant_on :safari do
218
- describe '#selected?' do
219
- it 'returns true if the given option is selected by text' do
220
- browser.select_list(name: 'new_user_country').select('Denmark')
221
- expect(browser.select_list(name: 'new_user_country')).to be_selected('Denmark')
222
- end
209
+ describe '#selected?' do
210
+ it 'returns true if the given option is selected by text' do
211
+ browser.select_list(name: 'new_user_country').select('Denmark')
212
+ expect(browser.select_list(name: 'new_user_country')).to be_selected('Denmark')
213
+ end
223
214
 
224
- it 'returns false if the given option is not selected by text' do
225
- expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Sweden')
226
- end
215
+ it 'returns false if the given option is not selected by text' do
216
+ expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Sweden')
217
+ end
227
218
 
228
- it 'returns true if the given option is selected by label' do
229
- browser.select_list(name: 'new_user_country').select('Germany')
230
- expect(browser.select_list(name: 'new_user_country')).to be_selected('Germany')
231
- end
219
+ it 'returns true if the given option is selected by label' do
220
+ browser.select_list(name: 'new_user_country').select('Germany')
221
+ expect(browser.select_list(name: 'new_user_country')).to be_selected('Germany')
222
+ end
232
223
 
233
- it 'returns false if the given option is not selected by label' do
234
- expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Germany')
235
- end
224
+ it 'returns false if the given option is not selected by label' do
225
+ expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Germany')
226
+ end
236
227
 
237
- it "raises UnknownObjectException if the option doesn't exist" do
238
- expect { browser.select_list(name: 'new_user_country').selected?('missing_option') }
239
- .to raise_unknown_object_exception
240
- end
228
+ it "raises UnknownObjectException if the option doesn't exist" do
229
+ expect { browser.select_list(name: 'new_user_country').selected?('missing_option') }
230
+ .to raise_unknown_object_exception
241
231
  end
242
232
  end
243
233
 
@@ -301,7 +291,7 @@ describe 'SelectList' do
301
291
  expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
302
292
  end
303
293
 
304
- bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255957', :firefox do
294
+ bug 'Safari is returning click intercepted error', :safari do
305
295
  it 'selects empty options' do
306
296
  browser.select_list(id: 'delete_user_username').select('')
307
297
  expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
@@ -312,21 +302,21 @@ describe 'SelectList' do
312
302
  expect(browser.select_list(name: 'new_user_languages').select('Danish')).to eq 'Danish'
313
303
  end
314
304
 
315
- not_compliant_on :safari do
316
- it 'fires onchange event when selecting an item' do
317
- browser.select_list(id: 'new_user_languages').select('Danish')
318
- expect(messages).to eq ['changed language']
319
- end
305
+ it 'fires onchange event when selecting an item' do
306
+ browser.select_list(id: 'new_user_languages').select('Danish')
307
+ expect(messages).to eq ['changed language']
308
+ end
320
309
 
321
- it "doesn't fire onchange event when selecting an already selected item" do
322
- browser.select_list(id: 'new_user_languages').clear # removes the two pre-selected options
323
- browser.select_list(id: 'new_user_languages').select('English')
324
- expect(messages.size).to eq 3
310
+ it "doesn't fire onchange event when selecting an already selected item" do
311
+ browser.select_list(id: 'new_user_languages').clear # removes the two pre-selected options
312
+ browser.select_list(id: 'new_user_languages').select('English')
313
+ expect(messages.size).to eq 3
325
314
 
326
- browser.select_list(id: 'new_user_languages').select('English')
327
- expect(messages.size).to eq 3
328
- end
315
+ browser.select_list(id: 'new_user_languages').select('English')
316
+ expect(messages.size).to eq 3
317
+ end
329
318
 
319
+ bug 'Safari is returning click intercepted error', :safari do
330
320
  it 'returns an empty string when selecting an option that disappears when selected' do
331
321
  expect(browser.select_list(id: 'obsolete').select('sweden')).to eq ''
332
322
  end
@@ -353,9 +343,11 @@ describe 'SelectList' do
353
343
  .to raise_no_value_found_exception message
354
344
  end
355
345
 
356
- it 'raises ObjectDisabledException if the option is disabled' do
357
- expect { browser.select_list(name: 'new_user_languages').select('Russian') }
358
- .to raise_object_disabled_exception
346
+ bug 'Safari is returning object enabled instead of disabled', :safari do
347
+ it 'raises ObjectDisabledException if the option is disabled' do
348
+ expect { browser.select_list(name: 'new_user_languages').select('Russian') }
349
+ .to raise_object_disabled_exception
350
+ end
359
351
  end
360
352
 
361
353
  it 'raises a TypeError if argument is not a String, Regexp or Numeric' do
@@ -423,11 +415,9 @@ describe 'SelectList' do
423
415
  expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish Swedish]
424
416
  end
425
417
 
426
- bug 'https://bugzilla.mozilla.org/show_bug.cgi?id=1255957', :firefox do
427
- it 'selects empty options' do
428
- browser.select_list(id: 'delete_user_username').select!('')
429
- expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
430
- end
418
+ it 'selects empty options' do
419
+ browser.select_list(id: 'delete_user_username').select!('')
420
+ expect(browser.select_list(id: 'delete_user_username').selected_options.map(&:text)).to eq ['']
431
421
  end
432
422
 
433
423
  it 'returns the value selected' do
@@ -454,10 +444,12 @@ describe 'SelectList' do
454
444
  .to raise_no_value_found_exception
455
445
  end
456
446
 
457
- it 'raises ObjectDisabledException if the option is disabled' do
458
- browser.select_list(id: 'new_user_languages').clear
459
- expect { browser.select_list(id: 'new_user_languages').select!('Russian') }
460
- .to raise_object_disabled_exception
447
+ bug 'Safari is returning object enabled instead of disabled', :safari do
448
+ it 'raises ObjectDisabledException if the option is disabled' do
449
+ browser.select_list(id: 'new_user_languages').clear
450
+ expect { browser.select_list(id: 'new_user_languages').select!('Russian') }
451
+ .to raise_object_disabled_exception
452
+ end
461
453
  end
462
454
 
463
455
  it 'raises a TypeError if argument is not a String, Regexp or Numeric' do
@@ -540,10 +532,4 @@ describe 'SelectList' do
540
532
  expect(browser.select_list(name: 'new_user_languages').select_all!(/ish/)).to eq 'Danish'
541
533
  end
542
534
  end
543
-
544
- # deprecate?
545
- not_compliant_on :safari do
546
- describe '#select_value' do
547
- end
548
- end
549
535
  end