File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
rb/spec/integration/selenium/webdriver Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,10 @@ def call(env)
116
116
end
117
117
118
118
[ 200 , { 'Content-Type' => 'text/html' } , [ body ] ]
119
+ when '/sleep'
120
+ time = Rack ::Request . new ( env ) . params [ 'time' ]
121
+ sleep Integer ( time )
122
+ [ 200 , { 'Content-Type' => 'text/html' } , [ "Slept for #{ time } " ] ]
119
123
else
120
124
@static . call env
121
125
end
Original file line number Diff line number Diff line change @@ -76,11 +76,17 @@ module WebDriver
76
76
end
77
77
78
78
context 'page loads' do
79
- # w3c default is 300,000
80
- after { driver . manage . timeouts . page_load = 300000 }
79
+ before { driver . manage . timeouts . page_load = 2 }
80
+ after { driver . manage . timeouts . page_load = 300 }
81
81
82
- it 'should be able to set the page load timeout' do
83
- expect { driver . manage . timeouts . page_load = 2 } . not_to raise_exception
82
+ it 'should timeout if page takes too long to load' do
83
+ expect { driver . navigate . to url_for ( 'sleep?time=3' ) } . to raise_error ( WebDriver ::Error ::TimeoutError )
84
+ end
85
+
86
+ it 'should timeout if page takes too long to load after click' do
87
+ driver . navigate . to url_for ( 'page_with_link_to_slow_loading_page.html' )
88
+
89
+ expect { driver . find_element ( id : 'link-to-slow-loading-page' ) . click } . to raise_error ( WebDriver ::Error ::TimeoutError )
84
90
end
85
91
end
86
92
end
You can’t perform that action at this time.
0 commit comments