operawatir 0.4-jruby → 0.4.1-jruby
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.
- data/.gitmodules +3 -3
- data/AUTHORS +1 -0
- data/CHANGES +454 -0
- data/README.md +67 -50
- data/Rakefile +6 -10
- data/VERSION +1 -1
- data/bin/desktopwatir +52 -29
- data/bin/operawatir +50 -18
- data/lib/operadriver/client-combined-nodeps.jar +0 -0
- data/lib/operadriver/webdriver-opera.jar +0 -0
- data/lib/operawatir.rb +8 -1
- data/lib/operawatir/browser.rb +35 -15
- data/lib/operawatir/collection.rb +2 -2
- data/lib/operawatir/compat.rb +3 -2
- data/lib/operawatir/compat/browser.rb +0 -5
- data/lib/operawatir/compat/collection.rb +15 -0
- data/lib/operawatir/compat/element.rb +72 -21
- data/lib/operawatir/compat/element_finders.rb +6 -0
- data/lib/operawatir/compat/selector.rb +7 -0
- data/lib/operawatir/compat/window.rb +49 -0
- data/lib/operawatir/desktop_browser.rb +88 -14
- data/lib/operawatir/desktop_common.rb +0 -2
- data/lib/operawatir/desktop_container.rb +82 -29
- data/lib/operawatir/desktop_helper.rb +2 -0
- data/lib/operawatir/element.rb +49 -25
- data/lib/operawatir/helper.rb +5 -3
- data/lib/operawatir/keys.rb +19 -6
- data/lib/operawatir/preferences.rb +315 -78
- data/lib/operawatir/quickwidgets.rb +2 -1
- data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -0
- data/lib/operawatir/quickwidgets/quick_button.rb +8 -2
- data/lib/operawatir/quickwidgets/quick_checkbox.rb +5 -5
- data/lib/operawatir/quickwidgets/quick_editfield.rb +8 -5
- data/lib/operawatir/quickwidgets/quick_find.rb +11 -0
- data/lib/operawatir/quickwidgets/quick_griditem.rb +11 -0
- data/lib/operawatir/quickwidgets/quick_gridlayout.rb +11 -0
- data/lib/operawatir/quickwidgets/quick_searchfield.rb +7 -1
- data/lib/operawatir/quickwidgets/quick_tab.rb +0 -1
- data/lib/operawatir/quickwidgets/quick_treeitem.rb +22 -1
- data/lib/operawatir/quickwidgets/quick_widget.rb +62 -23
- data/lib/operawatir/quickwidgets/quick_window.rb +32 -2
- data/lib/operawatir/screenshot.rb +46 -0
- data/lib/operawatir/version.rb +6 -4
- data/lib/operawatir/window.rb +53 -67
- data/operawatir.gemspec +310 -245
- data/spec/operawatir/README.md +4 -0
- data/spec/operawatir/core/browser_spec.rb +82 -0
- data/spec/operawatir/core/element_spec.rb +88 -0
- data/spec/operawatir/core/preferences_spec.rb +438 -0
- data/spec/operawatir/core/screenshot_spec.rb +76 -0
- data/spec/{new_watirspec → operawatir/core}/spatnav_spec.rb +3 -3
- data/spec/operawatir/core/window_spec.rb +76 -0
- data/spec/operawatir/desktop/desktopbrowser_spec.rb +316 -0
- data/spec/operawatir/desktop/quickaddressfield_spec.rb +59 -0
- data/spec/operawatir/desktop/quickbutton_spec.rb +248 -0
- data/spec/operawatir/desktop/quickcheckbox_spec.rb +36 -0
- data/spec/operawatir/desktop/quickdialogtab_spec.rb +30 -0
- data/spec/operawatir/desktop/quickdropdown_spec.rb +39 -0
- data/spec/operawatir/desktop/quickeditfield_spec.rb +51 -0
- data/spec/operawatir/desktop/quickfind_spec.rb +30 -0
- data/spec/operawatir/desktop/quickgriditem_spec.rb +16 -0
- data/spec/operawatir/desktop/quickgridlayout_spec.rb +15 -0
- data/spec/operawatir/desktop/quicklabel_spec.rb +28 -0
- data/spec/operawatir/desktop/quickradiobutton_spec.rb +24 -0
- data/spec/operawatir/desktop/quicksearchfield_spec.rb +26 -0
- data/spec/operawatir/desktop/quicktab_spec.rb +86 -0
- data/spec/operawatir/desktop/quickthumbnail_spec.rb +37 -0
- data/spec/operawatir/desktop/quicktreeitem_spec.rb +135 -0
- data/spec/operawatir/desktop/quicktreeview_spec.rb +30 -0
- data/spec/operawatir/desktop/quickwidget_spec.rb +101 -0
- data/spec/operawatir/desktop/quickwindow_spec.rb +108 -0
- data/spec/operawatir/desktop/shared/shared.rb +138 -0
- data/spec/operawatir/fixtures/boxes.html +22 -0
- data/spec/operawatir/fixtures/browsers.svg +367 -0
- data/spec/operawatir/fixtures/frames.html +13 -0
- data/spec/operawatir/fixtures/grid.html +29 -0
- data/spec/operawatir/fixtures/input_fields_value.html +6 -0
- data/spec/operawatir/fixtures/onclick.html +20 -0
- data/spec/operawatir/fixtures/paragraphs.html +15 -0
- data/spec/operawatir/fixtures/two_input_fields.html +6 -0
- data/spec/{new_watirspec → operawatir}/guards.rb +0 -0
- data/spec/operawatir/matchers.rb +68 -0
- data/spec/{legacy_watirspec → operawatir}/server.rb +0 -0
- data/spec/operawatir/watirspec.rake +43 -0
- data/spec/operawatir/watirspec_desktophelper.rb +14 -0
- data/spec/operawatir/watirspec_helper.rb +62 -0
- data/spec/{legacy_watirspec → watir2}/area_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/areas_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/browser_spec.rb +2 -0
- data/spec/{legacy_watirspec → watir2}/button_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/buttons_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/checkbox_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/checkboxes_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/collections_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dd_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dds_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/del_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dels_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/div_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/divs_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dl_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dls_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dt_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/dts_spec.rb +0 -0
- data/spec/watir2/element_spec.rb +155 -0
- data/spec/{legacy_watirspec → watir2}/em_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ems_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/filefield_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/filefields_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/2000_spans.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/bug_duplicate_attributes.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/bug_javascript_001.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/buttons_with_duplicate_ids.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/collections.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/definition_lists.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/euc-jp_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/forms_with_input_elements.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/frame_1.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/frame_2.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/frames.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/iframes.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/1.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/2.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/3.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/button.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/circle.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/map.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/map2.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/minus.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/originaltriangle.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/plus.gif +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/square.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/images/triangle.jpg +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/iso-2022-jp_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/javascript/helpers.js +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/jquery.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/latin1_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/multiple_ids.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/non_control_elements.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/parser_bug_001.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/prevent_form_submit.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/right_click.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/shift_jis_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/tables.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/timeout.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/timeout_window_location.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/tiny_mce.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/utf8_text.html +0 -0
- data/spec/{legacy_watirspec → watir2}/fixtures/watirspec.css +0 -0
- data/spec/{legacy_watirspec → watir2}/form_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/forms_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/frame_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/frames_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/guards.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hidden_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hiddens_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hn_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/hns_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/image_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/images_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ins_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/inses_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/label_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/labels_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/li_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/link_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/links_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/lis_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/map_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/maps_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/meta_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/metas_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ol_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ols_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/option_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/p_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/pre_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/pres_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ps_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/radio_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/radios_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/select_list_spec.rb +84 -71
- data/spec/{legacy_watirspec → watir2}/select_lists_spec.rb +0 -0
- data/spec/{new_watirspec → watir2}/server.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/span_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/spans_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/spec_helper.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/strong_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/strongs_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_bodies_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_body_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_cell_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_cells_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_footer_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_footers_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_header_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_headers_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_row_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_rows_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/table_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/tables_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/text_field_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/text_fields_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/ul_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/uls_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/watir_compatibility_spec.rb +0 -0
- data/spec/{legacy_watirspec → watir2}/watirspec_helper.rb +0 -0
- data/spec/{new_watirspec → watir3}/browser_spec.rb +11 -21
- data/spec/{new_watirspec → watir3}/clipboard_spec.rb +2 -2
- data/spec/{new_watirspec → watir3}/collection_spec.rb +0 -0
- data/spec/{new_watirspec → watir3}/element_spec.rb +30 -12
- data/spec/watir3/guards.rb +39 -0
- data/spec/{new_watirspec → watir3}/keys_spec.rb +0 -0
- data/spec/watir3/server.rb +91 -0
- data/spec/{new_watirspec → watir3}/watirspec_helper.rb +0 -0
- data/spec/{new_watirspec → watir3}/window_spec.rb +8 -83
- metadata +315 -280
- data/lib/operadriver/selenium-common.jar +0 -0
- data/spec/legacy_watirspec/element_spec.rb +0 -86
- data/spec/new_watirspec/preferences_spec.rb +0 -144
- data/spec/new_watirspec/screenshot_spec.rb +0 -34
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -49,6 +49,11 @@ describe 'Browser' do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe '#quit' do
|
52
|
+
it 'exists' do
|
53
|
+
browser.should respond_to :quit
|
54
|
+
end
|
55
|
+
|
56
|
+
=begin
|
52
57
|
before :each do
|
53
58
|
browser.quit
|
54
59
|
end
|
@@ -76,8 +81,12 @@ describe 'Browser' do
|
|
76
81
|
after :all do
|
77
82
|
# OperaWatir::Helper.reconnect
|
78
83
|
end
|
84
|
+
=end
|
85
|
+
|
79
86
|
end
|
80
87
|
|
88
|
+
|
89
|
+
|
81
90
|
=begin
|
82
91
|
describe '#windows' do
|
83
92
|
before :all do
|
@@ -109,19 +118,6 @@ describe 'Browser' do
|
|
109
118
|
end
|
110
119
|
=end
|
111
120
|
|
112
|
-
describe '#version' do
|
113
|
-
it 'fetches the version number of the driver' do
|
114
|
-
browser.version.should match /\d{1,}\.\d{1,}\.\d{1,}/
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe '#pid' do
|
119
|
-
it 'fetches the PID from the attached browser instance' do
|
120
|
-
browser.pid.should be_integer
|
121
|
-
browser.pid.should_not be_zero
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
121
|
describe '#platform' do
|
126
122
|
it 'fetches the platform the browser is running on' do
|
127
123
|
# TODO: Improve regexp
|
@@ -129,13 +125,6 @@ describe 'Browser' do
|
|
129
125
|
end
|
130
126
|
end
|
131
127
|
|
132
|
-
describe '#build' do
|
133
|
-
it 'fetches the build number of the attached browser instance' do
|
134
|
-
browser.build.should be_integer
|
135
|
-
browser.build.should_not be_zero
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
128
|
describe '#path' do
|
140
129
|
it 'fetches the full path to the binary of the attached browser' do
|
141
130
|
# TODO: Improve regexp
|
@@ -153,11 +142,12 @@ describe 'Browser' do
|
|
153
142
|
it 'is attached to a browser instance' do
|
154
143
|
browser.connected?.should be_true
|
155
144
|
end
|
156
|
-
|
145
|
+
=begin
|
157
146
|
it 'is not attached to a browser instance' do
|
158
147
|
browser.quit
|
159
148
|
browser.connected?.should be_false
|
160
149
|
end
|
150
|
+
=end
|
161
151
|
end
|
162
152
|
|
163
153
|
describe '#desktop?' do
|
@@ -16,8 +16,8 @@ describe 'Browser' do
|
|
16
16
|
|
17
17
|
describe '#select_all' do
|
18
18
|
it 'selects the value of an input field' do
|
19
|
-
window.
|
20
|
-
window.
|
19
|
+
window.execute_script('one = document.getElementById("one");')
|
20
|
+
window.execute_script('one.value.substr(one.selectionStart, one.selectionEnd - one.selectionStart)').to_s.should == 'foobar'
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
File without changes
|
@@ -109,15 +109,6 @@ describe 'Element' do
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
# hash
|
113
|
-
describe '#visual_hash' do
|
114
|
-
it 'is the MD5 hash of the screenshot of the element' do
|
115
|
-
window.url = fixture('images.html')
|
116
|
-
# this hash is from from Watir 1
|
117
|
-
image = window.find_by_tag(:img)[1].visual_hash.should == '0x45688373bcf08d9ecf111ecb2bcb7c4e'
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
112
|
# states
|
122
113
|
# ------
|
123
114
|
|
@@ -436,14 +427,14 @@ describe 'Element' do
|
|
436
427
|
end
|
437
428
|
end
|
438
429
|
|
439
|
-
describe '#
|
430
|
+
describe '#fire_event' do
|
440
431
|
it 'fires the given event on the element' do
|
441
|
-
window.find_by_id('link_3').
|
432
|
+
window.find_by_id('link_3').fire_event :click
|
442
433
|
browser.url.should include 'forms_with_input_elements.html'
|
443
434
|
end
|
444
435
|
|
445
436
|
it 'fires event handlers' do
|
446
|
-
window.find_by_id('html_test').first.
|
437
|
+
window.find_by_id('html_test').first.fire_event :dblclick
|
447
438
|
window.find_by_id('messages').first.text.should include 'double clicked'
|
448
439
|
end
|
449
440
|
end
|
@@ -453,4 +444,31 @@ describe 'Element' do
|
|
453
444
|
|
454
445
|
# style
|
455
446
|
|
447
|
+
|
448
|
+
|
449
|
+
# drag and drop
|
450
|
+
# -------------
|
451
|
+
|
452
|
+
describe '#drag_and_drop_by' do
|
453
|
+
it 'drags an element 100 pixels right and down' do
|
454
|
+
browser.url = fixture('draggable.html')
|
455
|
+
@draggable = window.find_by_id('draggable')
|
456
|
+
|
457
|
+
@draggable.location.to_s.should == 'x100y100'
|
458
|
+
@draggable.drag_and_drop_by(100,100)
|
459
|
+
@draggable.location.to_s.should == 'x200y200'
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
describe '#drag_and_drop_on' do
|
464
|
+
it 'drags one element onto another, triggering the correct events' do
|
465
|
+
browser.url = fixture('draggable.html')
|
466
|
+
@draggable = window.find_by_id('draggable')
|
467
|
+
@droppable = window.find_by_id('droppable')
|
468
|
+
|
469
|
+
@draggable.drag_and_drop_on(@droppable)
|
470
|
+
@droppable.text.should include 'Om nom nom!'
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
456
474
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module WatirSpec
|
2
|
+
class Guard
|
3
|
+
|
4
|
+
attr_accessor :type, :browsers, :data
|
5
|
+
|
6
|
+
def initialize(type, browsers, data={})
|
7
|
+
self.type, self.browsers, self.data = type, browsers, data
|
8
|
+
WatirSpec.guards << self
|
9
|
+
end
|
10
|
+
|
11
|
+
def guarded?(browser)
|
12
|
+
WatirSpec.guarded? || browsers.include?(browser.name)
|
13
|
+
end
|
14
|
+
|
15
|
+
module Helpers
|
16
|
+
def deviates_on(*browsers)
|
17
|
+
guard = WatirSpec::Guard.new :deviation, browsers, :file => caller.first
|
18
|
+
yield unless guard.guarded?(OperaWatir::Helper.browser)
|
19
|
+
end
|
20
|
+
|
21
|
+
def not_compliant_on(*browsers)
|
22
|
+
guard = WatirSpec::Guard.new :non_compliance, browsers, :file => caller.first
|
23
|
+
yield unless guard.guarded?(OperaWatir::Helper.browser)
|
24
|
+
end
|
25
|
+
|
26
|
+
def compliant_on(*browsers)
|
27
|
+
guard = WatirSpec::Guard.new :compliance, browsers, :file => caller.first
|
28
|
+
yield unless guard.guarded?(OperaWatir::Helper.browser)
|
29
|
+
end
|
30
|
+
|
31
|
+
def bug(url, *browsers)
|
32
|
+
guard = WatirSpec::Guard.new :bug, browsers, :file => caller.first, :url => url
|
33
|
+
yield unless guard.guarded?(OperaWatir::Helper.browser)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
File without changes
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'sinatra/base'
|
3
|
+
|
4
|
+
class WatirSpec::Server < ::Sinatra::Base
|
5
|
+
|
6
|
+
set :app_file, __FILE__
|
7
|
+
set :root, File.dirname(__FILE__)
|
8
|
+
set :public, lambda { File.join(root, 'fixtures')}
|
9
|
+
set :static, true
|
10
|
+
set :run, false
|
11
|
+
set :environment, :production
|
12
|
+
set :bind, 'localhost'
|
13
|
+
set :port, 2000
|
14
|
+
set :server, %w[thin mongrel webrick]
|
15
|
+
|
16
|
+
get '/' do
|
17
|
+
self.class.name
|
18
|
+
end
|
19
|
+
|
20
|
+
get '/big' do
|
21
|
+
Class.new do
|
22
|
+
def each(&blk)
|
23
|
+
yield "<html><head><title>Big Content</title></head><body>"
|
24
|
+
string = "hello "*205
|
25
|
+
300.times { yield string }
|
26
|
+
yield "</body></html>"
|
27
|
+
end
|
28
|
+
end.new
|
29
|
+
end
|
30
|
+
|
31
|
+
post '/post_to_me' do
|
32
|
+
"You posted the following content:\n#{ env['rack.input'].read }"
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/plain_text' do
|
36
|
+
content_type 'text/plain'
|
37
|
+
'This is text/plain'
|
38
|
+
end
|
39
|
+
|
40
|
+
get '/ajax' do
|
41
|
+
sleep 10
|
42
|
+
"A slooow ajax response"
|
43
|
+
end
|
44
|
+
|
45
|
+
get '/charset_mismatch' do
|
46
|
+
content_type 'text/html; charset=UTF-8'
|
47
|
+
%{
|
48
|
+
<html>
|
49
|
+
<head>
|
50
|
+
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<h1>ø</h1>
|
54
|
+
</body>
|
55
|
+
</html>
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
get '/octet_stream' do
|
60
|
+
content_type 'application/octet-stream'
|
61
|
+
'This is application/octet-stream'
|
62
|
+
end
|
63
|
+
|
64
|
+
get '/set_cookie' do
|
65
|
+
content_type 'text/plain'
|
66
|
+
headers 'Set-Cookie' => "monster=/"
|
67
|
+
|
68
|
+
"C is for cookie, it's good enough for me"
|
69
|
+
end
|
70
|
+
|
71
|
+
get '/header_echo' do
|
72
|
+
content_type 'text/plain'
|
73
|
+
env.inspect
|
74
|
+
end
|
75
|
+
|
76
|
+
get '/authentication' do
|
77
|
+
auth = Rack::Auth::Basic::Request.new(env)
|
78
|
+
|
79
|
+
unless auth.provided? && auth.credentials == %w[foo bar]
|
80
|
+
headers 'WWW-Authenticate' => %(Basic realm="localhost")
|
81
|
+
halt 401, 'Authorization Required'
|
82
|
+
end
|
83
|
+
|
84
|
+
"ok"
|
85
|
+
end
|
86
|
+
|
87
|
+
get '/encodable_<stuff>' do
|
88
|
+
'page with characters in URI that need encoding'
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
File without changes
|
@@ -121,7 +121,7 @@ describe 'Window' do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'changes when the title tag changes' do
|
124
|
-
window.
|
124
|
+
window.execute_script('document.title = "changed"')
|
125
125
|
window.title.should == 'changed'
|
126
126
|
end
|
127
127
|
end
|
@@ -209,107 +209,32 @@ describe 'Window' do
|
|
209
209
|
|
210
210
|
# click(x,y)
|
211
211
|
|
212
|
-
describe '#
|
213
|
-
it 'types the given characters' do
|
214
|
-
browser.url = fixture('forms_with_input_elements.html')
|
215
|
-
textbox = window.find_by_id('new_user_first_name').first
|
216
|
-
textbox.focus!
|
217
|
-
window.type('test')
|
218
|
-
textbox.attr(:value).should == 'test'
|
219
|
-
end
|
220
|
-
|
221
|
-
it 'sends keypress events' do
|
222
|
-
browser.url = fixture('keys.html')
|
223
|
-
window.type('hello')
|
224
|
-
window.find_by_id('log').text.should include 'press, 104, h,'
|
225
|
-
window.find_by_id('log').text.should include 'down, 69, E,'
|
226
|
-
window.find_by_id('log').text.should include 'up, 79, O,'
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
describe '#key' do
|
231
|
-
before :each do
|
232
|
-
browser.url = fixture('keys.html')
|
233
|
-
end
|
234
|
-
|
235
|
-
it 'presses and releases the given key' do
|
236
|
-
# TODO Is this how we should send ctrl/shift/alt?
|
237
|
-
window.key('ctrl')
|
238
|
-
|
239
|
-
window.find_by_id('log').text.should include 'down'
|
240
|
-
window.find_by_id('log').text.should include 'ctrl'
|
241
|
-
window.find_by_id('log').text.should include 'up'
|
242
|
-
end
|
243
|
-
|
244
|
-
it 'can press the home key' do
|
245
|
-
window.key('home')
|
246
|
-
window.find_by_id('log').text.should include 'press, 36'
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'can press the tab key' do
|
250
|
-
window.key('tab')
|
251
|
-
window.find_by_id('log').text.should include 'press, 9'
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'tabs through fields when tab is pressed' do
|
255
|
-
window.url = fixture('forms_with_input_elements.html')
|
256
|
-
window.key('tab')
|
257
|
-
window.find_by_id('new_user_first_name').focused?.should be_true
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'can press the F3 key' do
|
261
|
-
window.key('f3')
|
262
|
-
window.find_by_id('log').text.should include 'press, 114'
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
describe '#key_down' do
|
267
|
-
it 'presses down the given key' do
|
268
|
-
browser.url = fixture('keys.html')
|
269
|
-
window.key_down('ctrl')
|
270
|
-
window.key_down('shift')
|
271
|
-
window.find_by_id('log').text.should include 'ctrl,shift'
|
272
|
-
# Don't leave them pressed down
|
273
|
-
window.key_up('ctrl')
|
274
|
-
window.key_up('shift')
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
describe '#key_up' do
|
279
|
-
it 'releases the given key' do
|
280
|
-
browser.url = fixture('keys.html')
|
281
|
-
window.key_down('ctrl')
|
282
|
-
window.key_up('ctrl')
|
283
|
-
window.find_by_id('log').text.should include 'up, 17'
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
describe '#eval_js' do
|
212
|
+
describe '#execute_script' do
|
288
213
|
it 'executes Javascript in the page' do
|
289
|
-
window.
|
214
|
+
window.execute_script('document.title = "test"')
|
290
215
|
window.title.should == 'test'
|
291
216
|
end
|
292
217
|
|
293
218
|
it 'returns an element when the Javascript does' do
|
294
|
-
window.
|
219
|
+
window.execute_script('document.createElement("div")').tag_name.should match /div/i
|
295
220
|
end
|
296
221
|
|
297
222
|
it 'returns a number when the Javascript does' do
|
298
|
-
window.
|
223
|
+
window.execute_script('Math.abs(-5)').should == 5
|
299
224
|
end
|
300
225
|
|
301
226
|
it 'returns a boolean when the Javascript does' do
|
302
|
-
window.
|
227
|
+
window.execute_script('(function(){return true;})()').should be_true
|
303
228
|
end
|
304
229
|
|
305
230
|
it 'returns an array when the Javascript does' do
|
306
|
-
result = window.
|
231
|
+
result = window.execute_script('["this", "is", "a", "test"]') # WTR-227
|
307
232
|
result.length.should == 4
|
308
233
|
result[3].should == 'test'
|
309
234
|
end
|
310
235
|
|
311
236
|
it 'returns a string when the result is not one of these types' do
|
312
|
-
window.
|
237
|
+
window.execute_script('({one:"two"}).toString()').should == '[object Object]'
|
313
238
|
end
|
314
239
|
end
|
315
240
|
|