capybara 2.11.0 → 2.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +30 -4
  3. data/README.md +4 -0
  4. data/lib/capybara.rb +4 -2
  5. data/lib/capybara/driver/base.rb +2 -2
  6. data/lib/capybara/helpers.rb +8 -2
  7. data/lib/capybara/node/actions.rb +52 -1
  8. data/lib/capybara/node/document_matchers.rb +1 -0
  9. data/lib/capybara/node/finders.rb +2 -1
  10. data/lib/capybara/node/matchers.rb +54 -0
  11. data/lib/capybara/node/simple.rb +1 -1
  12. data/lib/capybara/queries/current_path_query.rb +4 -2
  13. data/lib/capybara/queries/selector_query.rb +23 -3
  14. data/lib/capybara/queries/text_query.rb +15 -7
  15. data/lib/capybara/queries/title_query.rb +2 -2
  16. data/lib/capybara/rack_test/form.rb +1 -1
  17. data/lib/capybara/rack_test/node.rb +4 -4
  18. data/lib/capybara/result.rb +2 -2
  19. data/lib/capybara/selector.rb +16 -4
  20. data/lib/capybara/selenium/driver.rb +27 -22
  21. data/lib/capybara/selenium/node.rb +10 -1
  22. data/lib/capybara/session.rb +91 -30
  23. data/lib/capybara/spec/session/accept_prompt_spec.rb +3 -0
  24. data/lib/capybara/spec/session/assert_all_of_selectors_spec.rb +94 -0
  25. data/lib/capybara/spec/session/assert_current_path.rb +12 -0
  26. data/lib/capybara/spec/session/attach_file_spec.rb +30 -0
  27. data/lib/capybara/spec/session/click_link_spec.rb +12 -1
  28. data/lib/capybara/spec/session/current_url_spec.rb +8 -0
  29. data/lib/capybara/spec/session/evaluate_script_spec.rb +14 -0
  30. data/lib/capybara/spec/session/execute_script_spec.rb +13 -0
  31. data/lib/capybara/spec/session/fill_in_spec.rb +6 -0
  32. data/lib/capybara/spec/session/find_field_spec.rb +2 -0
  33. data/lib/capybara/spec/session/find_spec.rb +3 -3
  34. data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +103 -0
  35. data/lib/capybara/spec/session/{within_frame_spec.rb → frame/within_frame_spec.rb} +12 -0
  36. data/lib/capybara/spec/session/has_current_path_spec.rb +28 -0
  37. data/lib/capybara/spec/session/has_selector_spec.rb +21 -0
  38. data/lib/capybara/spec/session/has_text_spec.rb +13 -1
  39. data/lib/capybara/spec/session/has_title_spec.rb +15 -0
  40. data/lib/capybara/spec/session/node_spec.rb +34 -1
  41. data/lib/capybara/spec/session/within_spec.rb +7 -0
  42. data/lib/capybara/spec/spec_helper.rb +4 -0
  43. data/lib/capybara/spec/views/form.erb +48 -0
  44. data/lib/capybara/spec/views/with_js.erb +5 -0
  45. data/lib/capybara/spec/views/within_frames.erb +1 -1
  46. data/lib/capybara/version.rb +1 -1
  47. data/lib/capybara/window.rb +1 -1
  48. data/spec/capybara_spec.rb +2 -2
  49. data/spec/rack_test_spec.rb +10 -0
  50. data/spec/result_spec.rb +3 -3
  51. data/spec/rspec/shared_spec_matchers.rb +1 -1
  52. data/spec/session_spec.rb +10 -0
  53. data/spec/shared_selenium_session.rb +2 -1
  54. data/spec/spec_helper.rb +2 -0
  55. metadata +7 -4
@@ -34,6 +34,12 @@ Capybara::SpecHelper.spec '#assert_current_path' do
34
34
  @session.visit('/with_js?test=test')
35
35
  expect{@session.assert_current_path('/with_js', only_path: true)}.not_to raise_error
36
36
  end
37
+
38
+ it "should not cause an exception when current_url is nil" do
39
+ allow_any_instance_of(Capybara::Session).to receive(:current_url) { nil }
40
+
41
+ expect{@session.assert_current_path(nil)}.not_to raise_error
42
+ end
37
43
  end
38
44
 
