operawatir 0.4.1.pre2-jruby → 0.4.1.pre3-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/CHANGES +233 -0
  2. data/VERSION +1 -1
  3. data/bin/desktopwatir +36 -16
  4. data/bin/operawatir +27 -14
  5. data/lib/operadriver/webdriver-opera.jar +0 -0
  6. data/lib/operawatir/compat/browser.rb +0 -5
  7. data/lib/operawatir/compat/collection.rb +2 -0
  8. data/lib/operawatir/compat/element.rb +3 -0
  9. data/lib/operawatir/compat/element_finders.rb +4 -0
  10. data/lib/operawatir/compat/selector.rb +7 -0
  11. data/lib/operawatir/compat/window.rb +8 -0
  12. data/lib/operawatir/compat.rb +3 -2
  13. data/lib/operawatir/desktop_browser.rb +18 -6
  14. data/lib/operawatir/desktop_helper.rb +2 -0
  15. data/lib/operawatir/quickwidgets/quick_addressfield.rb +12 -0
  16. data/lib/operawatir/quickwidgets/quick_checkbox.rb +1 -1
  17. data/lib/operawatir/quickwidgets/quick_editfield.rb +7 -4
  18. data/lib/operawatir/quickwidgets/quick_searchfield.rb +2 -0
  19. data/lib/operawatir/quickwidgets/quick_widget.rb +1 -1
  20. data/lib/operawatir/quickwidgets/quick_window.rb +6 -2
  21. data/lib/operawatir/screenshot.rb +46 -0
  22. data/lib/operawatir/window.rb +19 -16
  23. data/lib/operawatir.rb +1 -0
  24. data/operawatir.gemspec +23 -2
  25. data/spec/operawatir/core/screenshot_spec.rb +76 -0
  26. data/spec/operawatir/core/window_spec.rb +1 -12
  27. data/spec/operawatir/desktop/desktopbrowser_spec.rb +300 -0
  28. data/spec/operawatir/desktop/quickaddressfield_spec.rb +47 -0
  29. data/spec/operawatir/desktop/quickbutton_spec.rb +34 -0
  30. data/spec/operawatir/desktop/quickwidget_spec.rb +60 -0
  31. data/spec/operawatir/desktop/quickwindow_spec.rb +97 -0
  32. data/spec/operawatir/desktop/shared/shared.rb +48 -0
  33. data/spec/operawatir/matchers.rb +68 -0
  34. data/spec/operawatir/watirspec_desktophelper.rb +14 -0
  35. data/spec/operawatir/watirspec_helper.rb +1 -1
  36. data/spec/watir2/element_spec.rb +90 -21
  37. metadata +24 -3
