capybara 3.26.0 → 3.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +18 -0
  3. data/README.md +1 -2
  4. data/lib/capybara/minitest.rb +29 -29
  5. data/lib/capybara/node/element.rb +2 -1
  6. data/lib/capybara/node/matchers.rb +6 -6
  7. data/lib/capybara/node/simple.rb +2 -1
  8. data/lib/capybara/queries/ancestor_query.rb +5 -9
  9. data/lib/capybara/queries/selector_query.rb +2 -2
  10. data/lib/capybara/queries/sibling_query.rb +4 -10
  11. data/lib/capybara/registrations/servers.rb +4 -1
  12. data/lib/capybara/selector/regexp_disassembler.rb +7 -0
  13. data/lib/capybara/selenium/atoms/isDisplayed.min.js +1 -1
  14. data/lib/capybara/selenium/atoms/src/isDisplayed.js +9 -9
  15. data/lib/capybara/selenium/driver.rb +2 -1
  16. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +9 -4
  17. data/lib/capybara/selenium/driver_specializations/edge_driver.rb +8 -6
  18. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +9 -0
  19. data/lib/capybara/selenium/nodes/chrome_node.rb +41 -5
  20. data/lib/capybara/selenium/nodes/firefox_node.rb +16 -0
  21. data/lib/capybara/selenium/patches/is_displayed.rb +16 -0
  22. data/lib/capybara/spec/session/node_spec.rb +40 -3
  23. data/lib/capybara/spec/views/with_html.erb +10 -0
  24. data/lib/capybara/version.rb +1 -1
  25. data/spec/basic_node_spec.rb +6 -6
  26. data/spec/capybara_spec.rb +28 -28
  27. data/spec/filter_set_spec.rb +5 -5
  28. data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -1
  29. data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
  30. data/spec/rack_test_spec.rb +9 -9
  31. data/spec/regexp_dissassembler_spec.rb +12 -2
  32. data/spec/rspec/shared_spec_matchers.rb +2 -2
  33. data/spec/rspec_spec.rb +1 -1
  34. data/spec/selector_spec.rb +15 -15
  35. data/spec/selenium_spec_chrome.rb +38 -0
  36. data/spec/selenium_spec_firefox.rb +1 -1
  37. data/spec/server_spec.rb +18 -18
  38. data/spec/session_spec.rb +4 -4
  39. data/spec/shared_selenium_node.rb +36 -0
  40. metadata +3 -2
@@ -6,13 +6,13 @@ RSpec.describe Capybara::Session do
6
6
  context '#new' do
7
7
  it 'should raise an error if passed non-existent driver' do
8
8
  expect do
9
- Capybara::Session.new(:quox, TestApp).driver
9
+ described_class.new(:quox, TestApp).driver
10
10
  end.to raise_error(Capybara::DriverNotFoundError)
11
11
  end
12
12
 
13
13
  it 'verifies a passed app is a rack app' do
14
14
  expect do
15
- Capybara::Session.new(:unknown, random: 'hash')
15
+ described_class.new(:unknown, random: 'hash')
16
16
  end.to raise_error TypeError, 'The second parameter to Session::new should be a rack app if passed.'
17
17
  end
18
18
  end
@@ -75,14 +75,14 @@ RSpec.describe Capybara::Session do
75
75
 
76
76
  context 'quit' do
77
77
  it 'will reset the driver' do
78
- session = Capybara::Session.new(:rack_test, TestApp)
78
+ session = described_class.new(:rack_test, TestApp)
79
79
  driver = session.driver
80
80
  session.quit
81
81
  expect(session.driver).not_to eql driver
82
82
  end
83
83
 
84
84
  it 'resets the document' do
85
- session = Capybara::Session.new(:rack_test, TestApp)
85
+ session = described_class.new(:rack_test, TestApp)
86
86
  document = session.document
87
87
  session.quit
88
88
  expect(session.document.base).not_to eql document.base
@@ -26,4 +26,40 @@ RSpec.shared_examples 'Capybara::Node' do |session, _mode|
26
26
  expect(session.find(:css, '#address1_city').value).to eq 'ocean SIDE'
27
27
  end
28
28
  end
29
+
30
+ context '#visible?' do
31
+ let(:bridge) do
32
+ session.driver.browser.send(:bridge)
33
+ end
34
+
35
+ around do |example|
36
+ native_displayed = session.driver.options[:native_displayed]
37
+ example.run
38
+ session.driver.options[:native_displayed] = native_displayed
39
+ end
40
+
41
+ before do
42
+ allow(bridge).to receive(:execute_atom).and_call_original
43
+ end
44
+
45
+ it 'will use native displayed if told to' do
46
+ pending "Chromedriver < 76.0.3809.25 doesn't support native displayed in W3C mode" if chrome_lt?(76, session) && (ENV['W3C'] != 'false')
47
+
48
+ session.driver.options[:native_displayed] = true
49
+ session.visit('/form')
50
+ session.find(:css, '#address1_city', visible: true)
51
+
52
+ expect(bridge).not_to have_received(:execute_atom)
53
+ end
54
+
55
+ it "won't use native displayed if told not to" do
56
+ skip 'Non-W3C uses native' if chrome?(session) && (ENV['W3C'] == 'false')
57
+
58
+ session.driver.options[:native_displayed] = false
59
+ session.visit('/form')
60
+ session.find(:css, '#address1_city', visible: true)
61
+
62
+ expect(bridge).to have_received(:execute_atom).with(:isDisplayed, any_args)
63
+ end
64
+ end
29
65
  end
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.26.0
4
+ version: 3.27.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: 2019-07-15 00:00:00.000000000 Z
13
+ date: 2019-07-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -526,6 +526,7 @@ files:
526
526
  - lib/capybara/selenium/nodes/ie_node.rb
527
527
  - lib/capybara/selenium/nodes/safari_node.rb
528
528
  - lib/capybara/selenium/patches/atoms.rb
529
+ - lib/capybara/selenium/patches/is_displayed.rb
529
530
  - lib/capybara/selenium/patches/logs.rb
530
531
  - lib/capybara/selenium/patches/pause_duration_fix.rb
531
532
  - lib/capybara/selenium/patches/persistent_client.rb