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.
Files changed (222) hide show
  1. data/.gitmodules +3 -3
  2. data/AUTHORS +1 -0
  3. data/CHANGES +454 -0
  4. data/README.md +67 -50
  5. data/Rakefile +6 -10
  6. data/VERSION +1 -1
  7. data/bin/desktopwatir +52 -29
  8. data/bin/operawatir +50 -18
  9. data/lib/operadriver/client-combined-nodeps.jar +0 -0
  10. data/lib/operadriver/webdriver-opera.jar +0 -0
  11. data/lib/operawatir.rb +8 -1
  12. data/lib/operawatir/browser.rb +35 -15
  13. data/lib/operawatir/collection.rb +2 -2
  14. data/lib/operawatir/compat.rb +3 -2
  15. data/lib/operawatir/compat/browser.rb +0 -5
  16. data/lib/operawatir/compat/collection.rb +15 -0
  17. data/lib/operawatir/compat/element.rb +72 -21
  18. data/lib/operawatir/compat/element_finders.rb +6 -0
  19. data/lib/operawatir/compat/selector.rb +7 -0
  20. data/lib/operawatir/compat/window.rb +49 -0
  21. data/lib/operawatir/desktop_browser.rb +88 -14
  22. data/lib/operawatir/desktop_common.rb +0 -2
  23. data/lib/operawatir/desktop_container.rb +82 -29
  24. data/lib/operawatir/desktop_helper.rb +2 -0
  25. data/lib/operawatir/element.rb +49 -25
  26. data/lib/operawatir/helper.rb +5 -3
  27. data/lib/operawatir/keys.rb +19 -6
  28. data/lib/operawatir/preferences.rb +315 -78
  29. data/lib/operawatir/quickwidgets.rb +2 -1
  30. data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -0
  31. data/lib/operawatir/quickwidgets/quick_button.rb +8 -2
  32. data/lib/operawatir/quickwidgets/quick_checkbox.rb +5 -5
  33. data/lib/operawatir/quickwidgets/quick_editfield.rb +8 -5
  34. data/lib/operawatir/quickwidgets/quick_find.rb +11 -0
  35. data/lib/operawatir/quickwidgets/quick_griditem.rb +11 -0
  36. data/lib/operawatir/quickwidgets/quick_gridlayout.rb +11 -0
  37. data/lib/operawatir/quickwidgets/quick_searchfield.rb +7 -1
  38. data/lib/operawatir/quickwidgets/quick_tab.rb +0 -1
  39. data/lib/operawatir/quickwidgets/quick_treeitem.rb +22 -1
  40. data/lib/operawatir/quickwidgets/quick_widget.rb +62 -23
  41. data/lib/operawatir/quickwidgets/quick_window.rb +32 -2
  42. data/lib/operawatir/screenshot.rb +46 -0
  43. data/lib/operawatir/version.rb +6 -4
  44. data/lib/operawatir/window.rb +53 -67
  45. data/operawatir.gemspec +310 -245
  46. data/spec/operawatir/README.md +4 -0
  47. data/spec/operawatir/core/browser_spec.rb +82 -0
  48. data/spec/operawatir/core/element_spec.rb +88 -0
  49. data/spec/operawatir/core/preferences_spec.rb +438 -0
  50. data/spec/operawatir/core/screenshot_spec.rb +76 -0
  51. data/spec/{new_watirspec → operawatir/core}/spatnav_spec.rb +3 -3
  52. data/spec/operawatir/core/window_spec.rb +76 -0
  53. data/spec/operawatir/desktop/desktopbrowser_spec.rb +316 -0
  54. data/spec/operawatir/desktop/quickaddressfield_spec.rb +59 -0
  55. data/spec/operawatir/desktop/quickbutton_spec.rb +248 -0
  56. data/spec/operawatir/desktop/quickcheckbox_spec.rb +36 -0
  57. data/spec/operawatir/desktop/quickdialogtab_spec.rb +30 -0
  58. data/spec/operawatir/desktop/quickdropdown_spec.rb +39 -0
  59. data/spec/operawatir/desktop/quickeditfield_spec.rb +51 -0
  60. data/spec/operawatir/desktop/quickfind_spec.rb +30 -0
  61. data/spec/operawatir/desktop/quickgriditem_spec.rb +16 -0
  62. data/spec/operawatir/desktop/quickgridlayout_spec.rb +15 -0
  63. data/spec/operawatir/desktop/quicklabel_spec.rb +28 -0
  64. data/spec/operawatir/desktop/quickradiobutton_spec.rb +24 -0
  65. data/spec/operawatir/desktop/quicksearchfield_spec.rb +26 -0
  66. data/spec/operawatir/desktop/quicktab_spec.rb +86 -0
  67. data/spec/operawatir/desktop/quickthumbnail_spec.rb +37 -0
  68. data/spec/operawatir/desktop/quicktreeitem_spec.rb +135 -0
  69. data/spec/operawatir/desktop/quicktreeview_spec.rb +30 -0
  70. data/spec/operawatir/desktop/quickwidget_spec.rb +101 -0
  71. data/spec/operawatir/desktop/quickwindow_spec.rb +108 -0
  72. data/spec/operawatir/desktop/shared/shared.rb +138 -0
  73. data/spec/operawatir/fixtures/boxes.html +22 -0
  74. data/spec/operawatir/fixtures/browsers.svg +367 -0
  75. data/spec/operawatir/fixtures/frames.html +13 -0
  76. data/spec/operawatir/fixtures/grid.html +29 -0
  77. data/spec/operawatir/fixtures/input_fields_value.html +6 -0
  78. data/spec/operawatir/fixtures/onclick.html +20 -0
  79. data/spec/operawatir/fixtures/paragraphs.html +15 -0
  80. data/spec/operawatir/fixtures/two_input_fields.html +6 -0
  81. data/spec/{new_watirspec → operawatir}/guards.rb +0 -0
  82. data/spec/operawatir/matchers.rb +68 -0
  83. data/spec/{legacy_watirspec → operawatir}/server.rb +0 -0
  84. data/spec/operawatir/watirspec.rake +43 -0
  85. data/spec/operawatir/watirspec_desktophelper.rb +14 -0
  86. data/spec/operawatir/watirspec_helper.rb +62 -0
  87. data/spec/{legacy_watirspec → watir2}/area_spec.rb +0 -0
  88. data/spec/{legacy_watirspec → watir2}/areas_spec.rb +0 -0
  89. data/spec/{legacy_watirspec → watir2}/browser_spec.rb +2 -0
  90. data/spec/{legacy_watirspec → watir2}/button_spec.rb +0 -0
  91. data/spec/{legacy_watirspec → watir2}/buttons_spec.rb +0 -0
  92. data/spec/{legacy_watirspec → watir2}/checkbox_spec.rb +0 -0
  93. data/spec/{legacy_watirspec → watir2}/checkboxes_spec.rb +0 -0
  94. data/spec/{legacy_watirspec → watir2}/collections_spec.rb +0 -0
  95. data/spec/{legacy_watirspec → watir2}/dd_spec.rb +0 -0
  96. data/spec/{legacy_watirspec → watir2}/dds_spec.rb +0 -0
  97. data/spec/{legacy_watirspec → watir2}/del_spec.rb +0 -0
  98. data/spec/{legacy_watirspec → watir2}/dels_spec.rb +0 -0
  99. data/spec/{legacy_watirspec → watir2}/div_spec.rb +0 -0
  100. data/spec/{legacy_watirspec → watir2}/divs_spec.rb +0 -0
  101. data/spec/{legacy_watirspec → watir2}/dl_spec.rb +0 -0
  102. data/spec/{legacy_watirspec → watir2}/dls_spec.rb +0 -0
  103. data/spec/{legacy_watirspec → watir2}/dt_spec.rb +0 -0
  104. data/spec/{legacy_watirspec → watir2}/dts_spec.rb +0 -0
  105. data/spec/watir2/element_spec.rb +155 -0
  106. data/spec/{legacy_watirspec → watir2}/em_spec.rb +0 -0
  107. data/spec/{legacy_watirspec → watir2}/ems_spec.rb +0 -0
  108. data/spec/{legacy_watirspec → watir2}/filefield_spec.rb +0 -0
  109. data/spec/{legacy_watirspec → watir2}/filefields_spec.rb +0 -0
  110. data/spec/{legacy_watirspec → watir2}/fixtures/2000_spans.html +0 -0
  111. data/spec/{legacy_watirspec → watir2}/fixtures/bug_duplicate_attributes.html +0 -0
  112. data/spec/{legacy_watirspec → watir2}/fixtures/bug_javascript_001.html +0 -0
  113. data/spec/{legacy_watirspec → watir2}/fixtures/buttons_with_duplicate_ids.html +0 -0
  114. data/spec/{legacy_watirspec → watir2}/fixtures/collections.html +0 -0
  115. data/spec/{legacy_watirspec → watir2}/fixtures/definition_lists.html +0 -0
  116. data/spec/{legacy_watirspec → watir2}/fixtures/euc-jp_text.html +0 -0
  117. data/spec/{legacy_watirspec → watir2}/fixtures/forms_with_input_elements.html +0 -0
  118. data/spec/{legacy_watirspec → watir2}/fixtures/frame_1.html +0 -0
  119. data/spec/{legacy_watirspec → watir2}/fixtures/frame_2.html +0 -0
  120. data/spec/{legacy_watirspec → watir2}/fixtures/frames.html +0 -0
  121. data/spec/{legacy_watirspec → watir2}/fixtures/iframes.html +0 -0
  122. data/spec/{legacy_watirspec → watir2}/fixtures/images.html +0 -0
  123. data/spec/{legacy_watirspec → watir2}/fixtures/images/1.gif +0 -0
  124. data/spec/{legacy_watirspec → watir2}/fixtures/images/2.gif +0 -0
  125. data/spec/{legacy_watirspec → watir2}/fixtures/images/3.gif +0 -0
  126. data/spec/{legacy_watirspec → watir2}/fixtures/images/button.jpg +0 -0
  127. data/spec/{legacy_watirspec → watir2}/fixtures/images/circle.jpg +0 -0
  128. data/spec/{legacy_watirspec → watir2}/fixtures/images/map.gif +0 -0
  129. data/spec/{legacy_watirspec → watir2}/fixtures/images/map2.gif +0 -0
  130. data/spec/{legacy_watirspec → watir2}/fixtures/images/minus.gif +0 -0
  131. data/spec/{legacy_watirspec → watir2}/fixtures/images/originaltriangle.jpg +0 -0
  132. data/spec/{legacy_watirspec → watir2}/fixtures/images/plus.gif +0 -0
  133. data/spec/{legacy_watirspec → watir2}/fixtures/images/square.jpg +0 -0
  134. data/spec/{legacy_watirspec → watir2}/fixtures/images/triangle.jpg +0 -0
  135. data/spec/{legacy_watirspec → watir2}/fixtures/iso-2022-jp_text.html +0 -0
  136. data/spec/{legacy_watirspec → watir2}/fixtures/javascript/helpers.js +0 -0
  137. data/spec/{legacy_watirspec → watir2}/fixtures/jquery.html +0 -0
  138. data/spec/{legacy_watirspec → watir2}/fixtures/latin1_text.html +0 -0
  139. data/spec/{legacy_watirspec → watir2}/fixtures/multiple_ids.html +0 -0
  140. data/spec/{legacy_watirspec → watir2}/fixtures/non_control_elements.html +0 -0
  141. data/spec/{legacy_watirspec → watir2}/fixtures/parser_bug_001.html +0 -0
  142. data/spec/{legacy_watirspec → watir2}/fixtures/prevent_form_submit.html +0 -0
  143. data/spec/{legacy_watirspec → watir2}/fixtures/right_click.html +0 -0
  144. data/spec/{legacy_watirspec → watir2}/fixtures/shift_jis_text.html +0 -0
  145. data/spec/{legacy_watirspec → watir2}/fixtures/tables.html +0 -0
  146. data/spec/{legacy_watirspec → watir2}/fixtures/timeout.html +0 -0
  147. data/spec/{legacy_watirspec → watir2}/fixtures/timeout_window_location.html +0 -0
  148. data/spec/{legacy_watirspec → watir2}/fixtures/tiny_mce.html +0 -0
  149. data/spec/{legacy_watirspec → watir2}/fixtures/utf8_text.html +0 -0
  150. data/spec/{legacy_watirspec → watir2}/fixtures/watirspec.css +0 -0
  151. data/spec/{legacy_watirspec → watir2}/form_spec.rb +0 -0
  152. data/spec/{legacy_watirspec → watir2}/forms_spec.rb +0 -0
  153. data/spec/{legacy_watirspec → watir2}/frame_spec.rb +0 -0
  154. data/spec/{legacy_watirspec → watir2}/frames_spec.rb +0 -0
  155. data/spec/{legacy_watirspec → watir2}/guards.rb +0 -0
  156. data/spec/{legacy_watirspec → watir2}/hidden_spec.rb +0 -0
  157. data/spec/{legacy_watirspec → watir2}/hiddens_spec.rb +0 -0
  158. data/spec/{legacy_watirspec → watir2}/hn_spec.rb +0 -0
  159. data/spec/{legacy_watirspec → watir2}/hns_spec.rb +0 -0
  160. data/spec/{legacy_watirspec → watir2}/image_spec.rb +0 -0
  161. data/spec/{legacy_watirspec → watir2}/images_spec.rb +0 -0
  162. data/spec/{legacy_watirspec → watir2}/ins_spec.rb +0 -0
  163. data/spec/{legacy_watirspec → watir2}/inses_spec.rb +0 -0
  164. data/spec/{legacy_watirspec → watir2}/label_spec.rb +0 -0
  165. data/spec/{legacy_watirspec → watir2}/labels_spec.rb +0 -0
  166. data/spec/{legacy_watirspec → watir2}/li_spec.rb +0 -0
  167. data/spec/{legacy_watirspec → watir2}/link_spec.rb +0 -0
  168. data/spec/{legacy_watirspec → watir2}/links_spec.rb +0 -0
  169. data/spec/{legacy_watirspec → watir2}/lis_spec.rb +0 -0
  170. data/spec/{legacy_watirspec → watir2}/map_spec.rb +0 -0
  171. data/spec/{legacy_watirspec → watir2}/maps_spec.rb +0 -0
  172. data/spec/{legacy_watirspec → watir2}/meta_spec.rb +0 -0
  173. data/spec/{legacy_watirspec → watir2}/metas_spec.rb +0 -0
  174. data/spec/{legacy_watirspec → watir2}/ol_spec.rb +0 -0
  175. data/spec/{legacy_watirspec → watir2}/ols_spec.rb +0 -0
  176. data/spec/{legacy_watirspec → watir2}/option_spec.rb +0 -0
  177. data/spec/{legacy_watirspec → watir2}/p_spec.rb +0 -0
  178. data/spec/{legacy_watirspec → watir2}/pre_spec.rb +0 -0
  179. data/spec/{legacy_watirspec → watir2}/pres_spec.rb +0 -0
  180. data/spec/{legacy_watirspec → watir2}/ps_spec.rb +0 -0
  181. data/spec/{legacy_watirspec → watir2}/radio_spec.rb +0 -0
  182. data/spec/{legacy_watirspec → watir2}/radios_spec.rb +0 -0
  183. data/spec/{legacy_watirspec → watir2}/select_list_spec.rb +84 -71
  184. data/spec/{legacy_watirspec → watir2}/select_lists_spec.rb +0 -0
  185. data/spec/{new_watirspec → watir2}/server.rb +0 -0
  186. data/spec/{legacy_watirspec → watir2}/span_spec.rb +0 -0
  187. data/spec/{legacy_watirspec → watir2}/spans_spec.rb +0 -0
  188. data/spec/{legacy_watirspec → watir2}/spec_helper.rb +0 -0
  189. data/spec/{legacy_watirspec → watir2}/strong_spec.rb +0 -0
  190. data/spec/{legacy_watirspec → watir2}/strongs_spec.rb +0 -0
  191. data/spec/{legacy_watirspec → watir2}/table_bodies_spec.rb +0 -0
  192. data/spec/{legacy_watirspec → watir2}/table_body_spec.rb +0 -0
  193. data/spec/{legacy_watirspec → watir2}/table_cell_spec.rb +0 -0
  194. data/spec/{legacy_watirspec → watir2}/table_cells_spec.rb +0 -0
  195. data/spec/{legacy_watirspec → watir2}/table_footer_spec.rb +0 -0
  196. data/spec/{legacy_watirspec → watir2}/table_footers_spec.rb +0 -0
  197. data/spec/{legacy_watirspec → watir2}/table_header_spec.rb +0 -0
  198. data/spec/{legacy_watirspec → watir2}/table_headers_spec.rb +0 -0
  199. data/spec/{legacy_watirspec → watir2}/table_row_spec.rb +0 -0
  200. data/spec/{legacy_watirspec → watir2}/table_rows_spec.rb +0 -0
  201. data/spec/{legacy_watirspec → watir2}/table_spec.rb +0 -0
  202. data/spec/{legacy_watirspec → watir2}/tables_spec.rb +0 -0
  203. data/spec/{legacy_watirspec → watir2}/text_field_spec.rb +0 -0
  204. data/spec/{legacy_watirspec → watir2}/text_fields_spec.rb +0 -0
  205. data/spec/{legacy_watirspec → watir2}/ul_spec.rb +0 -0
  206. data/spec/{legacy_watirspec → watir2}/uls_spec.rb +0 -0
  207. data/spec/{legacy_watirspec → watir2}/watir_compatibility_spec.rb +0 -0
  208. data/spec/{legacy_watirspec → watir2}/watirspec_helper.rb +0 -0
  209. data/spec/{new_watirspec → watir3}/browser_spec.rb +11 -21
  210. data/spec/{new_watirspec → watir3}/clipboard_spec.rb +2 -2
  211. data/spec/{new_watirspec → watir3}/collection_spec.rb +0 -0
  212. data/spec/{new_watirspec → watir3}/element_spec.rb +30 -12
  213. data/spec/watir3/guards.rb +39 -0
  214. data/spec/{new_watirspec → watir3}/keys_spec.rb +0 -0
  215. data/spec/watir3/server.rb +91 -0
  216. data/spec/{new_watirspec → watir3}/watirspec_helper.rb +0 -0
  217. data/spec/{new_watirspec → watir3}/window_spec.rb +8 -83
  218. metadata +315 -280
  219. data/lib/operadriver/selenium-common.jar +0 -0
  220. data/spec/legacy_watirspec/element_spec.rb +0 -86
  221. data/spec/new_watirspec/preferences_spec.rb +0 -144
  222. data/spec/new_watirspec/screenshot_spec.rb +0 -34
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Readme
2
2
 