data/CHANGES ADDED
@@ -0,0 +1,233 @@
1
+ v0.4.1.pre3 2011-03-14
2
+
3
+ [API CHANGES]
4
+
5
+ * window.element (and browser.element if you're running in
6
+ compatibility mode) now works. Fixes backwards compatibility for
7
+ SPARTAN tests. Related to WTR-260. (andreastt)
8
+
9
+ * :selector has now been added as a basic type in Watir 2
10
+ compatibility mode (e.g. element(:css, 'foo')). This is aliased to
11
+ :css. Added method Compat::Collection#find_elements_by_selector as
12
+ alias to Collection#find_by_css. (andreastt)
13
+
14
+ * Element#get_hash is now alias to Element#visual_hash for backwards
15
+ compatiblity with WTR-260. (andreastt)
16
+
17
+ * Window#get_hash is now aliased to Window#visual_hash for backwards
18
+ compatibility with WTR-260. (andreastt)
19
+
20
+ * Compat::Browser#quit is no longer needed, removed method. We no
21
+ longer use Browser#quit! which it was an alias for. (andreastt)
22
+
23
+ * Window#screenshot now returns a Screenshot interface or the absolute
24
+ path to the file depending on whether an argument is given. This
25
+ provides backwards compatibility, but also allows you to access the
26
+ newly added methods Screenshot#save, …#blank?, …#png and …#md5.
27
+ (andreastt)
28
+
29
+ * Removed timeout argument to Window#visual_hash. We now default to
30
+ 50 milliseconds. (andreastt)
31
+
32
+ * Added Window#document which returns the body/document of a page.
33
+ (andreastt)
34
+
35
+ [NEW FEATURES]
36
+
37
+ * New command-line option --tag (or -t for short) for specifying to
38
+ run only tagged tests. Adding ~ (tilde) before the tag (e.g. ~slow)
39
+ will exclude given tests.
40
+
41
+ * New command-line option --backtrace (or -b for short) for enabling
42
+ full backtraces from RSpec. As a result, --binary has lost its
43
+ shortcut -b. (andreastt)
44
+
45
+ * Implemented a new screenshot API that exposes ScreenShotReply from
46
+ OperaDriver. (andreastt)
47
+
48
+ [ENHANCEMENTS]
49
+
50
+ * Upgraded to OperaDriver v0.4.2.pre5. (andreastt)
51
+
52
+ * Added specifications tests for Desktop part of OperaWatir. (karie,
53
+ mariap)
54
+
55
+ * OperaWatir specification tests for Desktop are now using RSpec
56
+ matchers. Makes it easier to expect windows to be closed, opened,
57
+ &c. (karie)
58
+
59
+ * --no-opera-idle has been renamed to --opera-idle. OperaIdle is now
60
+ by default switched off due to instability. (andreastt)
61
+
62
+ * Synced operawatir and desktopwatir binaries. (andreastt)
63
+
64
+ * Updated /spec/watir2/element_spec.rb to HEAD from watirspec.
65
+ (andreastt)
66
+
67
+ [BUG FIXES]
68
+
69
+ * desktopwatir is no longer writing to STDERR, but to STDOUT.
70
+ (andreastt)
71
+
72
+ * Window#get_hash and Element#get_hash methods are now marked as
73
+ deprecated.
74
+
75
+ * Resolved failing to activate address field will use the current
76
+ control without any errors. Fixes DSK-320799. (karie)
77
+
78
+ * Widgets should return widgets listing from active Document Window.
79
+ Fixes DSK-330102. (karie)
80
+
81
+ * Renamed paramter in DesktopBrowser#widgets since it's not
82
+ necessarily the window name the user will be looking for. (karie)
83
+
84
+ * Added more load actions to be handled by load_window_with_action.
85
+ Fixes DSK-320817. (karie)
86
+
87
+ * Failing to activate address field will use the current control
88
+ without any errors. Focus moved from edit_field to its subclass
89
+ before call to enter text. Fixes DSK-320799. (karie)
90
+
91
+ * Defaulting to active window when Document Window is specified, fixed
92
+ to only default when active window is actually a Document Window.
93
+ Related to DSK-320786. (karie)
94
+
95
+ * Documentation fixes in Desktop code. (karie)
96
+
97
+ [OTHER]
98
+
99
+ * Updated /README.me with the latest version requirements.
100
+ (andreastt)
101
+
102
+ * Added /CHANGES (this). (andreastt)
103
+
104
+ v0.4.1.pre2 2011-03-08
105
+
106
+ [BUG FIXES]
107
+
108
+ * Stringifying text before splitting it in Element#text=. Thanks to
109
+ Hallvord R. M. Steen. (andreastt)
110
+
111
+ * Depending on RSpec v2.4 or above, not v2.5 or less as we did
112
+ previously. This resolves upgrading OperaWatir if you already have
113
+ an ancient version of RSpec installed (like we did on SPARTAN).
114
+ (andreastt)
115
+
116
+ v0.4.1.pre1 2011-03-04
117
+
118
+ [API CHANGES]
119
+
120
+ * Moved deprecated keyboard interaction methods (Window#key,
121
+ Window#key_down, Window#key_up, Window#type) from Window to Browser.
122
+ If you're running operawatir in Watir 2 compatibility mode (which is
123
+ enabled by default), this won't change anything for you.
124
+ (andreastt)
125
+
126
+ * Added a new preferences API which is accessible from
127
+ browser.preferences. Removed Browser#set_preference,
128
+ Browser#get_default_preference and Browser#get_preference.
129
+ (andreastt)
130
+
131
+ * Removed Browser#pid. (wilhelmja)
132
+
133
+ * Removed Browser#goto. It's still available in Browser::Compat#goto,
134
+ which is included by default. (andreastt)
135
+
136
+ * Added DesktopBrowser#get_preference, DesktopBrowser#set_preference
137
+ and DesktopBrowser#get_default_preference. (karie)
138
+
139
+ * Removed Browser#exists? and Browser#connected?. (andreastt)
140
+
141
+ [NEW FEATURES]
142
+
143
+ * Support for disabling OperaIdle with --no-opera-idle. (andreastt)
144
+
145
+ * Added option to wait for connection from Opera. operawatir binary
146
+ now accepts --manual (or -m for short). This will allow you to go
147
+ to opera:debug and hit connect manually. (andreastt)
148
+
149
+ [ENHANCEMENTS]
150
+
151
+ * Updated OperaDriver to v0.4.2.pre2. (andreastt)
152
+
153
+ * Added tests for deprecated method Window#eval_js. (wilhelmja)
154
+
155
+ * Added deprecation notice to Element#compare_hash. (andreastt)
156
+
157
+ * Added specification tests for Window#screenshot,
158
+ Element#triple_click, Element#compare_hash. (wilhelmja)
159
+
160
+ * Added more specification tests for Window#quadruple_click.
161
+ (andreastt)
162
+
163
+ * DesktopBrowser is now using guessOperaPath from OperaDriver.
164
+ (karie)
165
+
166
+ [BUG FIXES]
167
+
168
+ * Fixed passing wrong variable (param instead of args) in
169
+ Browser#opera_action. This fixes browser.opera_action('foo').
170
+ (wilhelmja)
171
+
172
+ * Browser#ua_string now returns the navigator.userAgent value from
173
+ JavaScript. (wilhelmja)
174
+
175
+ * Browser#platform now returns the navigator.platform value from
176
+ JavaScript. (wilhelmja)
177
+
178
+ * Compat::Element#text now supports getting texteditable values from
179
+ input, textarea and select elements. (andreastt)
180
+
181
+ * Requiring stringio as JRuby apparently doesn't by default, fixes
182
+ problem with RSpec formatters. (andreastt)
183
+
184
+ * Colours are now enabled by default, even on Windows. Installing the
185
+ gem `ansicolor' fixes colour problems on Windows. (andreastt)
186
+
187
+ * --output now writes to a file, was broken when upgrading to RSpec
188
+ v2.5. (andreastt)
189
+
190
+ * --format was not working, fixed. (andreastt)
191
+
192
+ * Now requiring RSpec v2.5, not v2.5.1. rspec-core is v2.5.1, but the
193
+ main gem, rspec, is only 2.5. (andreastt)
194
+
195
+ * operawatir-launched tests now write to STDOUT instead of STDERR.
196
+ (andreastt)
197
+
198
+ * Check that Browser#desktop? actually returns true or false.
199
+ (wilhelmja)
200
+
201
+ * Check that Window#visual_hash and Element#visual_hash returns a hash
202
+ in the correct format 8an md5sum preceded by 0x. (wilhelmja)
203
+
204
+ * Added tests for Window#visual_hash and Browser#desktop?.
205
+ (wilhelmja)
206
+
207
+ * Misc. test name fixes. (wilhelmja)
208
+
209
+ * Removing Ruby platform dependency. (andreastt)
210
+
211
+ * We need to exit forcibly (I think because of RSpec) when we come to
212
+ the end of the test suite. (andreastt)
213
+
214
+ * Fixed compat problem and changed autostart fix to use empty Opera
215
+ path instead of separate setting. (karie)
216
+
217
+ * Super goto (in DesktopBrowser) disappeared, so don't use it.
218
+
219
+ [OTHER]
220
+
221
+ * Updated /README.md with the latest version requirements.
222
+ (andreastt)
223
+
224
+ * Updated documentation in /README.md. Also added a new section
225
+ listing the operawatir binary's option list. (andreastt)
226
+
227
+ * Set up framework for OperaWatir-specific specification tests.
228
+ (andreastt)
229
+
230
+ * Renamed /spec/legacy_watirspec to /spec/watir2. (andreastt)
231
+
232
+ * Renamed /spec/new_watirspec to /spec/watir3. (andreastt)
233
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1.pre2
1
+ 0.4.1.pre3
data/bin/desktopwatir CHANGED
@@ -7,12 +7,15 @@ require 'operawatir'
7
7
  require 'operawatir/desktop_helper'
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
+ :ng => false,
11
+ :color_enabled => true,
12
+ :check_syntax => false,
13
+ :output_stream => IO.new(1, 'w'),
14
+ :format => 'progress',
15
+ :no_quit => false,
16
+ :no_restart => false,
17
+ :opera_idle => false,
18
+ :full_backtrace => false
16
19
  }
17
20
 
18
21
  # TODO
@@ -21,12 +24,14 @@ require 'operawatir/desktop_helper'
21
24
  begin
22
25
  OptionParser.new do |opts|
23
26
  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
27
+ Usage: desktopwatir [-l|--launcher=BINARY] [-e|--executable=BINARY]
28
+ [-a|--args=ARGUMENTS] [--no-color] [-q|--no-quit] [-r|--no-restart]
29
+ [--opera-idle] [-b|--backtrace] [-t|--tag=TAG] [-f|--format=FORMAT]
30
+ [-o|--out=FILE] [-h|--help] [-v|--version] FILES
26
31
  EOS
27
32
 
28
- opts.separator ""
29
- opts.separator "Specific options:"
33
+ opts.separator ''
34
+ opts.separator 'Specific options:'
30
35
 
31
36
  opts.on('-l', '--launcher=BINARY', 'Path to launcher binary, will use environmental ',
32
37
  'variable OPERA_LAUNCHER if not specified') do |c|
@@ -51,10 +56,18 @@ EOS
51
56
  @options[:no_quit] = true
52
57
  end
53
58
 
54
- opts.on('-r', '--no-restart', 'Disables automatic relaunching of Opera') do |c|
59
+ opts.on('-r', '--no-restart', 'Disables automatic relaunching of Opera') do |c|
55
60
  @options[:no_restart] = true
56
61
  end
57
62
 
63
+ opts.on('--opera-idle', 'Enable OperaIdle') do |c|
64
+ @options[:opera_idle] = true
65
+ end
66
+
67
+ opts.on('-b', '--backtrace', 'Enable full backtrace') do |c|
68
+ @options[:full_backtrace] = true
69
+ end
70
+
58
71
  #opts.on('-c', '--check-syntax', 'Check syntax only') do |c|
59
72
  # @options[:check_syntax] = true
60
73
  #end
@@ -63,18 +76,25 @@ EOS
63
76
  # 'own JVM') do |ng|
64
77
  # @options[:ng] = ng
65
78
  #end
79
+
80
+ opts.on('-o', '--out=FILE', 'Send output to a file instead of STDOUT') do |o|
81
+ @options[:output_stream] = File.open(o, 'w') or
82
+ abort "desktopwatir: Unable to write to file `#{o}'"
83
+ end
66
84
 
