operawatir 0.3.2-jruby → 0.3.7.pre1-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/.yardopts +0 -3
- data/Gemfile +5 -6
- data/Rakefile +7 -2
- data/VERSION +1 -1
- data/bin/desktopwatir +86 -93
- data/bin/operawatir +3 -18
- data/lib/operadriver/commons-io-2.0.1.jar +0 -0
- data/lib/operadriver/selenium-common.jar +0 -0
- data/lib/operadriver/webdriver-opera.jar +0 -0
- data/lib/operawatir/browser.rb +93 -77
- data/lib/operawatir/compat/browser.rb +5 -0
- data/lib/operawatir/compat/element.rb +10 -17
- data/lib/operawatir/compat.rb +0 -1
- data/lib/operawatir/desktop-waiter.rb +1 -143
- data/lib/operawatir/desktop_browser.rb +80 -33
- data/lib/operawatir/desktop_enums.rb +3 -3
- data/lib/operawatir/desktop_helper.rb +84 -0
- data/lib/operawatir/element.rb +23 -4
- data/lib/operawatir/exceptions.rb +3 -0
- data/lib/operawatir/helper.rb +4 -1
- data/lib/operawatir/platform.rb +0 -38
- data/lib/operawatir/preferences.rb +164 -0
- data/lib/operawatir/quickwidgets/quick_addressfield.rb +14 -0
- data/lib/operawatir/quickwidgets/quick_button.rb +7 -1
- data/lib/operawatir/quickwidgets/quick_checkbox.rb +5 -4
- data/lib/operawatir/quickwidgets/quick_dialogtab.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_editfield.rb +9 -4
- data/lib/operawatir/quickwidgets/quick_thumbnail.rb +1 -1
- data/lib/operawatir/quickwidgets/quick_treeitem.rb +2 -2
- data/lib/operawatir/quickwidgets/quick_treeview.rb +2 -1
- data/lib/operawatir/quickwidgets/quick_widget.rb +51 -21
- data/lib/operawatir/quickwidgets/quick_window.rb +34 -19
- data/lib/operawatir/spatnav.rb +38 -0
- data/lib/operawatir/window.rb +76 -12
- data/lib/operawatir.rb +20 -4
- data/operawatir.gemspec +48 -28
- data/spec/new_watirspec/browser_spec.rb +5 -84
- data/spec/new_watirspec/clipboard_spec.rb +41 -56
- data/spec/new_watirspec/collection_spec.rb +2 -2
- data/spec/new_watirspec/element_spec.rb +8 -8
- data/spec/new_watirspec/keys_spec.rb +8 -10
- data/spec/new_watirspec/preferences_spec.rb +144 -0
- data/spec/new_watirspec/screenshot_spec.rb +34 -0
- data/spec/new_watirspec/spatnav_spec.rb +62 -0
- data/utils/formatters/operahelper_formatter.rb +50 -0
- data/utils/formatters/spartan_formatter.rb +29 -0
- metadata +126 -61
- data/lib/operawatir/compat/deprecation.rb +0 -46
- data/utils/launchers/launcher-linux-i686 +0 -0
- data/utils/launchers/launcher-linux-x86_64 +0 -0
- data/utils/launchers/launcher-mac +0 -0
- data/utils/launchers/launcher-win32-i86pc.exe +0 -0
@@ -1,79 +1,64 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
require File.expand_path('../watirspec_helper', __FILE__)
|
3
2
|
|
4
|
-
# These tests use the clipboard gem.
|
5
|
-
# the xclip package to be installed.
|
3
|
+
# These tests use the clipboard gem. On GNU/Linux, this gem requires
|
4
|
+
# the xclip package to be installed. On Windows and Mac, it should
|
5
|
+
# work out of the box.
|
6
6
|
require 'clipboard'
|
7
7
|
|
8
|
+
describe 'Browser' do
|
8
9
|
|
9
|
-
# Clipboard API
|
10
|
-
# ---------------
|
11
|
-
describe '#select_all' do
|
12
|
-
it 'selects the value of an input field' do
|
13
|
-
browser.url = fixture('input_fields_value.html')
|
14
|
-
window.find_by_name('one').click!
|
15
|
-
browser.select_all
|
16
|
-
window.eval_js('window.getSelection()').to_s should == 'foobar'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#copy' do
|
21
10
|
before :each do
|
22
11
|
Clipboard.clear
|
23
12
|
browser.url = fixture('input_fields_value.html')
|
24
|
-
window.
|
13
|
+
window.find_by_id('one').click
|
25
14
|
browser.select_all
|
26
15
|
end
|
27
16
|
|
28
|
-
|
29
|
-
|
30
|
-
|
17
|
+
describe '#select_all' do
|
18
|
+
it 'selects the value of an input field' do
|
19
|
+
window.eval_js('one = document.getElementById("one");')
|
20
|
+
window.eval_js('one.value.substr(one.selectionStart, one.selectionEnd - one.selectionStart)').to_s.should == 'foobar'
|
21
|
+
end
|
31
22
|
end
|
32
23
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
24
|
+
describe '#copy' do
|
25
|
+
it 'copies a string to the keyboard' do
|
26
|
+
browser.copy
|
27
|
+
Clipboard.paste.should == 'foobar'
|
28
|
+
end
|
38
29
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
window.find_by_name('one').click!
|
44
|
-
browser.select_all
|
30
|
+
it 'leaves the copied string alone' do
|
31
|
+
browser.copy
|
32
|
+
window.find_by_id('one').value.should == 'foobar'
|
33
|
+
end
|
45
34
|
end
|
46
35
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
36
|
+
describe '#cut' do
|
37
|
+
it 'copies a string to the keyboard' do
|
38
|
+
browser.cut
|
39
|
+
Clipboard.paste.should == 'foobar'
|
40
|
+
end
|
51
41
|
|
52
|
-
|
53
|
-
|
54
|
-
|
42
|
+
it 'removes the cut string' do
|
43
|
+
browser.cut
|
44
|
+
window.find_by_id('one').value.should == ''
|
45
|
+
end
|
55
46
|
end
|
56
|
-
end
|
57
47
|
|
58
|
-
describe '#paste' do
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
48
|
+
describe '#paste' do
|
49
|
+
it 'pastes a copied string' do
|
50
|
+
browser.copy
|
51
|
+
window.find_by_id('two').click
|
52
|
+
browser.paste
|
53
|
+
window.find_by_id('two').value.should == 'foobar'
|
54
|
+
end
|
65
55
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
56
|
+
it 'pastes a cut string' do
|
57
|
+
browser.cut
|
58
|
+
window.find_by_id('two').click
|
59
|
+
browser.paste
|
60
|
+
window.find_by_id('two').value.should == 'foobar'
|
61
|
+
end
|
71
62
|
end
|
72
63
|
|
73
|
-
it 'pastes a cut string' do
|
74
|
-
browser.cut
|
75
|
-
window.find_by_name('two').click!
|
76
|
-
browser.paste
|
77
|
-
window.find_by_name('two').value.should == 'foobar'
|
78
|
-
end
|
79
64
|
end
|
@@ -251,10 +251,10 @@ describe 'Collection' do
|
|
251
251
|
# states
|
252
252
|
# ------
|
253
253
|
|
254
|
-
describe '#click
|
254
|
+
describe '#click' do
|
255
255
|
it 'clicks all the elements in this collection' do
|
256
256
|
collection = window.find_by_class('footer')
|
257
|
-
collection.click
|
257
|
+
collection.click
|
258
258
|
collection.all? do |element|
|
259
259
|
element.text.match(/Javascript/) != nil
|
260
260
|
end.should be_true
|
@@ -264,16 +264,16 @@ describe 'Element' do
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
# click
|
268
|
-
describe '#click
|
267
|
+
# click([x, y]) , x,y relative to element top left
|
268
|
+
describe '#click' do
|
269
269
|
it 'follows links' do
|
270
|
-
window.find_by_id('link_3').first.click
|
270
|
+
window.find_by_id('link_3').first.click
|
271
271
|
window.url.should match /forms_with_input_elements\.html$/
|
272
272
|
end
|
273
273
|
|
274
274
|
it 'triggers onclick handlers' do
|
275
275
|
div = window.find_by_id('best_language').first
|
276
|
-
div.click
|
276
|
+
div.click
|
277
277
|
div.text.should == 'Ruby!'
|
278
278
|
end
|
279
279
|
|
@@ -281,9 +281,9 @@ describe 'Element' do
|
|
281
281
|
browser.url = fixture('forms_with_input_elements.html')
|
282
282
|
checkbox = window.find_by_id('new_user_interests_cars').first
|
283
283
|
checkbox.checked?.should be_false
|
284
|
-
checkbox.click
|
284
|
+
checkbox.click
|
285
285
|
checkbox.checked?.should be_true
|
286
|
-
checkbox.click
|
286
|
+
checkbox.click
|
287
287
|
checkbox.checked?.should be_false
|
288
288
|
end
|
289
289
|
|
@@ -293,8 +293,8 @@ describe 'Element' do
|
|
293
293
|
browser.url = fixture('forms_with_input_elements.html')
|
294
294
|
|
295
295
|
select = window.find_by_id('new_user_country')
|
296
|
-
select.click
|
297
|
-
select.option[0].click
|
296
|
+
select.click
|
297
|
+
select.option[0].click
|
298
298
|
select.option[0].selected?.should be_true
|
299
299
|
end
|
300
300
|
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# -*- coding: utf-8 -*-
|
2
2
|
require File.expand_path('../watirspec_helper', __FILE__)
|
3
3
|
|
4
4
|
# keyboard input
|
5
5
|
# ---------------
|
6
|
-
describe '
|
7
|
-
|
6
|
+
describe 'Keys' do
|
8
7
|
after :each do
|
9
8
|
browser.keys.release
|
10
9
|
end
|
@@ -14,7 +13,7 @@ describe '#keys' do
|
|
14
13
|
browser.url = fixture('two_input_fields.html')
|
15
14
|
@one = window.find_by_name('one')
|
16
15
|
@two = window.find_by_name('two')
|
17
|
-
@one.click
|
16
|
+
@one.click
|
18
17
|
end
|
19
18
|
|
20
19
|
it 'types a single character' do
|
@@ -69,7 +68,6 @@ describe '#keys' do
|
|
69
68
|
end
|
70
69
|
|
71
70
|
it 'presses an invalid key' do
|
72
|
-
p browser.driver.key('hoobaflooba')
|
73
71
|
browser.keys.send(:hoobaflooba).should raise_error InvalidKeyException
|
74
72
|
end
|
75
73
|
end
|
@@ -77,7 +75,7 @@ describe '#keys' do
|
|
77
75
|
describe '#down' do
|
78
76
|
it 'types a mixed-case string by holding shift' do
|
79
77
|
browser.url = fixture('two_input_fields.html')
|
80
|
-
window.find_by_name('one').click
|
78
|
+
window.find_by_name('one').click
|
81
79
|
browser.keys.send 'a'
|
82
80
|
browser.keys.down :shift
|
83
81
|
browser.keys.send 'b'
|
@@ -87,7 +85,7 @@ describe '#keys' do
|
|
87
85
|
|
88
86
|
it 'holds down a non-modifier key for one second' do
|
89
87
|
browser.url = fixture('two_input_fields.html')
|
90
|
-
window.find_by_name('one').click
|
88
|
+
window.find_by_name('one').click
|
91
89
|
browser.keys.down 'a'
|
92
90
|
sleep 1
|
93
91
|
browser.keys.up 'a'
|
@@ -129,7 +127,7 @@ describe '#keys' do
|
|
129
127
|
describe '#up' do
|
130
128
|
it 'types a mixed-case string by holding shift' do
|
131
129
|
browser.url = fixture('two_input_fields.html')
|
132
|
-
window.find_by_name('one').click
|
130
|
+
window.find_by_name('one').click
|
133
131
|
browser.keys.down :shift
|
134
132
|
browser.keys.send 'a'
|
135
133
|
browser.keys.send 'b' # Testing that we do not release prematurely
|
@@ -140,7 +138,7 @@ describe '#keys' do
|
|
140
138
|
|
141
139
|
it 'holds down a non-modifier key for one second (but no longer)' do
|
142
140
|
browser.url = fixture('two_input_fields.html')
|
143
|
-
window.find_by_name('one').click
|
141
|
+
window.find_by_name('one').click
|
144
142
|
browser.keys.down 'a'
|
145
143
|
sleep 1
|
146
144
|
browser.keys.up 'a'
|
@@ -186,7 +184,7 @@ describe '#keys' do
|
|
186
184
|
describe '#release' do
|
187
185
|
it 'releases one button' do
|
188
186
|
browser.url = fixture('two_input_fields.html')
|
189
|
-
window.find_by_name('one').click
|
187
|
+
window.find_by_name('one').click
|
190
188
|
browser.keys.down :shift
|
191
189
|
browser.keys.send 'a'
|
192
190
|
browser.keys.release
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require File.expand_path('../watirspec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'Preferences' do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@prefs = browser.preferences
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#new' do
|
10
|
+
it 'constructs a new instance' do
|
11
|
+
@prefs.exist?.should be_true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#to_s' do; end
|
16
|
+
|
17
|
+
describe '#each_section' do # #each is an alias
|
18
|
+
it 'contains a list' do
|
19
|
+
@prefs.each_section do |p|
|
20
|
+
p.kind_of?(OperaWatir::Preferences::Entry).should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#length' do; end # #size is an alias
|
26
|
+
describe '#last' do; end
|
27
|
+
describe '#empty?' do; end
|
28
|
+
|
29
|
+
describe 'Section' do # Entry / Preferences#method_missing
|
30
|
+
|
31
|
+
before :all do
|
32
|
+
@section = @prefs.link
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#new' do
|
36
|
+
it 'constructs a new instance' do
|
37
|
+
@section.exist?.should be_true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#value' do; end
|
42
|
+
describe '#value=' do; end
|
43
|
+
describe '#default' do; end
|
44
|
+
describe '#default!' do; end
|
45
|
+
describe '#each_key' do; end # #each is an alias
|
46
|
+
|
47
|
+
describe '#is_section?' do
|
48
|
+
it 'is a section' do
|
49
|
+
@section.is_section?.should be_true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'Keys' do # Entry / Entry#method_missing
|
54
|
+
|
55
|
+
before :all do
|
56
|
+
@key = @section.expiry
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#type' do
|
60
|
+
it '`expiry` is a type integer' do
|
61
|
+
@key.type.should include 'Integer'
|
62
|
+
end
|
63
|
+
|
64
|
+
it '`color` is a type boolean' do
|
65
|
+
@section.color.type.should include 'Boolean'
|
66
|
+
end
|
67
|
+
|
68
|
+
it '`opera_account.server_address` is a type string' do
|
69
|
+
@prefs.opera_account.server_address.should include 'String'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#value' do
|
74
|
+
it 'is not empty' do
|
75
|
+
@key.value.should_not be_empty
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'is numeric' do
|
79
|
+
@key.value.should be_numeric
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#value=' do
|
84
|
+
it 'is changed when set' do
|
85
|
+
@key.value = '20'
|
86
|
+
@key.value.should == '20'
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'has effect in the browser when changed' do
|
90
|
+
@section.strike_through.value = true
|
91
|
+
window.url = fixture('simple.html')
|
92
|
+
window.a.eval_js('this.currentStyle.textDecoration').should include /strike\-through/
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'does not allow setting an invalid value' do
|
96
|
+
old_value = @section.color.value
|
97
|
+
@section.color.value = 'foo'
|
98
|
+
@section.color.value.should_not == 'foo'
|
99
|
+
@section.color.value.should == old_value
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#default' do
|
104
|
+
it 'returns the default value' do
|
105
|
+
@key.default == '10'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '#default!' do
|
110
|
+
before :each do
|
111
|
+
@default_value = @key.default
|
112
|
+
@key.value = '1337'
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'returns and sets default value' do
|
116
|
+
@key.default!.should == @default_value
|
117
|
+
@key.value.should == @default_value
|
118
|
+
end
|
119
|
+
|
120
|
+
after :all do
|
121
|
+
@key.value = @default_value
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe '#each_key' do; end # #each is an alias
|
126
|
+
|
127
|
+
describe '#is_section?' do
|
128
|
+
it 'is not a section' do
|
129
|
+
@key.is_section?.should be_false
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
describe '#cleanup' do; end
|
138
|
+
describe '#cleanup!' do; end
|
139
|
+
|
140
|
+
after :all do
|
141
|
+
@prefs.cleanup!
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path('../watirspec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'Element' do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
browser.url = fixture('boxes.html')
|
7
|
+
@one = window.find_by_id('one');
|
8
|
+
@two = window.find_by_id('two');
|
9
|
+
@three = window.find_by_id('three');
|
10
|
+
@four = window.find_by_id('four');
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#visual_hash' do
|
14
|
+
it 'returns a hash' do
|
15
|
+
@one.visual_hash.length.should == 34
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns identical hashes for visually identical elements' do
|
19
|
+
@one.visual_hash.should == @three.visual_hash
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns different hashes for visually different elements' do
|
23
|
+
@one.visual_hash.should_not == @two.visual_hash
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns correct hashes when querying several elements in sequence' do
|
27
|
+
@one.visual_hash.should == @three.visual_hash
|
28
|
+
@two.visual_hash.should == @four.visual_hash
|
29
|
+
@one.visual_hash.should_not == @two.visual_hash
|
30
|
+
@two.visual_hash.should_not == @three.visual_hash
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.expand_path('../watirspec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe 'Spatnav' do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
browser.url = fixture('grid.html')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#up' do
|
10
|
+
it 'selects the correct links when navigating up' do
|
11
|
+
browser.spatnav.up
|
12
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C1'
|
13
|
+
browser.spatnav.up
|
14
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C2'
|
15
|
+
browser.spatnav.up
|
16
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C3'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#down' do
|
21
|
+
it 'selects the correct links when navigating down' do
|
22
|
+
browser.spatnav.down
|
23
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C3'
|
24
|
+
browser.spatnav.down
|
25
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C2'
|
26
|
+
browser.spatnav.down
|
27
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C1'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#left' do
|
32
|
+
it 'selects the correct links when navigating left' do
|
33
|
+
browser.spatnav.left
|
34
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C1'
|
35
|
+
browser.spatnav.left
|
36
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'B1'
|
37
|
+
browser.spatnav.left
|
38
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'A1'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#right' do
|
43
|
+
it 'selects the correct links when navigating right' do
|
44
|
+
browser.spatnav.right
|
45
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'A1'
|
46
|
+
browser.spatnav.right
|
47
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'B1'
|
48
|
+
browser.spatnav.right
|
49
|
+
window.execute_script("document.activeElement.text;").to_s.should == 'C1'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#activate!' do
|
54
|
+
it 'activates the focused link' do
|
55
|
+
browser.spatnav.down
|
56
|
+
browser.spatnav.activate
|
57
|
+
window.url.should include 'C3'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# OperaHelperFormatter is intended for use with OperaHelper, which can
|
2
|
+
# be loaded using
|
3
|
+
#
|
4
|
+
# require "operawatir/helper"
|
5
|
+
#
|
6
|
+
# in your RSpec test suite.
|
7
|
+
|
8
|
+
class OperaHelperFormatter < Spec::Runner::Formatter::BaseTextFormatter
|
9
|
+
def example_failed (example, counter, failure)
|
10
|
+
output.puts message example, colorize_failure("FAILED", failure)
|
11
|
+
output.flush
|
12
|
+
end
|
13
|
+
|
14
|
+
def example_passed (example)
|
15
|
+
output.puts message example, green("PASSED")
|
16
|
+
output.flush
|
17
|
+
end
|
18
|
+
|
19
|
+
def example_pending (example, message)
|
20
|
+
output.puts message example, blue("PENDING")
|
21
|
+
output.flush
|
22
|
+
end
|
23
|
+
|
24
|
+
def example_group_started (example_group_proxy)
|
25
|
+
message = line +
|
26
|
+
example_group_proxy.description + " (" + example_group_proxy.examples.size.to_s + " examples)\n" +
|
27
|
+
line
|
28
|
+
|
29
|
+
output.puts(message)
|
30
|
+
output.flush
|
31
|
+
end
|
32
|
+
|
33
|
+
def message (example, text)
|
34
|
+
example.description.ljust(OperaWatir::Helper.terminal_size[0] - 7) + text
|
35
|
+
end
|
36
|
+
|
37
|
+
def line
|
38
|
+
message = ""
|
39
|
+
i = 0
|
40
|
+
|
41
|
+
begin
|
42
|
+
message += "-"
|
43
|
+
i += 1
|
44
|
+
end while i < OperaWatir::Helper.terminal_size[0]
|
45
|
+
|
46
|
+
message += "\n"
|
47
|
+
return message
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# SpartanFormatter is intended for use with Opera's internal testing
|
2
|
+
# environment SPARTAN.
|
3
|
+
|
4
|
+
require 'rspec/core/formatters/base_text_formatter'
|
5
|
+
|
6
|
+
class SpartanFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
7
|
+
def example_failed(example)
|
8
|
+
message = "#{example.description}\tFAILED\n"
|
9
|
+
output.print message
|
10
|
+
end
|
11
|
+
|
12
|
+
def example_passed(example)
|
13
|
+
message = "#{example.description}\tPASSED\n"
|
14
|
+
output.print message
|
15
|
+
end
|
16
|
+
|
17
|
+
def example_pending(example)
|
18
|
+
message = "#{example.description}\tPENDING\n"
|
19
|
+
output.print message
|
20
|
+
end
|
21
|
+
|
22
|
+
def start_dump
|
23
|
+
output.puts
|
24
|
+
end
|
25
|
+
|
26
|
+
# def dump_summary(duration, example_count, failure_count, pending_count); end
|
27
|
+
# def dump_pending; end
|
28
|
+
# def dump_failure(counter, failure); end
|
29
|
+
end
|