3
- [OperaWatir](http://operawatir.org/) is a part of the [Watir](http://watir.com/) (pronounced _water_) family of free software Ruby libraries for automating web browsers. OperaWatir provides a querying engine and Ruby bindings for a backend Java library, OperaDriver, for driving the [Opera web browser](http://opera.com/). It aims for full compliance with the [watirspec](https://github.com/jarib/watirspec) specification.
3
+ [OperaWatir](http://operawatir.org/) is a part of the [Watir](http://watir.com/) (pronounced _water_) family of free software Ruby libraries for automating web browsers. OperaWatir provides a querying engine and Ruby bindings for a backend Java library, OperaDriver, for driving the [Opera web browser](http://opera.com/). It aims for full compliance with the [Watir 2](https://github.com/jarib/watirspec) and the [Watir 3](https://github.com/operasoftware/watir3-spec) specifications.
4
4
 
5
5
  * __License:__ [New BSD](https://github.com/operasoftware/operawatir/blob/master/LICENSE)
6
6
  * __Project Home:__ [http://www.opera.com/developer/tools/operawatir/](http://www.opera.com/developer/tools/operawatir/)
@@ -9,31 +9,11 @@
9
9
  * __Issues:__ [https://github.com/operasoftware/operawatir/issues](https://github.com/operasoftware/operawatir/issues)
10
10
  * __Gem:__ [https://rubygems.org/operawatir](http://rubygems.org/gems/operawatir)
11
11
 
12
- ## Third-Party Libraries
13
-
14
- OperaWatir uses the following libraries:
15
-
16
- - [OperaDriver](http://www.opera.com/developer/tools/operadriver/) (Apache 2.0 License)
17
- - [rspec](https://github.com/rspec/rspec) (MIT License)
18
- - [jeweler](https://github.com/technicalpickles/jeweler) (MIT License)
19
- - [rake](https://github.com/jimweirich/rake) (MIT License)
20
- - [yard](https://github.com/lsegal/yard) (MIT License)
21
- - [mongrel](http://rubyforge.org/projects/mongrel) (Ruby License)
22
- - [sinatra](http://www.sinatrarb.com/) (MIT License)
23
- - [rr](http://rubyforge.org/projects/double-ruby) (MIT License)
24
- - [bluecloth](http://deveiate.org/projects/BlueCloth) (BSD License)
25
- - [inifile](https://github.com/TwP/inifile) (MIT License)
26
- - [clipboard](https://github.com/janlelis/clipboard) (MIT License)
27
- - [activesupport](http://rubyonrails.org/) (MIT License)
28
- - [i18n](https://github.com/svenfuchs/i18n) (MIT License)
29
- - [deprecated](https://github.com/erikh/deprecated) (BSD License)
30
- - [bundler](http://gembundler.com/) (MIT License)
31
-
32
12
  ## Install
33
13
 
34
14
  ### Requirements
35
15
 
36
- OperaWatir runs on GNU/Linux, Mac OS X and Windows operating systems. Required dependencies are _Java_ >= 1.6.0, _JRuby_ =< 1.5.5, _RubyGems_ >= 1.3.5, _RSpec_ = 2.4, and a somewhat recent desktop or nightly build of Opera. For Windows you must also have the Microsoft Visual C++ 2010 Redistributable Package (x86).
16
+ OperaWatir runs on GNU/Linux, Mac OS X and Windows operating systems. Required dependencies are _Java_ >= 1.6.0, _JRuby_ <= 1.5.5, _RubyGems_ >= 1.3.5, _RSpec_ >= 2.4, and a somewhat recent build of Opera (desktop, internal, mobile). For Windows you must also have the Microsoft Visual C++ 2008 Redistributable Package.
37
17
 
38
18
  ### Installation procedure
39
19
 
@@ -45,16 +25,6 @@ To install (leave out the “sudo” command if you're installing on Windows):
45
25
 
46
26
  Next, make sure that JRuby's ``bin`` directory is a part of your ``PATH`` environmental variable on GNU/Linux.
47
27
 
48
- ## Limitations
49
-
50
- __Before you get started playing with OperaWatir, there are a few important things you need to keep in mind.__
51
-
52
- This is a __pre-release__ of OperaWatir (0.3), and should not be considered stable or suitable for use in production. It should be treated as a proof of concept.
53
-
54
- It is not possible to run OperaWatir without specifying the ``OPERA_PATH`` (full path to Opera binary) and ``OPERA_LAUNCHER`` (full path to Opera launcher binary) environmental variables.
55
-
56
- Since the launcher applications are not shipped with the latest public release of Opera, we have bundled them with the gem. They can be found in ``./utils/launchers/`` under the gem's directory (typically ``/usr/lib/jruby/lib/ruby/gems/1.8/gems/operawatir-0.3-java/utils/launchers/`` on GNU/Linux systems and ``C:\\JRuby-1.5.2\\lib\\ruby\\gems\\1.8\\gems\\operawatir-0.3-java\\utils\\launchers\\`` on Windows). The launchers provided will work on 32-bit GNU/Linux and Windows operating systems. OS X support is planned.
57
-
58
28
  ## Examples
59
29
 
60
30
  The Watir API allows you to write scripts that interact with any web page. Its primary purpose is to ease test automation for web applications. Your scripts can, for example, before you deploy automatically go through all the steps your users normally would and alert you of any regressions.
@@ -67,8 +37,8 @@ Let's take a closer look at how this works.
67
37
  browser = OperaWatir::Browser.new
68
38
 
69
39
  browser.goto 'http://en.wikipedia.org/'
70
- browser.text_field(:id => 'searchInput').set 'Opera'
71
- browser.button(:id => 'searchButton').click
40
+ browser.text_field(:id, 'searchInput').set 'Opera'
41
+ browser.button(:id, 'searchButton').click
72
42
 
73
43
  The script above will tell the browser to load the front page of Wikipedia, write “Opera” in the search field and click the search button. If all goes as intended, the browser will end up at a relevant article.
74
44
 
@@ -84,10 +54,9 @@ As Watir scripts are run in a full-featured browser, all keypresses and clicks w
84
54
  browser = OperaWatir::Browser.new
85
55
 
86
56
  browser.goto 'http://en.wikipedia.org/'
87
- browser.text_field(:id => 'searchInput').click
57
+ browser.text_field(:id, 'searchInput').click
88
58
  browser.type 'Hello world'
89
- browser.key 'Down'
90
- browser.key 'Enter'
59
+ browser.keys.send :down, :enter
91
60
 
92
61
  The first suggested link will be selected by pressing arrow down (``'Down'``) and navigated to (``'Enter'``). Using the same key events, you could even teach a script to play platform games:
93
62
 
@@ -96,12 +65,12 @@ The first suggested link will be selected by pressing arrow down (``'Down'``) an
96
65
 
97
66
  browser.goto 'http://www.phoboslab.org/biolab/'
98
67
  sleep 2
99
- browser.key 'X'
68
+ browser.keys.send 'X'
100
69
  sleep 1
101
- browser.key_down 'Right'
102
- 5.times { browser.key 'X' }
103
- 2.times { browser.key 'C' }
104
- browser.key_up 'Right'
70
+ browser.keys.down :right
71
+ 5.times { browser.keys.send 'X' }
72
+ 2.times { browser.keys.send 'C' }
73
+ browser.keys.up :right
105
74
 
106
75
  Sending commands to the browser is great, but sometimes we want to get something back too. The following lines of code will have the browser automatically look up the phone number of Opera Software in the [yellow pages](http://gulesider.no/) and write it to the console.
107
76
 
@@ -111,9 +80,9 @@ Sending commands to the browser is great, but sometimes we want to get something
111
80
  browser = OperaWatir::Browser.new
112
81
 
113
82
  browser.goto 'http://gulesider.no/'
114
- browser.text_field(:name => 'search_word').set 'Opera Software'
115
- browser.button(:name => 'btn_cs').click
116
- puts browser.li(:class => 'tel').text
83
+ browser.text_field(:name, 'search_word').set 'Opera Software'
84
+ browser.button(:name, 'btn_cs').click
85
+ puts browser.li(:class, 'tel').text
117
86
 
118
87
  When running proper functional tests on your web application with Watir, you might want a bit more structured output. To define assertions and get pretty test reports, you can use [RSpec](http://rspec.info/), a behaviour-driven testing framework.
119
88
 
@@ -125,15 +94,15 @@ When writing test suites you can use the OperaWatir::Helper class to help ease s
125
94
  end
126
95
 
127
96
  it 'finds the phone number to Opera Software' do
128
- browser.text_field(:name => 'search_word').set 'Opera Software'
129
- browser.button(:name => 'btn_cs').click
97
+ browser.text_field(:name, 'search_word').set 'Opera Software'
98
+ browser.button(:name, 'btn_cs').click
130
99
  browser.li(:class => 'tel').text.should == '24 16 40 00'
131
100
  end
132
101
 
133
102
  it 'finds the phone number to the Norwegian Opera and Ballet' do
134
- browser.text_field(:name => 'search_word').set 'Den Norske Opera'
135
- browser.button(:name => 'btn_cs').click
136
- browser.li(:class => 'tel').text.should == '21 42 21 00'
103
+ browser.text_field(:name, 'search_word').set 'Den Norske Opera'
104
+ browser.button(:name, 'btn_cs').click
105
+ browser.li(:class, 'tel').text.should == '21 42 21 00'
137
106
  end
138
107
  end
139
108
 
@@ -149,3 +118,51 @@ Each block of code corresponds to a single named test case returning PASS or FAI
149
118
  2 examples, 0 failures
150
119
 
151
120
  If anything fails, more information about each failure will be provided.
121
+
122
+ You can also see ``operawatir -h`` for more usage information:
123
+
124
+ Usage: operawatir [-m|--manual] [-l|--launcher=BINARY] [--binary=BINARY]
125
+ [-a|--args=ARGUMENTS] [-q|--no-quit] [--opera-idle] [-b|--backtrace]
126
+ [--no-color] [-t|--tag=TAG] [-f|--format=FORMAT] [-o|--out=FILE]
127
+ [-h|--help] [-v|--version] FILES
128
+
129
+ Specific options:
130
+ -m, --manual Wait for a manual connection from opera:debug
131
+ -l, --launcher=BINARY Path to launcher binary, will use environmental
132
+ variable OPERA_LAUNCHER if not specified
133
+ --binary=BINARY Browser to run the test with, will use guess the
134
+ path or use environmental variable OPERA_PATH if
135
+ not specified
136
+ -a, --args=ARGUMENTS Arguments passed to the binary, will override
137
+ environmental variable OPERA_ARGS
138
+ -q, --no-quit Disable quitting of Opera at the end of a test run
139
+ --opera-idle Enable OperaIdle
140
+ -b, --backtrace Enable full backtrace
141
+ --no-color Disable colorized output
142
+ -t, --tag=TAG Specify tags to only run examples with the specified
143
+ tag, to exclude examples, add ~ before the tag (e.g.
144
+ `~slow')
145
+ -o, --out=FILE Send output to a file instead of STDOUT
146
+ -f, --format=FORMAT Specify RSpec output formatter (documentation,
147
+ html, progress (default), textmate)
148
+
149
+ Common options:
150
+ -h, --help Show this message
151
+ -v, --version Show version
152
+
153
+ ## Third-Party Libraries
154
+
155
+ OperaWatir uses the following libraries:
156
+
157
+ - [OperaDriver](http://www.opera.com/developer/tools/operadriver/) (Apache 2.0 License)
158
+ - [rspec](https://github.com/rspec/rspec) (MIT License)
159
+ - [jeweler](https://github.com/technicalpickles/jeweler) (MIT License)
160
+ - [rake](https://github.com/jimweirich/rake) (MIT License)
161
+ - [yard](https://github.com/lsegal/yard) (MIT License)
162
+ - [mongrel](http://rubyforge.org/projects/mongrel) (Ruby License)
163
+ - [sinatra](http://www.sinatrarb.com/) (MIT License)
164
+ - [rr](http://rubyforge.org/projects/double-ruby) (MIT License)
165
+ - [bluecloth](http://deveiate.org/projects/BlueCloth) (BSD License)
166
+ - [clipboard](https://github.com/janlelis/clipboard) (MIT License)
167
+ - [deprecated](https://github.com/erikh/deprecated) (BSD License)
168
+ - [bundler](http://gembundler.com/) (MIT License)
data/Rakefile CHANGED
@@ -17,24 +17,20 @@ Jeweler::Tasks.new do |gem|
17
17
  gem.summary = 'Toolkit for automating interactions with the Opera web browser.'
18
18
  gem.description = <<-EOF
19
19
  OperaWatir is a part of the Watir (pronounced water) family of
20
- free software Ruby libraries for automating web
21
- browsers. OperaWatir provides a querying engine and Ruby bindings
22
- for a backend Java library, OperaDriver, for driving the Opera web
23
- browser. It aims for full compliancy with the watirspec
24
- specification.
20
+ free software Ruby libraries for automating web browsers.
21
+ OperaWatir provides a querying engine and Ruby bindings for a
22
+ backend Java library, OperaDriver, for driving the Opera web
23
+ browser. It aims for full compliancy with the Watir 2 and Watir 3
24
+ specifications.
25
25
  EOF
26
26
 
27
27
  gem.rubyforge_project = gem.name
28
28
 
29
29
  gem.platform = 'jruby'
30
- gem.required_ruby_version = '>= 1.8.7'
31
30
  gem.has_rdoc = true
32
31
  gem.extra_rdoc_files = ['README.md']
33
32
 
34
- gem.add_dependency 'rspec', '= 2.4'
35
- gem.add_dependency 'inifile', '>= 0.3'
36
- gem.add_dependency 'i18n'
37
- gem.add_dependency 'activesupport', '>= 3.0.1'
33
+ gem.add_dependency 'rspec', '>= 2.4'
38
34
  gem.add_dependency 'deprecated'
39
35
 
40
36
  gem.add_development_dependency 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4
1
+ 0.4.1
data/bin/desktopwatir CHANGED
@@ -4,15 +4,19 @@ require 'optparse'
4
4
  require 'rspec'
5
5
  require 'rbconfig'
6
6
  require 'operawatir'
7
- require 'operawatir/desktop_helper'
7
+
8
8
 
9
9
  @options = {
10
- :ng => false,
11
- :color_enabled => Config::CONFIG['host_os'] =~ /mswin|mingw|bccwin|wince|emx/ ? false : true,
12
- :check_syntax => false,
13
- :format => 'progress',
14
- :no_quit => false,
15
- :no_restart => false
10
+ #:manual => false,
11
+ :ng => false,
12
+ :color_enabled => true,
13
+ :check_syntax => false,
14
+ :output_stream => IO.new(1, 'w'),
15
+ :format => 'progress',
16
+ :no_quit => false,
17
+ :no_restart => false,
18
+ :opera_idle => false,
19
+ #:full_backtrace => false # TODO: Provide fix for RSpec
16
20
  }
17
21
 
18
22
  # TODO
@@ -21,13 +25,21 @@ require 'operawatir/desktop_helper'
21
25
  begin
22
26
  OptionParser.new do |opts|
23
27
  opts.banner = <<EOS
24
- Usage: desktopwatir [-l|--launcher=BINARY] [-e|--executable=BINARY] [-a|--args=ARGUMENTS]
25
- [--no-color] [-q|--no-quit] [-r|--no-restart] [-f|--format=FORMAT] [-o|--out=FILE] [-h|--help] [-v|--version] FILES
28
+
29
+ Usage: desktopwatir [-l|--launcher=BINARY] [-e|--executable=BINARY]
30
+ [-a|--args=ARGUMENTS] [--no-color] [-q|--no-quit] [-r|--no-restart]
31
+ [--opera-idle] [-b|--backtrace] [-t|--tag=TAG] [-f|--format=FORMAT]
32
+ [-o|--out=FILE] [-h|--help] [-v|--version] FILES
26
33
  EOS
27
34
 
28
- opts.separator ""
29
- opts.separator "Specific options:"
35
+ opts.separator ''
36
+ opts.separator 'Specific options:'
30
37
 
38
+ #run without launcher and with manual connection, restart not possible (same as -rq)
39
+ #opts.on('-m', '--manual', 'Wait for a manual connection from opera:debug') do |c|
40
+ # @options[:manual] = c
41
+ #end
42
+
31
43
  opts.on('-l', '--launcher=BINARY', 'Path to launcher binary, will use environmental ',
32
44
  'variable OPERA_LAUNCHER if not specified') do |c|
33
45
  @options[:launcher] = c
@@ -46,35 +58,41 @@ EOS
46
58
  opts.on('--no-color', 'Disable colorized output') do |c|
47
59
  @options[:color_enabled] = false
48
60
  end
49
-
61
+
50
62
  opts.on('-q', '--no-quit', 'Disable quitting of Opera at the end of a testrun') do |c|
51
63
  @options[:no_quit] = true
52
64
  end
53
65
 
54
- opts.on('-r', '--no-restart', 'Disables automatic relaunching of Opera') do |c|
66
+ opts.on('-r', '--no-restart', 'Disables automatic relaunching of Opera') do |c|
55
67
  @options[:no_restart] = true
56
68
  end
57
69
 
58
- #opts.on('-c', '--check-syntax', 'Check syntax only') do |c|
59
- # @options[:check_syntax] = true
60
- #end
70
+ opts.on('--opera-idle', 'Enable OperaIdle') do |c|
71
+ @options[:opera_idle] = true
72
+ end
61
73
 
62
- #opts.on('--ng', 'Connect to Nailgun server instead of starting out ',
63
- # 'own JVM') do |ng|
64
- # @options[:ng] = ng
65
- #end
74
+ opts.on('-b', '--backtrace', 'Enable full backtrace') do |c|
75
+ @options[:full_backtrace] = true
76
+ end
77
+
78
+ opts.on('-o', '--out=FILE', 'Send output to a file instead of STDOUT') do |o|
79
+ @options[:output_stream] = File.open(o, 'w') or
80
+ abort "desktopwatir: Unable to write to file `#{o}'"
81
+ end
66
82
 
67
83
  opts.on('-f', '--format=FORMAT',
68
84
  'Specify RSpec output formatter (documentation, html, ',
69
85
  'progress (default), textmate)') do |formatter|
70
86
  @options[:formatter] = formatter
71
87
  end
72
-
73
- opts.on('-o', '--out=FILE', 'Send output to a file instead of STDOUT') do |o|
74
- @options[:output_stream] = File.open(o, 'w') or
75
- abort "desktopwatir: Unable to write to file `#{o}'"
88
+
89
+ opts.on('-t', '--tag=TAG',
90
+ 'Specify tags to only run examples with the specified tag
91
+ To exclude examples, add ~ before the tag (e.g. ~slow)
92
+ (TAG is always converted to a symbol)') do |tag|
93
+ @options[:filter_run] = tag
76
94
  end
77
-
95
+
78
96
  opts.separator ''
79
97
  opts.separator 'Common options:'
80
98
 
@@ -93,10 +111,15 @@ end
93
111
  if ARGV.empty?
94
112
  abort 'desktopwatir: You need to specify at least one test file to run'
95
113
  else
96
- @options[:files_to_run] = ARGV
97
- @options[:files_to_run].map! { | f | Dir.glob(f) }.flatten!
114
+ @options[:files_or_directories_to_run] = ARGV
115
+ @options[:files_or_directories_to_run].map! do | f |
116
+ if f.include? "\\"
117
+ f
118
+ else
119
+ Dir.glob(f)
120
+ end
121
+ end.flatten!
98
122
  end
99
123
 
100
- #abort 'desktopwatir: --ng and --check-syntax are disabled for now' if @options[:ng] || @options[:check_syntax]
101
-
124
+ require 'operawatir/desktop_helper'
102
125
  OperaWatir::DesktopHelper.run! @options
data/bin/operawatir CHANGED
@@ -1,16 +1,21 @@
1
1
  #!/usr/bin/env jruby
2
2
  require 'rubygems'
3
3
  require 'optparse'
4
+ require 'stringio'
4
5
  require 'rspec'
5
6
  require 'rbconfig'
6
7
  require 'operawatir'
7
- require 'operawatir/helper'
8
8
 
9
9
  @options = {
10
- :ng => false,
11
- :color_enabled => OperaWatir::Platform.os == :windows ? false : true,
12
- :check_syntax => false,
13
- :format => 'progress'
10
+ :manual => false,
11
+ :ng => false,
12
+ :color_enabled => true,
13
+ :check_syntax => false,
14
+ :output_stream => IO.new(1, 'w'),
15
+ :format => 'progress',
16
+ :no_quit => false,
17
+ :opera_idle => false,
18
+ #:full_backtrace => false # TODO: Provide fix for RSpec
14
19
  }
15
20
 
16
21
  # TODO
@@ -19,36 +24,56 @@ require 'operawatir/helper'
19
24
  begin
20
25
  OptionParser.new do |opts|
21
26
  opts.banner = <<EOS
22
- Usage: operawatir [-l|--launcher=BINARY] [-b|--binary=BINARY] [-a|--args=ARGUMENTS]
23
- [--no-color] [-f|--format=FORMAT] [-o|--out=FILE] [-h|--help] [-v|--version] FILES
27
+ Usage: operawatir [-m|--manual] [-l|--launcher=BINARY] [--binary=BINARY]
28
+ [-a|--args=ARGUMENTS] [-q|--no-quit] [--opera-idle] [-b|--backtrace]
29
+ [--no-color] [-t|--tag=TAG] [-f|--format=FORMAT] [-o|--out=FILE]
30
+ [-h|--help] [-v|--version] FILES
24
31
  EOS
25
32
 
26
- opts.separator ""
27
- opts.separator "Specific options:"
33
+ opts.separator ''
34
+ opts.separator 'Specific options:'
35
+
36
+ opts.on('-m', '--manual', 'Wait for a manual connection from opera:debug') do |c|
37
+ @options[:manual] = c
38
+ end
28
39
 
29
40
  opts.on('-l', '--launcher=BINARY', 'Path to launcher binary, will use environmental ',
30
41
  'variable OPERA_LAUNCHER if not specified') do |c|
31
42
  @options[:launcher] = c
32
43
  end
33
44
 
34
- opts.on('-b', '--binary=BINARY', 'Browser to run the test with, will use environmental ',
35
- 'variable OPERA_PATH if not specified') do |e|
45
+ opts.on('--binary=BINARY', 'Browser to run the test with, will use guess the ',
46
+ 'path or use environmental variable OPERA_PATH if ',
47
+ 'not specified') do |e|
36
48
  @options[:path] = e
37
49
  end
38
50
 
39
- opts.on('-a', '--args=ARGUMENTS', 'Arguments passed to the executable. ',
40
- 'Will override environmental variable OPERA_ARGS') do |a|
51
+ opts.on('-a', '--args=ARGUMENTS', 'Arguments passed to the binary, will override ',
52
+ 'environmental variable OPERA_ARGS') do |a|
41
53
  @options[:args] = a
42
54
  end
43
55
 
56
+ opts.on('-q', '--no-quit', 'Disable quitting of Opera at the end of a test run') do |c|
57
+ @options[:no_quit] = true
58
+ end
59
+
60
+ opts.on('--opera-idle', 'Enable OperaIdle') do |c|
61
+ @options[:opera_idle] = true
62
+ end
63
+
64
+ opts.on('-b', '--backtrace', 'Enable full backtrace') do |c|
65
+ @options[:full_backtrace] = true
66
+ end
67
+
44
68
  opts.on('--no-color', 'Disable colorized output') do |c|
45
69
  @options[:color_enabled] = false
46
70
  end
47
71
 
48
- opts.on('-f', '--format=FORMAT',
49
- 'Specify RSpec output formatter (documentation, html, ',
50
- 'progress (default), textmate)') do |formatter|
51
- @options[:formatter] = formatter
72
+ opts.on('-t', '--tag=TAG',
73
+ 'Specify tags to only run examples with the specified',
74
+ 'tag, to exclude examples, add ~ before the tag (e.g.',
75
+ "`~slow')") do |tag|
76
+ @options[:filter_run] = tag
52
77
  end
53
78
 
54
79
  opts.on('-o', '--out=FILE', 'Send output to a file instead of STDOUT') do |o|
@@ -56,6 +81,12 @@ EOS
56
81
  abort "operawatir: Unable to write to file `#{o}'"
57
82
  end
58
83
 
84
+ opts.on('-f', '--format=FORMAT',
85
+ 'Specify RSpec output formatter (documentation, ',
86
+ 'html, progress (default), textmate)') do |formatter|
87
+ @options[:formatter] = formatter
88
+ end
89
+
59
90
  opts.separator ''
60
91
  opts.separator 'Common options:'
61
92
 
@@ -74,7 +105,8 @@ end
74
105
  if ARGV.empty?
75
106
  abort 'operawatir: You need to specify at least one test file to run'
76
107
  else
77
- @options[:files_to_run] = ARGV
108
+ @options[:files_or_directories_to_run] = ARGV
78
109
  end
79
110
 
111
+ require 'operawatir/helper'
80
112
  OperaWatir::Helper.run! @options