capybara 2.14.4 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +17 -0
- data/README.md +14 -22
- data/lib/capybara.rb +16 -4
- data/lib/capybara/config.rb +12 -2
- data/lib/capybara/driver/base.rb +4 -0
- data/lib/capybara/node/finders.rb +79 -16
- data/lib/capybara/queries/ancestor_query.rb +25 -0
- data/lib/capybara/queries/selector_query.rb +4 -1
- data/lib/capybara/queries/sibling_query.rb +25 -0
- data/lib/capybara/rack_test/browser.rb +5 -0
- data/lib/capybara/rack_test/driver.rb +5 -1
- data/lib/capybara/rack_test/form.rb +1 -3
- data/lib/capybara/rack_test/node.rb +1 -1
- data/lib/capybara/rspec/compound.rb +95 -0
- data/lib/capybara/rspec/matchers.rb +4 -1
- data/lib/capybara/selector.rb +1 -0
- data/lib/capybara/selector/filter.rb +13 -41
- data/lib/capybara/selector/filter_set.rb +12 -5
- data/lib/capybara/selector/filters/base.rb +33 -0
- data/lib/capybara/selector/filters/expression_filter.rb +40 -0
- data/lib/capybara/selector/filters/node_filter.rb +27 -0
- data/lib/capybara/selector/selector.rb +4 -4
- data/lib/capybara/selenium/driver.rb +12 -2
- data/lib/capybara/selenium/node.rb +70 -55
- data/lib/capybara/session.rb +65 -41
- data/lib/capybara/spec/session/ancestor_spec.rb +85 -0
- data/lib/capybara/spec/session/attach_file_spec.rb +1 -1
- data/lib/capybara/spec/session/check_spec.rb +4 -4
- data/lib/capybara/spec/session/choose_spec.rb +2 -2
- data/lib/capybara/spec/session/click_button_spec.rb +1 -1
- data/lib/capybara/spec/session/click_link_or_button_spec.rb +3 -3
- data/lib/capybara/spec/session/click_link_spec.rb +1 -1
- data/lib/capybara/spec/session/fill_in_spec.rb +2 -2
- data/lib/capybara/spec/session/find_spec.rb +1 -1
- data/lib/capybara/spec/session/refresh_spec.rb +28 -0
- data/lib/capybara/spec/session/select_spec.rb +2 -2
- data/lib/capybara/spec/session/sibling_spec.rb +52 -0
- data/lib/capybara/spec/session/uncheck_spec.rb +2 -2
- data/lib/capybara/spec/session/unselect_spec.rb +2 -2
- data/lib/capybara/spec/session/window/become_closed_spec.rb +3 -3
- data/lib/capybara/spec/session/window/switch_to_window_spec.rb +11 -9
- data/lib/capybara/spec/session/window/within_window_spec.rb +27 -2
- data/lib/capybara/spec/test_app.rb +3 -1
- data/lib/capybara/spec/views/with_html.erb +27 -1
- data/lib/capybara/spec/views/with_windows.erb +4 -0
- data/lib/capybara/version.rb +1 -1
- data/spec/capybara_spec.rb +9 -1
- data/spec/minitest_spec_spec.rb +1 -1
- data/spec/rspec/shared_spec_matchers.rb +146 -42
- data/spec/selenium_spec_chrome.rb +12 -16
- data/spec/selenium_spec_marionette.rb +2 -0
- data/spec/shared_selenium_session.rb +2 -0
- metadata +14 -6
- data/lib/capybara/selector/expression_filter.rb +0 -40
@@ -3,38 +3,34 @@ require 'spec_helper'
|
|
3
3
|
require 'selenium-webdriver'
|
4
4
|
require 'shared_selenium_session'
|
5
5
|
|
6
|
-
|
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
|
6
|
+
CHROME_DRIVER = if ENV['HEADLESS'] then :selenium_chrome_headless else :selenium_chrome end
|
15
7
|
|
16
|
-
|
17
|
-
|
8
|
+
if ENV['HEADLESS'] && ENV['TRAVIS']
|
9
|
+
Selenium::WebDriver::Chrome.path='/usr/bin/google-chrome-beta'
|
18
10
|
end
|
19
11
|
|
20
12
|
Capybara.register_driver :selenium_chrome_clear_storage do |app|
|
13
|
+
chrome_options = {
|
14
|
+
browser: :chrome,
|
15
|
+
options: ::Selenium::WebDriver::Chrome::Options.new()
|
16
|
+
}
|
17
|
+
chrome_options[:options].args << 'headless' if ENV['HEADLESS']
|
21
18
|
Capybara::Selenium::Driver.new(app, chrome_options.merge(clear_local_storage: true, clear_session_storage: true))
|
22
19
|
end
|
23
20
|
|
24
21
|
module TestSessions
|
25
|
-
Chrome = Capybara::Session.new(
|
22
|
+
Chrome = Capybara::Session.new(CHROME_DRIVER, TestApp)
|
26
23
|
end
|
27
24
|
|
28
25
|
skipped_tests = [:response_headers, :status_code, :trigger]
|
29
|
-
skipped_tests << :windows if ENV['TRAVIS'] && ENV['SKIP_WINDOW']
|
30
26
|
# skip window tests when headless for now - closing a window not supported by chromedriver/chrome
|
31
|
-
skipped_tests << :windows if ENV['TRAVIS']
|
27
|
+
skipped_tests << :windows if ENV['TRAVIS'] && (ENV['SKIP_WINDOW'] || ENV['HEADLESS'])
|
32
28
|
|
33
|
-
Capybara::SpecHelper.run_specs TestSessions::Chrome,
|
29
|
+
Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybara_skip: skipped_tests
|
34
30
|
|
35
31
|
RSpec.describe "Capybara::Session with chrome" do
|
36
32
|
include Capybara::SpecHelper
|
37
|
-
include_examples "Capybara::Session", TestSessions::Chrome,
|
33
|
+
include_examples "Capybara::Session", TestSessions::Chrome, CHROME_DRIVER
|
38
34
|
|
39
35
|
context "storage" do
|
40
36
|
describe "#reset!" do
|
@@ -43,11 +43,13 @@ RSpec.shared_examples "Capybara::Session" do |session, mode|
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should have return code 1 when running selenium_driver_rspec_failure.rb" do
|
46
|
+
skip if ENV['HEADLESS']
|
46
47
|
system(@env, 'rspec spec/fixtures/selenium_driver_rspec_failure.rb', out: File::NULL, err: File::NULL)
|
47
48
|
expect($?.exitstatus).to eq(1)
|
48
49
|
end
|
49
50
|
|
50
51
|
it "should have return code 0 when running selenium_driver_rspec_success.rb" do
|
52
|
+
skip if ENV['HEADLESS']
|
51
53
|
system(@env, 'rspec spec/fixtures/selenium_driver_rspec_success.rb', out: File::NULL, err: File::NULL)
|
52
54
|
expect($?.exitstatus).to eq(0)
|
53
55
|
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: 2.
|
4
|
+
version: 2.15.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: 2017-
|
13
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -27,19 +27,19 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 1.3.3
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: mini_mime
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 0.1.3
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 0.1.3
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rack
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -309,10 +309,12 @@ files:
|
|
309
309
|
- lib/capybara/node/finders.rb
|
310
310
|
- lib/capybara/node/matchers.rb
|
311
311
|
- lib/capybara/node/simple.rb
|
312
|
+
- lib/capybara/queries/ancestor_query.rb
|
312
313
|
- lib/capybara/queries/base_query.rb
|
313
314
|
- lib/capybara/queries/current_path_query.rb
|
314
315
|
- lib/capybara/queries/match_query.rb
|
315
316
|
- lib/capybara/queries/selector_query.rb
|
317
|
+
- lib/capybara/queries/sibling_query.rb
|
316
318
|
- lib/capybara/queries/text_query.rb
|
317
319
|
- lib/capybara/queries/title_query.rb
|
318
320
|
- lib/capybara/query.rb
|
@@ -324,14 +326,17 @@ files:
|
|
324
326
|
- lib/capybara/rails.rb
|
325
327
|
- lib/capybara/result.rb
|
326
328
|
- lib/capybara/rspec.rb
|
329
|
+
- lib/capybara/rspec/compound.rb
|
327
330
|
- lib/capybara/rspec/features.rb
|
328
331
|
- lib/capybara/rspec/matcher_proxies.rb
|
329
332
|
- lib/capybara/rspec/matchers.rb
|
330
333
|
- lib/capybara/selector.rb
|
331
334
|
- lib/capybara/selector/css.rb
|
332
|
-
- lib/capybara/selector/expression_filter.rb
|
333
335
|
- lib/capybara/selector/filter.rb
|
334
336
|
- lib/capybara/selector/filter_set.rb
|
337
|
+
- lib/capybara/selector/filters/base.rb
|
338
|
+
- lib/capybara/selector/filters/expression_filter.rb
|
339
|
+
- lib/capybara/selector/filters/node_filter.rb
|
335
340
|
- lib/capybara/selector/selector.rb
|
336
341
|
- lib/capybara/selenium/driver.rb
|
337
342
|
- lib/capybara/selenium/node.rb
|
@@ -349,6 +354,7 @@ files:
|
|
349
354
|
- lib/capybara/spec/session/accept_confirm_spec.rb
|
350
355
|
- lib/capybara/spec/session/accept_prompt_spec.rb
|
351
356
|
- lib/capybara/spec/session/all_spec.rb
|
357
|
+
- lib/capybara/spec/session/ancestor_spec.rb
|
352
358
|
- lib/capybara/spec/session/assert_all_of_selectors_spec.rb
|
353
359
|
- lib/capybara/spec/session/assert_current_path.rb
|
354
360
|
- lib/capybara/spec/session/assert_selector.rb
|
@@ -396,6 +402,7 @@ files:
|
|
396
402
|
- lib/capybara/spec/session/headers.rb
|
397
403
|
- lib/capybara/spec/session/html_spec.rb
|
398
404
|
- lib/capybara/spec/session/node_spec.rb
|
405
|
+
- lib/capybara/spec/session/refresh_spec.rb
|
399
406
|
- lib/capybara/spec/session/reset_session_spec.rb
|
400
407
|
- lib/capybara/spec/session/response_code.rb
|
401
408
|
- lib/capybara/spec/session/save_and_open_page_spec.rb
|
@@ -405,6 +412,7 @@ files:
|
|
405
412
|
- lib/capybara/spec/session/screenshot_spec.rb
|
406
413
|
- lib/capybara/spec/session/select_spec.rb
|
407
414
|
- lib/capybara/spec/session/selectors_spec.rb
|
415
|
+
- lib/capybara/spec/session/sibling_spec.rb
|
408
416
|
- lib/capybara/spec/session/source_spec.rb
|
409
417
|
- lib/capybara/spec/session/text_spec.rb
|
410
418
|
- lib/capybara/spec/session/title_spec.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'capybara/selector/filter'
|
3
|
-
|
4
|
-
module Capybara
|
5
|
-
class Selector
|
6
|
-
class ExpressionFilter < Filter
|
7
|
-
undef_method :matches?
|
8
|
-
|
9
|
-
def apply_filter(expr, value)
|
10
|
-
return expr if skip?(value)
|
11
|
-
|
12
|
-
if !valid_value?(value)
|
13
|
-
msg = "Invalid value #{value.inspect} passed to expression filter #{@name} - "
|
14
|
-
if default?
|
15
|
-
warn msg + "defaulting to #{default}"
|
16
|
-
value = default
|
17
|
-
else
|
18
|
-
warn msg + "skipping"
|
19
|
-
return expr
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
@block.call(expr, value)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class IdentityExpressionFilter < ExpressionFilter
|
28
|
-
def initialize
|
29
|
-
end
|
30
|
-
|
31
|
-
def default?
|
32
|
-
false
|
33
|
-
end
|
34
|
-
|
35
|
-
def apply_filter(expr, _value)
|
36
|
-
return expr
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|