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
|
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
|
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
|
File without changes
|
File without changes
|
@@ -14,21 +14,18 @@ describe "SelectList" do
|
|
14
14
|
browser.select_list(:id, /new_user_country/).should exist
|
15
15
|
browser.select_list(:name, 'new_user_country').should exist
|
16
16
|
browser.select_list(:name, /new_user_country/).should exist
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
|
18
|
+
not_compliant_on :webdriver do
|
19
|
+
browser.select_list(:text, 'Norway').should exist
|
20
|
+
browser.select_list(:text, /Norway/).should exist
|
21
|
+
end
|
22
|
+
|
22
23
|
browser.select_list(:class, 'country').should exist
|
23
24
|
browser.select_list(:class, /country/).should exist
|
24
|
-
browser.select_list(:index,
|
25
|
+
browser.select_list(:index, 0).should exist
|
25
26
|
browser.select_list(:xpath, "//select[@id='new_user_country']").should exist
|
26
27
|
end
|
27
28
|
|
28
|
-
it "returns true if the element exists (default how = :name)" do
|
29
|
-
browser.select_list("new_user_country").should exist
|
30
|
-
end
|
31
|
-
|
32
29
|
it "returns the first select if given no args" do
|
33
30
|
browser.select_list.should exist
|
34
31
|
end
|
@@ -70,7 +67,7 @@ describe "SelectList" do
|
|
70
67
|
|
71
68
|
describe "#id" do
|
72
69
|
it "returns the id of the element" do
|
73
|
-
browser.select_list(:index,
|
70
|
+
browser.select_list(:index, 0).id.should == "new_user_country"
|
74
71
|
end
|
75
72
|
|
76
73
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -80,7 +77,7 @@ describe "SelectList" do
|
|
80
77
|
|
81
78
|
describe "#name" do
|
82
79
|
it "returns the name of the element" do
|
83
|
-
browser.select_list(:index,
|
80
|
+
browser.select_list(:index, 0).name.should == "new_user_country"
|
84
81
|
end
|
85
82
|
|
86
83
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -88,22 +85,22 @@ describe "SelectList" do
|
|
88
85
|
end
|
89
86
|
end
|
90
87
|
|
91
|
-
describe "#
|
92
|
-
it "
|
93
|
-
browser.select_list(:index,
|
94
|
-
browser.select_list(:index,
|
88
|
+
describe "#multiple?" do
|
89
|
+
it "knows whether the select list allows multiple slections" do
|
90
|
+
browser.select_list(:index, 0).should_not be_multiple
|
91
|
+
browser.select_list(:index, 1).should be_multiple
|
95
92
|
end
|
96
93
|
|
97
94
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
98
|
-
lambda { browser.select_list(:index, 1337).
|
95
|
+
lambda { browser.select_list(:index, 1337).multiple? }.should raise_error(UnknownObjectException)
|
99
96
|
end
|
100
97
|
end
|
101
98
|
|
102
99
|
describe "#value" do
|
103
100
|
it "returns the value of the selected option" do
|
104
|
-
browser.select_list(:index,
|
105
|
-
browser.select_list(:index,
|
106
|
-
browser.select_list(:index,
|
101
|
+
browser.select_list(:index, 0).value.should == "2"
|
102
|
+
browser.select_list(:index, 0).select(/Sweden/)
|
103
|
+
browser.select_list(:index, 0).value.should == "3"
|
107
104
|
end
|
108
105
|
|
109
106
|
it "raises UnknownObjectException if the select list doesn't exist" do
|
@@ -113,11 +110,10 @@ describe "SelectList" do
|
|
113
110
|
|
114
111
|
describe "#respond_to?" do
|
115
112
|
it "returns true for all attribute methods" do
|
116
|
-
browser.select_list(:index,
|
117
|
-
browser.select_list(:index,
|
118
|
-
browser.select_list(:index,
|
119
|
-
browser.select_list(:index,
|
120
|
-
browser.select_list(:index, 1).should respond_to(:value)
|
113
|
+
browser.select_list(:index, 0).should respond_to(:class_name)
|
114
|
+
browser.select_list(:index, 0).should respond_to(:id)
|
115
|
+
browser.select_list(:index, 0).should respond_to(:name)
|
116
|
+
browser.select_list(:index, 0).should respond_to(:value)
|
121
117
|
end
|
122
118
|
end
|
123
119
|
|
@@ -138,14 +134,14 @@ describe "SelectList" do
|
|
138
134
|
|
139
135
|
describe "#disabled?" do
|
140
136
|
it "returns true if the select list is disabled" do
|
141
|
-
browser.select_list(:index,
|
137
|
+
browser.select_list(:index, 2).should be_disabled
|
142
138
|
end
|
143
139
|
|
144
140
|
it "returns false if the select list is enabled" do
|
145
|
-
browser.select_list(:index,
|
141
|
+
browser.select_list(:index, 0).should_not be_disabled
|
146
142
|
end
|
147
143
|
|
148
|
-
it "
|
144
|
+
it "should raise UnknownObjectException when the select list does not exist" do
|
149
145
|
lambda { browser.select_list(:index, 1337).disabled? }.should raise_error(UnknownObjectException)
|
150
146
|
end
|
151
147
|
end
|
@@ -160,19 +156,31 @@ describe "SelectList" do
|
|
160
156
|
end
|
161
157
|
|
162
158
|
describe "#options" do
|
163
|
-
it "
|
159
|
+
it "should raise UnknownObjectException if the select list doesn't exist" do
|
164
160
|
lambda { browser.select_list(:name, 'no_such_name').options }.should raise_error(UnknownObjectException)
|
165
161
|
end
|
166
162
|
|
167
|
-
|
163
|
+
#
|
164
|
+
# The correct behaviour here needs to be discussed.
|
165
|
+
#
|
166
|
+
|
167
|
+
not_compliant_on :webdriver do
|
168
168
|
it "returns all the options as an Array" do
|
169
|
-
browser.select_list(:name, "new_user_country").options.should == ["Denmark"
|
169
|
+
browser.select_list(:name, "new_user_country").options.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
deviates_on :webdriver do
|
174
|
+
it "returns all the options as a collection of Options" do
|
175
|
+
options = browser.select_list(:name, "new_user_country").options
|
176
|
+
options.should be_kind_of(OptionCollection)
|
177
|
+
options.map { |opt| opt.text }.should == ["Denmark", "Norway", "Sweden", "United Kingdom", "USA", "Germany"]
|
170
178
|
end
|
171
179
|
end
|
172
180
|
end
|
173
181
|
|
174
182
|
describe "#selected_options" do
|
175
|
-
it "
|
183
|
+
it "should raise UnknownObjectException if the select list doesn't exist" do
|
176
184
|
lambda { browser.select_list(:name, 'no_such_name').selected_options }.should raise_error(UnknownObjectException)
|
177
185
|
end
|
178
186
|
|
@@ -189,7 +197,7 @@ describe "SelectList" do
|
|
189
197
|
end
|
190
198
|
|
191
199
|
it "does not clear selections when not possible" do
|
192
|
-
browser.select_list(:name
|
200
|
+
lambda { browser.select_list(:name, "new_user_country").clear }.should raise_error
|
193
201
|
browser.select_list(:name, "new_user_country").selected_options.should == ["Norway"]
|
194
202
|
end
|
195
203
|
|
@@ -198,24 +206,24 @@ describe "SelectList" do
|
|
198
206
|
end
|
199
207
|
end
|
200
208
|
|
201
|
-
describe "#
|
209
|
+
describe "#include?" do
|
202
210
|
it "returns true if the given option exists" do
|
203
|
-
browser.select_list(:name, 'new_user_country').
|
211
|
+
browser.select_list(:name, 'new_user_country').should include('Denmark')
|
204
212
|
end
|
205
213
|
|
206
214
|
it "returns false if the given option doesn't exist" do
|
207
|
-
browser.select_list(:name, 'new_user_country').
|
215
|
+
browser.select_list(:name, 'new_user_country').should_not include('Ireland')
|
208
216
|
end
|
209
217
|
end
|
210
218
|
|
211
219
|
describe "#selected?" do
|
212
220
|
it "returns true if the given option is selected" do
|
213
221
|
browser.select_list(:name, 'new_user_country').select('Denmark')
|
214
|
-
browser.select_list(:name, 'new_user_country').
|
222
|
+
browser.select_list(:name, 'new_user_country').should be_selected('Denmark')
|
215
223
|
end
|
216
224
|
|
217
225
|
it "returns false if the given option is not selected" do
|
218
|
-
browser.select_list(:name, 'new_user_country').
|
226
|
+
browser.select_list(:name, 'new_user_country').should_not be_selected('Sweden')
|
219
227
|
end
|
220
228
|
|
221
229
|
it "raises UnknonwObjectException if the option doesn't exist" do
|
@@ -251,18 +259,16 @@ describe "SelectList" do
|
|
251
259
|
browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "Swedish"]
|
252
260
|
end
|
253
261
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
end
|
262
|
+
it "selects multiple items using :name and a Regexp" do
|
263
|
+
browser.select_list(:name, "new_user_languages").clear
|
264
|
+
browser.select_list(:name, "new_user_languages").select(/ish/)
|
265
|
+
browser.select_list(:name, "new_user_languages").selected_options.should == ["Danish", "English", "Swedish"]
|
266
|
+
end
|
260
267
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
end
|
268
|
+
it "selects multiple items using :xpath" do
|
269
|
+
browser.select_list(:xpath, "//select[@name='new_user_languages']").clear
|
270
|
+
browser.select_list(:xpath, "//select[@name='new_user_languages']").select(/ish/)
|
271
|
+
browser.select_list(:xpath, "//select[@name='new_user_languages']").selected_options.should == ["Danish", "English", "Swedish"]
|
266
272
|
end
|
267
273
|
|
268
274
|
it "selects empty options" do
|
@@ -270,14 +276,12 @@ describe "SelectList" do
|
|
270
276
|
browser.select_list(:id, "delete_user_username").selected_options.should == [""]
|
271
277
|
end
|
272
278
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
end
|
279
|
+
it "returns the value selected" do
|
280
|
+
browser.select_list(:name, "new_user_languages").select("Danish").should == "Danish"
|
281
|
+
end
|
277
282
|
|
278
|
-
|
279
|
-
|
280
|
-
end
|
283
|
+
it "returns the first matching value if there are multiple matches" do
|
284
|
+
browser.select_list(:name, "new_user_languages").select(/ish/).should == "Danish"
|
281
285
|
end
|
282
286
|
|
283
287
|
it "fires onchange event when selecting an item" do
|
@@ -285,23 +289,34 @@ describe "SelectList" do
|
|
285
289
|
messages.should == ['changed language']
|
286
290
|
end
|
287
291
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
messages.size.should == 3
|
292
|
+
it "doesn't fire onchange event when selecting an already selected item" do
|
293
|
+
browser.select_list(:id, "new_user_languages").clear # removes the two pre-selected options
|
294
|
+
browser.select_list(:id, "new_user_languages").select("English")
|
295
|
+
messages.size.should == 3
|
293
296
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
+
browser.select_list(:id, "new_user_languages").select("English")
|
298
|
+
messages.size.should == 3
|
299
|
+
end
|
300
|
+
|
301
|
+
it "returns the text of the selected option" do
|
302
|
+
browser.select_list(:id, "new_user_languages").select("English").should == "English"
|
303
|
+
end
|
304
|
+
|
305
|
+
it "returns an empty string when selecting an option that disappears when selected" do
|
306
|
+
browser.select_list(:id, 'obsolete').select('sweden').should == ''
|
297
307
|
end
|
298
308
|
|
299
309
|
it "raises NoValueFoundException if the option doesn't exist" do
|
300
310
|
lambda { browser.select_list(:name, "new_user_country").select("missing_option") }.should raise_error(NoValueFoundException)
|
301
311
|
lambda { browser.select_list(:name, "new_user_country").select(/missing_option/) }.should raise_error(NoValueFoundException)
|
302
312
|
end
|
303
|
-
end
|
304
313
|
|
314
|
+
it "raises a TypeError if argument is not a String, Regexp or Numeric" do
|
315
|
+
lambda { browser.select_list(:id, "new_user_languages").select([]) }.should raise_error(TypeError)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# deprecate?
|
305
320
|
describe "#select_value" do
|
306
321
|
it "selects the item by value string" do
|
307
322
|
browser.select_list(:name, "new_user_languages").clear
|
@@ -309,12 +324,10 @@ describe "SelectList" do
|
|
309
324
|
browser.select_list(:name, "new_user_languages").selected_options.should == %w[English]
|
310
325
|
end
|
311
326
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
|
317
|
-
end
|
327
|
+
it "selects the items by value regexp" do
|
328
|
+
browser.select_list(:name, "new_user_languages").clear
|
329
|
+
browser.select_list(:name, "new_user_languages").select_value(/1|3/)
|
330
|
+
browser.select_list(:name, "new_user_languages").selected_options.should == %w[Danish Norwegian]
|
318
331
|
end
|
319
332
|
|
320
333
|
it "raises NoValueFoundException if the option doesn't exist" do
|