operawatir 0.4-jruby → 0.4.1-jruby
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.expand_path('../../watirspec_helper', __FILE__)
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
RSpec::Matchers.define :save_file do
|
5
|
+
match { |filename| File.exists? filename }
|
6
|
+
end
|
7
|
+
|
8
|
+
RSpec::Matchers.define :be_boolean do
|
9
|
+
match { |variable| !!variable == variable }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'Screenshot' do
|
13
|
+
|
14
|
+
before :all do
|
15
|
+
browser.url = fixture('boxes.html')
|
16
|
+
@screenshot = window.screenshot
|
17
|
+
@filename = "#{Dir.tmpdir}/screenshot.png"
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#new' do
|
21
|
+
context 'given no argument' do
|
22
|
+
it 'creates a new Screenshot object' do
|
23
|
+
@screenshot.should be_kind_of OperaWatir::Screenshot
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'given an argument' do
|
28
|
+
it 'saves a screenshot' do
|
29
|
+
window.screenshot(@filename).should save_file
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#save' do
|
35
|
+
it 'saves screenshot to disk' do
|
36
|
+
@screenshot.save(@filename).should save_file
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#blank?' do
|
41
|
+
it 'returns a valid type' do
|
42
|
+
@screenshot.blank?.should be_boolean
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'is not blank' do
|
46
|
+
@screenshot.blank?.should be_false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#png' do
|
51
|
+
before(:all) { @png = @screenshot.png }
|
52
|
+
|
53
|
+
it 'returns a valid type' do
|
54
|
+
@png.should be_kind_of String
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'is a real type PNG image' do
|
58
|
+
@png.should match /PNG/
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#md5' do
|
63
|
+
before(:all) { @md5 = @screenshot.md5 }
|
64
|
+
|
65
|
+
it 'returns a valid type' do
|
66
|
+
@md5.should be_kind_of String
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'returns a hash' do
|
70
|
+
@md5.should match /^(0x)[a-f0-9]{32}$/
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
after(:all) { File.delete @filename if File.exists? @filename }
|
75
|
+
|
76
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('../../watirspec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe 'Spatnav' do
|
4
4
|
|
@@ -53,8 +53,8 @@ describe 'Spatnav' do
|
|
53
53
|
describe '#activate!' do
|
54
54
|
it 'activates the focused link' do
|
55
55
|
browser.spatnav.down
|
56
|
-
|
57
|
-
|
56
|
+
browser.spatnav.activate
|
57
|
+
window.url.should include 'C3'
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.expand_path('../../watirspec_helper', __FILE__)
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
describe 'Window' do
|
5
|
+
|
6
|
+
describe '#visual_hash' do
|
7
|
+
before :each do
|
8
|
+
browser.url = fixture('boxes.html')
|
9
|
+
@reference = window.visual_hash
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns a hash' do
|
13
|
+
@reference.should match /^(0x)[a-f0-9]{32}$/
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns identical hashes for visually identical pages' do
|
17
|
+
browser.url = fixture('boxes.html')
|
18
|
+
window.visual_hash.should == @reference
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns different hashes for visually different pages' do
|
22
|
+
browser.url = fixture('grid.html')
|
23
|
+
window.visual_hash.should_not == @reference
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns a hash of an SVG document' do
|
27
|
+
browser.url = fixture('browsers.svg')
|
28
|
+
browser.visual_hash.should match /^(0x)[a-f0-9]{32}$/
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
#
|
34
|
+
# This method is deprecated, but must be tested anyway.
|
35
|
+
#
|
36
|
+
|
37
|
+
describe '#eval_js' do
|
38
|
+
it 'works the same way as execute_script' do
|
39
|
+
window.eval_js('1+1').should == window.execute_script('1+1');
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# The frames implementation is a relic from the old OperaWatir. We
|
45
|
+
# need to replace this with a better frames implementation in the
|
46
|
+
# future.
|
47
|
+
#
|
48
|
+
|
49
|
+
describe '#frame' do
|
50
|
+
before :all do
|
51
|
+
require 'operawatir/compat/window'
|
52
|
+
OperaWatir::Window.send :include, OperaWatir::Compat::Window
|
53
|
+
browser.url = fixture('frames.html')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'will switch to the specified frame' do
|
57
|
+
window.frame(:name, 'test')
|
58
|
+
window.text.should include 'Lorem ipsum'
|
59
|
+
window.text.should_not include 'foobar'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#switch_to_default' do
|
64
|
+
before :all do
|
65
|
+
browser.url = fixture('frames.html')
|
66
|
+
window.frame(:name, 'test')
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'will switch back to the default top frame' do
|
70
|
+
window.switch_to_default
|
71
|
+
window.text.should include 'foobar'
|
72
|
+
window.text.should_not include 'Lorem ipsum'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,316 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../../watirspec_desktophelper', __FILE__)
|
3
|
+
|
4
|
+
describe 'DesktopBrowser' do
|
5
|
+
before :all do
|
6
|
+
browser.url = fixture('simple.html')
|
7
|
+
#@window = browser.quick_window(:name, "Tab 0")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#goto' do
|
11
|
+
it 'loads page'
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
describe '#quit_opera' do
|
16
|
+
it 'quits opera without quitting driver'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#start_opera' do
|
20
|
+
before(:each) do
|
21
|
+
browser.quit_opera
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'starts opera' do
|
25
|
+
browser.start_opera
|
26
|
+
browser.quick_windows.should_not be_empty
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#quit_driver' do
|
31
|
+
it 'quits driver'
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#restart' do
|
35
|
+
it 'starts opera' do
|
36
|
+
browser.restart
|
37
|
+
browser.quick_windows.should_not be_empty
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'open and load window' do
|
42
|
+
after(:each) do
|
43
|
+
browser.close_all_tabs
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#open_window_with_action' do
|
47
|
+
it 'opens new window' do
|
48
|
+
browser.open_window_with_action("Document Window", "New page", "1").should open_window
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'fails for actions not opening a new window'
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#load_window_with_action' do
|
55
|
+
it 'loads window' do
|
56
|
+
browser.load_window_with_action("Document Window", "Open url in new page", WatirSpec.files + "/boxes.html").should > 0
|
57
|
+
end
|
58
|
+
it 'fails for actions not loading'
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#open_window_with_key_press' do
|
62
|
+
it 'opens window' do
|
63
|
+
browser.open_window_with_key_press("Document Window", "t", :ctrl).should > 0
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'close window' do
|
69
|
+
before(:each) do
|
70
|
+
browser.open_window_with_key_press("Document Window", "t", :ctrl).should > 0
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#close_window_with_action' do
|
74
|
+
it 'closes window' do
|
75
|
+
browser.close_window_with_action("Document Window", "Close page").should > 0
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#close_window_with_key_press' do
|
80
|
+
it 'closes window' do
|
81
|
+
browser.close_window_with_key_press("Document Window", "w", :ctrl).should > 0
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'open dialogs' do
|
87
|
+
after(:each) do
|
88
|
+
browser.close_all_dialogs
|
89
|
+
end
|
90
|
+
describe '#open_dialog_with_url' do
|
91
|
+
it 'opens dialog'
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#open_dialog_with_click' do
|
95
|
+
it 'opens dialog'
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'close dialogs' do
|
101
|
+
before(:each) do
|
102
|
+
browser.open_dialog_with_key_press("New Preferences Dialog", "F12", :ctrl)
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '#close_dialog' do
|
106
|
+
it 'closes dialog' do
|
107
|
+
browser.close_dialog("New Preferences Dialog").should > 0
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
describe '#close_all_dialogs' do
|
113
|
+
it 'closes all dialogs' do
|
114
|
+
browser.close_all_dialogs
|
115
|
+
browser.quick_windows.select { |win| win.type == "Dialog" }.should be_empty
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#activate_tab_with_key_press' do
|
121
|
+
it 'activates tab'
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#set_alignment_with_action' do
|
125
|
+
it 'sets alignment'
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#widgets' do
|
129
|
+
it 'retrieves all widgets' do
|
130
|
+
browser.widgets("Browser Window").should_not be_empty
|
131
|
+
end
|
132
|
+
it 'retrieves only windows'
|
133
|
+
end
|
134
|
+
|
135
|
+
describe '#quick_windows' do
|
136
|
+
it 'retrieves all windows' do
|
137
|
+
browser.quick_windows.should_not be_empty
|
138
|
+
end
|
139
|
+
it 'retrieves only windows'
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '#open_pages' do
|
143
|
+
it 'holds open tabs' do
|
144
|
+
browser.open_pages.should_not be_empty
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe '#quick_buttons' do
|
149
|
+
it 'retrieves buttons' do
|
150
|
+
browser.quick_buttons("Document Window").should_not be_empty
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe '#quick_tabbuttons' do
|
155
|
+
it 'retrieves tabbuttons' do
|
156
|
+
browser.quick_tabbuttons("Browser Window").should_not be_empty
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe '#quick_thumbnails' do
|
161
|
+
before do
|
162
|
+
browser.open_window_with_key_press("Document Window", "t", :ctrl).should > 0
|
163
|
+
end
|
164
|
+
after do
|
165
|
+
browser.quick_window(:name, "Browser Window").quick_toolbar(:name, "Pagebar").quick_tab(:text, "Speed Dial").quick_button(:name, "pb_CloseButton").close_window_with_click("Document Window")
|
166
|
+
end
|
167
|
+
it 'retrieves thumbnails from the active window' do
|
168
|
+
browser.quick_thumbnails("Document Window").length.should be > 0
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#quick_checkboxes' do
|
173
|
+
before(:each) do
|
174
|
+
browser.open_dialog_with_action("New Preferences Dialog", "Show preferences", 4).should > 0
|
175
|
+
end
|
176
|
+
it 'retrieves checkboxes' do
|
177
|
+
browser.quick_checkboxes("New Preferences Dialog").should_not be_empty
|
178
|
+
end
|
179
|
+
it 'retrieves only checkboxes' do
|
180
|
+
browser.quick_checkboxes("New Preferences Dialog").select { |c| c.type != :checkbox }.should be_empty
|
181
|
+
end
|
182
|
+
after(:each) do
|
183
|
+
browser.close_dialog("New Preferences Dialog")
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
#TODO: Add all other collection types
|
188
|
+
|
189
|
+
describe '#window_name' do
|
190
|
+
it 'returns empty string for invalid id' do
|
191
|
+
browser.window_name(-1).should be_empty
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'returns window name for valid id' do
|
195
|
+
valid_id = browser.open_window_with_key_press("Document Window", "t", :ctrl)
|
196
|
+
browser.window_name(valid_id).should == "Document Window"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe '#load_page_with_key_press' do
|
201
|
+
it 'load page'
|
202
|
+
end
|
203
|
+
|
204
|
+
describe '#path' do
|
205
|
+
it 'is not be empty' do
|
206
|
+
browser.path.should_not be_empty
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe '#large_preferences_path' do
|
211
|
+
it 'is not be empty' do
|
212
|
+
browser.large_preferences_path.should_not be_empty
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe '#small_preferences_path' do
|
217
|
+
it 'returns path' do
|
218
|
+
browser.small_preferences_path.should_not be_empty
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe '#cache_preferences_path' do
|
223
|
+
it 'returns path' do
|
224
|
+
browser.cache_preferences_path.should_not be_empty
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
describe '#string' do
|
229
|
+
it 'returns string corresponding to string_id' do
|
230
|
+
browser.string("D_NEW_PREFERENCES_GENERAL").should == "General"
|
231
|
+
end
|
232
|
+
it 'removes ampersands in string with ampersand' do
|
233
|
+
browser.string("S_FIND_IN_PAGE").should == "Find in page"
|
234
|
+
end
|
235
|
+
it 'leaves ampersand in string when skip_ampersand is true' do
|
236
|
+
browser.string("S_FIND_IN_PAGE", false).should == "&Find in page"
|
237
|
+
end
|
238
|
+
#it 'fails in some reasonable way if string_id doesn\'t exist' do
|
239
|
+
# browser.string("SOME_STRING")
|
240
|
+
#end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
describe '#mac?' do
|
245
|
+
end
|
246
|
+
|
247
|
+
describe '#linux?' do
|
248
|
+
end
|
249
|
+
|
250
|
+
describe '#driver' do
|
251
|
+
end
|
252
|
+
|
253
|
+
# @private
|
254
|
+
# Special method to access the driver
|
255
|
+
#attr_reader :driver
|
256
|
+
|
257
|
+
describe '#clear_all_private_data' do
|
258
|
+
it 'clears private data'
|
259
|
+
end
|
260
|
+
|
261
|
+
describe '#clear_history' do
|
262
|
+
it 'clears history'
|
263
|
+
end
|
264
|
+
|
265
|
+
describe '#clear_cache' do
|
266
|
+
it 'clears cache'
|
267
|
+
end
|
268
|
+
|
269
|
+
describe '#close_all_tabs' do
|
270
|
+
it 'closes all tabs except last' do
|
271
|
+
browser.close_all_tabs
|
272
|
+
browser.open_pages.should have(1).item
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
describe '#reset_prefs' do
|
277
|
+
it 'resets prefs'
|
278
|
+
end
|
279
|
+
|
280
|
+
describe '#delete_profile' do
|
281
|
+
it 'deletes profile' do
|
282
|
+
|
283
|
+
end
|
284
|
+
it 'doesn\'t delete main profile'
|
285
|
+
end
|
286
|
+
|
287
|
+
describe '#set_preference' do
|
288
|
+
it 'sets preference' do
|
289
|
+
browser.set_preference("User Prefs", "Speed Dial State", 0)
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
describe '#get_preference' do
|
294
|
+
it 'returns string' do
|
295
|
+
browser.get_preference("User Prefs", "Speed Dial State").should be_kind_of String
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
describe '#get_default_preference' do
|
300
|
+
it 'gets default value of preference'
|
301
|
+
end
|
302
|
+
|
303
|
+
# Gets the parent widget name of which there is none here
|
304
|
+
#describe "#parent_widget" do
|
305
|
+
# it "is nil" do
|
306
|
+
# browser.parent_widget.should be_nil
|
307
|
+
# end
|
308
|
+
#end
|
309
|
+
|
310
|
+
#describe "#window_id" do
|
311
|
+
# it "is nil" do
|
312
|
+
# browser.window_id.should be_nil
|
313
|
+
# end
|
314
|
+
#end
|
315
|
+
end
|
316
|
+
|