39
45
  Capybara::SpecHelper.spec '#assert_no_current_path?' do
@@ -57,4 +63,10 @@ Capybara::SpecHelper.spec '#assert_no_current_path?' do
57
63
  it "should not raise if the page has not the given current_path" do
58
64
  expect{@session.assert_no_current_path('/with_html')}.not_to raise_error
59
65
  end
66
+
67
+ it "should not cause an exception when current_url is nil" do
68
+ allow_any_instance_of(Capybara::Session).to receive(:current_url) { nil }
69
+
70
+ expect{@session.assert_no_current_path('/with_html')}.not_to raise_error
71
+ end
60
72
  end
@@ -107,4 +107,34 @@ Capybara::SpecHelper.spec "#attach_file" do
107
107
  end.to raise_error(Capybara::ElementNotFound)
108
108
  end
109
109
  end
110
+
111
+ context "with :make_visible option", requires: [:js, :es_args] do
112
+ it "applies a default style change when true" do
113
+ @session.visit('/with_js')
114
+ expect { @session.attach_file("hidden_file", __FILE__) }.to raise_error Capybara::ElementNotFound
115
+ expect {
116
+ @session.attach_file("hidden_file", __FILE__, make_visible: true)
117
+ }.not_to raise_error
118
+ end
119
+
120
+ it "accepts a hash of styles to be applied" do
121
+ @session.visit('/with_js')
122
+ expect {
123
+ @session.attach_file("hidden_file", __FILE__, make_visible: { opacity: 1, display: 'block' })
124
+ }.not_to raise_error
125
+ end
126
+
127
+ it "raises an error when the file input is not made visible" do
128
+ @session.visit('/with_js')
129
+ expect {
130
+ @session.attach_file("hidden_file", __FILE__, make_visible: { color: 'red' })
131
+ }.to raise_error(Capybara::ExpectationNotMet)
132
+ end
133
+
134
+ it "resets the style when done" do
135
+ @session.visit('/with_js')
136
+ @session.attach_file("hidden_file", __FILE__, make_visible: true)
137
+ expect(@session.evaluate_script("arguments[0].style.display", @session.find(:css, '#hidden_file', visible: :all))).to eq 'none'
138
+ end
139
+ end
110
140
  end
@@ -105,6 +105,17 @@ Capybara::SpecHelper.spec '#click_link' do
105
105
  expect { @session.click_link('labore', href: /invalid_pattern/) }.to raise_error(Capybara::ElementNotFound)
106
106
  expect { @session.click_link('labore', href: /.+d+/) }.to raise_error(Capybara::ElementNotFound)
107
107
  end
108
+
109
+ context 'href: nil' do
110
+ it "should not raise an error on links with no href attribute" do
111
+ expect { @session.click_link('No Href', href: nil) }.not_to raise_error
112
+ end
113
+
114
+ it "should raise an error if href attribute exists" do
115
+ expect { @session.click_link('Blank Href', href: nil) }.to raise_error(Capybara::ElementNotFound)
116
+ expect { @session.click_link('Normal Anchor', href: nil) }.to raise_error(Capybara::ElementNotFound)
117
+ end
118
+ end
108
119
  end
109
120
 
110
121
  it "should follow relative links" do
@@ -161,7 +172,7 @@ Capybara::SpecHelper.spec '#click_link' do
161
172
  expect(@session).to have_content('Bar')
162
173
  end
163
174
 
164
- it "raise an error with links with no href" do
175
+ it "should raise an error with links with no href" do
165
176
  expect do
166
177
  @session.click_link('No Href')
167
178
  end.to raise_error(Capybara::ElementNotFound)
@@ -96,4 +96,12 @@ Capybara::SpecHelper.spec '#current_url, #current_path, #current_host' do
96
96
  @session.execute_script("window.history.replaceState({}, '', '/replaced')")
97
97
  expect(@session.current_path).to eq("/replaced")
98
98
  end
99
+
100
+ it "doesn't raise exception on a nil current_url" do
101
+ @session.visit("/")
102
+ allow_any_instance_of(Capybara::Session).to receive(:current_url) { nil }
103
+
104
+ expect { @session.current_url }.not_to raise_exception
105
+ expect { @session.current_path }.not_to raise_exception
106
+ end
99
107
  end
