rwebspec 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +300 -0
- data/MIT-LICENSE +21 -0
- data/README +33 -0
- data/Rakefile +94 -0
- data/lib/rspec_extensions.rb +51 -0
- data/lib/rwebspec/assert.rb +361 -0
- data/lib/rwebspec/clickJSDialog.rb +15 -0
- data/lib/rwebspec/context.rb +24 -0
- data/lib/rwebspec/driver.rb +734 -0
- data/lib/rwebspec/itest_plugin.rb +68 -0
- data/lib/rwebspec/matchers/contains_text.rb +37 -0
- data/lib/rwebspec/popup.rb +147 -0
- data/lib/rwebspec/rspec_helper.rb +96 -0
- data/lib/rwebspec/test_script.rb +8 -0
- data/lib/rwebspec/test_utils.rb +171 -0
- data/lib/rwebspec/using_pages.rb +49 -0
- data/lib/rwebspec/web_browser.rb +528 -0
- data/lib/rwebspec/web_page.rb +94 -0
- data/lib/rwebspec/web_testcase.rb +36 -0
- data/lib/rwebspec.rb +31 -0
- data/lib/rwebunit.rb +3 -0
- data/lib/watir_extensions.rb +69 -0
- metadata +105 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
if RUBY_PLATFORM == "java" then
|
2
|
+
# no need to load firefox extension
|
3
|
+
else
|
4
|
+
module FireWatir
|
5
|
+
class Firefox
|
6
|
+
|
7
|
+
@@firefox_started = false
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
if(options.kind_of?(Integer))
|
11
|
+
options = {:waitTime => options}
|
12
|
+
end
|
13
|
+
|
14
|
+
if(options[:profile])
|
15
|
+
profile_opt = "-no-remote -P #{options[:profile]}"
|
16
|
+
else
|
17
|
+
profile_opt = ""
|
18
|
+
end
|
19
|
+
|
20
|
+
waitTime = options[:waitTime] || 2
|
21
|
+
|
22
|
+
case RUBY_PLATFORM
|
23
|
+
when /mswin/
|
24
|
+
# Get the path to Firefox.exe using Registry.
|
25
|
+
require 'win32/registry.rb'
|
26
|
+
path_to_bin = ""
|
27
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Mozilla\Mozilla Firefox') do |reg|
|
28
|
+
keys = reg.keys
|
29
|
+
reg1 = Win32::Registry::HKEY_LOCAL_MACHINE.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{keys[0]}\\Main")
|
30
|
+
reg1.each do |subkey, type, data|
|
31
|
+
if(subkey =~ /pathtoexe/i)
|
32
|
+
path_to_bin = data
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
when /linux/i
|
38
|
+
path_to_bin = `which firefox`.strip
|
39
|
+
when /darwin/i
|
40
|
+
path_to_bin = '/Applications/Firefox.app/Contents/MacOS/firefox'
|
41
|
+
when /java/
|
42
|
+
raise "Not implemented: Create a browser finder in JRuby"
|
43
|
+
end
|
44
|
+
|
45
|
+
@t = Thread.new { system("#{path_to_bin} -jssh #{profile_opt}")} unless @@firefox_started
|
46
|
+
|
47
|
+
sleep waitTime
|
48
|
+
begin
|
49
|
+
set_defaults()
|
50
|
+
rescue Watir::Exception::UnableToStartJSShException
|
51
|
+
if !@t # no new thread starting browser, try again
|
52
|
+
puts "Firefox with JSSH not detected after you indicated @@firefox_started"
|
53
|
+
@t = Thread.new { system("#{path_to_bin} -jssh #{profile_opt}")}
|
54
|
+
sleep waitTime
|
55
|
+
set_defaults
|
56
|
+
end
|
57
|
+
end
|
58
|
+
get_window_number()
|
59
|
+
set_browser_document()
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.firefox_started=(value)
|
63
|
+
@@firefox_started = value
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rwebspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zhimin Zhan
|
8
|
+
autorequire: rwebspec
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-11 00:00:00 +10:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.1.12
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: commonwatir
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.2
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: test-unit
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.0.2
|
44
|
+
version:
|
45
|
+
description:
|
46
|
+
email: zhimin@agileway.net
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files: []
|
52
|
+
|
53
|
+
files:
|
54
|
+
- Rakefile
|
55
|
+
- README
|
56
|
+
- CHANGELOG
|
57
|
+
- MIT-LICENSE
|
58
|
+
- lib/rspec_extensions.rb
|
59
|
+
- lib/rwebspec
|
60
|
+
- lib/rwebspec/assert.rb
|
61
|
+
- lib/rwebspec/clickJSDialog.rb
|
62
|
+
- lib/rwebspec/context.rb
|
63
|
+
- lib/rwebspec/driver.rb
|
64
|
+
- lib/rwebspec/itest_plugin.rb
|
65
|
+
- lib/rwebspec/matchers
|
66
|
+
- lib/rwebspec/matchers/contains_text.rb
|
67
|
+
- lib/rwebspec/popup.rb
|
68
|
+
- lib/rwebspec/rspec_helper.rb
|
69
|
+
- lib/rwebspec/test_script.rb
|
70
|
+
- lib/rwebspec/test_utils.rb
|
71
|
+
- lib/rwebspec/using_pages.rb
|
72
|
+
- lib/rwebspec/web_browser.rb
|
73
|
+
- lib/rwebspec/web_page.rb
|
74
|
+
- lib/rwebspec/web_testcase.rb
|
75
|
+
- lib/rwebspec.rb
|
76
|
+
- lib/rwebunit.rb
|
77
|
+
- lib/watir_extensions.rb
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://github.com/zhimin/rwebspec/tree/master
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
version:
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
version:
|
97
|
+
requirements:
|
98
|
+
- none
|
99
|
+
rubyforge_project: rwebspec
|
100
|
+
rubygems_version: 1.3.1
|
101
|
+
signing_key:
|
102
|
+
specification_version: 2
|
103
|
+
summary: Executable functional specification for web applications in RSpec syntax and Watir
|
104
|
+
test_files: []
|
105
|
+
|