capybara 2.8.1 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yard/templates_custom/default/class/html/selectors.erb +38 -0
- data/.yard/templates_custom/default/class/html/setup.rb +17 -0
- data/.yard/yard_extensions.rb +78 -0
- data/.yardopts +1 -0
- data/History.md +13 -1
- data/README.md +1 -1
- data/lib/capybara/helpers.rb +0 -59
- data/lib/capybara/node/actions.rb +17 -11
- data/lib/capybara/node/finders.rb +9 -0
- data/lib/capybara/node/matchers.rb +54 -15
- data/lib/capybara/queries/base_query.rb +59 -3
- data/lib/capybara/queries/selector_query.rb +7 -16
- data/lib/capybara/queries/text_query.rb +11 -10
- data/lib/capybara/rack_test/form.rb +2 -1
- data/lib/capybara/result.rb +25 -10
- data/lib/capybara/rspec/features.rb +3 -2
- data/lib/capybara/rspec/matchers.rb +1 -1
- data/lib/capybara/selector.rb +277 -175
- data/lib/capybara/selector/filter_set.rb +3 -1
- data/lib/capybara/selector/selector.rb +227 -0
- data/lib/capybara/session.rb +2 -2
- data/lib/capybara/spec/session/element/matches_selector_spec.rb +29 -1
- data/lib/capybara/spec/session/selectors_spec.rb +12 -0
- data/lib/capybara/spec/views/form.erb +11 -0
- data/lib/capybara/version.rb +1 -1
- data/spec/fixtures/capybara.csv +1 -0
- data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -1
- data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
- data/spec/rack_test_spec.rb +8 -0
- data/spec/result_spec.rb +3 -0
- data/spec/selenium_firefox_spec.rb +44 -0
- data/spec/selenium_spec_chrome.rb +5 -2
- data/spec/{selenium_spec.rb → shared_selenium_session.rb} +9 -43
- metadata +10 -3
@@ -2,32 +2,12 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require "selenium-webdriver"
|
4
4
|
|
5
|
-
|
5
|
+
RSpec.shared_examples "Capybara::Session" do |session, mode|
|
6
|
+
let(:session) {session}
|
6
7
|
|
7
|
-
Capybara.register_driver :selenium_focus do |app|
|
8
|
-
# profile = Selenium::WebDriver::Firefox::Profile.new
|
9
|
-
# profile["focusmanager.testmode"] = true
|
10
|
-
# Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile)
|
11
|
-
Capybara::Selenium::Driver.new(app, browser: :firefox)
|
12
|
-
end
|
13
|
-
|
14
|
-
module TestSessions
|
15
|
-
Selenium = Capybara::Session.new(:selenium_focus, TestApp)
|
16
|
-
end
|
17
|
-
|
18
|
-
skipped_tests = [
|
19
|
-
:response_headers,
|
20
|
-
:status_code,
|
21
|
-
:trigger
|
22
|
-
]
|
23
|
-
skipped_tests << :windows if ENV['TRAVIS'] && !ENV['WINDOW_TEST']
|
24
|
-
|
25
|
-
Capybara::SpecHelper.run_specs TestSessions::Selenium, "selenium", :capybara_skip => skipped_tests
|
26
|
-
|
27
|
-
RSpec.describe Capybara::Session do
|
28
8
|
context 'with selenium driver' do
|
29
9
|
before do
|
30
|
-
@session =
|
10
|
+
@session = session
|
31
11
|
end
|
32
12
|
|
33
13
|
describe '#driver' do
|
@@ -38,7 +18,7 @@ RSpec.describe Capybara::Session do
|
|
38
18
|
|
39
19
|
describe '#mode' do
|
40
20
|
it "should remember the mode" do
|
41
|
-
expect(@session.mode).to eq(
|
21
|
+
expect(@session.mode).to eq(mode)
|
42
22
|
end
|
43
23
|
end
|
44
24
|
|
@@ -61,13 +41,15 @@ RSpec.describe Capybara::Session do
|
|
61
41
|
end
|
62
42
|
|
63
43
|
it "should have return code 1 when running selenium_driver_rspec_failure.rb" do
|
44
|
+
ENV['SELENIUM_BROWSER'] = @session.driver.options[:browser].to_s
|
64
45
|
`rspec spec/fixtures/selenium_driver_rspec_failure.rb`
|
65
|
-
expect($?.exitstatus).to
|
46
|
+
expect($?.exitstatus).to eq(1)
|
66
47
|
end
|
67
48
|
|
68
49
|
it "should have return code 0 when running selenium_driver_rspec_success.rb" do
|
50
|
+
ENV['SELENIUM_BROWSER'] = @session.driver.options[:browser].to_s
|
69
51
|
`rspec spec/fixtures/selenium_driver_rspec_success.rb`
|
70
|
-
expect($?.exitstatus).to
|
52
|
+
expect($?.exitstatus).to eq(0)
|
71
53
|
end
|
72
54
|
end
|
73
55
|
|
@@ -76,7 +58,7 @@ RSpec.describe Capybara::Session do
|
|
76
58
|
@session.visit('/with_js')
|
77
59
|
@session.click_link('Open alert')
|
78
60
|
@session.accept_alert
|
79
|
-
expect{@session.driver.browser.switch_to.alert}.to raise_error(
|
61
|
+
expect{@session.driver.browser.switch_to.alert}.to raise_error(Selenium::WebDriver::Error::NoAlertPresentError)
|
80
62
|
end
|
81
63
|
end
|
82
64
|
|
@@ -136,19 +118,3 @@ RSpec.describe Capybara::Session do
|
|
136
118
|
end
|
137
119
|
end
|
138
120
|
end
|
139
|
-
|
140
|
-
RSpec.describe Capybara::Selenium::Driver do
|
141
|
-
before do
|
142
|
-
@driver = Capybara::Selenium::Driver.new(TestApp, browser: :firefox)
|
143
|
-
end
|
144
|
-
|
145
|
-
describe '#quit' do
|
146
|
-
it "should reset browser when quit" do
|
147
|
-
expect(@driver.browser).to be
|
148
|
-
@driver.quit
|
149
|
-
#access instance variable directly so we don't create a new browser instance
|
150
|
-
expect(@driver.instance_variable_get(:@browser)).to be_nil
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
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.9.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: 2016-
|
13
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -245,6 +245,10 @@ executables: []
|
|
245
245
|
extensions: []
|
246
246
|
extra_rdoc_files: []
|
247
247
|
files:
|
248
|
+
- ".yard/templates_custom/default/class/html/selectors.erb"
|
249
|
+
- ".yard/templates_custom/default/class/html/setup.rb"
|
250
|
+
- ".yard/yard_extensions.rb"
|
251
|
+
- ".yardopts"
|
248
252
|
- History.md
|
249
253
|
- License.txt
|
250
254
|
- README.md
|
@@ -282,6 +286,7 @@ files:
|
|
282
286
|
- lib/capybara/selector.rb
|
283
287
|
- lib/capybara/selector/filter.rb
|
284
288
|
- lib/capybara/selector/filter_set.rb
|
289
|
+
- lib/capybara/selector/selector.rb
|
285
290
|
- lib/capybara/selenium/driver.rb
|
286
291
|
- lib/capybara/selenium/node.rb
|
287
292
|
- lib/capybara/server.rb
|
@@ -400,6 +405,7 @@ files:
|
|
400
405
|
- spec/basic_node_spec.rb
|
401
406
|
- spec/capybara_spec.rb
|
402
407
|
- spec/dsl_spec.rb
|
408
|
+
- spec/fixtures/capybara.csv
|
403
409
|
- spec/fixtures/selenium_driver_rspec_failure.rb
|
404
410
|
- spec/fixtures/selenium_driver_rspec_success.rb
|
405
411
|
- spec/rack_test_spec.rb
|
@@ -410,9 +416,10 @@ files:
|
|
410
416
|
- spec/rspec/views_spec.rb
|
411
417
|
- spec/rspec_spec.rb
|
412
418
|
- spec/selector_spec.rb
|
413
|
-
- spec/
|
419
|
+
- spec/selenium_firefox_spec.rb
|
414
420
|
- spec/selenium_spec_chrome.rb
|
415
421
|
- spec/server_spec.rb
|
422
|
+
- spec/shared_selenium_session.rb
|
416
423
|
- spec/spec_helper.rb
|
417
424
|
homepage: https://github.com/jnicklas/capybara
|
418
425
|
licenses:
|