@@ -4,4 +4,18 @@ Capybara::SpecHelper.spec "#evaluate_script", requires: [:js] do
4
4
  @session.visit('/with_js')
5
5
  expect(@session.evaluate_script("1+3")).to eq(4)
6
6
  end
7
+
8
+ it "should pass arguments to the script", requires: [:js, :es_args] do
9
+ @session.visit('/with_js')
10
+ @session.evaluate_script("document.getElementById('change').textContent = arguments[0]", "Doodle Funk")
11
+ expect(@session).to have_css('#change', text: 'Doodle Funk')
12
+ end
13
+
14
+ it "should support passing elements as arguments to the script", requires: [:js, :es_args] do
15
+ @session.visit('/with_js')
16
+ el = @session.find(:css, '#change')
17
+ @session.evaluate_script("arguments[0].textContent = arguments[1]", el, "Doodle Funk")
18
+ expect(@session).to have_css('#change', text: 'Doodle Funk')
19
+ end
20
+
7
21
  end
@@ -10,4 +10,17 @@ Capybara::SpecHelper.spec "#execute_script", requires: [:js] do
10
10
  @session.visit('/with_js')
11
11
  expect{ @session.execute_script("$('#change').text('Funky Doodle')") }.not_to raise_error
12
12
  end
13
+
14
+ it "should pass arguments to the script", requires: [:js, :es_args] do
15
+ @session.visit('/with_js')
16
+ @session.execute_script("document.getElementById('change').textContent = arguments[0]", "Doodle Funk")
17
+ expect(@session).to have_css('#change', text: 'Doodle Funk')
18
+ end
19
+
20
+ it "should support passing elements as arguments to the script", requires: [:js, :es_args] do
21
+ @session.visit('/with_js')
22
+ el = @session.find(:css, '#change')
23
+ @session.execute_script("arguments[1].textContent = arguments[0]", "Doodle Funk", el)
24
+ expect(@session).to have_css('#change', text: 'Doodle Funk')
25
+ end
13
26
  end
@@ -100,6 +100,12 @@ Capybara::SpecHelper.spec "#fill_in" do
100
100
  expect(extract_results(@session)['password']).to eq('supasikrit')
101
101
  end
102
102
 
103
+ it "should fill in a field based on current value" do
104
+ @session.fill_in(currently_with: 'John', with: 'Thomas')
105
+ @session.click_button('awesome')
106
+ expect(extract_results(@session)['first_name']).to eq('Thomas')
107
+ end
108
+
103
109
  it "should throw an exception if a hash containing 'with' is not provided" do
104
110
  expect {@session.fill_in 'Name', 'ignu'}.to raise_error(RuntimeError, /with/)
105
111
  end
@@ -62,6 +62,8 @@ Capybara::SpecHelper.spec '#find_field' do
62
62
  context "with :disabled option" do
63
63
  it "should find disabled fields when true" do
64
64
  expect(@session.find_field("Disabled Checkbox", disabled: true)[:name]).to eq("form[disabled_checkbox]")
65
+ expect(@session.find_field("form_disabled_fieldset_child", disabled: true)[:name]).to eq("form[disabled_fieldset_child]")
66
+ expect(@session.find_field("form_disabled_fieldset_descendant", disabled: true)[:name]).to eq("form[disabled_fieldset_descendant]")
65
67
  end
66
68
 
67
69
  it "should not find disabled fields when false" do
@@ -104,11 +104,11 @@ Capybara::SpecHelper.spec '#find' do
104
104
  end
105
105
  end
106
106
 
107
- context "with custom selector with :for option" do
108
- it "should use the selector when it matches the :for option" do
107
+ context "with custom selector with custom `match` block" do
108
+ it "should use the custom selector when locator matches the block" do
109
109
  Capybara.add_selector(:beatle) do
110
110
  xpath { |num| ".//*[contains(@class, 'beatle')][#{num}]" }
111
- match { |value| value.is_a?(Fixnum) }
111
+ match { |value| value.is_a?(Integer) }
112
112
  end
113
113
  expect(@session.find(:beatle, '2').text).to eq('Paul')
