capybara 3.31.0 → 3.32.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.
@@ -49,7 +49,6 @@ RSpec.describe Capybara::Selector::RegexpDisassembler, :aggregate_failures do
49
49
  end
50
50
 
51
51
  it 'handles optional characters for #alternated_substrings' do
52
- # rubocop:disable Style/BracesAroundHashParameters
53
52
  verify_alternated_strings(
54
53
  {
55
54
  /abc*def/ => [%w[ab def]],
@@ -62,7 +61,6 @@ RSpec.describe Capybara::Selector::RegexpDisassembler, :aggregate_failures do
62
61
  /d?/ => []
63
62
  }
64
63
  )
65
- # rubocop:enable Style/BracesAroundHashParameters
66
64
  end
67
65
 
68
66
  it 'handles character classes' do
@@ -140,7 +138,6 @@ RSpec.describe Capybara::Selector::RegexpDisassembler, :aggregate_failures do
140
138
  end
141
139
 
142
140
  it 'handles alternation for #alternated_substrings' do
143
- # rubocop:disable Style/BracesAroundHashParameters
144
141
  verify_alternated_strings(
145
142
  {
146
143
  /abc|def/ => [%w[abc], %w[def]],
@@ -173,7 +170,6 @@ RSpec.describe Capybara::Selector::RegexpDisassembler, :aggregate_failures do
173
170
  /ab\\?cd/ => [%w[abcd], %w[ab\cd]]
174
171
  }
175
172
  )
176
- # rubocop:enable Style/BracesAroundHashParameters
177
173
  end
178
174
 
179
175
  it 'handles grouping' do
@@ -65,24 +65,47 @@ RSpec.describe Capybara::Result do
65
65
  end).to eq(2)
66
66
  end
67
67
 
68
+ def recalc_result
69
+ string.all '//li', minimum: 0 # pass minimum: 0 so lazy evaluation doesn't get triggered yet
70
+ end
71
+
68
72
  it 'supports all modes of []' do
69
- expect(result[1].text).to eq 'Beta'
70
- expect(result[0, 2].map(&:text)).to eq %w[Alpha Beta]
71
- expect(result[1..3].map(&:text)).to eq %w[Beta Gamma Delta]
72
- expect(result[-1].text).to eq 'Delta'
73
- expect(result[-2, 3].map(&:text)).to eq %w[Gamma Delta]
74
- expect(result[1..7].map(&:text)).to eq %w[Beta Gamma Delta]
75
- expect(result[1...3].map(&:text)).to eq %w[Beta Gamma]
76
- expect(result[2..-1].map(&:text)).to eq %w[Gamma Delta]
77
- expect(result[2...-1].map(&:text)).to eq %w[Gamma]
78
- eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.5
73
+ expect(recalc_result[1].text).to eq 'Beta'
74
+ expect(recalc_result[0, 2].map(&:text)).to eq %w[Alpha Beta]
75
+ expect(recalc_result[1..3].map(&:text)).to eq %w[Beta Gamma Delta]
76
+ expect(recalc_result[-1].text).to eq 'Delta'
77
+ expect(recalc_result[-2, 3].map(&:text)).to eq %w[Gamma Delta]
78
+ expect(recalc_result[1...3].map(&:text)).to eq %w[Beta Gamma]
79
+ expect(recalc_result[1..7].map(&:text)).to eq %w[Beta Gamma Delta]
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]
82
+ end
83
+
84
+ eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.5
85
+ it 'supports endless ranges' do
79
86
  expect(result[2..].map(&:text)).to eq %w[Gamma Delta]
80
- TEST
81
- eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.6
87
+ end
88
+ TEST
89
+
90
+ eval <<~TEST, binding, __FILE__, __LINE__ + 1 if RUBY_VERSION.to_f > 2.6
91
+ it 'supports inclusive positive beginless ranges' do
82
92
  expect(result[..2].map(&:text)).to eq %w[Alpha Beta Gamma]
93
+ end
94
+
95
+ it 'supports inclusive negative beginless ranges' do
96
+ expect(result[..-2].map(&:text)).to eq %w[Alpha Beta Gamma]
97
+ expect(result[..-1].map(&:text)).to eq %w[Alpha Beta Gamma Delta]
98
+ end
99
+
100
+ it 'supports exclusive positive beginless ranges' do
83
101
  expect(result[...2].map(&:text)).to eq %w[Alpha Beta]
84
- TEST
85
- end
102
+ end
103
+
104
+ it 'supports exclusive negative beginless ranges' do
105
+ expect(result[...-2].map(&:text)).to eq %w[Alpha Beta]
106
+ expect(result[...-1].map(&:text)).to eq %w[Alpha Beta Gamma]
107
+ end
108
+ TEST
86
109
 
87
110
  it 'works with filter blocks' do
88
111
  result = string.all('//li') { |node| node.text == 'Alpha' }
@@ -68,8 +68,12 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybar
68
68
  skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
69
69
  when /Capybara::Session selenium_chrome Capybara::Window#maximize/
70
70
  pending "Chrome headless doesn't support maximize" if ENV['HEADLESS']
71
+ when /Capybara::Window#fullscreen should be able to fullscreen the window/
72
+ skip 'Chromedriver hangs on attempts to fullscreen in headless mode' if ENV['HEADLESS']
71
73
  when /details non-summary descendants should be non-visible/
72
74
  pending 'Chromedriver built-in is_displayed is currently broken' if ENV['W3C'] == 'false'
75
+ when /node #right_click delay should delay the mouse up/
76
+ skip "Legacy selenium doesn't support separate right button down/up" if ENV['W3C'] == 'false'
73
77
  end
74
78
  end
75
79
 
@@ -62,6 +62,8 @@ 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'
65
67
  end
66
68
  end
67
69
 
@@ -27,6 +27,14 @@ RSpec.shared_examples 'Capybara::Node' do |session, _mode|
27
27
  end
28
28
  end
29
29
 
30
+ describe '#[]' do
31
+ it 'should work for spellcheck' do
32
+ session.visit('/with_html')
33
+ expect(session.find('//input[@spellcheck="TRUE"]')[:spellcheck]).to eq('true')
34
+ expect(session.find('//input[@spellcheck="FALSE"]')[:spellcheck]).to eq('false')
35
+ end
36
+ end
37
+
30
38
  describe '#visible?' do
31
39
  let(:bridge) do
32
40
  session.driver.browser.send(:bridge)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.31.0
4
+ version: 3.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Walpole
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - gem-public_cert.pem
13
- date: 2020-01-26 00:00:00.000000000 Z
13
+ date: 2020-03-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -528,6 +528,7 @@ files:
528
528
  - lib/capybara/selenium/nodes/firefox_node.rb
529
529
  - lib/capybara/selenium/nodes/ie_node.rb
530
530
  - lib/capybara/selenium/nodes/safari_node.rb
531
+ - lib/capybara/selenium/patches/action_pauser.rb
531
532
  - lib/capybara/selenium/patches/atoms.rb
532
533
  - lib/capybara/selenium/patches/is_displayed.rb
533
534
  - lib/capybara/selenium/patches/logs.rb