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
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<meta charset='utf-8'>
|
3
|
+
<title>A grid of links with algebraic notation</title>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<tr>
|
7
|
+
<td><a href='#A3'>A3</a></td>
|
8
|
+
<td><a href='#B3'>B3</a></td>
|
9
|
+
<td><a href='#C3'>C3</a></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<td><a href='#A2'>A2</a></td>
|
13
|
+
<td><a href='#B2'>B2</a></td>
|
14
|
+
<td><a href='#C2'>C2</a></td>
|
15
|
+
</tr>
|
16
|
+
<tr>
|
17
|
+
<td><a href='#A1'>A1</a></td>
|
18
|
+
<td><a href='#B1'>B1</a></td>
|
19
|
+
<td><a href='#C1'>C1</a></td>
|
20
|
+
</tr>
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
</table>
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<meta charset="utf-8" />
|
3
|
+
<title>onclick</title>
|
4
|
+
|
5
|
+
<p>
|
6
|
+
<button onclick="clickme()">Click me</button>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p id="clicks"></p>
|
10
|
+
|
11
|
+
<script>
|
12
|
+
|
13
|
+
var clicks = 0;
|
14
|
+
|
15
|
+
function clickme() {
|
16
|
+
clicks++;
|
17
|
+
document.getElementById('clicks').innerHTML = clicks;
|
18
|
+
}
|
19
|
+
|
20
|
+
</script>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<meta charset="utf-8" />
|
3
|
+
<title>Paragraphs</title>
|
4
|
+
|
5
|
+
<p id="first">
|
6
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p id="second">
|
10
|
+
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p id="third">
|
14
|
+
Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
|
15
|
+
</p>
|
File without changes
|
@@ -0,0 +1,68 @@
|
|
1
|
+
RSpec::Matchers.define :close_window do
|
2
|
+
match do |actual|
|
3
|
+
actual > 0
|
4
|
+
end
|
5
|
+
|
6
|
+
failure_message_for_should do |window_id|
|
7
|
+
"expected close_window to close window, but window_id returned is not valid: #{window_id}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec::Matchers.define :close_dialog do |expected|
|
12
|
+
match do |window_id|
|
13
|
+
window_id > 0
|
14
|
+
end
|
15
|
+
|
16
|
+
failure_message_for_should do |window_id|
|
17
|
+
"expected close_dialog to close dialog, but window_id returned is not valid: #{window_id}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
RSpec::Matchers.define :open_window do
|
22
|
+
match do |actual|
|
23
|
+
actual > 0
|
24
|
+
end
|
25
|
+
|
26
|
+
failure_message_for_should do |window_id|
|
27
|
+
"expected open_window to open window, but window_id returned is not valid: #{window_id}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec::Matchers.define :open_dialog do
|
32
|
+
match do |actual|
|
33
|
+
actual > 0
|
34
|
+
end
|
35
|
+
|
36
|
+
failure_message_for_should do |window_id|
|
37
|
+
"expected open_dialog to close dialog, but window_id returned is not valid: #{window_id}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
RSpec::Matchers.define :load_window do
|
43
|
+
match do |actual|
|
44
|
+
actual > 0
|
45
|
+
end
|
46
|
+
|
47
|
+
failure_message_for_should do |window_id|
|
48
|
+
"expected load... to load in window, but window_id returned is not valid: #{window_id}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
RSpec::Matchers.define :load_page do
|
53
|
+
match do |actual|
|
54
|
+
actual > 0
|
55
|
+
end
|
56
|
+
|
57
|
+
failure_message_for_should do |window_id|
|
58
|
+
"expected load_page to load page, but window_id returned is not valid: #{window_id}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
=begin
|
63
|
+
RSpec::Matchers.define :load do |expected|
|
64
|
+
match do |actual|
|
65
|
+
expected == actual
|
66
|
+
end
|
67
|
+
end
|
68
|
+
=end
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
begin
|
2
|
+
require 'rspec'
|
3
|
+
rescue LoadError
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
require 'rspec'
|
7
|
+
rescue LoadError
|
8
|
+
puts <<-EOS
|
9
|
+
To use rspec for testing you must install rspec gem:
|
10
|
+
gem install rspec
|
11
|
+
EOS
|
12
|
+
exit(0)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'rspec/core/rake_task'
|
17
|
+
namespace :watirspec do
|
18
|
+
desc "Run the specs under #{File.dirname(__FILE__)}"
|
19
|
+
RSpec::Core::RakeTask.new(:run) do |t|
|
20
|
+
t.pattern = "#{File.dirname(__FILE__)}/*_spec.rb"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
namespace :watirspec do
|
26
|
+
def watirspec_config; "#{File.dirname(__FILE__)}/.git/config"; end
|
27
|
+
|
28
|
+
#
|
29
|
+
# stolen from rubinius
|
30
|
+
#
|
31
|
+
|
32
|
+
desc 'Switch to the committer url for watirspec'
|
33
|
+
task :committer do
|
34
|
+
system "git config --file #{watirspec_config} remote.origin.url git@github.com:jarib/watirspec.git"
|
35
|
+
puts "\nYou're now accessing watirspec via the committer URL."
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Switch to the watirspec anonymous URL"
|
39
|
+
task :anon do
|
40
|
+
system "git config --file #{watirspec_config} remote.origin.url git://github.com/jarib/watirspec.git"
|
41
|
+
puts "\nYou're now accessing watirspec via the anonymous URL."
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
|
5
|
+
require 'watirspec_helper'
|
6
|
+
#require 'operawatir/desktop_helper'
|
7
|
+
|
8
|
+
module WatirSpec
|
9
|
+
module Helpers
|
10
|
+
def browser
|
11
|
+
OperaWatir::DesktopHelper.browser
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
require 'guards'
|
7
|
+
require 'server'
|
8
|
+
|
9
|
+
require 'operawatir/helper'
|
10
|
+
|
11
|
+
OperaWatir.api = 2
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.mock_with :rr
|
15
|
+
end
|
16
|
+
|
17
|
+
module WatirSpec
|
18
|
+
extend self
|
19
|
+
|
20
|
+
attr_accessor :args, :guarded
|
21
|
+
|
22
|
+
def host
|
23
|
+
"http://#{Server.bind}:#{Server.port}"
|
24
|
+
end
|
25
|
+
alias_method :files, :host
|
26
|
+
|
27
|
+
def guards
|
28
|
+
@guards ||= []
|
29
|
+
end
|
30
|
+
|
31
|
+
def guarded?
|
32
|
+
!!@guarded
|
33
|
+
end
|
34
|
+
|
35
|
+
module Helpers
|
36
|
+
def browser
|
37
|
+
OperaWatir::Helper.browser
|
38
|
+
end
|
39
|
+
|
40
|
+
def window
|
41
|
+
browser.active_window
|
42
|
+
end
|
43
|
+
|
44
|
+
def fixture(*paths)
|
45
|
+
[WatirSpec.host, *paths].join('/')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
include OperaWatir::DesktopExceptions
|
52
|
+
|
53
|
+
include WatirSpec::Guard::Helpers
|
54
|
+
|
55
|
+
RSpec.configure do |config|
|
56
|
+
config.include WatirSpec::Helpers
|
57
|
+
|
58
|
+
config.before(:suite) do
|
59
|
+
Thread.new { WatirSpec::Server.run! }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
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
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path("../spec_helper", __FILE__)
|
3
|
+
|
4
|
+
describe "Element" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
+
end
|
9
|
+
=begin
|
10
|
+
describe ".new" do
|
11
|
+
it "finds elements matching the conditions when given a hash of :how => 'what' arguments" do
|
12
|
+
browser.checkbox(:name => 'new_user_interests', :title => 'Dancing is fun!').value.should == 'dancing'
|
13
|
+
browser.text_field(:class_name => 'name', :index => 1).id.should == 'new_user_last_name'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "raises UnknownObjectException with a sane error message when given a hash of :how => 'what' arguments (non-existing object)" do
|
17
|
+
lambda { browser.text_field(:index => 100, :name => "foo").id }.should raise_error(UnknownObjectException)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "raises ArgumentError if given the wrong number of arguments" do
|
21
|
+
container = mock("container").as_null_object
|
22
|
+
lambda { Element.new(container, 1,2,3,4) }.should raise_error(ArgumentError)
|
23
|
+
lambda { Element.new(container, "foo") }.should raise_error(ArgumentError)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#== and #eql?" do
|
28
|
+
before { browser.goto(WatirSpec.files + "/definition_lists.html") }
|
29
|
+
|
30
|
+
it "returns true if the two elements point to the same DOM element" do
|
31
|
+
a = browser.dl(:id => "experience-list")
|
32
|
+
b = browser.dl
|
33
|
+
|
34
|
+
a.should == b
|
35
|
+
a.should eql(b)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns false if the two elements are not the same" do
|
39
|
+
a = browser.dls[0]
|
40
|
+
b = browser.dls[1]
|
41
|
+
|
42
|
+
a.should_not == b
|
43
|
+
a.should_not eql(b)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "returns false if the other object is not an Element" do
|
47
|
+
browser.dl.should_not == 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "data-* attributes" do
|
52
|
+
before { browser.goto("file://" + File.expand_path("html/data_attributes.html", File.dirname(__FILE__))) }
|
53
|
+
|
54
|
+
bug "http://github.com/jarib/celerity/issues#issue/27", :celerity do
|
55
|
+
it "finds elements by a data-* attribute" do
|
56
|
+
browser.p(:data_type => "ruby-library").should exist
|
57
|
+
end
|
58
|
+
|
59
|
+
it "returns the value of a data-* attribute" do
|
60
|
+
browser.p.data_type.should == "ruby-library"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
=end
|
65
|
+
describe "finding with unknown tag name" do
|
66
|
+
it "finds an element by xpath" do
|
67
|
+
browser.element(:xpath => "//*[@for='new_user_first_name']").should exist
|
68
|
+
end
|
69
|
+
|
70
|
+
it "finds an element by arbitrary attribute" do
|
71
|
+
browser.element(:id => "new_user").should exist
|
72
|
+
end
|
73
|
+
=begin
|
74
|
+
it "finds several elements by xpath" do
|
75
|
+
browser.elements(:xpath => "//a").length.should == 1
|
76
|
+
end
|
77
|
+
|
78
|
+
it "finds finds several elements by arbitrary attribute" do
|
79
|
+
browser.elements(:name => /^new_user/).length.should == 30
|
80
|
+
end
|
81
|
+
=end
|
82
|
+
end
|
83
|
+
=begin
|
84
|
+
describe "#to_subtype" do
|
85
|
+
it "returns a more precise subtype of Element (input element)" do
|
86
|
+
el = browser.element(:xpath => "//input[@type='radio']").to_subtype
|
87
|
+
el.should be_kind_of(Watir::Radio)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns a more precise subtype of Element" do
|
91
|
+
el = browser.element(:xpath => "//*[@id='messages']").to_subtype
|
92
|
+
el.should be_kind_of(Watir::Div)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "#focus" do
|
97
|
+
bug "http://code.google.com/p/selenium/issues/detail?id=157", [:webdriver, :firefox] do
|
98
|
+
it "fires the onfocus event for the given element" do
|
99
|
+
tf = browser.text_field(:id, "new_user_occupation")
|
100
|
+
tf.value.should == "Developer"
|
101
|
+
tf.focus
|
102
|
+
browser.div(:id, "onfocus_test").text.should == "changed by onfocus event"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#fire_event" do
|
108
|
+
it "should fire the given event" do
|
109
|
+
browser.div(:id, "onfocus_test").text.should be_empty
|
110
|
+
browser.text_field(:id, "new_user_occupation").fire_event('onfocus')
|
111
|
+
browser.div(:id, "onfocus_test").text.should == "changed by onfocus event"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "#parent" do
|
116
|
+
bug "http://github.com/jarib/celerity/issues#issue/28", :celerity do
|
117
|
+
it "gets the parent of this element" do
|
118
|
+
browser.text_field(:id, "new_user_email").parent.should be_instance_of(FieldSet)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "#visible?" do
|
124
|
+
it "returns true if the element is visible" do
|
125
|
+
browser.text_field(:id, "new_user_email").should be_visible
|
126
|
+
end
|
127
|
+
|
128
|
+
it "returns false if the element is input element where type == 'hidden'" do
|
129
|
+
browser.text_field(:id, "new_user_interests_dolls").should_not be_visible
|
130
|
+
end
|
131
|
+
|
132
|
+
it "returns false if the element has style='display: none;'" do
|
133
|
+
browser.div(:id, 'changed_language').should_not be_visible
|
134
|
+
end
|
135
|
+
|
136
|
+
it "returns false if the element has style='visibility: hidden;" do
|
137
|
+
browser.div(:id, 'wants_newsletter').should_not be_visible
|
138
|
+
end
|
139
|
+
|
140
|
+
it "returns false if one of the parent elements is hidden" do
|
141
|
+
browser.div(:id, 'hidden_parent').should_not be_visible
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "#exist?" do
|
146
|
+
it "doesn't raise when called on nested elements" do
|
147
|
+
browser.div(:id, 'no_such_div').link(:id, 'no_such_id').should_not exist
|
148
|
+
end
|
149
|
+
|
150
|
+
it "raises ArgumentError error if selector hash with :xpath has multiple entries" do
|
151
|
+
lambda { browser.div(:xpath => "//div", :class => "foo").exists? }.should raise_error(ArgumentError)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
=end
|
155
|
+
end
|