rwebspec 2.1.3 → 2.2.0
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/CHANGELOG +2 -4
- data/Rakefile +1 -1
- data/lib/rwebspec/driver.rb +1 -5
- data/lib/rwebspec/web_browser.rb +9 -75
- data/lib/rwebspec/web_page.rb +2 -2
- data/lib/rwebspec.rb +1 -16
- metadata +15 -9
- data/lib/extensions/firewatir_extensions.rb +0 -74
data/CHANGELOG
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
|
-
2.1.3
|
4
|
-
[Fix] Page object to include Utils module
|
5
3
|
|
6
|
-
2.
|
7
|
-
[Change]
|
4
|
+
2.2.0
|
5
|
+
[Change] Drop support for firewatir
|
8
6
|
|
9
7
|
2.1.1
|
10
8
|
[Change] use Global variable for retry settings (instead of class variables)
|
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.
|
74
|
+
s.version = "2.2.0"
|
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
@@ -102,11 +102,7 @@ module RWebSpec
|
|
102
102
|
#
|
103
103
|
def close_all_browsers
|
104
104
|
if @web_browser
|
105
|
-
|
106
|
-
FireWatir::Firefox.close_all
|
107
|
-
else
|
108
|
-
Watir::IE.close_all
|
109
|
-
end
|
105
|
+
Watir::IE.close_all
|
110
106
|
else
|
111
107
|
browser_type = $ITEST2_BROWSER ? $ITEST2_BROWSER.downcase.to_sym : :ie
|
112
108
|
WebBrowser.close_all_browsers(browser_type)
|
data/lib/rwebspec/web_browser.rb
CHANGED
@@ -17,14 +17,6 @@ rescue LoadError => e
|
|
17
17
|
$watir_loaded = false
|
18
18
|
end
|
19
19
|
|
20
|
-
begin
|
21
|
-
require "rubygems";
|
22
|
-
require "firewatir";
|
23
|
-
$firewatir_loaded = true
|
24
|
-
rescue LoadError => e
|
25
|
-
puts e
|
26
|
-
$firewatir_loaded = false
|
27
|
-
end
|
28
20
|
|
29
21
|
begin
|
30
22
|
require "rubygems";
|
@@ -34,7 +26,7 @@ rescue LoadError => e
|
|
34
26
|
$celerity_loaded = false
|
35
27
|
end
|
36
28
|
|
37
|
-
raise "You have must at least Watir
|
29
|
+
raise "You have must at least Watir installed" unless $watir_loaded || $celerity_loaded
|
38
30
|
|
39
31
|
module RWebSpec
|
40
32
|
|
@@ -56,50 +48,16 @@ module RWebSpec
|
|
56
48
|
|
57
49
|
case RUBY_PLATFORM
|
58
50
|
when /java/i
|
59
|
-
# Java, maybe
|
51
|
+
# Java, maybe celerity
|
60
52
|
puts "Ruby java platform"
|
61
|
-
raise "Not supported
|
62
|
-
if $
|
63
|
-
# choose one out of two, :default to celerity
|
64
|
-
if options[:firefox] then
|
65
|
-
initialize_firefox_browser(existing_browser, base_url, options)
|
66
|
-
else
|
67
|
-
initialize_celerity_browser(base_url, options)
|
68
|
-
end
|
69
|
-
elsif $firewatir_loaded
|
70
|
-
initialize_firefox_browser(existing_browser, base_url, options)
|
71
|
-
else
|
53
|
+
raise "Not supported unless Celerity detected" unless $celerity_loaded
|
54
|
+
if $celerity_loaded then
|
72
55
|
initialize_celerity_browser(base_url, options)
|
73
56
|
end
|
74
|
-
|
75
57
|
when /mswin|windows|mingw/i
|
76
|
-
raise "Not supported, no Watir
|
77
|
-
|
78
|
-
initialize_firefox_browser(existing_browser, base_url, options)
|
79
|
-
else
|
80
|
-
initialize_ie_browser(existing_browser, options)
|
81
|
-
end
|
82
|
-
else
|
83
|
-
raise "Not supported, no FireWatirdetected" unless $firewatir_loaded
|
84
|
-
initialize_firefox_browser(existing_browser, base_url, options)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def initialize_firefox_browser(existing_browser, base_url, options)
|
89
|
-
if existing_browser then
|
90
|
-
@browser = existing_browser
|
91
|
-
return
|
58
|
+
raise "Not supported, no Watir detected" unless $watir_loaded
|
59
|
+
initialize_ie_browser(existing_browser, options)
|
92
60
|
end
|
93
|
-
# JSSH is running, 9997
|
94
|
-
begin
|
95
|
-
require 'net/telnet'
|
96
|
-
firefox_jssh = Net::Telnet::new("Host" => "127.0.0.1", "Port" => 9997)
|
97
|
-
FireWatir::Firefox.firefox_started = true
|
98
|
-
rescue => e
|
99
|
-
puts "The firefox brower with JSSH is not available, #{e}"
|
100
|
-
sleep 1
|
101
|
-
end
|
102
|
-
@browser = FireWatir::Firefox.start(base_url)
|
103
61
|
end
|
104
62
|
|
105
63
|
def initialize_celerity_browser(base_url, options)
|
@@ -167,15 +125,8 @@ module RWebSpec
|
|
167
125
|
alias a link
|
168
126
|
alias img image
|
169
127
|
|
170
|
-
# Wrapp of Watir's area to support Firefox and Watir
|
171
|
-
#
|
172
|
-
# Note: FireWatir does not support area directly, treat it as text_field
|
173
128
|
def area(*args)
|
174
|
-
|
175
|
-
text_field(*args)
|
176
|
-
else
|
177
|
-
@browser.send("area", *args)
|
178
|
-
end
|
129
|
+
@browser.send("area", *args)
|
179
130
|
end
|
180
131
|
|
181
132
|
def modal_dialog(how=nil, what=nil)
|
@@ -270,8 +221,6 @@ module RWebSpec
|
|
270
221
|
|
271
222
|
def page_title
|
272
223
|
case @browser.class.to_s
|
273
|
-
when "FireWatir::Firefox"
|
274
|
-
@browser.title
|
275
224
|
when "Watir::IE"
|
276
225
|
@browser.document.title
|
277
226
|
else
|
@@ -303,20 +252,13 @@ module RWebSpec
|
|
303
252
|
end
|
304
253
|
|
305
254
|
def is_firefox?
|
306
|
-
return false
|
307
|
-
begin
|
308
|
-
@browser.class == FireWatir::Firefox
|
309
|
-
rescue => e
|
310
|
-
return false
|
311
|
-
end
|
255
|
+
return false
|
312
256
|
end
|
313
257
|
|
314
258
|
# Close the browser window. Useful for automated test suites to reduce
|
315
259
|
# test interaction.
|
316
260
|
def close_browser
|
317
261
|
case @browser.class.to_s
|
318
|
-
when "FireWatir::Firefox"
|
319
|
-
@browser.close
|
320
262
|
when "Watir::IE"
|
321
263
|
@browser.getIE.quit
|
322
264
|
else
|
@@ -329,9 +271,6 @@ module RWebSpec
|
|
329
271
|
def self.close_all_browsers(browser_type = :ie)
|
330
272
|
if browser_type == :ie
|
331
273
|
Watir::IE.close_all
|
332
|
-
elsif browser_type == :firefox
|
333
|
-
# raise "not supported in FireFox yet."
|
334
|
-
FireWatir::Firefox.new.close_all
|
335
274
|
end
|
336
275
|
end
|
337
276
|
|
@@ -615,12 +554,7 @@ module RWebSpec
|
|
615
554
|
default_options = {:browser => "IE"}
|
616
555
|
options = default_options.merge(options)
|
617
556
|
site_context = Context.new(options[:base_url]) if options[:base_url]
|
618
|
-
|
619
|
-
ff = FireWatir::Firefox.attach(how, what)
|
620
|
-
return WebBrowser.new_from_existing(ff, site_context)
|
621
|
-
else
|
622
|
-
return WebBrowser.new_from_existing(Watir::IE.attach(how, what), site_context)
|
623
|
-
end
|
557
|
+
return WebBrowser.new_from_existing(Watir::IE.attach(how, what), site_context)
|
624
558
|
end
|
625
559
|
|
626
560
|
# Attach a Watir::IE instance to a popup window.
|
data/lib/rwebspec/web_page.rb
CHANGED
@@ -24,14 +24,14 @@ module RWebSpec
|
|
24
24
|
|
25
25
|
include RWebSpec::Assert
|
26
26
|
include RWebSpec::Driver
|
27
|
-
include RWebSpec::Utils
|
28
27
|
|
29
28
|
# browser: passed to do assertion within the page
|
30
29
|
# page_text: text used to identify the page, title will be the first candidate
|
31
30
|
attr_accessor :page_specific_text
|
32
31
|
|
33
32
|
def initialize(the_browser, page_specific_text = nil)
|
34
|
-
@web_browser =
|
33
|
+
@web_browser = the_browser
|
34
|
+
@web_tester = the_browser
|
35
35
|
@page_specific_text = page_specific_text
|
36
36
|
begin
|
37
37
|
snapshot if $TESTWISE_DUMP_PAGE || $ITEST2_DUMP_PAGE
|
data/lib/rwebspec.rb
CHANGED
@@ -4,20 +4,6 @@
|
|
4
4
|
#***********************************************************
|
5
5
|
require "rubygems"
|
6
6
|
|
7
|
-
# From 2.0, no default support for FireWatir.
|
8
|
-
#
|
9
|
-
if $ENABLE_FIREFOX
|
10
|
-
# Try load firewatir first, which depends on ActiveSupport
|
11
|
-
puts "Deprecated: Please use watir-webdriver or selenium-webdriver to run tests in Firefox"
|
12
|
-
begin
|
13
|
-
require "firewatir";
|
14
|
-
$firewatir_loaded = true
|
15
|
-
rescue LoadError => e
|
16
|
-
puts e
|
17
|
-
$firewatir_loaded = false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
7
|
# Load active_support, so that we can use 1.days.ago
|
22
8
|
begin
|
23
9
|
require 'active_support/basic_object'
|
@@ -30,7 +16,7 @@ end
|
|
30
16
|
require 'spec'
|
31
17
|
|
32
18
|
unless defined? RWEBSPEC_VERSION
|
33
|
-
RWEBSPEC_VERSION = RWEBUNIT_VERSION = "2.
|
19
|
+
RWEBSPEC_VERSION = RWEBUNIT_VERSION = "2.2.0"
|
34
20
|
end
|
35
21
|
|
36
22
|
$testwise_polling_interval = 1 # seconds
|
@@ -63,7 +49,6 @@ require File.dirname(__FILE__) + "/rwebspec/load_test_helper"
|
|
63
49
|
require File.dirname(__FILE__) + "/rwebspec/matchers/contains_text"
|
64
50
|
require File.dirname(__FILE__) + "/extensions/rspec_extensions"
|
65
51
|
|
66
|
-
require File.dirname(__FILE__) + "/extensions/firewatir_extensions" if $ENABLE_FIREFOX
|
67
52
|
if RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /mingw/
|
68
53
|
require File.dirname(__FILE__) + "/extensions/watir_extensions"
|
69
54
|
require File.dirname(__FILE__) + "/extensions/window_script_extensions.rb"
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rwebspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 2.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Zhimin Zhan
|
@@ -14,16 +15,17 @@ autorequire: rwebspec
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2012-
|
18
|
-
default_executable:
|
18
|
+
date: 2012-03-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - "="
|
26
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 11
|
27
29
|
segments:
|
28
30
|
- 1
|
29
31
|
- 1
|
@@ -35,9 +37,11 @@ dependencies:
|
|
35
37
|
name: commonwatir
|
36
38
|
prerelease: false
|
37
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
38
41
|
requirements:
|
39
42
|
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
41
45
|
segments:
|
42
46
|
- 2
|
43
47
|
- 0
|
@@ -57,7 +61,6 @@ files:
|
|
57
61
|
- README
|
58
62
|
- CHANGELOG
|
59
63
|
- MIT-LICENSE
|
60
|
-
- lib/extensions/firewatir_extensions.rb
|
61
64
|
- lib/extensions/rspec_extensions.rb
|
62
65
|
- lib/extensions/watir_extensions.rb
|
63
66
|
- lib/extensions/window_script_extensions.rb
|
@@ -78,7 +81,6 @@ files:
|
|
78
81
|
- lib/rwebspec/web_page.rb
|
79
82
|
- lib/rwebspec/web_testcase.rb
|
80
83
|
- lib/rwebspec.rb
|
81
|
-
has_rdoc: true
|
82
84
|
homepage: http://github.com/zhimin/rwebspec/tree/master
|
83
85
|
licenses: []
|
84
86
|
|
@@ -88,23 +90,27 @@ rdoc_options: []
|
|
88
90
|
require_paths:
|
89
91
|
- lib
|
90
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
91
94
|
requirements:
|
92
95
|
- - ">="
|
93
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
94
98
|
segments:
|
95
99
|
- 0
|
96
100
|
version: "0"
|
97
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
98
103
|
requirements:
|
99
104
|
- - ">="
|
100
105
|
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
101
107
|
segments:
|
102
108
|
- 0
|
103
109
|
version: "0"
|
104
110
|
requirements:
|
105
111
|
- none
|
106
112
|
rubyforge_project: rwebspec
|
107
|
-
rubygems_version: 1.
|
113
|
+
rubygems_version: 1.8.15
|
108
114
|
signing_key:
|
109
115
|
specification_version: 3
|
110
116
|
summary: Web application functional specification in Ruby
|
@@ -1,74 +0,0 @@
|
|
1
|
-
module FireWatir
|
2
|
-
class Firefox
|
3
|
-
|
4
|
-
@@firefox_started = false
|
5
|
-
|
6
|
-
def initialize(options = {})
|
7
|
-
if(options.kind_of?(Integer))
|
8
|
-
options = {:waitTime => options}
|
9
|
-
end
|
10
|
-
|
11
|
-
if(options[:profile])
|
12
|
-
profile_opt = "-no-remote -P #{options[:profile]}"
|
13
|
-
else
|
14
|
-
profile_opt = ""
|
15
|
-
end
|
16
|
-
|
17
|
-
waitTime = options[:waitTime] || 2
|
18
|
-
|
19
|
-
os = RUBY_PLATFORM
|
20
|
-
if RUBY_PLATFORM =~ /java/ then
|
21
|
-
require 'rbconfig'
|
22
|
-
os = Config::CONFIG['host_os']
|
23
|
-
end
|
24
|
-
|
25
|
-
case os
|
26
|
-
when /mswin/ || /mingw/
|
27
|
-
begin
|
28
|
-
# Get the path to Firefox.exe using Registry.
|
29
|
-
require 'win32/registry.rb'
|
30
|
-
path_to_bin = ""
|
31
|
-
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Mozilla\Mozilla Firefox') do |reg|
|
32
|
-
keys = reg.keys
|
33
|
-
reg1 = Win32::Registry::HKEY_LOCAL_MACHINE.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{keys[0]}\\Main")
|
34
|
-
reg1.each do |subkey, type, data|
|
35
|
-
if(subkey =~ /pathtoexe/i)
|
36
|
-
path_to_bin = data
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
rescue LoadError => e
|
41
|
-
path_to_bin = '"C:\Program Files\Mozilla Firefox\firefox.exe"'
|
42
|
-
end
|
43
|
-
|
44
|
-
when /linux/i
|
45
|
-
path_to_bin = `which firefox`.strip
|
46
|
-
when /darwin/i
|
47
|
-
path_to_bin = '/Applications/Firefox.app/Contents/MacOS/firefox'
|
48
|
-
when /java/
|
49
|
-
raise "Error, should have set using rbconfig: #{os}"
|
50
|
-
end
|
51
|
-
|
52
|
-
@t = Thread.new { system("#{path_to_bin} -jssh #{profile_opt}")} unless @@firefox_started
|
53
|
-
|
54
|
-
sleep waitTime
|
55
|
-
begin
|
56
|
-
set_defaults()
|
57
|
-
rescue Watir::Exception::UnableToStartJSShException
|
58
|
-
if !@t # no new thread starting browser, try again
|
59
|
-
puts "Firefox with JSSH not detected after you indicated @@firefox_started"
|
60
|
-
@t = Thread.new { system("#{path_to_bin} -jssh #{profile_opt}")}
|
61
|
-
sleep waitTime
|
62
|
-
set_defaults
|
63
|
-
end
|
64
|
-
end
|
65
|
-
get_window_number()
|
66
|
-
set_browser_document()
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.firefox_started=(value)
|
70
|
-
@@firefox_started = value
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|