watirsplash 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +13 -9
- data/Gemfile.lock +94 -93
- data/History.rdoc +9 -0
- data/License.txt +1 -1
- data/README.rdoc +5 -6
- data/Rakefile +1 -1
- data/lib/watirsplash/browser.rb +6 -5
- data/lib/watirsplash/frameworks/watir.rb +12 -16
- data/lib/watirsplash/generators/helper.rb +1 -1
- data/lib/watirsplash/page/base.rb +1 -4
- data/lib/watirsplash/rspec_patches.rb +99 -146
- data/lib/watirsplash/version.rb +4 -4
- data/spec/browser_spec.rb +2 -2
- data/spec/rspec_patches_spec.rb +9 -26
- data/watirsplash.gemspec +0 -2
- metadata +60 -102
- data/lib/watirsplash/frameworks/firewatir.rb +0 -9
data/Gemfile
CHANGED
@@ -1,18 +1,22 @@
|
|
1
|
-
source :rubygems
|
2
|
-
|
1
|
+
source :rubygems
|
3
2
|
# load WatirSplash and it's dependencies
|
4
3
|
gemspec
|
5
4
|
|
6
5
|
platforms :mingw, :mswin do
|
7
|
-
|
8
|
-
|
6
|
+
gem "watir", WatirSplash::Version::WATIR
|
7
|
+
gem "win32screenshot", WatirSplash::Version::WIN32SCREENSHOT
|
9
8
|
end
|
10
9
|
|
11
10
|
gem "watir-webdriver", WatirSplash::Version::WATIR_WEBDRIVER
|
12
|
-
gem "
|
13
|
-
gem "
|
14
|
-
gem "spork", "~>0.
|
15
|
-
gem "spork-local_process"
|
11
|
+
gem "rspec", "~>2.9.0"
|
12
|
+
gem "spork", "~>0.9.0"
|
13
|
+
gem "spork-local_process", "~> 0.0.7"
|
16
14
|
|
17
15
|
# add your project specific dependencies here:
|
18
|
-
|
16
|
+
platforms :mri_18, :ruby_18, :mingw_18 do
|
17
|
+
# gem "ruby-debug", "0.10.3"
|
18
|
+
end
|
19
|
+
|
20
|
+
platforms :mri_19, :ruby_19, :mingw_19 do
|
21
|
+
# gem "ruby-debug19"
|
22
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,93 +1,94 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
watirsplash (2.4.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
rspec-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
rspec-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
windows-
|
78
|
-
win32-api (>= 1.4.5)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
spork
|
90
|
-
|
91
|
-
watir
|
92
|
-
|
93
|
-
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
watirsplash (2.4.3)
|
5
|
+
require_all
|
6
|
+
syntax
|
7
|
+
thor (~> 0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.2.7)
|
13
|
+
builder (3.0.0)
|
14
|
+
childprocess (0.3.2)
|
15
|
+
ffi (~> 1.0.6)
|
16
|
+
commonwatir (3.0.0)
|
17
|
+
diff-lcs (1.1.3)
|
18
|
+
ffi (1.0.11)
|
19
|
+
hoe (3.0.3)
|
20
|
+
rake (~> 0.8)
|
21
|
+
libwebsocket (0.1.3)
|
22
|
+
addressable
|
23
|
+
mini_magick (3.2.1)
|
24
|
+
subexec (~> 0.0.4)
|
25
|
+
multi_json (1.3.2)
|
26
|
+
nokogiri (1.5.2-x86-mingw32)
|
27
|
+
rake (0.9.2.2)
|
28
|
+
rautomation (0.7.2)
|
29
|
+
require_all (1.2.1)
|
30
|
+
rspec (2.9.0)
|
31
|
+
rspec-core (~> 2.9.0)
|
32
|
+
rspec-expectations (~> 2.9.0)
|
33
|
+
rspec-mocks (~> 2.9.0)
|
34
|
+
rspec-core (2.9.0)
|
35
|
+
rspec-expectations (2.9.0)
|
36
|
+
diff-lcs (~> 1.1.3)
|
37
|
+
rspec-mocks (2.9.0)
|
38
|
+
rubyzip (0.9.7)
|
39
|
+
s4t-utils (1.0.4)
|
40
|
+
hoe (>= 1.3.0)
|
41
|
+
selenium-webdriver (2.21.2)
|
42
|
+
childprocess (>= 0.2.5)
|
43
|
+
ffi (~> 1.0)
|
44
|
+
libwebsocket (~> 0.1.3)
|
45
|
+
multi_json (~> 1.0)
|
46
|
+
rubyzip
|
47
|
+
spork (0.9.0-x86-mingw32)
|
48
|
+
win32-process
|
49
|
+
spork-local_process (0.0.7)
|
50
|
+
spork (~> 0.9.0)
|
51
|
+
subexec (0.0.4)
|
52
|
+
syntax (1.0.0)
|
53
|
+
thor (0.14.6)
|
54
|
+
user-choices (1.1.6.1)
|
55
|
+
builder (>= 2.1.2)
|
56
|
+
s4t-utils (>= 1.0.3)
|
57
|
+
xml-simple (>= 1.0.11)
|
58
|
+
watir (3.0.0)
|
59
|
+
commonwatir (= 3.0.0)
|
60
|
+
watir-classic (~> 3)
|
61
|
+
watir-classic (3.0.0)
|
62
|
+
ffi (~> 1.0)
|
63
|
+
nokogiri
|
64
|
+
rautomation (~> 0.7.2)
|
65
|
+
user-choices
|
66
|
+
win32-process (>= 0.5.5)
|
67
|
+
windows-pr (>= 0.6.6)
|
68
|
+
watir-webdriver (0.5.5)
|
69
|
+
selenium-webdriver (>= 2.18.0)
|
70
|
+
win32-api (1.4.8-x86-mingw32)
|
71
|
+
win32-process (0.6.5)
|
72
|
+
windows-pr (>= 1.1.2)
|
73
|
+
win32screenshot (1.0.7)
|
74
|
+
ffi (~> 1.0)
|
75
|
+
mini_magick (~> 3.2.1)
|
76
|
+
rautomation (~> 0.7.0)
|
77
|
+
windows-api (0.4.1)
|
78
|
+
win32-api (>= 1.4.5)
|
79
|
+
windows-pr (1.2.1)
|
80
|
+
win32-api (>= 1.4.5)
|
81
|
+
windows-api (>= 0.3.0)
|
82
|
+
xml-simple (1.1.1)
|
83
|
+
|
84
|
+
PLATFORMS
|
85
|
+
x86-mingw32
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
rspec (~> 2.9.0)
|
89
|
+
spork (~> 0.9.0)
|
90
|
+
spork-local_process (~> 0.0.7)
|
91
|
+
watir (~> 3.0.0)
|
92
|
+
watir-webdriver (~> 0.5.5)
|
93
|
+
watirsplash!
|
94
|
+
win32screenshot (~> 1.0.7)
|
data/History.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 2.4.3 / 2012-04-23
|
2
|
+
|
3
|
+
* Add support for Watir 3
|
4
|
+
* Add support for file downloads in IE9 with Watir 3
|
5
|
+
* Add support for RSpec 2.9
|
6
|
+
* Remove rake and bundler as gem dependencies
|
7
|
+
* Remove Firewatir support
|
8
|
+
* Remove RSpec #match_array matcher
|
9
|
+
|
1
10
|
=== 2.4.2 / 2011-10-17
|
2
11
|
|
3
12
|
* Fix Page::Base.url to use instance variable instead of class variable
|
data/License.txt
CHANGED
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* Web: http://github.com/jarmo/WatirSplash
|
4
4
|
* Author: Jarmo Pertman (mailto:jarmo.p[at]gmail.com)
|
5
5
|
|
6
|
-
|
6
|
+
{<img alt="Click here to lend your support to: WatirSplash and make a donation at www.pledgie.com !" src="https://www.pledgie.com/campaigns/16193.png?skin_name=chrome" />}[https://www.pledgie.com/campaigns/16193]
|
7
7
|
|
8
8
|
WatirSplash makes browser-based web page testing in Ruby splashin' easy.
|
9
9
|
It combines Watir, FireWatir or Watir-WebDriver for controlling the browser,
|
@@ -17,7 +17,7 @@ testing right away!
|
|
17
17
|
|
18
18
|
== GETTING STARTED
|
19
19
|
|
20
|
-
1) Install Ruby (version 1.
|
20
|
+
1) Install Ruby (version 1.9.3 is recommended)
|
21
21
|
|
22
22
|
2) Install WatirSplash
|
23
23
|
C:\my_project>gem install watirsplash
|
@@ -119,13 +119,12 @@ testing right away!
|
|
119
119
|
== SUPPORTED PLATFORMS & BROWSERS
|
120
120
|
|
121
121
|
WatirSplash supports different frameworks/browsers on different operating systems:
|
122
|
-
* Linux & OS X - watir-webdriver/firefox
|
123
|
-
* Windows - watir, watir-webdriver/firefox, watir-webdriver/chrome
|
122
|
+
* Linux & OS X - watir-webdriver/firefox and watir-webdriver/chrome
|
123
|
+
* Windows - watir, watir-webdriver/firefox, watir-webdriver/chrome and watir-webdriver/ie
|
124
124
|
|
125
125
|
Each framework drives a specific browser:
|
126
126
|
* Watir - IE
|
127
127
|
* Watir-WebDriver - Chrome, IE and Firefox
|
128
|
-
* FireWatir - Firefox
|
129
128
|
|
130
129
|
It is possible to specify what framework to use in spec_helper.rb file:
|
131
130
|
WatirSplash::Util.framework = "watir-webdriver/firefox"
|
@@ -143,4 +142,4 @@ You can read more information about the usage and features from the wiki at http
|
|
143
142
|
|
144
143
|
== COPYRIGHT
|
145
144
|
|
146
|
-
Copyright ©
|
145
|
+
Copyright © Jarmo Pertman. See LICENSE for details.
|
data/Rakefile
CHANGED
data/lib/watirsplash/browser.rb
CHANGED
@@ -4,12 +4,13 @@ module WatirSplash
|
|
4
4
|
class Browser
|
5
5
|
# raises an error if any JavaScript errors were found
|
6
6
|
JAVASCRIPT_ERRORS_CHECKER = lambda do |browser|
|
7
|
-
error_message = browser.execute_script
|
7
|
+
error_message = browser.execute_script %q[
|
8
|
+
var msg = window.__browserErrorMessage;
|
9
|
+
window.__browserErrorMessage = undefined;
|
10
|
+
return msg;
|
11
|
+
]
|
8
12
|
|
9
|
-
|
10
|
-
browser.execute_script "window.__browserErrorMessage = undefined"
|
11
|
-
raise JavaScriptError, "JavaScript error: #{error_message}"
|
12
|
-
end
|
13
|
+
raise JavaScriptError, "JavaScript error: #{error_message}" if error_message
|
13
14
|
|
14
15
|
browser.execute_script %q[
|
15
16
|
if (!window.onErrorFn) {
|
@@ -1,6 +1,6 @@
|
|
1
|
-
WatirSplash::Frameworks::Helper.load_gems "watir", "win32/screenshot"
|
1
|
+
WatirSplash::Frameworks::Helper.load_gems "watir-classic", "win32/screenshot"
|
2
2
|
require "watirsplash/mini_magick_patch"
|
3
|
-
require "watir/ie"
|
3
|
+
require "watir-classic/ie"
|
4
4
|
|
5
5
|
# patches for Watir
|
6
6
|
module Watir
|
@@ -24,7 +24,7 @@ module Watir
|
|
24
24
|
# saves a file with the browser
|
25
25
|
#
|
26
26
|
# clicking the button opens a browser's save as dialog and saves the file document.pdf
|
27
|
-
# button(:id => "something").
|
27
|
+
# button(:id => "something").save_as("c:/document.pdf") # => c:/document.pdf
|
28
28
|
#
|
29
29
|
# * raises an exception if saving the file is unsuccessful
|
30
30
|
# * returns saved file path
|
@@ -32,9 +32,16 @@ module Watir
|
|
32
32
|
path = Pathname.new(file_path)
|
33
33
|
raise "path to #{file_path} has to be absolute!" unless path.absolute?
|
34
34
|
self.click_no_wait
|
35
|
-
RAutomation::Window.new(:title => "File Download").button(:value => "&Save").click
|
36
35
|
|
37
|
-
|
36
|
+
browser_window = page_container.rautomation
|
37
|
+
|
38
|
+
if page_container.class.version.to_i >= 9
|
39
|
+
browser_window.child(:title => "Windows Internet Explorer").button(:value => "Save &as").click
|
40
|
+
else
|
41
|
+
browser_window.child(:title => "File Download").button(:value => "&Save").click
|
42
|
+
end
|
43
|
+
|
44
|
+
save_as_window = browser_window.child(:title => "Save As")
|
38
45
|
save_as_window.text_field(:class => "Edit", :index => 0).set(WatirSplash::Util.file_native_path(file_path))
|
39
46
|
save_as_window.button(:value => "&Save").click
|
40
47
|
|
@@ -43,15 +50,4 @@ module Watir
|
|
43
50
|
end
|
44
51
|
end
|
45
52
|
|
46
|
-
class FileField < InputElement
|
47
|
-
def set(file_path)
|
48
|
-
raise "#{file_path} has to exist to set!" unless File.exists?(file_path)
|
49
|
-
assert_exists
|
50
|
-
self.click_no_wait
|
51
|
-
window = RAutomation::Window.new(:title => /choose file( to upload)?/i)
|
52
|
-
window.text_field(:class => "Edit", :index => 0).set(WatirSplash::Util.file_native_path(file_path))
|
53
|
-
window.button(:value => "&Open").click
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
53
|
end
|
@@ -2,7 +2,7 @@ module WatirSplash
|
|
2
2
|
module Generators
|
3
3
|
module Helper
|
4
4
|
def supported_frameworks
|
5
|
-
%w[default watir
|
5
|
+
%w[default watir watir-webdriver/ie watir-webdriver/firefox watir-webdriver/chrome]
|
6
6
|
end
|
7
7
|
|
8
8
|
def frameworks_banner
|
@@ -1,179 +1,132 @@
|
|
1
|
-
|
2
|
-
require 'rspec/core/formatters/snippet_extractor'
|
3
|
-
|
4
|
-
# patch for https://github.com/rspec/rspec-core/issues/#issue/214
|
5
|
-
module RSpec
|
6
|
-
module Core
|
7
|
-
module Formatters
|
8
|
-
class HtmlFormatter < BaseTextFormatter
|
9
|
-
def extra_failure_content(exception)
|
10
|
-
require 'rspec/core/formatters/snippet_extractor'
|
11
|
-
backtrace = exception.backtrace.map {|line| backtrace_line(line)}
|
12
|
-
backtrace.compact!
|
13
|
-
@snippet_extractor ||= SnippetExtractor.new
|
14
|
-
" <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class SnippetExtractor
|
19
|
-
def snippet(backtrace)
|
20
|
-
raw_code, line = snippet_for(backtrace[0])
|
21
|
-
highlighted = @@converter.convert(raw_code, false)
|
22
|
-
highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>" if @@converter.is_a?(NullConverter)
|
23
|
-
post_process(highlighted, line)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
RSpec.configure do |config| #:nodoc:
|
31
|
-
config.include(WatirSplash::SpecHelper)
|
32
|
-
end
|
33
|
-
|
34
|
-
module RSpec #:nodoc:all
|
35
|
-
module Core
|
36
|
-
class ExampleGroup
|
37
|
-
subject {self}
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# match_array is useful for matching arrays where some elements are regular expressions.
|
43
|
-
# expected_array = ["1", "2", /\d+/, "3"]
|
44
|
-
#
|
45
|
-
# ["1", "2", "66", "3"].should match_array(expected_array)
|
46
|
-
# table(:id => "table_id").to_a.should match_array(expected_array)
|
47
|
-
RSpec::Matchers.define :match_array do |array2|
|
48
|
-
match do |array1|
|
49
|
-
raise "match_array works only with Array objects!" unless array1.is_a?(Array) && array2.is_a?(Array)
|
50
|
-
match?(array1, array2)
|
51
|
-
end
|
52
|
-
|
53
|
-
def match?(array1, array2)
|
54
|
-
array2.each_with_index do |element, i|
|
55
|
-
if element.is_a?(Array)
|
56
|
-
return false unless match?(array1[i], element)
|
57
|
-
elsif element.is_a?(Regexp)
|
58
|
-
return false unless array1[i] =~ element
|
59
|
-
else
|
60
|
-
return false unless array1[i] == element
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
true
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# patch for #in(timeout) method
|
69
|
-
module RSpec::Matchers
|
70
|
-
class Change
|
71
|
-
def matches?(event_proc)
|
72
|
-
raise_block_syntax_error if block_given?
|
73
|
-
|
74
|
-
# to make #change work with #in(timeout) method
|
75
|
-
unless defined? @actual_before
|
76
|
-
@actual_before = evaluate_value_proc
|
77
|
-
event_proc.call
|
78
|
-
end
|
79
|
-
@actual_after = evaluate_value_proc
|
80
|
-
|
81
|
-
(!change_expected? || changed?) && matches_before? && matches_after? && matches_expected_delta? && matches_min? && matches_max?
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
alias_method :make, :change
|
86
|
-
end
|
87
|
-
|
88
|
-
# add #in(timeout) method for every matcher for allowing to wait until some condition.
|
1
|
+
# add #within(timeout) and #during(timeout) methods for every matcher for allowing to wait until some condition.
|
89
2
|
# div.click
|
90
|
-
# another_div.should be_present.
|
3
|
+
# another_div.should be_present.within(5)
|
91
4
|
#
|
92
5
|
# expect {
|
93
6
|
# div.click
|
94
|
-
# }.to change {another_div.text}.from("before").to("after").
|
7
|
+
# }.to change {another_div.text}.from("before").to("after").within(5)
|
95
8
|
#
|
96
9
|
# expect {
|
97
10
|
# div.click
|
98
|
-
# }.to make {another_div.present?}.
|
11
|
+
# }.to make {another_div.present?}.within(5)
|
99
12
|
#
|
100
13
|
# expect {
|
101
14
|
# div.click
|
102
15
|
# }.to change {another_div.text}.soon
|
103
16
|
#
|
104
|
-
# use with ActiveSupport to use descriptive methods for numbers:
|
105
|
-
# require "active_support"
|
106
|
-
# another_div.should exist.in(5.minutes)
|
107
|
-
RSpec::Matchers.constants.each do |const|
|
108
|
-
RSpec::Matchers.const_get(const).class_eval do
|
109
17
|
|
110
|
-
|
18
|
+
module WatirSplash
|
19
|
+
module RSpecPatches
|
111
20
|
|
112
|
-
|
113
|
-
|
21
|
+
::RSpec.configure do |config| #:nodoc:
|
22
|
+
config.include(WatirSplash::SpecHelper)
|
23
|
+
end
|
114
24
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
25
|
+
class ::RSpec::Core::ExampleGroup
|
26
|
+
subject {self}
|
27
|
+
end
|
119
28
|
|
120
|
-
|
121
|
-
|
122
|
-
self
|
123
|
-
end
|
29
|
+
def self.bootstrap const
|
30
|
+
const.class_eval do
|
124
31
|
|
125
|
-
|
126
|
-
within(30)
|
127
|
-
end
|
32
|
+
inst_methods = instance_methods.map &:to_sym
|
128
33
|
|
129
|
-
|
130
|
-
|
131
|
-
self
|
132
|
-
end
|
34
|
+
if !(inst_methods.include?(:__matches?) || inst_methods.include?(:__does_not_match?)) &&
|
35
|
+
(inst_methods.include?(:matches?) || inst_methods.include?(:does_not_match?))
|
133
36
|
|
134
|
-
|
37
|
+
def within(timeout)
|
38
|
+
@within_timeout = timeout
|
39
|
+
self
|
40
|
+
end
|
135
41
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
42
|
+
def during(timeout)
|
43
|
+
@during_timeout = timeout
|
44
|
+
self
|
45
|
+
end
|
141
46
|
|
142
|
-
|
143
|
-
|
47
|
+
def soon
|
48
|
+
within(30)
|
49
|
+
end
|
50
|
+
|
51
|
+
def seconds
|
52
|
+
# for syntactic sugar
|
53
|
+
self
|
54
|
+
end
|
144
55
|
|
145
|
-
|
146
|
-
|
56
|
+
alias_method :second, :seconds
|
57
|
+
|
58
|
+
def minutes
|
59
|
+
@within_timeout *= 60 if @within_timeout
|
60
|
+
@during_timeout *= 60 if @during_timeout
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
64
|
+
alias_method :minute, :minutes
|
65
|
+
end
|
147
66
|
|
148
|
-
|
149
|
-
|
67
|
+
if inst_methods.include? :matches?
|
68
|
+
alias_method :__matches?, :matches?
|
69
|
+
|
70
|
+
def matches?(actual)
|
71
|
+
match_with_wait {__matches?(actual)}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if inst_methods.include? :does_not_match?
|
76
|
+
alias_method :__does_not_match?, :does_not_match?
|
77
|
+
|
78
|
+
def does_not_match?(actual)
|
79
|
+
match_with_wait {__does_not_match?(actual)}
|
80
|
+
end
|
81
|
+
elsif inst_methods.include? :matches?
|
82
|
+
def does_not_match?(actual)
|
83
|
+
match_with_wait {!__matches?(actual)}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def match_with_wait
|
90
|
+
if @within_timeout
|
91
|
+
timeout = @within_timeout; @within_timeout = nil
|
92
|
+
Watir::Wait.until(timeout) {yield} rescue false
|
93
|
+
elsif @during_timeout
|
94
|
+
timeout = @during_timeout; @during_timeout = nil
|
95
|
+
Watir::Wait.while(timeout) {yield} rescue true
|
96
|
+
else
|
97
|
+
yield
|
98
|
+
end
|
99
|
+
end
|
150
100
|
end
|
151
101
|
end
|
152
102
|
|
153
|
-
|
154
|
-
|
103
|
+
# patch for #within(timeout) method
|
104
|
+
module ::RSpec::Matchers
|
105
|
+
class BuiltIn::Change
|
106
|
+
def matches?(event_proc)
|
107
|
+
raise_block_syntax_error if block_given?
|
155
108
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
109
|
+
# to make #change work with #in(timeout) method
|
110
|
+
unless defined? @actual_before
|
111
|
+
@actual_before = evaluate_value_proc
|
112
|
+
event_proc.call
|
113
|
+
end
|
114
|
+
@actual_after = evaluate_value_proc
|
115
|
+
|
116
|
+
(!change_expected? || changed?) && matches_before? && matches_after? && matches_expected_delta? && matches_min? && matches_max?
|
117
|
+
end
|
162
118
|
end
|
119
|
+
|
120
|
+
alias_method :make, :change
|
163
121
|
end
|
164
122
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
timeout = @within_timeout; @within_timeout = nil
|
170
|
-
Watir::Wait.until(timeout) {yield} rescue false
|
171
|
-
elsif @during_timeout
|
172
|
-
timeout = @during_timeout; @during_timeout = nil
|
173
|
-
Watir::Wait.while(timeout) {yield} rescue true
|
174
|
-
else
|
175
|
-
yield
|
176
|
-
end
|
123
|
+
matchers = ::RSpec::Matchers::BuiltIn.constants
|
124
|
+
matchers.delete :BaseMatcher
|
125
|
+
matchers.each do |const|
|
126
|
+
bootstrap ::RSpec::Matchers::BuiltIn.const_get const
|
177
127
|
end
|
128
|
+
|
129
|
+
bootstrap ::RSpec::Matchers::DSL::Matcher
|
178
130
|
end
|
179
131
|
end
|
132
|
+
|
data/lib/watirsplash/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module WatirSplash
|
2
2
|
module Version
|
3
|
-
WATIRSPLASH = "2.4.
|
3
|
+
WATIRSPLASH = "2.4.3"
|
4
4
|
|
5
5
|
# possible runtime dependencies
|
6
|
-
WATIR = "
|
7
|
-
WIN32SCREENSHOT = "~>1.0.
|
8
|
-
WATIR_WEBDRIVER = "~>0.
|
6
|
+
WATIR = "~>3.0.0"
|
7
|
+
WIN32SCREENSHOT = "~>1.0.7"
|
8
|
+
WATIR_WEBDRIVER = "~>0.5.5"
|
9
9
|
end
|
10
10
|
end
|
data/spec/browser_spec.rb
CHANGED
@@ -19,12 +19,12 @@ describe WatirSplash::Browser do
|
|
19
19
|
it "detects JavaScript errors" do
|
20
20
|
browser = WatirSplash::Browser.new
|
21
21
|
browser.goto "http://dl.dropbox.com/u/2731643/WatirSplash/test.html"
|
22
|
-
browser.execute_script("window.originalOnErrorExecuted").
|
22
|
+
browser.execute_script("return window.originalOnErrorExecuted").should be_nil
|
23
23
|
|
24
24
|
expect {
|
25
25
|
browser.link(:id => "errorLink").click
|
26
26
|
}.to raise_error(WatirSplash::JavaScriptError, /JavaScript error:.*unexistingVar/)
|
27
|
-
browser.execute_script("window.originalOnErrorExecuted").should be_true
|
27
|
+
browser.execute_script("return window.originalOnErrorExecuted").should be_true
|
28
28
|
|
29
29
|
expect {
|
30
30
|
browser.link(:id => "toggle").click
|
data/spec/rspec_patches_spec.rb
CHANGED
@@ -5,23 +5,6 @@ describe "RSpec patches" do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
context "RSpec::Matchers" do
|
8
|
-
context "Array#match_array" do
|
9
|
-
it "matches other arrays with regexps" do
|
10
|
-
expected_ary = ["1", "2", "3", /\d/]
|
11
|
-
["1", "2", "3", "5"].should match_array(expected_ary)
|
12
|
-
|
13
|
-
expected_ary = ["1", ["2", /\d+/], /3/]
|
14
|
-
["1", [], "4"].should_not match_array(expected_ary)
|
15
|
-
["1", ["2", "55"], "3"].should match_array(expected_ary)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "doesn't work with other objects except Array" do
|
19
|
-
lambda {"".should match_array("")}.should raise_exception
|
20
|
-
lambda {[].should match_array("")}.should raise_exception
|
21
|
-
lambda {"".should match_array([])}.should raise_exception
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
8
|
context "#within" do
|
26
9
|
it "can be used with #change" do
|
27
10
|
div(:id => "div2").text.should == "Div is shown"
|
@@ -172,7 +155,7 @@ describe "RSpec patches" do
|
|
172
155
|
|
173
156
|
context "#soon" do
|
174
157
|
it "is an alias for #within(30)" do
|
175
|
-
RSpec::Matchers::Matcher.new(nil) {}.soon.instance_variable_get(:@within_timeout).should == 30
|
158
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.soon.instance_variable_get(:@within_timeout).should == 30
|
176
159
|
end
|
177
160
|
end
|
178
161
|
|
@@ -186,25 +169,25 @@ describe "RSpec patches" do
|
|
186
169
|
|
187
170
|
context "#seconds" do
|
188
171
|
it "is for syntactic sugar" do
|
189
|
-
RSpec::Matchers::Matcher.new(nil) {}.within(2).seconds.instance_variable_get(:@within_timeout).should == 2
|
190
|
-
RSpec::Matchers::Matcher.new(nil) {}.during(3).seconds.instance_variable_get(:@during_timeout).should == 3
|
172
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.within(2).seconds.instance_variable_get(:@within_timeout).should == 2
|
173
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.during(3).seconds.instance_variable_get(:@during_timeout).should == 3
|
191
174
|
end
|
192
175
|
|
193
176
|
it "has #second as an alias" do
|
194
|
-
RSpec::Matchers::Matcher.new(nil) {}.within(1).second.instance_variable_get(:@within_timeout).should == 1
|
195
|
-
RSpec::Matchers::Matcher.new(nil) {}.during(2).second.instance_variable_get(:@during_timeout).should == 2
|
177
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.within(1).second.instance_variable_get(:@within_timeout).should == 1
|
178
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.during(2).second.instance_variable_get(:@during_timeout).should == 2
|
196
179
|
end
|
197
180
|
end
|
198
181
|
|
199
182
|
context "#minutes" do
|
200
183
|
it "converts timeout into minutes" do
|
201
|
-
RSpec::Matchers::Matcher.new(nil) {}.within(2).minutes.instance_variable_get(:@within_timeout).should == 2*60
|
202
|
-
RSpec::Matchers::Matcher.new(nil) {}.during(3).minutes.instance_variable_get(:@during_timeout).should == 3*60
|
184
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.within(2).minutes.instance_variable_get(:@within_timeout).should == 2*60
|
185
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.during(3).minutes.instance_variable_get(:@during_timeout).should == 3*60
|
203
186
|
end
|
204
187
|
|
205
188
|
it "has #minute as an alias" do
|
206
|
-
RSpec::Matchers::Matcher.new(nil) {}.within(1).minute.instance_variable_get(:@within_timeout).should == 1*60
|
207
|
-
RSpec::Matchers::Matcher.new(nil) {}.during(2).minute.instance_variable_get(:@during_timeout).should == 2*60
|
189
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.within(1).minute.instance_variable_get(:@within_timeout).should == 1*60
|
190
|
+
RSpec::Matchers::DSL::Matcher.new(nil) {}.during(2).minute.instance_variable_get(:@during_timeout).should == 2*60
|
208
191
|
end
|
209
192
|
end
|
210
193
|
|
data/watirsplash.gemspec
CHANGED
@@ -16,8 +16,6 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency("rake", "0.8.7")
|
20
|
-
s.add_dependency("bundler", "~>1.0")
|
21
19
|
s.add_dependency("thor", "~>0")
|
22
20
|
s.add_dependency("require_all")
|
23
21
|
s.add_dependency("syntax")
|
metadata
CHANGED
@@ -1,104 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: watirsplash
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.4.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 4
|
9
|
-
- 2
|
10
|
-
version: 2.4.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jarmo Pertman
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - "="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 49
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 8
|
32
|
-
- 7
|
33
|
-
version: 0.8.7
|
34
|
-
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: bundler
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
12
|
+
date: 2012-04-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
40
17
|
none: false
|
41
|
-
requirements:
|
18
|
+
requirements:
|
42
19
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 0
|
48
|
-
version: "1.0"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
49
22
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: thor
|
53
23
|
prerelease: false
|
54
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
25
|
none: false
|
56
|
-
requirements:
|
26
|
+
requirements:
|
57
27
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
type: :runtime
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
66
31
|
name: require_all
|
67
|
-
|
68
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
69
33
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
version: "0"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
77
38
|
type: :runtime
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: syntax
|
81
39
|
prerelease: false
|
82
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: syntax
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
83
49
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
91
54
|
type: :runtime
|
92
|
-
|
93
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: WatirSplash makes testing of web applications splashin' easy by combining
|
63
|
+
best features of Watir, RSpec and Ruby!
|
94
64
|
email: jarmo.p@gmail.com
|
95
|
-
executables:
|
65
|
+
executables:
|
96
66
|
- watirsplash
|
97
67
|
extensions: []
|
98
|
-
|
99
68
|
extra_rdoc_files: []
|
100
|
-
|
101
|
-
files:
|
69
|
+
files:
|
102
70
|
- .gitignore
|
103
71
|
- .rspec
|
104
72
|
- Gemfile
|
@@ -111,7 +79,6 @@ files:
|
|
111
79
|
- lib/watirsplash.rb
|
112
80
|
- lib/watirsplash/browser.rb
|
113
81
|
- lib/watirsplash/cli.rb
|
114
|
-
- lib/watirsplash/frameworks/firewatir.rb
|
115
82
|
- lib/watirsplash/frameworks/helper.rb
|
116
83
|
- lib/watirsplash/frameworks/watir-webdriver.rb
|
117
84
|
- lib/watirsplash/frameworks/watir-webdriver/chrome.rb
|
@@ -143,38 +110,29 @@ files:
|
|
143
110
|
- watirsplash.gemspec
|
144
111
|
homepage: http://github.com/jarmo/WatirSplash
|
145
112
|
licenses: []
|
146
|
-
|
147
113
|
post_install_message:
|
148
114
|
rdoc_options: []
|
149
|
-
|
150
|
-
require_paths:
|
115
|
+
require_paths:
|
151
116
|
- lib
|
152
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
118
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
|
159
|
-
- 0
|
160
|
-
version: "0"
|
161
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
124
|
none: false
|
163
|
-
requirements:
|
164
|
-
- -
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
|
167
|
-
segments:
|
168
|
-
- 0
|
169
|
-
version: "0"
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
170
129
|
requirements: []
|
171
|
-
|
172
130
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.8.
|
131
|
+
rubygems_version: 1.8.21
|
174
132
|
signing_key:
|
175
133
|
specification_version: 3
|
176
|
-
summary: watirsplash 2.4.
|
177
|
-
test_files:
|
134
|
+
summary: watirsplash 2.4.3
|
135
|
+
test_files:
|
178
136
|
- spec/browser_spec.rb
|
179
137
|
- spec/page_spec.rb
|
180
138
|
- spec/rspec_patches_spec.rb
|