watirsplash 0.2.2 → 0.2.3
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/History.rdoc +6 -0
- data/README.rdoc +4 -4
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/watirsplash.rb +1 -0
- data/lib/watirsplash/html_formatter.rb +12 -5
- data/lib/watirsplash/spec_helper.rb +9 -2
- data/lib/watirsplash/util.rb +14 -17
- data/spec/spec_helper_spec.rb +8 -1
- data/spec/util_spec.rb +23 -10
- data/spec/watir_ie_spec.rb +1 -1
- data/spec/watir_table_row_spec.rb +1 -1
- data/spec/watir_table_spec.rb +1 -1
- data/templates/project/environment.rb +1 -1
- metadata +5 -5
data/History.rdoc
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
=== Version 0.2.3 / 2010-07-23
|
|
2
|
+
|
|
3
|
+
Bug fixes:
|
|
4
|
+
* it is now possible to use method 'p' to find <p> elements in specs without invoking Kernel.p
|
|
5
|
+
* fixed project template to use require_all instead of require_rel
|
|
6
|
+
|
|
1
7
|
=== Version 0.2.2 / 2010-06-13
|
|
2
8
|
|
|
3
9
|
* fixed minor bugs
|
data/README.rdoc
CHANGED
|
@@ -35,7 +35,7 @@ testing right away!
|
|
|
35
35
|
|
|
36
36
|
== SYNOPSIS:
|
|
37
37
|
|
|
38
|
-
===
|
|
38
|
+
=== With plain Watir and RSpec:
|
|
39
39
|
require 'watir'
|
|
40
40
|
require 'spec'
|
|
41
41
|
|
|
@@ -48,9 +48,9 @@ testing right away!
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
it "has search field" do
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
text_field = @browser.text_field(:name => "q")
|
|
52
|
+
text_field.should exist
|
|
53
|
+
text_field.should be_visible
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
it "performs search" do
|
data/Rakefile
CHANGED
|
@@ -60,7 +60,7 @@ Rake::RDocTask.new do |rdoc|
|
|
|
60
60
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
61
61
|
|
|
62
62
|
rdoc.rdoc_dir = 'rdoc'
|
|
63
|
-
rdoc.title = "
|
|
63
|
+
rdoc.title = "WatirSplash #{version}"
|
|
64
64
|
rdoc.rdoc_files.include('README*')
|
|
65
65
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
66
66
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.3
|
data/lib/watirsplash.rb
CHANGED
|
@@ -19,13 +19,10 @@ module WatirSplash
|
|
|
19
19
|
def initialize(options, output) # :nodoc:
|
|
20
20
|
raise "output has to be a file path!" unless output.is_a?(String)
|
|
21
21
|
@output_dir = File.expand_path(File.dirname(output))
|
|
22
|
+
archive_results
|
|
23
|
+
|
|
22
24
|
puts "Results will be saved into the directory #{@output_dir}"
|
|
23
25
|
@files_dir = File.join(@output_dir, "files")
|
|
24
|
-
if File.exists?(@output_dir)
|
|
25
|
-
archive_dir = File.join(@output_dir, "../archive")
|
|
26
|
-
FileUtils.mkdir_p(archive_dir) unless File.exists?(archive_dir)
|
|
27
|
-
FileUtils.mv @output_dir, File.join(archive_dir, "#{File.basename(@output_dir)}_#{File.mtime(@output_dir).strftime("%y%m%d_%H%M%S")}")
|
|
28
|
-
end
|
|
29
26
|
FileUtils.mkdir_p(@files_dir)
|
|
30
27
|
@files_saved_during_example = []
|
|
31
28
|
super
|
|
@@ -116,5 +113,15 @@ module WatirSplash
|
|
|
116
113
|
file_path
|
|
117
114
|
end
|
|
118
115
|
|
|
116
|
+
private
|
|
117
|
+
|
|
118
|
+
def archive_results
|
|
119
|
+
if File.exists?(@output_dir)
|
|
120
|
+
archive_dir = File.join(@output_dir, "../archive")
|
|
121
|
+
FileUtils.mkdir_p(archive_dir) unless File.exists?(archive_dir)
|
|
122
|
+
FileUtils.mv @output_dir, File.join(archive_dir, "#{File.basename(@output_dir)}_#{File.mtime(@output_dir).strftime("%y%m%d_%H%M%S")}")
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
119
126
|
end
|
|
120
127
|
end
|
|
@@ -55,8 +55,15 @@ module WatirSplash
|
|
|
55
55
|
File::ALT_SEPARATOR ? file_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) : file_path
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
def method_missing name, *
|
|
59
|
-
@browser.respond_to?(name) ? @browser.send(name, *
|
|
58
|
+
def method_missing name, *args #:nodoc:
|
|
59
|
+
@browser.respond_to?(name) ? @browser.send(name, *args) : super
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# make sure that using method 'p' will be invoked on @browser
|
|
63
|
+
# and not Kernel
|
|
64
|
+
# use Kernel.p if you need to dump some variable
|
|
65
|
+
def p *args #:nodoc:
|
|
66
|
+
@browser.p *args
|
|
60
67
|
end
|
|
61
68
|
|
|
62
69
|
end
|
data/lib/watirsplash/util.rb
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
module WatirSplash
|
|
2
2
|
# class for common functionality
|
|
3
3
|
class Util
|
|
4
|
-
@@ui_test_common_dir = "ui-test-common"
|
|
5
|
-
|
|
6
4
|
class << self
|
|
7
5
|
|
|
8
6
|
# loads ui-test-common/environment.rb
|
|
@@ -15,30 +13,29 @@ module WatirSplash
|
|
|
15
13
|
require File.join(dir, "environment.rb")
|
|
16
14
|
end
|
|
17
15
|
|
|
16
|
+
# loads environment.rb for the project if it exists in the ui-test
|
|
17
|
+
# or in some higher level directory
|
|
18
18
|
def load_environment
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
require env_file
|
|
22
|
-
else
|
|
23
|
-
Dir.chdir("..") do
|
|
24
|
-
load_environment if Dir.entries(Dir.pwd).include?("..")
|
|
25
|
-
end
|
|
19
|
+
Pathname(Dir.pwd).ascend do |path|
|
|
20
|
+
require File.join(path, "environment.rb") if has_environment?(path)
|
|
26
21
|
end
|
|
27
22
|
end
|
|
28
23
|
|
|
29
24
|
private
|
|
30
25
|
|
|
31
26
|
def common_dir
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
common_dir
|
|
38
|
-
else
|
|
39
|
-
raise "#{@@ui_test_common_dir} directory was not found! It has to exist somewhere higher in directory tree than your project's directory and it has to have environment.rb file in it!"
|
|
27
|
+
ui_test_common_dir = "ui-test-common"
|
|
28
|
+
Pathname(Dir.pwd).ascend do |path|
|
|
29
|
+
if File.exists?(dir = File.join(path, ui_test_common_dir)) &&
|
|
30
|
+
has_environment?(dir)
|
|
31
|
+
return dir
|
|
40
32
|
end
|
|
41
33
|
end
|
|
34
|
+
raise "#{ui_test_common_dir} directory was not found! It has to exist somewhere higher in directory tree than your project's directory and it has to have environment.rb file in it!"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def has_environment? dir
|
|
38
|
+
return File.exists?(File.join(dir, "environment.rb"))
|
|
42
39
|
end
|
|
43
40
|
|
|
44
41
|
end
|
data/spec/spec_helper_spec.rb
CHANGED
|
@@ -43,7 +43,7 @@ describe WatirSplash::SpecHelper do
|
|
|
43
43
|
|
|
44
44
|
it "has download_file method" do
|
|
45
45
|
begin
|
|
46
|
-
goto "http://dl.dropbox.com/u/2731643/
|
|
46
|
+
goto "http://dl.dropbox.com/u/2731643/WatirSplash/download.html"
|
|
47
47
|
link(:text => "Download").click_no_wait
|
|
48
48
|
file = download_file("download.zip")
|
|
49
49
|
File.read(file).should == "this is a 'zip' file!"
|
|
@@ -52,4 +52,11 @@ describe WatirSplash::SpecHelper do
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
it "redirects usages of method 'p' to Watir::IE#p instead of Kernel.p" do
|
|
56
|
+
goto "http://dl.dropbox.com/u/2731643/WatirSplash/elements.html"
|
|
57
|
+
paragraph = p(:class => "my_pg")
|
|
58
|
+
paragraph.should exist
|
|
59
|
+
paragraph.text.should == "This is a paragraph!"
|
|
60
|
+
end
|
|
61
|
+
|
|
55
62
|
end
|
data/spec/util_spec.rb
CHANGED
|
@@ -3,12 +3,9 @@ require "spec"
|
|
|
3
3
|
describe WatirSplash::Util do
|
|
4
4
|
|
|
5
5
|
it "loads ui-test-common" do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
9
|
-
|
|
6
|
+
ui_test_common_dir = "../ui-test-common"
|
|
7
|
+
raise "ui-test-common directory should not exist due to testing!" if File.exists?(ui_test_common_dir)
|
|
10
8
|
begin
|
|
11
|
-
ui_test_common_dir = "../ui-test-common-for-test"
|
|
12
9
|
FileUtils.mkdir(ui_test_common_dir)
|
|
13
10
|
File.open(File.join(ui_test_common_dir, "environment.rb"), "w") do |f|
|
|
14
11
|
f.puts "
|
|
@@ -17,6 +14,7 @@ module GlobalApplication
|
|
|
17
14
|
end"
|
|
18
15
|
end
|
|
19
16
|
|
|
17
|
+
lambda {GlobalApplication::LOADED}.should raise_exception
|
|
20
18
|
lambda {WatirSplash::Util.load_common}.should_not raise_exception
|
|
21
19
|
GlobalApplication::LOADED.should be_true
|
|
22
20
|
ensure
|
|
@@ -25,13 +23,28 @@ end"
|
|
|
25
23
|
end
|
|
26
24
|
|
|
27
25
|
it "raises exception if ui-test-common is not found" do
|
|
28
|
-
class WatirSplash::Util
|
|
29
|
-
@@ui_test_common_dir = "nonexisting_ui_test_common_dir"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
26
|
lambda {WatirSplash::Util.load_common}.
|
|
33
27
|
should raise_exception(RuntimeError,
|
|
34
|
-
"
|
|
28
|
+
"ui-test-common directory was not found! It has to exist somewhere higher in directory tree than your project's directory and it has to have environment.rb file in it!")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "loads project's environment.rb automatically" do
|
|
32
|
+
env_file = "../environment.rb"
|
|
33
|
+
raise "environment.rb file should not exist due to testing!" if File.exists?(env_file)
|
|
34
|
+
begin
|
|
35
|
+
File.open(env_file, "w") do |file|
|
|
36
|
+
file.puts "
|
|
37
|
+
module GlobalApplication
|
|
38
|
+
ENVIRONMENT_LOADED = true
|
|
39
|
+
end"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
lambda {GlobalApplication::ENVIRONMENT_LOADED}.should raise_exception
|
|
43
|
+
lambda {WatirSplash::Util.load_environment}.should_not raise_exception
|
|
44
|
+
GlobalApplication::ENVIRONMENT_LOADED.should be_true
|
|
45
|
+
ensure
|
|
46
|
+
FileUtils.rm_rf(env_file)
|
|
47
|
+
end
|
|
35
48
|
end
|
|
36
49
|
|
|
37
50
|
end
|
data/spec/watir_ie_spec.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "spec"
|
|
|
3
3
|
describe Watir::IE do
|
|
4
4
|
|
|
5
5
|
it "uses currentStyle method to show computed style" do
|
|
6
|
-
goto "http://dl.dropbox.com/u/2731643/
|
|
6
|
+
goto "http://dl.dropbox.com/u/2731643/WatirSplash/tables.html"
|
|
7
7
|
t = table(:id => "normal")
|
|
8
8
|
normal_cell = t[1][1]
|
|
9
9
|
normal_cell.text.should == "1"
|
data/spec/watir_table_spec.rb
CHANGED
|
@@ -10,6 +10,6 @@ spec_dir = File.join(File.dirname(__FILE__), "spec/**/*.rb")
|
|
|
10
10
|
filtered_spec_files = Dir.glob(spec_dir).delete_if do |file|
|
|
11
11
|
File.directory?(file) || File.basename(file) =~ /.*spec\.rb$/
|
|
12
12
|
end
|
|
13
|
-
|
|
13
|
+
require_all filtered_spec_files
|
|
14
14
|
require_rel "config.rb"
|
|
15
15
|
require_rel "application_helper.rb"
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 2
|
|
8
|
-
-
|
|
9
|
-
version: 0.2.
|
|
8
|
+
- 3
|
|
9
|
+
version: 0.2.3
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Jarmo Pertman
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2010-
|
|
17
|
+
date: 2010-07-23 00:00:00 +03:00
|
|
18
18
|
default_executable: watirsplash
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -167,7 +167,7 @@ licenses: []
|
|
|
167
167
|
post_install_message: |-
|
|
168
168
|
*************************
|
|
169
169
|
|
|
170
|
-
Thank you for installing WatirSplash 0.2.
|
|
170
|
+
Thank you for installing WatirSplash 0.2.3! Don't forget to take a look at README and History files!
|
|
171
171
|
|
|
172
172
|
Execute "watirsplash generate" under your project's directory to generate default project structure.
|
|
173
173
|
|
|
@@ -202,7 +202,7 @@ rubyforge_project:
|
|
|
202
202
|
rubygems_version: 1.3.6
|
|
203
203
|
signing_key:
|
|
204
204
|
specification_version: 3
|
|
205
|
-
summary: watirsplash 0.2.
|
|
205
|
+
summary: watirsplash 0.2.3
|
|
206
206
|
test_files:
|
|
207
207
|
- spec/spec_helper_spec.rb
|
|
208
208
|
- spec/spec_match_array_spec.rb
|