114
114
  expect(@session.find(1).text).to eq('John')
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+ Capybara::SpecHelper.spec '#switch_to_frame', requires: [:frames] do
3
+ before(:each) do
4
+ @session.visit('/within_frames')
5
+ end
6
+
7
+ after(:each) do
8
+ # Ensure we clean up after the frame changes
9
+ @session.switch_to_frame(:top)
10
+ end
11
+
12
+ it "should find the div in frameOne" do
13
+ frame = @session.find(:frame, "frameOne")
14
+ @session.switch_to_frame(frame)
15
+ expect(@session.find("//*[@id='divInFrameOne']").text).to eql 'This is the text of divInFrameOne'
16
+ end
17
+
18
+ it "should find the div in FrameTwo" do
19
+ frame = @session.find(:frame, "frameTwo")
20
+ @session.switch_to_frame(frame)
21
+ expect(@session.find("//*[@id='divInFrameTwo']").text).to eql 'This is the text of divInFrameTwo'
22
+ end
23
+
24
+ it "should return to the parent frame when told to" do
25
+ frame = @session.find(:frame, "frameOne")
26
+ @session.switch_to_frame(frame)
27
+ @session.switch_to_frame(:parent)
28
+ expect(@session.find("//*[@id='divInMainWindow']").text).to eql 'This is the text for divInMainWindow'
29
+ end
30
+
31
+ it "should be able to switch to nested frames" do
32
+ frame = @session.find(:frame, "parentFrame")
33
+ @session.switch_to_frame frame
34
+ frame = @session.find(:frame, "childFrame")
35
+ @session.switch_to_frame frame
36
+ frame = @session.find(:frame, "grandchildFrame1")
37
+ @session.switch_to_frame frame
38
+ expect(@session).to have_selector(:css, '#divInFrameOne', text: 'This is the text of divInFrameOne')
39
+ end
40
+
41
+ it "should reset scope when changing frames" do
42
+ frame = @session.find(:frame, 'parentFrame')
43
+ @session.within(:css, '#divInMainWindow') do
44
+ @session.switch_to_frame(frame)
45
+ expect(@session.has_selector?(:css, "iframe#childFrame")).to be true
46
+ @session.switch_to_frame(:parent)
47
+ end
48
+ end
49
+
50
+ it "works if the frame is closed", requires: [:frames, :js] do
51
+ frame = @session.find(:frame, 'parentFrame')
52
+ @session.switch_to_frame frame
53
+ frame = @session.find(:frame, 'childFrame')
54
+ @session.switch_to_frame frame
55
+
56
+ @session.click_link 'Close Window'
57
+ @session.switch_to_frame :parent # Go back to parentFrame
58
+ expect(@session).to have_selector(:css, 'body#parentBody')
59
+ expect(@session).not_to have_selector(:css, '#childFrame')
60
+ @session.switch_to_frame :parent # Go back to top
61
+ end
62
+
63
+ it "can return to the top frame", requires: [:frames] do
64
+ frame = @session.find(:frame, "parentFrame")
65
+ @session.switch_to_frame frame
66
+ frame = @session.find(:frame, "childFrame")
67
+ @session.switch_to_frame frame
68
+ @session.switch_to_frame :top
69
+ expect(@session.find("//*[@id='divInMainWindow']").text).to eql 'This is the text for divInMainWindow'
70
+ end
71
+
72
+ it "should raise error if switching to parent unmatched inside `within` as it's nonsense" do
73
+ expect do
74
+ frame = @session.find(:frame, 'parentFrame')
75
+ @session.switch_to_frame(frame)
76
+ @session.within(:css, '#parentBody') do
77
+ @session.switch_to_frame(:parent)
78
+ end
79
+ end.to raise_error(Capybara::ScopeError, "`switch_to_frame(:parent)` cannot be called from inside a descendant frame's `within` block.")
80
+ end
81
+
82
+ it "should raise error if switching to top inside a `within` in a frame as it's nonsense" do
83
+ frame = @session.find(:frame, 'parentFrame')
84
+ @session.switch_to_frame(frame)
85
+ @session.within(:css, '#parentBody') do
86
+ expect do
87
+ @session.switch_to_frame(:top)
88
+ end.to raise_error(Capybara::ScopeError, "`switch_to_frame(:top)` cannot be called from inside a descendant frame's `within` block.")
89
+ end
90
+ end
91
+
92
+ it "should raise error if switching to top inside a nested `within` in a frame as it's nonsense" do
93
+ frame = @session.find(:frame, 'parentFrame')
94
+ @session.switch_to_frame(frame)
95
+ @session.within(:css, '#parentBody') do
96
+ @session.switch_to_frame(@session.find(:frame, "childFrame"))
97
+ expect do
98
+ @session.switch_to_frame(:top)
99
+ end.to raise_error(Capybara::ScopeError, "`switch_to_frame(:top)` cannot be called from inside a descendant frame's `within` block.")
100
+ @session.switch_to_frame(:parent)
101
+ end
102
+ end
103
+ end
@@ -41,6 +41,18 @@ Capybara::SpecHelper.spec '#within_frame', requires: [:frames] do
41
41
  end