67
85
  opts.on('-f', '--format=FORMAT',
68
86
  'Specify RSpec output formatter (documentation, html, ',
69
87
  'progress (default), textmate)') do |formatter|
70
88
  @options[:formatter] = formatter
71
89
  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}'"
90
+
91
+ opts.on('-t', '--tag=TAG',
92
+ 'Specify tags to only run examples with the specified tag
93
+ To exclude examples, add ~ before the tag (e.g. ~slow)
94
+ (TAG is always converted to a symbol)') do |tag|
95
+ @options[:filter_run] = tag
76
96
  end
77
-
97
+
78
98
  opts.separator ''
79
99
  opts.separator 'Common options:'
80
100
 
data/bin/operawatir CHANGED
@@ -8,14 +8,15 @@ require 'operawatir'
8
8
  require 'operawatir/helper'
9
9
 
10
10
  @options = {
11
- :manual => false,
12
- :ng => false,
13
- :color_enabled => true,
14
- :check_syntax => false,
15
- :output_stream => IO.new(1, 'w'),
16
- :format => 'progress',
17
- :no_quit => false,
18
- :opera_idle => true
11
+ :manual => false,
12
+ :ng => false,
13
+ :color_enabled => true,
14
+ :check_syntax => false,
15
+ :output_stream => IO.new(1, 'w'),
16
+ :format => 'progress',
17
+ :no_quit => false,
18
+ :opera_idle => false,
19
+ #:full_backtrace => false # TODO: Provide fix for RSpec
19
20
  }
20
21
 
21
22
  # TODO
@@ -24,9 +25,10 @@ require 'operawatir/helper'
24
25
  begin
25
26
  OptionParser.new do |opts|
26
27
  opts.banner = <<EOS
27
- Usage: operawatir [-m|--manual] [-l|--launcher=BINARY] [-b|--binary=BINARY]
28
- [-a|--args=ARGUMENTS] [-q|--no-quit] [--no-opera-idle] [--no-color]
29
- [-f|--format=FORMAT] [-o|--out=FILE] [-h|--help] [-v|--version] FILES
28
+ Usage: operawatir [-m|--manual] [-l|--launcher=BINARY] [--binary=BINARY]
29
+ [-a|--args=ARGUMENTS] [-q|--no-quit] [--opera-idle] [-b|--backtrace]
30
+ [--no-color] [-t|--tag=TAG] [-f|--format=FORMAT] [-o|--out=FILE]
31
+ [-h|--help] [-v|--version] FILES
30
32
  EOS
31
33
 
32
34
  opts.separator ""
@@ -41,7 +43,7 @@ EOS
41
43
  @options[:launcher] = c
42
44
  end
43
45
 
44
- opts.on('-b', '--binary=BINARY', 'Browser to run the test with, will use guess the ',
46
+ opts.on('--binary=BINARY', 'Browser to run the test with, will use guess the ',
45
47
  'path or use environmental variable OPERA_PATH if ',
46
48
  'not specified') do |e|
47
49
  @options[:path] = e
@@ -56,14 +58,25 @@ EOS
56
58
  @options[:no_quit] = true
57
59
  end
58
60
 
59
- opts.on('--no-opera-idle', 'Disable OperaIdle') do |c|
60
- @options[:opera_idle] = false
61
+ opts.on('--opera-idle', 'Enable OperaIdle') do |c|
62
+ @options[:opera_idle] = true
63
+ end
64
+
65
+ opts.on('-b', '--backtrace', 'Enable full backtrace') do |c|
66
+ @options[:full_backtrace] = true
61
67
  end
62
68
 
63
69
  opts.on('--no-color', 'Disable colorized output') do |c|
64
70
  @options[:color_enabled] = false
65
71
  end
66
72
 
73
+ opts.on('-t', '--tag=TAG',
74
+ 'Specify tags to only run examples with the specified',
75
+ 'tag, to exclude examples, add ~ before the tag (e.g.',
76
+ "`~slow')") do |tag|
77
+ @options[:filter_run] = tag
78
+ end
79
+
67
80
  opts.on('-o', '--out=FILE', 'Send output to a file instead of STDOUT') do |o|
68
81
  @options[:output_stream] = File.open(o, 'w') or
69
82
  abort "operawatir: Unable to write to file `#{o}'"
Binary file
@@ -11,11 +11,6 @@ module OperaWatir
11
11
  end
12
12
  end
13
13
 
14
- # Quits the browser
15
- def quit
16
- browser.quit!
17
- end
18
-
19
14
  # Class#type is defined by Ruby, it will never reach
20
15
  # #method_missing.
21
16
  def_delegator :active_window, :type
@@ -102,4 +102,6 @@ private
102
102
  blk.call(raw_elements.first)
103
103
  end
104
104
 
105
+ alias_method :find_elements_by_selector, :find_elements_by_css
106
+
105
107
  end
@@ -158,6 +158,9 @@ class OperaWatir::Element
158
158
  end
159
159
  deprecated :compare_hash, 'element.visual_hash'
160
160
 
161
+ alias_method :get_hash, :visual_hash
162
+ deprecated :get_hash, 'element.visual_hash'
163
+
161
164
  private
162
165
 
163
166
  def assert_enabled!
@@ -52,6 +52,10 @@ module OperaWatir::Compat::ElementFinders
52
52
 
53
53
  def_element :dt, :dts
54
54
 
55
+ def_element :element, :elements do |selector|
56
+ selector.xpath '//*'
57
+ end
58
+
55
59
  def_element :em, :ems
56
60
 
57
61
  def_element :file_field, :file_fields, :how => :name do |selector|