kookaburra 1.2.1 → 1.2.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc92c0ad611819f4fa8b18a0199b58d76f542e3d
|
4
|
+
data.tar.gz: 4258ae554e2d6fdaa225ebdbae1bce175333153c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f2d5c643f9169c22b87d80a46103066409cf7f12a0b0395ad6a97c137183e991f36f23dfab81097bfa0d69a53107aab4c44ea7fabcef054b5fd2cbd77358765
|
7
|
+
data.tar.gz: d9ebcf011b5cc453835902359836dbf325fe9121f3e98613a637c1cd5ba1eef98c4a7888eb6cfc99a1e1e23fee09ca40017b47eddc80276fa1b044c0804b01c2
|
data/Gemfile.lock
CHANGED
data/lib/kookaburra/version.rb
CHANGED
@@ -9,6 +9,8 @@ require 'sinatra/base'
|
|
9
9
|
require 'json'
|
10
10
|
|
11
11
|
describe "testing a Rack application with Kookaburra" do
|
12
|
+
include Kookaburra::TestHelpers
|
13
|
+
|
12
14
|
describe "with an HTML interface" do
|
13
15
|
describe "with a JSON API" do
|
14
16
|
# This is the fixture Rack application against which the integration
|
@@ -163,6 +165,20 @@ describe "testing a Rack application with Kookaburra" do
|
|
163
165
|
body content
|
164
166
|
end
|
165
167
|
|
168
|
+
get '/error_page' do
|
169
|
+
content = <<-EOF
|
170
|
+
<html>
|
171
|
+
<head>
|
172
|
+
<title>Internal Server Error</title>
|
173
|
+
</head>
|
174
|
+
<body>
|
175
|
+
<p>A Purposeful Error</p>
|
176
|
+
</body>
|
177
|
+
</html>
|
178
|
+
EOF
|
179
|
+
body content
|
180
|
+
end
|
181
|
+
|
166
182
|
error do
|
167
183
|
e = request.env['sinatra.error']
|
168
184
|
body << <<-EOF
|
@@ -231,6 +247,12 @@ describe "testing a Rack application with Kookaburra" do
|
|
231
247
|
end
|
232
248
|
end
|
233
249
|
|
250
|
+
class ErrorPage < Kookaburra::UIDriver::UIComponent
|
251
|
+
def component_path
|
252
|
+
'/error_page'
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
234
256
|
class WidgetDataContainer
|
235
257
|
def initialize(element)
|
236
258
|
@element = element
|
@@ -293,6 +315,7 @@ describe "testing a Rack application with Kookaburra" do
|
|
293
315
|
end
|
294
316
|
|
295
317
|
class MyUIDriver < Kookaburra::UIDriver
|
318
|
+
ui_component :error_page, ErrorPage
|
296
319
|
ui_component :sign_in_screen, SignInScreen
|
297
320
|
ui_component :widget_list, WidgetList
|
298
321
|
ui_component :widget_form, WidgetForm
|
@@ -302,6 +325,10 @@ describe "testing a Rack application with Kookaburra" do
|
|
302
325
|
sign_in_screen.sign_in(mental_model.users[name])
|
303
326
|
end
|
304
327
|
|
328
|
+
def error_on_purpose
|
329
|
+
address_bar.go_to error_page
|
330
|
+
end
|
331
|
+
|
305
332
|
def view_widget_list
|
306
333
|
address_bar.go_to widget_list
|
307
334
|
end
|
@@ -325,25 +352,23 @@ describe "testing a Rack application with Kookaburra" do
|
|
325
352
|
|
326
353
|
before(:all) do
|
327
354
|
app_server.boot
|
328
|
-
end
|
329
|
-
|
330
|
-
after(:all) do
|
331
|
-
app_server.shutdown
|
332
|
-
end
|
333
355
|
|
334
|
-
it "runs the tests against the app" do
|
335
356
|
Kookaburra.configure do |c|
|
336
357
|
c.ui_driver_class = MyUIDriver
|
337
358
|
c.given_driver_class = MyGivenDriver
|
338
359
|
c.app_host = 'http://127.0.0.1:%d' % app_server.port
|
339
360
|
c.browser = Capybara::Session.new(:selenium)
|
340
361
|
c.server_error_detection do |browser|
|
341
|
-
browser.has_css?('head title', :text => 'Internal Server Error')
|
362
|
+
browser.has_css?('head title', :text => 'Internal Server Error', :visible => false)
|
342
363
|
end
|
343
364
|
end
|
365
|
+
end
|
344
366
|
|
345
|
-
|
367
|
+
after(:all) do
|
368
|
+
app_server.shutdown
|
369
|
+
end
|
346
370
|
|
371
|
+
it "runs the tests against the app" do
|
347
372
|
given.a_user(:bob)
|
348
373
|
given.a_widget(:widget_a)
|
349
374
|
given.a_widget(:widget_b, :name => 'Foo')
|
@@ -370,6 +395,11 @@ describe "testing a Rack application with Kookaburra" do
|
|
370
395
|
ui.widget_list.widgets.should == k.get_data(:widgets).values_at(:widget_a, :widget_c)
|
371
396
|
ui.widget_list.widgets.should match_mental_model_of(:widgets)
|
372
397
|
end
|
398
|
+
|
399
|
+
it "catches errors based on the server error detection handler" do
|
400
|
+
expect { ui.error_on_purpose } \
|
401
|
+
.to raise_error(Kookaburra::UnexpectedResponse)
|
402
|
+
end
|
373
403
|
end
|
374
404
|
end
|
375
405
|
end
|
@@ -8,8 +8,10 @@ describe Kookaburra::UIDriver::UIComponent::AddressBar do
|
|
8
8
|
end
|
9
9
|
}
|
10
10
|
|
11
|
+
let(:error_detector) { nil }
|
12
|
+
|
11
13
|
let(:configuration) {
|
12
|
-
double('Configuration', :browser => browser, :app_host => nil, :server_error_detection =>
|
14
|
+
double('Configuration', :browser => browser, :app_host => nil, :server_error_detection => error_detector)
|
13
15
|
}
|
14
16
|
|
15
17
|
let(:address_bar) {
|
@@ -22,11 +24,20 @@ describe Kookaburra::UIDriver::UIComponent::AddressBar do
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
context 'when given
|
26
|
-
it
|
27
|
+
context 'when given an addressable object' do
|
28
|
+
it "causes the browser to navigate to the object's #url" do
|
27
29
|
addressable = double('addressable', :url => 'http://site.example.com')
|
28
30
|
address_bar.go_to addressable
|
29
31
|
end
|
30
32
|
end
|
33
|
+
|
34
|
+
context "when a server error would be detected" do
|
35
|
+
let(:error_detector) { ->(browser) { true } }
|
36
|
+
|
37
|
+
it 'raises a Kookaburra::UnexpectedResponse' do
|
38
|
+
expect { address_bar.go_to 'http://site.example.com' } \
|
39
|
+
.to raise_error(Kookaburra::UnexpectedResponse)
|
40
|
+
end
|
41
|
+
end
|
31
42
|
end
|
32
43
|
end
|