42
42
  end
43
43
 
44
+ it "should find the div given selector and locator" do
45
+ @session.within_frame(:css, '#frameOne') do
46
+ expect(@session.find("//*[@id='divInFrameOne']").text).to eql 'This is the text of divInFrameOne'
47
+ end
48
+ end
49
+
50
+ it "should default to the :frame selector kind when only options passed" do
51
+ @session.within_frame(name: 'my frame one') do
52
+ expect(@session.find("//*[@id='divInFrameOne']").text).to eql 'This is the text of divInFrameOne'
53
+ end
54
+ end
55
+
44
56
  it "should find multiple nested frames" do
45
57
  @session.within_frame 'parentFrame' do
46
58
  @session.within_frame 'childFrame' do
@@ -52,6 +52,20 @@ Capybara::SpecHelper.spec '#has_current_path?' do
52
52
  expect(@session).to have_current_path('/with_js', url: true, only_path: true)
53
53
  }. to raise_error ArgumentError
54
54
  end
55
+
56
+ it "should not raise an exception if the current_url is nil" do
57
+ allow_any_instance_of(Capybara::Session).to receive(:current_url) { nil }
58
+
59
+ # Without only_path option
60
+ expect {
61
+ expect(@session).to have_current_path(nil)
62
+ }. not_to raise_exception
63
+
64
+ # With only_path option
65
+ expect {
66
+ expect(@session).to have_current_path(nil, only_path: true)
67
+ }. not_to raise_exception
68
+ end
55
69
  end
56
70
 
57
71
  Capybara::SpecHelper.spec '#has_no_current_path?' do
@@ -76,4 +90,18 @@ Capybara::SpecHelper.spec '#has_no_current_path?' do
76
90
  it "should be true if the page has not the given current_path" do
77
91
  expect(@session).to have_no_current_path('/with_html')
78
92
  end
93
+
94
+ it "should not raise an exception if the current_url is nil" do
95
+ allow_any_instance_of(Capybara::Session).to receive(:current_url) { nil }
96
+
97
+ # Without only_path option
98
+ expect {
99
+ expect(@session).not_to have_current_path('/with_js')
100
+ }. not_to raise_exception
101
+
102
+ # With only_path option
103
+ expect {
104
+ expect(@session).not_to have_current_path('/with_js', only_path: true)
105
+ }. not_to raise_exception
106
+ end
79
107
  end
@@ -77,6 +77,27 @@ Capybara::SpecHelper.spec '#has_selector?' do
77
77
  expect(@session).to have_selector(:css, "p a#foo", 'extra')
78
78
  end
79
79
  end
80
+
81
+ context "with exact_text" do
82
+ context "string" do
83
+ it "should only match elements that match exactly" do
84
+ expect(@session).to have_selector(:id, "h2one", exact_text: "Header Class Test One")
85
+ expect(@session).to have_no_selector(:id, "h2one", exact_text: "Header Class Test")
86
+ end
87
+ end
88
+
89
+ context "boolean" do
90
+ it "should only match elements that match exactly when true" do
91
+ expect(@session).to have_selector(:id, "h2one", text: "Header Class Test One", exact_text: true)
92
+ expect(@session).to have_no_selector(:id, "h2one", text: "Header Class Test", exact_text: true)
93
+ end
94
+
95
+ it "should match substrings when false" do
96
+ expect(@session).to have_selector(:id, "h2one", text: "Header Class Test One", exact_text: false)
97
+ expect(@session).to have_selector(:id, "h2one", text: "Header Class Test", exact_text: false)
98
+ end
99
+ end
100
+ end
80
101
  end
