capybara 3.35.3 → 3.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +31 -1
- data/README.md +5 -1
- data/lib/capybara/config.rb +16 -4
- data/lib/capybara/driver/base.rb +4 -0
- data/lib/capybara/driver/node.rb +1 -1
- data/lib/capybara/helpers.rb +2 -11
- data/lib/capybara/node/actions.rb +10 -5
- data/lib/capybara/node/document.rb +2 -2
- data/lib/capybara/node/element.rb +1 -1
- data/lib/capybara/node/finders.rb +1 -1
- data/lib/capybara/node/simple.rb +5 -1
- data/lib/capybara/queries/active_element_query.rb +18 -0
- data/lib/capybara/queries/ancestor_query.rb +2 -1
- data/lib/capybara/queries/current_path_query.rb +1 -1
- data/lib/capybara/queries/selector_query.rb +14 -1
- data/lib/capybara/queries/sibling_query.rb +2 -1
- data/lib/capybara/rack_test/node.rb +9 -6
- data/lib/capybara/registrations/drivers.rb +3 -3
- data/lib/capybara/rspec/matcher_proxies.rb +3 -3
- data/lib/capybara/rspec/matchers/have_selector.rb +1 -1
- data/lib/capybara/selector/builders/css_builder.rb +1 -1
- data/lib/capybara/selector/builders/xpath_builder.rb +1 -1
- data/lib/capybara/selector/css.rb +1 -1
- data/lib/capybara/selector/definition/button.rb +9 -4
- data/lib/capybara/selector/definition/checkbox.rb +1 -1
- data/lib/capybara/selector/definition/file_field.rb +1 -1
- data/lib/capybara/selector/definition/fillable_field.rb +1 -1
- data/lib/capybara/selector/definition/radio_button.rb +1 -1
- data/lib/capybara/selector/definition.rb +2 -1
- data/lib/capybara/selector/filter_set.rb +4 -6
- data/lib/capybara/selector.rb +1 -0
- data/lib/capybara/selenium/driver.rb +19 -9
- data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +1 -1
- data/lib/capybara/selenium/driver_specializations/edge_driver.rb +1 -1
- data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +1 -1
- data/lib/capybara/selenium/node.rb +10 -8
- data/lib/capybara/selenium/nodes/chrome_node.rb +1 -1
- data/lib/capybara/selenium/nodes/edge_node.rb +1 -1
- data/lib/capybara/selenium/nodes/firefox_node.rb +1 -1
- data/lib/capybara/selenium/nodes/safari_node.rb +2 -2
- data/lib/capybara/server/animation_disabler.rb +15 -9
- data/lib/capybara/session.rb +12 -2
- data/lib/capybara/spec/session/active_element_spec.rb +31 -0
- data/lib/capybara/spec/session/all_spec.rb +4 -6
- data/lib/capybara/spec/session/check_spec.rb +9 -0
- data/lib/capybara/spec/session/choose_spec.rb +6 -0
- data/lib/capybara/spec/session/has_any_selectors_spec.rb +4 -0
- data/lib/capybara/spec/session/has_button_spec.rb +24 -0
- data/lib/capybara/spec/session/has_field_spec.rb +24 -0
- data/lib/capybara/spec/session/has_link_spec.rb +24 -0
- data/lib/capybara/spec/session/has_text_spec.rb +1 -1
- data/lib/capybara/spec/session/node_spec.rb +1 -1
- data/lib/capybara/spec/session/scroll_spec.rb +4 -4
- data/lib/capybara/spec/spec_helper.rb +4 -3
- data/lib/capybara/spec/test_app.rb +17 -8
- data/lib/capybara/spec/views/animated.erb +1 -1
- data/lib/capybara/spec/views/form.erb +11 -3
- data/lib/capybara/spec/views/frame_child.erb +1 -1
- data/lib/capybara/spec/views/frame_one.erb +1 -1
- data/lib/capybara/spec/views/frame_parent.erb +1 -1
- data/lib/capybara/spec/views/frame_two.erb +1 -1
- data/lib/capybara/spec/views/initial_alert.erb +2 -1
- data/lib/capybara/spec/views/layout.erb +10 -0
- data/lib/capybara/spec/views/obscured.erb +1 -1
- data/lib/capybara/spec/views/offset.erb +2 -1
- data/lib/capybara/spec/views/path.erb +2 -2
- data/lib/capybara/spec/views/popup_one.erb +1 -1
- data/lib/capybara/spec/views/popup_two.erb +1 -1
- data/lib/capybara/spec/views/react.erb +2 -2
- data/lib/capybara/spec/views/scroll.erb +2 -1
- data/lib/capybara/spec/views/spatial.erb +1 -1
- data/lib/capybara/spec/views/with_animation.erb +2 -3
- data/lib/capybara/spec/views/with_base_tag.erb +2 -2
- data/lib/capybara/spec/views/with_dragula.erb +2 -2
- data/lib/capybara/spec/views/with_fixed_header_footer.erb +2 -1
- data/lib/capybara/spec/views/with_hover.erb +2 -2
- data/lib/capybara/spec/views/with_html.erb +1 -1
- data/lib/capybara/spec/views/with_jquery_animation.erb +1 -1
- data/lib/capybara/spec/views/with_js.erb +2 -3
- data/lib/capybara/spec/views/with_jstree.erb +1 -1
- data/lib/capybara/spec/views/with_namespace.erb +1 -0
- data/lib/capybara/spec/views/with_slow_unload.erb +2 -1
- data/lib/capybara/spec/views/with_sortable_js.erb +2 -2
- data/lib/capybara/spec/views/with_unload_alert.erb +1 -0
- data/lib/capybara/spec/views/with_windows.erb +1 -1
- data/lib/capybara/spec/views/within_frames.erb +1 -1
- data/lib/capybara/version.rb +1 -1
- data/lib/capybara.rb +18 -22
- data/spec/basic_node_spec.rb +16 -3
- data/spec/dsl_spec.rb +1 -1
- data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
- data/spec/rack_test_spec.rb +14 -10
- data/spec/result_spec.rb +5 -6
- data/spec/rspec/features_spec.rb +1 -1
- data/spec/rspec/shared_spec_matchers.rb +2 -2
- data/spec/selenium_spec_chrome.rb +8 -9
- data/spec/selenium_spec_chrome_remote.rb +9 -8
- data/spec/selenium_spec_firefox.rb +4 -3
- data/spec/selenium_spec_firefox_remote.rb +2 -2
- data/spec/selenium_spec_ie.rb +3 -6
- data/spec/selenium_spec_safari.rb +27 -19
- data/spec/shared_selenium_node.rb +0 -4
- data/spec/shared_selenium_session.rb +11 -8
- metadata +35 -14
- data/lib/capybara/spec/views/with_title.erb +0 -5
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
1
|
<h1>Form</h1>
|
|
3
2
|
|
|
3
|
+
<button type="button" tabindex="1">A Button</button>
|
|
4
|
+
|
|
5
|
+
<label>
|
|
6
|
+
An Input
|
|
7
|
+
<input type="text" tabindex="2">
|
|
8
|
+
</label>
|
|
9
|
+
|
|
4
10
|
<form action="/form" method="post" novalidate>
|
|
5
11
|
|
|
6
12
|
<p>
|
|
7
13
|
<label for="form_title">Title</label>
|
|
8
|
-
<select name="form[title]" id="form_title" class="title">
|
|
14
|
+
<select name="form[title]" id="form_title" class="title" tabindex="3">
|
|
9
15
|
<option class="title">Mrs</option>
|
|
10
16
|
<option class="title">Mr</option>
|
|
11
17
|
<option>Miss</option>
|
|
@@ -170,7 +176,7 @@ New line after and before textarea tag
|
|
|
170
176
|
<label for="gender_male">Male</label>
|
|
171
177
|
<input type="radio" name="form[gender]" value="female" id="gender_female" checked="checked"/>
|
|
172
178
|
<label for="gender_female">Female</label>
|
|
173
|
-
<input type="radio" name="form[gender]" value="both" id="gender_both"/>
|
|
179
|
+
<input type="radio" name="form[gender]" value="both" id="gender_both" readonly="readonly"/>
|
|
174
180
|
<label for="gender_both">Both</label>
|
|
175
181
|
</p>
|
|
176
182
|
|
|
@@ -223,6 +229,8 @@ New line after and before textarea tag
|
|
|
223
229
|
</label>
|
|
224
230
|
<input type="checkbox" value="maserati" name="form[cars][]" id="form_cars_maserati" disabled="disabled"/>
|
|
225
231
|
<label for="form_cars_maserati">Maserati</label>
|
|
232
|
+
<input type="checkbox" value="lotus" name="form[cars][]" id="form_cars_lotus" style="display: none"/>
|
|
233
|
+
<label for="form_cars_lotus"><a href="#" onclick="return false;">Link here</a>Lotus</label>
|
|
226
234
|
</p>
|
|
227
235
|
|
|
228
236
|
<p>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<p class="para" id="first" data-random="abc\def" style="line-height: 25px;">
|
|
21
21
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
22
|
-
tempor incididunt ut <a href="/with_simple_html" title="awesome title" class="simple">labore</a>
|
|
22
|
+
tempor incididunt ut <a href="/with_simple_html" title="awesome title" class="simple" tabindex="1">labore</a>
|
|
23
23
|
et dolore magna aliqua. Ut enim ad minim veniam,
|
|
24
24
|
quis nostrud exercitation <a href="/foo" id="foo" data-test-id="test-foo">ullamco</a> laboris nisi
|
|
25
25
|
ut aliquip ex ea commodo consequat.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
<html
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
|
5
5
|
<title>with_js</title>
|
|
@@ -160,4 +160,3 @@
|
|
|
160
160
|
</script>
|
|
161
161
|
</body>
|
|
162
162
|
</html>
|
|
163
|
-
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
2
3
|
<head>
|
|
3
4
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
|
4
5
|
<title>with_sortable_js</title>
|
|
@@ -18,4 +19,3 @@
|
|
|
18
19
|
</script>
|
|
19
20
|
</body>
|
|
20
21
|
</html>
|
|
21
|
-
|
data/lib/capybara/version.rb
CHANGED
data/lib/capybara.rb
CHANGED
|
@@ -39,7 +39,7 @@ module Capybara
|
|
|
39
39
|
# See {Capybara.configure}
|
|
40
40
|
# @!method javascript_driver
|
|
41
41
|
# See {Capybara.configure}
|
|
42
|
-
# @!method
|
|
42
|
+
# @!method use_html5_parsing
|
|
43
43
|
# See {Capybara.configure}
|
|
44
44
|
Config::OPTIONS.each do |method|
|
|
45
45
|
def_delegators :config, method, "#{method}="
|
|
@@ -69,7 +69,7 @@ module Capybara
|
|
|
69
69
|
#
|
|
70
70
|
# #### Configurable options
|
|
71
71
|
#
|
|
72
|
-
# - **
|
|
72
|
+
# - **use_html5_parsing** (Boolean = `false`) - When Nokogiri >= 1.12.0 or `nokogumbo` is installed, whether HTML5 parsing will be used for HTML strings.
|
|
73
73
|
# - **always_include_port** (Boolean = `false`) - Whether the Rack server's port should automatically be inserted into every visited URL
|
|
74
74
|
# unless another port is explicitly specified.
|
|
75
75
|
# - **app_host** (String, `nil`) - The default host to use when giving a relative URL to visit, must be a valid URL e.g. `http://www.example.com`.
|
|
@@ -385,26 +385,21 @@ module Capybara
|
|
|
385
385
|
# @return [Nokogiri::HTML::Document] HTML document
|
|
386
386
|
#
|
|
387
387
|
def HTML(html) # rubocop:disable Naming/MethodName
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
# template elements content is not part of the document
|
|
392
|
-
template.inner_html = ''
|
|
393
|
-
end
|
|
394
|
-
document.xpath('//textarea').each do |textarea|
|
|
395
|
-
# The Nokogumbo HTML5 parser already returns spec compliant contents
|
|
396
|
-
textarea['_capybara_raw_value'] = textarea.content
|
|
397
|
-
end
|
|
398
|
-
end
|
|
388
|
+
# Nokogiri >= 1.12.0 or Nokogumbo installed and allowed for use
|
|
389
|
+
html_parser, using_html5 = if defined?(Nokogiri::HTML5) && Capybara.use_html5_parsing
|
|
390
|
+
[Nokogiri::HTML5, true]
|
|
399
391
|
else
|
|
400
|
-
Nokogiri::
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
392
|
+
[defined?(Nokogiri::HTML4) ? Nokogiri::HTML4 : Nokogiri::HTML, false]
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
html_parser.parse(html).tap do |document|
|
|
396
|
+
document.xpath('//template').each do |template|
|
|
397
|
+
# template elements content is not part of the document
|
|
398
|
+
template.inner_html = ''
|
|
399
|
+
end
|
|
400
|
+
document.xpath('//textarea').each do |textarea|
|
|
401
|
+
# The Nokogiri HTML5 parser already returns spec compliant contents
|
|
402
|
+
textarea['_capybara_raw_value'] = using_html5 ? textarea.content : textarea.content.delete_prefix("\n")
|
|
408
403
|
end
|
|
409
404
|
end
|
|
410
405
|
end
|
|
@@ -467,6 +462,7 @@ module Capybara
|
|
|
467
462
|
require 'capybara/queries/ancestor_query'
|
|
468
463
|
require 'capybara/queries/sibling_query'
|
|
469
464
|
require 'capybara/queries/style_query'
|
|
465
|
+
require 'capybara/queries/active_element_query'
|
|
470
466
|
|
|
471
467
|
require 'capybara/node/finders'
|
|
472
468
|
require 'capybara/node/matchers'
|
|
@@ -516,6 +512,6 @@ Capybara.configure do |config|
|
|
|
516
512
|
config.test_id = nil
|
|
517
513
|
config.predicates_wait = true
|
|
518
514
|
config.default_normalize_ws = false
|
|
519
|
-
config.
|
|
515
|
+
config.use_html5_parsing = false
|
|
520
516
|
config.w3c_click_offset = false
|
|
521
517
|
end
|
data/spec/basic_node_spec.rb
CHANGED
|
@@ -111,14 +111,27 @@ RSpec.describe Capybara do
|
|
|
111
111
|
expect(string.find('//form/input[@name="meh"]')).not_to be_disabled
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
+
it 'allows finding siblings' do
|
|
115
|
+
h1 = string.find(:css, 'h1')
|
|
116
|
+
expect(h1).to have_sibling(:css, 'p', text: 'Yes it is')
|
|
117
|
+
expect(h1).not_to have_sibling(:css, 'p', text: 'Jonas Nicklas')
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'allows finding ancestor' do
|
|
121
|
+
h1 = string.find(:css, 'h1')
|
|
122
|
+
expect(h1).to have_ancestor(:css, '#content')
|
|
123
|
+
expect(h1).not_to have_ancestor(:css, '#footer')
|
|
124
|
+
end
|
|
125
|
+
|
|
114
126
|
it 'drops illegal fragments when using gumbo' do
|
|
115
127
|
skip 'libxml is less strict than Gumbo' unless Nokogiri.respond_to?(:HTML5)
|
|
128
|
+
described_class.use_html5_parsing = true
|
|
116
129
|
expect(described_class.string('<td>1</td>')).not_to have_css('td')
|
|
117
130
|
end
|
|
118
131
|
|
|
119
|
-
it 'can disable use of
|
|
120
|
-
skip "Test doesn't make sense unlesss
|
|
121
|
-
described_class.
|
|
132
|
+
it 'can disable use of HTML5 parsing' do
|
|
133
|
+
skip "Test doesn't make sense unlesss HTML5 parsing is loaded (Nokogumbo or Nokogiri >= 1.12.0)" unless Nokogiri.respond_to?(:HTML5)
|
|
134
|
+
described_class.use_html5_parsing = false
|
|
122
135
|
expect(described_class.string('<td>1</td>')).to have_css('td')
|
|
123
136
|
end
|
|
124
137
|
|
data/spec/dsl_spec.rb
CHANGED
|
@@ -8,7 +8,7 @@ class TestClass
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
Capybara::SpecHelper.run_specs TestClass.new, 'DSL', capybara_skip: %i[
|
|
11
|
-
js modals screenshot frames windows send_keys server hover about_scheme psc download css driver scroll spatial html_validation shadow_dom
|
|
11
|
+
js modals screenshot frames windows send_keys server hover about_scheme psc download css driver scroll spatial html_validation shadow_dom active_element
|
|
12
12
|
] do |example|
|
|
13
13
|
case example.metadata[:full_description]
|
|
14
14
|
when /has_css\? should support case insensitive :class and :id options/
|
|
@@ -8,6 +8,6 @@ RSpec.describe Capybara::Selenium::Driver do
|
|
|
8
8
|
options = { browser: (ENV['SELENIUM_BROWSER'] || :firefox).to_sym }
|
|
9
9
|
browser = described_class.new(TestApp, **options).browser
|
|
10
10
|
expect(browser).to be_truthy
|
|
11
|
-
expect(true).to eq(true) # rubocop:disable RSpec/ExpectActual
|
|
11
|
+
expect(true).to eq(true) # rubocop:disable RSpec/ExpectActual,RSpec/IdenticalEqualityAssertion
|
|
12
12
|
end
|
|
13
13
|
end
|
data/spec/rack_test_spec.rb
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
|
-
nokogumbo_required = begin
|
|
5
|
-
require 'nokogumbo'
|
|
6
|
-
true
|
|
7
|
-
rescue LoadError
|
|
8
|
-
false
|
|
9
|
-
end
|
|
10
4
|
|
|
11
5
|
module TestSessions
|
|
12
6
|
RackTest = Capybara::Session.new(:rack_test, TestApp)
|
|
@@ -28,6 +22,7 @@ skipped_tests = %i[
|
|
|
28
22
|
spatial
|
|
29
23
|
html_validation
|
|
30
24
|
shadow_dom
|
|
25
|
+
active_element
|
|
31
26
|
]
|
|
32
27
|
Capybara::SpecHelper.run_specs TestSessions::RackTest, 'RackTest', capybara_skip: skipped_tests do |example|
|
|
33
28
|
case example.metadata[:full_description]
|
|
@@ -153,6 +148,14 @@ RSpec.describe Capybara::Session do # rubocop:disable RSpec/MultipleDescribes
|
|
|
153
148
|
end
|
|
154
149
|
end
|
|
155
150
|
|
|
151
|
+
describe '#active_element' do
|
|
152
|
+
it 'raises an UnsupportedMethodError' do
|
|
153
|
+
session.visit('/form')
|
|
154
|
+
|
|
155
|
+
expect { session.active_element }.to raise_error(Capybara::NotSupportedByDriverError)
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
156
159
|
describe '#text' do
|
|
157
160
|
it 'should return original text content for textareas' do
|
|
158
161
|
session.visit('/with_html')
|
|
@@ -256,11 +259,12 @@ RSpec.describe Capybara::RackTest::Driver do
|
|
|
256
259
|
end
|
|
257
260
|
|
|
258
261
|
RSpec.describe 'Capybara::String' do
|
|
259
|
-
it 'should use
|
|
260
|
-
skip 'Only
|
|
261
|
-
|
|
262
|
+
it 'should use HTML5 parsing' do
|
|
263
|
+
skip 'Only valid if Nokogiri >= 1.12.0 or gumbo is included' unless defined? Nokogiri::HTML5
|
|
264
|
+
Capybara.use_html5_parsing = true
|
|
265
|
+
allow(Nokogiri::HTML5).to receive(:parse).and_call_original
|
|
262
266
|
Capybara.string('<div id=test_div></div>')
|
|
263
|
-
expect(Nokogiri).to have_received(:
|
|
267
|
+
expect(Nokogiri::HTML5).to have_received(:parse)
|
|
264
268
|
end
|
|
265
269
|
end
|
|
266
270
|
|
data/spec/result_spec.rb
CHANGED
|
@@ -78,14 +78,13 @@ RSpec.describe Capybara::Result do
|
|
|
78
78
|
expect(recalc_result[1...3].map(&:text)).to eq %w[Beta Gamma]
|
|
79
79
|
expect(recalc_result[1..7].map(&:text)).to eq %w[Beta Gamma Delta]
|
|
80
80
|
expect(recalc_result[2...-1].map(&:text)).to eq %w[Gamma]
|
|
81
|
-
expect(recalc_result[2..-1].map(&:text)).to eq %w[Gamma Delta]
|
|
81
|
+
expect(recalc_result[2..-1].map(&:text)).to eq %w[Gamma Delta] # rubocop:disable Style/SlicingWithRange
|
|
82
|
+
expect(recalc_result[2..].map(&:text)).to eq %w[Gamma Delta]
|
|
82
83
|
end
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
end
|
|
88
|
-
TEST
|
|
85
|
+
it 'supports endless ranges' do
|
|
86
|
+
expect(result[2..].map(&:text)).to eq %w[Gamma Delta]
|
|
87
|
+
end
|
|
89
88
|
|
|
90
89
|
eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.6
|
|
91
90
|
it 'supports inclusive positive beginless ranges' do
|
data/spec/rspec/features_spec.rb
CHANGED
|
@@ -94,7 +94,7 @@ ffeature 'if ffeature aliases focused tag then' do # rubocop:disable RSpec/Focus
|
|
|
94
94
|
expect(example.metadata[:focus]).to eq true
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
scenario 'other scenarios also has metatag focus tag
|
|
97
|
+
scenario 'other scenarios also has metatag focus tag' do |example|
|
|
98
98
|
expect(example.metadata[:focus]).to eq true
|
|
99
99
|
end
|
|
100
100
|
end
|
|
@@ -840,10 +840,10 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode|
|
|
|
840
840
|
end
|
|
841
841
|
|
|
842
842
|
it 'gives proper description when :visible option passed' do
|
|
843
|
-
expect(have_table('Lovely table', visible: true).description).to eq('have visible table "Lovely table"')
|
|
843
|
+
expect(have_table('Lovely table', visible: true).description).to eq('have visible table "Lovely table"') # rubocop:disable RSpec/Capybara/VisibilityMatcher
|
|
844
844
|
expect(have_table('Lovely table', visible: :hidden).description).to eq('have non-visible table "Lovely table"')
|
|
845
845
|
expect(have_table('Lovely table', visible: :all).description).to eq('have table "Lovely table"')
|
|
846
|
-
expect(have_table('Lovely table', visible: false).description).to eq('have table "Lovely table"')
|
|
846
|
+
expect(have_table('Lovely table', visible: false).description).to eq('have table "Lovely table"') # rubocop:disable RSpec/Capybara/VisibilityMatcher
|
|
847
847
|
end
|
|
848
848
|
|
|
849
849
|
it 'passes if there is such a table' do
|
|
@@ -12,7 +12,7 @@ Selenium::WebDriver::Chrome.path = '/usr/bin/google-chrome-beta' if ENV['CI'] &&
|
|
|
12
12
|
|
|
13
13
|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
|
|
14
14
|
browser_options.headless! if ENV['HEADLESS']
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
# Chromedriver 77 requires setting this for headless mode on linux
|
|
17
17
|
# Different versions of Chrome/selenium-webdriver require setting differently - jus set them all
|
|
18
18
|
browser_options.add_preference('download.default_directory', Capybara.save_path)
|
|
@@ -85,10 +85,6 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybar
|
|
|
85
85
|
skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
|
|
86
86
|
when /Capybara::Session selenium_chrome Capybara::Window#maximize/
|
|
87
87
|
pending "Chrome headless doesn't support maximize" if ENV['HEADLESS']
|
|
88
|
-
when /Capybara::Window#fullscreen should be able to fullscreen the window/
|
|
89
|
-
skip 'Chromedriver hangs on attempts to fullscreen in headless mode' if ENV['HEADLESS']
|
|
90
|
-
when /node #right_click delay should delay the mouse up/
|
|
91
|
-
skip "Legacy selenium doesn't support separate right button down/up" if ENV['W3C'] == 'false'
|
|
92
88
|
end
|
|
93
89
|
end
|
|
94
90
|
|
|
@@ -185,18 +181,21 @@ RSpec.describe 'Capybara::Session with chrome' do
|
|
|
185
181
|
end
|
|
186
182
|
|
|
187
183
|
describe 'log access' do
|
|
188
|
-
|
|
184
|
+
let(:logs) do
|
|
185
|
+
session.driver.browser.then do |chrome_driver|
|
|
186
|
+
chrome_driver.respond_to?(:logs) ? chrome_driver : chrome_driver.manage
|
|
187
|
+
end.logs
|
|
188
|
+
end
|
|
189
189
|
|
|
190
190
|
it 'does not error getting log types' do
|
|
191
|
-
skip if Gem::Requirement.new('< 75.0.3770.90').satisfied_by? chromedriver_version
|
|
192
191
|
expect do
|
|
193
|
-
|
|
192
|
+
logs.available_types
|
|
194
193
|
end.not_to raise_error
|
|
195
194
|
end
|
|
196
195
|
|
|
197
196
|
it 'does not error when getting logs' do
|
|
198
197
|
expect do
|
|
199
|
-
|
|
198
|
+
logs.get(:browser)
|
|
200
199
|
end.not_to raise_error
|
|
201
200
|
end
|
|
202
201
|
end
|
|
@@ -21,8 +21,8 @@ def ensure_selenium_running!
|
|
|
21
21
|
rescue StandardError
|
|
22
22
|
if timer.expired?
|
|
23
23
|
raise 'Selenium is not running. ' \
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
"You can run a selenium server easily with: \n" \
|
|
25
|
+
' $ docker-compose up -d selenium_chrome'
|
|
26
26
|
else
|
|
27
27
|
puts 'Waiting for Selenium docker instance...'
|
|
28
28
|
sleep 1
|
|
@@ -62,8 +62,6 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_REMOTE_DRIVER.to_s,
|
|
|
62
62
|
'Capybara::Session selenium_chrome_remote #attach_file with multipart form should fire change once for each set of files uploaded',
|
|
63
63
|
'Capybara::Session selenium_chrome_remote #attach_file with multipart form should fire change once when uploading multiple files from empty'
|
|
64
64
|
pending "Selenium with Remote Chrome doesn't support multiple file upload" unless selenium_gte?(3.14)
|
|
65
|
-
when /node #right_click delay should delay the mouse up/
|
|
66
|
-
skip "Legacy selenium doesn't support separate right button down/up" if ENV['W3C'] == 'false'
|
|
67
65
|
end
|
|
68
66
|
end
|
|
69
67
|
|
|
@@ -78,18 +76,21 @@ RSpec.describe 'Capybara::Session with remote Chrome' do
|
|
|
78
76
|
end
|
|
79
77
|
|
|
80
78
|
describe 'log access' do
|
|
81
|
-
|
|
79
|
+
let(:logs) do
|
|
80
|
+
session.driver.browser.then do |chrome_driver|
|
|
81
|
+
chrome_driver.respond_to?(:logs) ? chrome_driver : chrome_driver.manage
|
|
82
|
+
end.logs
|
|
83
|
+
end
|
|
82
84
|
|
|
83
85
|
it 'does not error when getting log types' do
|
|
84
|
-
skip unless Gem::Requirement.new('>= 75.0.3770.90').satisfied_by? chromedriver_version
|
|
85
86
|
expect do
|
|
86
|
-
|
|
87
|
+
logs.available_types
|
|
87
88
|
end.not_to raise_error
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
it 'does not error when getting logs' do
|
|
91
92
|
expect do
|
|
92
|
-
|
|
93
|
+
logs.get(:browser)
|
|
93
94
|
end.not_to raise_error
|
|
94
95
|
end
|
|
95
96
|
end
|