rwebspec 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/rwebspec/driver.rb +3 -7
- data/lib/rwebspec/load_test_helper.rb +1 -1
- data/lib/rwebspec/test_utils.rb +3 -3
- data/lib/rwebspec.rb +7 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -71,7 +71,7 @@ end
|
|
71
71
|
spec = Gem::Specification.new do |s|
|
72
72
|
s.platform= Gem::Platform::RUBY
|
73
73
|
s.name = "rwebspec"
|
74
|
-
s.version = "2.1.
|
74
|
+
s.version = "2.1.1"
|
75
75
|
s.summary = "Web application functional specification in Ruby"
|
76
76
|
s.description = "Executable functional specification for web applications in RSpec syntax and Watir"
|
77
77
|
|
data/lib/rwebspec/driver.rb
CHANGED
@@ -19,10 +19,6 @@ module RWebSpec
|
|
19
19
|
module Driver
|
20
20
|
include RWebSpec::TestWisePlugin
|
21
21
|
include RWebSpec::Popup
|
22
|
-
# include Watir::ScreenCapture if RUBY_PLATFORM.downcase.include?("mswin") or RUBY_PLATFORM.downcase.include?("mingw")
|
23
|
-
|
24
|
-
@@default_polling_interval = 1 # second
|
25
|
-
@@default_timeout = 30 # seconds
|
26
22
|
|
27
23
|
# open a browser, and set base_url via hash, but does not acually
|
28
24
|
#
|
@@ -624,7 +620,7 @@ module RWebSpec
|
|
624
620
|
# wait_until {puts 'hello'}
|
625
621
|
# wait_until { div(:id, :receipt_date).exists? }
|
626
622
|
#
|
627
|
-
def wait_until(timeout =
|
623
|
+
def wait_until(timeout = $testwise_polling_timeout || 30, polling_interval = $testwise_polling_interval || 1, & block)
|
628
624
|
waiter = Watir::Waiter.new(timeout, polling_interval)
|
629
625
|
waiter.wait_until { yield }
|
630
626
|
end
|
@@ -644,7 +640,7 @@ module RWebSpec
|
|
644
640
|
#
|
645
641
|
# Warning: this method has not been fully tested, if you are not using Rails, change your parameter accordingly.
|
646
642
|
#
|
647
|
-
def ajax_wait_for_element(element_id, seconds, status='show', check_interval =
|
643
|
+
def ajax_wait_for_element(element_id, seconds, status='show', check_interval = $testwise_polling_interval)
|
648
644
|
count = 0
|
649
645
|
check_interval = 1 if check_interval < 1 or check_interval > seconds
|
650
646
|
while count < (seconds / check_interval) do
|
@@ -664,7 +660,7 @@ module RWebSpec
|
|
664
660
|
#Wait the element with given id to be present in web page
|
665
661
|
#
|
666
662
|
# Warning: this not working in Firefox, try use wait_util or try instead
|
667
|
-
def wait_for_element(element_id, timeout =
|
663
|
+
def wait_for_element(element_id, timeout = $testwise_polling_timeout, interval = $testwise_polling_interval)
|
668
664
|
start_time = Time.now
|
669
665
|
#TODO might not work with Firefox
|
670
666
|
until @web_browser.element_by_id(element_id) do
|
@@ -45,7 +45,7 @@ module RWebSpec
|
|
45
45
|
# try { click_link('waiting')}
|
46
46
|
# try(10, 2) { click_button('Search' } # try to click the 'Search' button upto 10 seconds, try every 2 seconds
|
47
47
|
# try { click_button('Search' }
|
48
|
-
def try(timeout =
|
48
|
+
def try(timeout = $testwise_polling_timeout, polling_interval = $testwise_polling_interval || 1, &block)
|
49
49
|
start_time = Time.now
|
50
50
|
|
51
51
|
last_error = nil
|
data/lib/rwebspec/test_utils.rb
CHANGED
@@ -16,7 +16,7 @@ module RWebSpec
|
|
16
16
|
# try_until { click_link('waiting')}
|
17
17
|
# try_until(10, 2) { click_button('Search' } # try to click the 'Search' button upto 10 seconds, try every 2 seconds
|
18
18
|
# try_until { click_button('Search' }
|
19
|
-
def try_until(timeout =
|
19
|
+
def try_until(timeout = $testwise_polling_timeout, polling_interval = $testwise_polling_interval || 1, &block)
|
20
20
|
start_time = Time.now
|
21
21
|
|
22
22
|
last_error = nil
|
@@ -37,7 +37,7 @@ module RWebSpec
|
|
37
37
|
|
38
38
|
alias try_upto try_until
|
39
39
|
|
40
|
-
def try(timeout =
|
40
|
+
def try(timeout = $testwise_polling_timeout, polling_interval = $testwise_polling_interval || 1, &block)
|
41
41
|
puts "Warning: method 'try' is deprecated (won't support in RWebSpec 3), use try_until instead."
|
42
42
|
try_until(timeout, polling_interval) {
|
43
43
|
yield
|
@@ -50,7 +50,7 @@ module RWebSpec
|
|
50
50
|
# Example
|
51
51
|
# repeat_try(3, 2) { click_button('Search' } # 3 times, 6 seconds in total
|
52
52
|
# repeat_try { click_button('Search' } # using default 5 tries, 2 second interval
|
53
|
-
def repeat_try(num_tries =
|
53
|
+
def repeat_try(num_tries = $testwise_polling_timeout || 30, interval = $testwise_polling_interval || 1, & block)
|
54
54
|
num_tries ||= 1
|
55
55
|
(num_tries - 1).times do |num|
|
56
56
|
begin
|
data/lib/rwebspec.rb
CHANGED
@@ -30,9 +30,14 @@ end
|
|
30
30
|
require 'spec'
|
31
31
|
|
32
32
|
unless defined? RWEBSPEC_VERSION
|
33
|
-
RWEBSPEC_VERSION = RWEBUNIT_VERSION = "2.1.
|
33
|
+
RWEBSPEC_VERSION = RWEBUNIT_VERSION = "2.1.1"
|
34
34
|
end
|
35
35
|
|
36
|
+
$testwise_polling_interval = 1 # seconds
|
37
|
+
|
38
|
+
$testwise_polling_timeout = 30 # seconds
|
39
|
+
|
40
|
+
|
36
41
|
if RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /mingw/
|
37
42
|
$screenshot_supported = false
|
38
43
|
begin
|
@@ -42,6 +47,7 @@ if RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /mingw/
|
|
42
47
|
end
|
43
48
|
end
|
44
49
|
|
50
|
+
|
45
51
|
# Extra full path to load libraries
|
46
52
|
require File.dirname(__FILE__) + "/rwebspec/using_pages"
|
47
53
|
require File.dirname(__FILE__) + "/rwebspec/test_utils"
|