81
102
 
82
103
  Capybara::SpecHelper.spec '#has_no_selector?' do
@@ -96,6 +96,18 @@ Capybara::SpecHelper.spec '#has_text?' do
96
96
  expect(@session).not_to have_text(/xxxxyzzz/)
97
97
  end
98
98
 
99
+ context "with exact: true option" do
100
+ it "should be true if text matches exactly" do
101
+ @session.visit('/with_html')
102
+ expect(@session.find(:id, "h2one")).to have_text("Header Class Test One", exact: true)
103
+ end
104
+
105
+ it "should be false if text doesn't match exactly" do
106
+ @session.visit('/with_html')
107
+ expect(@session.find(:id, "h2one")).not_to have_text("Header Class Test On", exact: true)
108
+ end
109
+ end
110
+
99
111
  it "should escape any characters that would have special meaning in a regexp" do
100
112
  @session.visit('/with_html')
101
113
  expect(@session).not_to have_text('.orem')
@@ -205,7 +217,7 @@ Capybara::SpecHelper.spec '#has_text?' do
205
217
  it "should raise an error if an invalid option is passed" do
206
218
  @session.visit('/with_html')
207
219
  expect do
208
- expect(@session).to have_text('Lorem', exact: true)
220
+ expect(@session).to have_text('Lorem', invalid: true)
209
221
  end.to raise_error(ArgumentError)
210
222
  end
211
223
  end
@@ -21,6 +21,21 @@ Capybara::SpecHelper.spec '#has_title?' do
21
21
  it "should be false if the page has not the given title" do
22
22
  expect(@session).not_to have_title('monkey')
23
23
  end
24
+
25
+ it "should default to exact: false matching" do
26
+ expect(@session).to have_title('with_js', exact: false)
27
+ expect(@session).to have_title('with_', exact: false)
28
+ end
29
+
30
+ it "should match exactly if exact: true option passed" do
31
+ expect(@session).to have_title('with_js', exact: true)
32
+ expect(@session).not_to have_title('with_', exact: true)
33
+ end
34
+
35
+ it "should match partial if exact: false option passed" do
36
+ expect(@session).to have_title('with_js', exact: false)
37
+ expect(@session).to have_title('with_', exact: false)
38
+ end
24
39
  end
25
40
 
26
41
  Capybara::SpecHelper.spec '#has_no_title?' do
@@ -135,7 +135,7 @@ Capybara::SpecHelper.spec "node" do
135
135
  end
136
136
 
137
137
  it 'should allow me to change the contents of a contenteditable elements child', requires: [:js] do
138
- pending "Selenium doesn't like editing nested contents"
138
+ pending "Selenium doesn't like editing nested contents" if @session.respond_to?(:mode) && @session.mode.to_s =~ /^selenium_/
139
139
  @session.visit('/with_js')
140
140
  @session.find(:css,'#existing_content_editable_child').set('WYSIWYG')
141
141
  expect(@session.find(:css,'#existing_content_editable_child').text).to eq('WYSIWYG')
@@ -166,9 +166,35 @@ Capybara::SpecHelper.spec "node" do
166
166
  it "should see enabled options in disabled select as disabled" do
167
167
  @session.visit('/form')
168
168
  expect(@session.find('//select[@id="form_disabled_select"]/option')).to be_disabled
169
+ expect(@session.find('//select[@id="form_disabled_select"]/optgroup/option')).to be_disabled
169
170
  expect(@session.find('//select[@id="form_title"]/option[1]')).not_to be_disabled
170
171
  end
171
172
 
