capybara 2.4.4 → 2.5.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 +32 -5
- data/README.md +69 -8
- data/lib/capybara.rb +50 -29
- data/lib/capybara/driver/base.rb +4 -0
- data/lib/capybara/driver/node.rb +4 -0
- data/lib/capybara/helpers.rb +17 -5
- data/lib/capybara/node/actions.rb +16 -11
- data/lib/capybara/node/base.rb +7 -7
- data/lib/capybara/node/document_matchers.rb +1 -1
- data/lib/capybara/node/element.rb +82 -7
- data/lib/capybara/node/finders.rb +62 -22
- data/lib/capybara/node/matchers.rb +3 -3
- data/lib/capybara/node/simple.rb +6 -1
- data/lib/capybara/queries/base_query.rb +1 -1
- data/lib/capybara/queries/current_path_query.rb +58 -0
- data/lib/capybara/queries/text_query.rb +2 -11
- data/lib/capybara/rack_test/browser.rb +7 -2
- data/lib/capybara/rack_test/driver.rb +4 -0
- data/lib/capybara/rack_test/form.rb +2 -1
- data/lib/capybara/rack_test/node.rb +1 -0
- data/lib/capybara/result.rb +2 -2
- data/lib/capybara/rspec.rb +1 -0
- data/lib/capybara/rspec/features.rb +1 -1
- data/lib/capybara/rspec/matchers.rb +42 -3
- data/lib/capybara/selector.rb +7 -2
- data/lib/capybara/selenium/driver.rb +26 -12
- data/lib/capybara/selenium/node.rb +42 -6
- data/lib/capybara/server.rb +1 -1
- data/lib/capybara/session.rb +78 -50
- data/lib/capybara/session/matchers.rb +69 -0
- data/lib/capybara/spec/public/test.js +8 -0
- data/lib/capybara/spec/session/all_spec.rb +5 -0
- data/lib/capybara/spec/session/assert_current_path.rb +59 -0
- data/lib/capybara/spec/session/assert_text.rb +1 -1
- data/lib/capybara/spec/session/attach_file_spec.rb +2 -2
- data/lib/capybara/spec/session/body_spec.rb +2 -0
- data/lib/capybara/spec/session/click_button_spec.rb +17 -8
- data/lib/capybara/spec/session/click_link_spec.rb +32 -1
- data/lib/capybara/spec/session/current_url_spec.rb +5 -0
- data/lib/capybara/spec/session/fill_in_spec.rb +1 -1
- data/lib/capybara/spec/session/find_field_spec.rb +17 -0
- data/lib/capybara/spec/session/find_spec.rb +14 -5
- data/lib/capybara/spec/session/first_spec.rb +24 -0
- data/lib/capybara/spec/session/has_current_path_spec.rb +68 -0
- data/lib/capybara/spec/session/has_link_spec.rb +3 -0
- data/lib/capybara/spec/session/has_text_spec.rb +7 -0
- data/lib/capybara/spec/session/node_spec.rb +45 -6
- data/lib/capybara/spec/session/reset_session_spec.rb +18 -1
- data/lib/capybara/spec/session/save_and_open_page_spec.rb +19 -0
- data/lib/capybara/spec/session/save_page_spec.rb +12 -3
- data/lib/capybara/spec/session/save_screenshot_spec.rb +23 -0
- data/lib/capybara/spec/session/select_spec.rb +12 -0
- data/lib/capybara/spec/session/title_spec.rb +2 -2
- data/lib/capybara/spec/session/window/become_closed_spec.rb +4 -4
- data/lib/capybara/spec/session/window/switch_to_window_spec.rb +8 -0
- data/lib/capybara/spec/session/window/window_opened_by_spec.rb +14 -8
- data/lib/capybara/spec/session/window/window_spec.rb +24 -4
- data/lib/capybara/spec/spec_helper.rb +3 -1
- data/lib/capybara/spec/test_app.rb +10 -1
- data/lib/capybara/spec/views/form.erb +7 -1
- data/lib/capybara/spec/views/path.erb +12 -0
- data/lib/capybara/spec/views/with_html.erb +2 -0
- data/lib/capybara/spec/views/with_js.erb +9 -1
- data/lib/capybara/spec/views/with_title.erb +4 -1
- data/lib/capybara/spec/views/with_windows.erb +2 -2
- data/lib/capybara/version.rb +1 -1
- data/spec/basic_node_spec.rb +1 -0
- data/spec/capybara_spec.rb +12 -3
- data/spec/dsl_spec.rb +18 -6
- data/spec/rack_test_spec.rb +6 -5
- data/spec/rspec/matchers_spec.rb +62 -16
- data/spec/rspec/views_spec.rb +7 -0
- data/spec/selenium_spec.rb +38 -3
- data/spec/selenium_spec_chrome.rb +3 -7
- metadata +13 -4
@@ -0,0 +1,23 @@
|
|
1
|
+
Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
|
2
|
+
before do
|
3
|
+
@session.visit '/foo'
|
4
|
+
end
|
5
|
+
|
6
|
+
it "generates sensible filename" do
|
7
|
+
allow(@session.driver).to receive(:save_screenshot)
|
8
|
+
|
9
|
+
@session.save_screenshot
|
10
|
+
|
11
|
+
regexp = Regexp.new(File.expand_path('capybara-\d+\.png'))
|
12
|
+
expect(@session.driver).to have_received(:save_screenshot).with(regexp, {})
|
13
|
+
end
|
14
|
+
|
15
|
+
it "allows to specify another path" do
|
16
|
+
allow(@session.driver).to receive(:save_screenshot)
|
17
|
+
|
18
|
+
custom_path = 'screenshots/1.png'
|
19
|
+
@session.save_screenshot(custom_path)
|
20
|
+
|
21
|
+
expect(@session.driver).to have_received(:save_screenshot).with(custom_path, {})
|
22
|
+
end
|
23
|
+
end
|
@@ -108,6 +108,18 @@ Capybara::SpecHelper.spec "#select" do
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
context "on a disabled option" do
|
112
|
+
it "should not select" do
|
113
|
+
@session.select('Other', :from => 'form_title')
|
114
|
+
expect(@session.find_field('form_title').value).not_to eq 'Other'
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should warn" do
|
118
|
+
expect_any_instance_of(Capybara::Node::Element).to receive(:warn).once
|
119
|
+
@session.select('Other', :from => 'form_title')
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
111
123
|
context "with multiple select" do
|
112
124
|
it "should return an empty value" do
|
113
125
|
expect(@session.find_field('Language').value).to eq([])
|
@@ -1,13 +1,13 @@
|
|
1
1
|
Capybara::SpecHelper.spec '#title' do
|
2
2
|
|
3
|
-
it "should
|
3
|
+
it "should get the title of the page" do
|
4
4
|
@session.visit('/with_title')
|
5
5
|
expect(@session.title).to eq('Test Title')
|
6
6
|
end
|
7
7
|
|
8
8
|
context "with css as default selector" do
|
9
9
|
before { Capybara.default_selector = :css }
|
10
|
-
it "should
|
10
|
+
it "should get the title of the page" do
|
11
11
|
@session.visit('/with_title')
|
12
12
|
expect(@session.title).to eq('Test Title')
|
13
13
|
end
|
@@ -37,7 +37,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'without :wait option' do
|
40
|
-
it 'should wait if value of
|
40
|
+
it 'should wait if value of default_max_wait_time is more than timeout' do
|
41
41
|
@session.within_window @other_window do
|
42
42
|
@session.execute_script('setTimeout(function(){ window.close(); }, 500);')
|
43
43
|
end
|
@@ -46,7 +46,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
it 'should raise error if value of
|
49
|
+
it 'should raise error if value of default_max_wait_time is less than timeout' do
|
50
50
|
@session.within_window @other_window do
|
51
51
|
@session.execute_script('setTimeout(function(){ window.close(); }, 900);')
|
52
52
|
end
|
@@ -59,7 +59,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
context 'with not_to' do
|
62
|
-
it 'should raise error if
|
62
|
+
it 'should raise error if default_max_wait_time is more than timeout' do
|
63
63
|
@session.within_window @other_window do
|
64
64
|
@session.execute_script('setTimeout(function(){ window.close(); }, 700);')
|
65
65
|
end
|
@@ -70,7 +70,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
it 'should raise error if
|
73
|
+
it 'should raise error if default_max_wait_time is more than timeout' do
|
74
74
|
@session.within_window @other_window do
|
75
75
|
@session.execute_script('setTimeout(function(){ window.close(); }, 700);')
|
76
76
|
end
|
@@ -46,6 +46,7 @@ Capybara::SpecHelper.spec '#switch_to_window', requires: [:windows] do
|
|
46
46
|
context "with block" do
|
47
47
|
before(:each) do
|
48
48
|
@session.find(:css, '#openTwoWindows').click
|
49
|
+
sleep(0.2) # wait for the windows to open
|
49
50
|
end
|
50
51
|
|
51
52
|
it "should be able to switch to current window" do
|
@@ -111,4 +112,11 @@ Capybara::SpecHelper.spec '#switch_to_window', requires: [:windows] do
|
|
111
112
|
expect(@session.current_window).to eq(original)
|
112
113
|
end
|
113
114
|
end
|
115
|
+
|
116
|
+
it "should wait for window to appear" do
|
117
|
+
@session.find(:css, '#openWindowWithTimeout').click
|
118
|
+
expect do
|
119
|
+
@session.switch_to_window { @session.title == 'Title of the first popup'}
|
120
|
+
end.not_to raise_error
|
121
|
+
end
|
114
122
|
end
|
@@ -18,9 +18,10 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
|
|
18
18
|
it 'should raise error if value of :wait is less than timeout' do
|
19
19
|
# So large value is used as `driver.window_handles` takes up to 800 ms on Travis
|
20
20
|
Capybara.using_wait_time 2 do
|
21
|
+
button=@session.find(:css, '#openWindowWithLongerTimeout')
|
21
22
|
expect do
|
22
23
|
@session.window_opened_by(wait: 0.8) do
|
23
|
-
|
24
|
+
button.click
|
24
25
|
end
|
25
26
|
end.to raise_error(Capybara::WindowError, zero_windows_message)
|
26
27
|
end
|
@@ -30,9 +31,10 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
it 'should find window if value of :wait is more than timeout' do
|
34
|
+
button = @session.find(:css, '#openWindowWithTimeout')
|
33
35
|
Capybara.using_wait_time 0.1 do
|
34
36
|
window = @session.window_opened_by(wait: 1.5) do
|
35
|
-
|
37
|
+
button.click
|
36
38
|
end
|
37
39
|
expect(window).to be_instance_of(Capybara::Window)
|
38
40
|
end
|
@@ -40,11 +42,12 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
|
|
40
42
|
end
|
41
43
|
|
42
44
|
context 'without :wait option' do
|
43
|
-
it 'should raise error if
|
45
|
+
it 'should raise error if default_max_wait_time is less than timeout' do
|
46
|
+
button = @session.find(:css, '#openWindowWithTimeout')
|
44
47
|
Capybara.using_wait_time 0.4 do
|
45
48
|
expect do
|
46
49
|
@session.window_opened_by do
|
47
|
-
|
50
|
+
button.click
|
48
51
|
end
|
49
52
|
end.to raise_error(Capybara::WindowError, zero_windows_message)
|
50
53
|
end
|
@@ -53,10 +56,11 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
|
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
56
|
-
it 'should find window if
|
59
|
+
it 'should find window if default_max_wait_time is more than timeout' do
|
60
|
+
button = @session.find(:css, '#openWindowWithTimeout')
|
57
61
|
Capybara.using_wait_time 1.5 do
|
58
62
|
window = @session.window_opened_by do
|
59
|
-
|
63
|
+
button.click
|
60
64
|
end
|
61
65
|
expect(window).to be_instance_of(Capybara::Window)
|
62
66
|
end
|
@@ -64,9 +68,10 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
|
|
64
68
|
end
|
65
69
|
|
66
70
|
it 'should raise error when two windows have been opened by block' do
|
71
|
+
button = @session.find(:css, '#openTwoWindows')
|
67
72
|
expect do
|
68
73
|
@session.window_opened_by do
|
69
|
-
|
74
|
+
button.click
|
70
75
|
end
|
71
76
|
end.to raise_error(Capybara::WindowError, two_windows_message)
|
72
77
|
@session.document.synchronize(2, errors: [Capybara::CapybaraError]) do
|
@@ -75,9 +80,10 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
|
|
75
80
|
end
|
76
81
|
|
77
82
|
it 'should raise error when no windows were opened by block' do
|
83
|
+
button = @session.find(:css, '#doesNotOpenWindows')
|
78
84
|
expect do
|
79
85
|
@session.window_opened_by do
|
80
|
-
|
86
|
+
button.click
|
81
87
|
end
|
82
88
|
end.to raise_error(Capybara::WindowError, zero_windows_message)
|
83
89
|
end
|
@@ -86,10 +86,14 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
|
|
86
86
|
|
87
87
|
describe '#size' do
|
88
88
|
it 'should return size of whole window', requires: [:windows, :js] do
|
89
|
+
skip "Chromedriver returns a size larger than outerWidth, outerHeight???" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_chrome)
|
90
|
+
|
89
91
|
expect(@session.current_window.size).to eq @session.evaluate_script("[window.outerWidth, window.outerHeight];")
|
90
92
|
end
|
91
93
|
|
92
94
|
it 'should switch to original window if invoked not for current window' do
|
95
|
+
skip "Chromedriver returns a size larger than outerWidth, outerHeight???" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_chrome)
|
96
|
+
|
93
97
|
@other_window = @session.window_opened_by do
|
94
98
|
@session.find(:css, '#openWindow').click
|
95
99
|
end
|
@@ -104,23 +108,32 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
|
|
104
108
|
|
105
109
|
describe '#resize_to' do
|
106
110
|
it 'should be able to resize window', requires: [:windows, :js] do
|
111
|
+
|
107
112
|
width, height = @session.evaluate_script("[window.outerWidth, window.outerHeight];")
|
108
113
|
@session.current_window.resize_to(width-10, height-10)
|
109
114
|
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([width-10, height-10])
|
110
115
|
end
|
111
116
|
|
112
|
-
it 'should
|
117
|
+
it 'should stay on current window if invoked not for current window', requires: [:windows, :js] do
|
118
|
+
|
113
119
|
@other_window = @session.window_opened_by do
|
114
120
|
@session.find(:css, '#openWindow').click
|
115
121
|
end
|
116
122
|
@other_window.resize_to(400, 300)
|
117
123
|
expect(@session.current_window).to eq(@window)
|
118
|
-
|
124
|
+
|
125
|
+
# #size returns values larger than availWidth, availHeight with Chromedriver
|
126
|
+
# expect(@other_window.size).to eq([400, 300])
|
127
|
+
@session.within_window(@other_window) do
|
128
|
+
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight]")).to eq([400,300])
|
129
|
+
end
|
119
130
|
end
|
120
131
|
end
|
121
132
|
|
122
133
|
describe '#maximize' do
|
123
134
|
it 'should be able to maximize window', requires: [:windows, :js] do
|
135
|
+
skip "This test fails when run with Firefox on Travis - see issue #1493 - skipping for now" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_focus)
|
136
|
+
|
124
137
|
screen_width, screen_height = @session.evaluate_script("[window.screen.availWidth, window.screen.availHeight];")
|
125
138
|
window = @session.current_window
|
126
139
|
window.resize_to(screen_width-100, screen_height-100)
|
@@ -130,13 +143,20 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
|
|
130
143
|
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width, screen_height])
|
131
144
|
end
|
132
145
|
|
133
|
-
it 'should
|
146
|
+
it 'should stay on current window if invoked not for current window', requires: [:windows, :js] do
|
147
|
+
skip "This test fails when run with Firefox on Travis - see issue #1493 - skipping for now" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_focus)
|
148
|
+
|
134
149
|
@other_window = @session.window_opened_by do
|
135
150
|
@session.find(:css, '#openWindow').click
|
136
151
|
end
|
137
152
|
@other_window.maximize
|
153
|
+
sleep 0.5 # The timing on maximize is finicky on Travis -- wait a bit for maximize to occur
|
138
154
|
expect(@session.current_window).to eq(@window)
|
139
|
-
|
155
|
+
# #size returns values larger than availWidth, availHeight with Chromedriver
|
156
|
+
# expect(@other_window.size).to eq(@session.evaluate_script("[window.screen.availWidth, window.screen.availHeight];"))
|
157
|
+
@session.within_window(@other_window) do
|
158
|
+
expect(@session.evaluate_script("[window.outerWidth, window.outerHeight]")).to eq(@session.evaluate_script("[window.screen.availWidth, window.screen.availHeight];"))
|
159
|
+
end
|
140
160
|
end
|
141
161
|
end
|
142
162
|
end
|
@@ -26,13 +26,14 @@ module Capybara
|
|
26
26
|
Capybara.app = TestApp
|
27
27
|
Capybara.app_host = nil
|
28
28
|
Capybara.default_selector = :xpath
|
29
|
-
Capybara.
|
29
|
+
Capybara.default_max_wait_time = 1
|
30
30
|
Capybara.ignore_hidden_elements = true
|
31
31
|
Capybara.exact = false
|
32
32
|
Capybara.exact_options = false
|
33
33
|
Capybara.raise_server_errors = true
|
34
34
|
Capybara.visible_text_only = false
|
35
35
|
Capybara.match = :smart
|
36
|
+
Capybara.wait_on_first_by_default = false
|
36
37
|
end
|
37
38
|
|
38
39
|
def filter(requires, metadata)
|
@@ -88,6 +89,7 @@ module Capybara
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def extract_results(session)
|
92
|
+
expect(session).to have_xpath("//pre[@id='results']")
|
91
93
|
YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.inner_html.lstrip
|
92
94
|
end
|
93
95
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'tilt/erb'
|
2
3
|
require 'rack'
|
3
4
|
require 'yaml'
|
4
5
|
|
@@ -123,8 +124,16 @@ class TestApp < Sinatra::Base
|
|
123
124
|
raise TestAppError, "some error"
|
124
125
|
end
|
125
126
|
|
127
|
+
get '/load_error' do
|
128
|
+
raise LoadError
|
129
|
+
end
|
130
|
+
|
131
|
+
get '/with.*html' do
|
132
|
+
erb :with_html, locals: { referrer: request.referrer }
|
133
|
+
end
|
134
|
+
|
126
135
|
get '/:view' do |view|
|
127
|
-
erb view.to_sym
|
136
|
+
erb view.to_sym, locals: { referrer: request.referrer }
|
128
137
|
end
|
129
138
|
|
130
139
|
post '/form' do
|
@@ -161,7 +161,7 @@ New line after and before textarea tag
|
|
161
161
|
<input type="checkbox" value="hamster" name="form[pets][]" id="form_pets_hamster" checked="checked"/>
|
162
162
|
<label for="form_pets_hamster">Hamster</label>
|
163
163
|
</p>
|
164
|
-
|
164
|
+
|
165
165
|
<p>
|
166
166
|
<input type="checkbox" name="form[valueless_checkbox]" id="valueless_checkbox" checked="checked"/>
|
167
167
|
<label for="valueless_checkbox">Valueless Checkbox</label>
|
@@ -289,6 +289,11 @@ New line after and before textarea tag
|
|
289
289
|
<button id="no_type">No Type!</button>
|
290
290
|
<input type="button" disabled="disabled" value="Disabled button"/>
|
291
291
|
</p>
|
292
|
+
|
293
|
+
<p>
|
294
|
+
<input id="readonly" name="form[readonly_test]" readonly/>
|
295
|
+
<input id="not_readonly" name="form[readonly_test]" />
|
296
|
+
</p>
|
292
297
|
</form>
|
293
298
|
|
294
299
|
<input type="text" name="form[outside_input]" value="outside_input" form="form1"/>
|
@@ -434,6 +439,7 @@ New line after and before textarea tag
|
|
434
439
|
<input type="text" name="form[which_form]" value="formaction form"/>
|
435
440
|
</p>
|
436
441
|
<input type="submit" name="form[button]" formaction="/form" value="Formaction button"/>
|
442
|
+
<input type="submit" name="form[button]" formaction="/form/get" formmethod="get" value="Formmethod button"/>
|
437
443
|
</form>
|
438
444
|
|
439
445
|
<form action="relative" method="post">
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<div id="referrer"><%= referrer %></div>
|
1
2
|
<h1>This is a test</h1>
|
2
3
|
|
3
4
|
<h2 class="no text"></h2>
|
@@ -45,6 +46,7 @@ banana</textarea>
|
|
45
46
|
<a>No Href</a>
|
46
47
|
<a href="">Blank Href</a>
|
47
48
|
<a href="#">Blank Anchor</a>
|
49
|
+
<a href="javascript:void(0)">Blank JS Anchor</a>
|
48
50
|
<a href="#anchor">Normal Anchor</a>
|
49
51
|
<a href="/with_simple_html#anchor">Anchor on different page</a>
|
50
52
|
<a href="/with_html#anchor">Anchor on same page</a>
|
@@ -69,7 +69,7 @@
|
|
69
69
|
<p>
|
70
70
|
<a href="#" id="change-title">Change title</a>
|
71
71
|
</p>
|
72
|
-
|
72
|
+
|
73
73
|
<p id="click-test">Click me</p>
|
74
74
|
|
75
75
|
<p>
|
@@ -89,6 +89,14 @@
|
|
89
89
|
<a href="#" id="open-prompt">Open prompt</a>
|
90
90
|
</p>
|
91
91
|
|
92
|
+
<p>
|
93
|
+
<a href="#" id="delayed-page-change">Change page</a>
|
94
|
+
</p>
|
95
|
+
|
96
|
+
<p>
|
97
|
+
<input type="test" name="with-key-events" id="with-key-events">
|
98
|
+
<p id="key-events-output"></p>
|
99
|
+
</p>
|
92
100
|
<script type="text/javascript">
|
93
101
|
// a javascript comment
|
94
102
|
var aVar = 123;
|
@@ -11,14 +11,14 @@
|
|
11
11
|
|
12
12
|
$('#openWindowWithTimeout').click(function(){
|
13
13
|
setTimeout(function(){
|
14
|
-
window.open('/popup_one', '
|
14
|
+
window.open('/popup_one', 'timeoutPopup');
|
15
15
|
}, 600);
|
16
16
|
return false;
|
17
17
|
});
|
18
18
|
|
19
19
|
$('#openWindowWithLongerTimeout').click(function(){
|
20
20
|
setTimeout(function(){
|
21
|
-
window.open('/popup_one', '
|
21
|
+
window.open('/popup_one', 'longerTimeoutPopup');
|
22
22
|
}, 1400);
|
23
23
|
return false;
|
24
24
|
});
|
data/lib/capybara/version.rb
CHANGED
data/spec/basic_node_spec.rb
CHANGED
data/spec/capybara_spec.rb
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Capybara do
|
4
|
-
describe '
|
4
|
+
describe 'default_max_wait_time' do
|
5
5
|
after do
|
6
|
-
Capybara.
|
6
|
+
Capybara.default_max_wait_time = @previous_default_time
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should be changeable" do
|
10
|
-
@previous_default_time = Capybara.
|
10
|
+
@previous_default_time = Capybara.default_max_wait_time
|
11
|
+
Capybara.default_max_wait_time = 5
|
12
|
+
expect(Capybara.default_max_wait_time).to eq(5)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be accesible as the deprecated default_wait_time" do
|
16
|
+
expect_any_instance_of(Kernel).to receive(:warn).once.with('DEPRECATED: #default_wait_time= is deprecated, please use #default_max_wait_time= instead')
|
17
|
+
expect_any_instance_of(Kernel).to receive(:warn).once.with('DEPRECATED: #default_wait_time is deprecated, please use #default_max_wait_time instead')
|
18
|
+
@previous_default_time = Capybara.default_max_wait_time
|
11
19
|
Capybara.default_wait_time = 5
|
12
20
|
expect(Capybara.default_wait_time).to eq(5)
|
21
|
+
expect(Capybara.default_max_wait_time).to eq(5)
|
13
22
|
end
|
14
23
|
end
|
15
24
|
|