capybara 2.14.3 → 2.14.4
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 +8 -0
- data/lib/capybara/rspec/matchers.rb +7 -1
- data/lib/capybara/spec/session/reset_session_spec.rb +2 -2
- data/lib/capybara/version.rb +1 -1
- data/spec/rspec_matchers_spec.rb +46 -0
- data/spec/selenium_spec_chrome.rb +12 -15
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 987f25342ad56a2981f48c4cee5894c01601450e
|
4
|
+
data.tar.gz: c9c97e994be43ebde7ec94cd8cebcfcec74c2ad3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 217162eb0ad144e6617666bc998f3f2dda3ccbd93b57f787762314f58203a53dcad4e2d78f9f760807cea15b597c3b6f3aa7533da4fe841af2aab73b211e222d
|
7
|
+
data.tar.gz: 59aef00f83df73f98197550976838d7b9e8690d89756a070497c3429a705b78d82b5807a89a24eebae0513277cf38bf23cf155bb32e1c6e4da17fa3b58709dee
|
data/History.md
CHANGED
@@ -45,7 +45,13 @@ module Capybara
|
|
45
45
|
|
46
46
|
def session_options
|
47
47
|
@context_el ||= nil
|
48
|
-
|
48
|
+
if @context_el.respond_to? :session_options
|
49
|
+
@context_el.session_options
|
50
|
+
elsif @context_el.respond_to? :current_scope
|
51
|
+
@context_el.current_scope.session_options
|
52
|
+
else
|
53
|
+
Capybara.session_options
|
54
|
+
end
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
@@ -39,14 +39,14 @@ Capybara::SpecHelper.spec '#reset_session!' do
|
|
39
39
|
expect(@session).to have_no_selector :xpath, "/html/body/*", wait: false
|
40
40
|
end
|
41
41
|
|
42
|
-
it "handles modals during unload" do
|
42
|
+
it "handles modals during unload", requires: [:modals] do
|
43
43
|
@session.visit('/with_unload_alert')
|
44
44
|
expect(@session).to have_selector(:css, 'div')
|
45
45
|
expect { @session.reset_session! }.not_to raise_error
|
46
46
|
expect(@session).to have_no_selector :xpath, "/html/body/*", wait: false
|
47
47
|
end
|
48
48
|
|
49
|
-
it "handles already open modals" do
|
49
|
+
it "handles already open modals", requires: [:modals] do
|
50
50
|
@session.visit('/with_unload_alert')
|
51
51
|
@session.click_link('Go away')
|
52
52
|
expect { @session.reset_session! }.not_to raise_error
|
data/lib/capybara/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe 'Capybara RSpec Matchers', :type => :feature do
|
5
|
+
context "after called on session" do
|
6
|
+
it "HaveSelector should allow getting a description of the matcher" do
|
7
|
+
visit('/with_html')
|
8
|
+
matcher = have_selector(:css, 'h2.head', minimum: 3)
|
9
|
+
expect(page).to matcher
|
10
|
+
expect { matcher.description }.not_to raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
it "HaveText should allow getting a description" do
|
14
|
+
visit('/with_html')
|
15
|
+
matcher = have_text("Lorem")
|
16
|
+
expect(page).to matcher
|
17
|
+
expect { matcher.description }.not_to raise_error
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "after called on element" do
|
22
|
+
it "HaveSelector should allow getting a description" do
|
23
|
+
visit('/with_html')
|
24
|
+
el = find(:css, '#first')
|
25
|
+
matcher = have_selector(:css, 'a#foo')
|
26
|
+
expect(el).to matcher
|
27
|
+
expect { matcher.description }.not_to raise_error
|
28
|
+
end
|
29
|
+
|
30
|
+
it "MatchSelector should allow getting a description" do
|
31
|
+
visit('/with_html')
|
32
|
+
el = find(:css, '#first')
|
33
|
+
matcher = match_selector(:css, '#first')
|
34
|
+
expect(el).to matcher
|
35
|
+
expect { matcher.description }.not_to raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
it "HaveText should allow getting a description" do
|
39
|
+
visit('/with_html')
|
40
|
+
el = find(:css, '#first')
|
41
|
+
matcher = have_text("Lorem")
|
42
|
+
expect(el).to matcher
|
43
|
+
expect { matcher.description }.not_to raise_error
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -3,25 +3,22 @@ require 'spec_helper'
|
|
3
3
|
require 'selenium-webdriver'
|
4
4
|
require 'shared_selenium_session'
|
5
5
|
|
6
|
+
chrome_options = {
|
7
|
+
browser: :chrome,
|
8
|
+
options: ::Selenium::WebDriver::Chrome::Options.new(args: ENV['TRAVIS'] ? ['no-sandbox' ] : [])
|
9
|
+
}
|
10
|
+
|
11
|
+
if ENV['CAPYBARA_CHROME_HEADLESS']
|
12
|
+
chrome_options[:options].args << 'headless'
|
13
|
+
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta' if ENV['TRAVIS']
|
14
|
+
end
|
15
|
+
|
6
16
|
Capybara.register_driver :selenium_chrome do |app|
|
7
|
-
|
8
|
-
if ENV['CAPYBARA_CHROME_HEADLESS']
|
9
|
-
args << 'headless'
|
10
|
-
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta' if ENV['TRAVIS']
|
11
|
-
end
|
12
|
-
Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
|
17
|
+
Capybara::Selenium::Driver.new(app, chrome_options)
|
13
18
|
end
|
14
19
|
|
15
20
|
Capybara.register_driver :selenium_chrome_clear_storage do |app|
|
16
|
-
|
17
|
-
if ENV['CAPYBARA_CHROME_HEADLESS']
|
18
|
-
args << 'headless'
|
19
|
-
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta' if ENV['TRAVIS']
|
20
|
-
end
|
21
|
-
Capybara::Selenium::Driver.new(app, :browser => :chrome,
|
22
|
-
:args => args,
|
23
|
-
clear_local_storage: true,
|
24
|
-
clear_session_storage: true)
|
21
|
+
Capybara::Selenium::Driver.new(app, chrome_options.merge(clear_local_storage: true, clear_session_storage: true))
|
25
22
|
end
|
26
23
|
|
27
24
|
module TestSessions
|
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: 2.14.
|
4
|
+
version: 2.14.4
|
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: 2017-06-
|
13
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -467,6 +467,7 @@ files:
|
|
467
467
|
- spec/rspec/scenarios_spec.rb
|
468
468
|
- spec/rspec/shared_spec_matchers.rb
|
469
469
|
- spec/rspec/views_spec.rb
|
470
|
+
- spec/rspec_matchers_spec.rb
|
470
471
|
- spec/rspec_spec.rb
|
471
472
|
- spec/selector_spec.rb
|
472
473
|
- spec/selenium_spec_chrome.rb
|