173
+ it "should see enabled options in disabled optgroup as disabled" do
174
+ @session.visit('/form')
175
+ expect(@session.find('//option', text: "A.B.1")).to be_disabled
176
+ expect(@session.find('//option', text: "A.2")).not_to be_disabled
177
+ end
178
+
179
+ context "in a disabled fieldset" do
180
+ # https://html.spec.whatwg.org/#the-fieldset-element
181
+ it "should see elements not in first legend as disabled" do
182
+ @session.visit('/form')
183
+ expect(@session.find('//input[@id="form_disabled_fieldset_child"]')).to be_disabled
184
+ expect(@session.find('//input[@id="form_disabled_fieldset_second_legend_child"]')).to be_disabled
185
+ expect(@session.find('//input[@id="form_enabled_fieldset_child"]')).not_to be_disabled
186
+ end
187
+
188
+ it "should see elements in first legend as enabled" do
189
+ @session.visit('/form')
190
+ expect(@session.find('//input[@id="form_disabled_fieldset_legend_child"]')).not_to be_disabled
191
+ end
192
+
193
+ it "should sees options not in first legend as disabled" do
194
+ @session.visit('/form')
195
+ expect(@session.find('//option', text: 'Disabled Child Option')).to be_disabled
196
+ end
197
+ end
172
198
  it "should be boolean" do
173
199
  @session.visit('/form')
174
200
  expect(@session.find('//select[@id="form_disabled_select"]/option').disabled?).to be true
@@ -263,6 +289,7 @@ Capybara::SpecHelper.spec "node" do
263
289
 
264
290
  describe '#drag_to', requires: [:js, :drag] do
265
291
  it "should drag and drop an object" do
292
+ pending "selenium-webdriver/geckodriver doesn't support mouse move_to" if marionette?(@session)
266
293
  @session.visit('/with_js')
267
294
  element = @session.find('//div[@id="drag"]')
268
295
  target = @session.find('//div[@id="drop"]')
@@ -273,6 +300,7 @@ Capybara::SpecHelper.spec "node" do
273
300
 
274
301
  describe '#hover', requires: [:hover] do
275
302
  it "should allow hovering on an element" do
303
+ pending "selenium-webdriver/geckodriver doesn't support mouse move_to" if marionette?(@session)
276
304
  @session.visit('/with_hover')
277
305
  expect(@session.find(:css,'.hidden_until_hover', visible: false)).not_to be_visible
278
306
  @session.find(:css,'.wrapper').hover
@@ -289,6 +317,7 @@ Capybara::SpecHelper.spec "node" do
289
317
 
290
318
  describe '#double_click', requires: [:js] do
291
319
  it "should double click an element" do
320
+ pending "selenium-webdriver/geckodriver doesn't support mouse move_to" if marionette?(@session)
292
321
  @session.visit('/with_js')
293
322
  @session.find(:css, '#click-test').double_click
294
323
  expect(@session.find(:css, '#has-been-double-clicked')).to be
@@ -297,6 +326,7 @@ Capybara::SpecHelper.spec "node" do
297
326
 
298
327
  describe '#right_click', requires: [:js] do
299
328
  it "should right click an element" do
329
+ pending "selenium-webdriver/geckodriver doesn't support mouse move_to" if marionette?(@session)
300
330
  @session.visit('/with_js')
301
331
  @session.find(:css, '#click-test').right_click
302
332
  expect(@session.find(:css, '#has-been-right-clicked')).to be
@@ -311,18 +341,21 @@ Capybara::SpecHelper.spec "node" do
311
341
  end
312
342
 
313
343
  it "should send special characters" do
344
+ pending "selenium-webdriver/geckodriver doesn't support complex sets of characters" if marionette?(@session)
314
345
  @session.visit('/form')
315
346
  @session.find(:css, '#address1_city').send_keys('Ocean', :space, 'sie', :left, 'd')
316
347
  expect(@session.find(:css, '#address1_city').value).to eq 'Ocean side'
317
348
  end
318
349
 
319
350
  it "should allow for multiple simultaneous keys" do
351
+ pending "selenium-webdriver/geckodriver doesn't support complex sets of characters" if marionette?(@session)
320
352
  @session.visit('/form')
321
353
  @session.find(:css, '#address1_city').send_keys([:shift, 'o'], 'ceanside')
322
354
  expect(@session.find(:css, '#address1_city').value).to eq 'Oceanside'
323
355
  end
324
356
 
325
357
  it "should generate key events", requires: [:send_keys, :js] do
358
+ pending "selenium-webdriver/geckodriver doesn't support complex sets of characters" if marionette?(@session)
326
359
  @session.visit('/with_js')
327
360
  @session.find(:css, '#with-key-events').send_keys([:shift,'t'], [:shift,'w'])
328
361
  expect(@session.find(:css, '#key-events-output')).to have_text('keydown:16 keydown:84 keydown:16 keydown:87')