lazyman 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +64 -64
- data/VERSION +1 -1
- data/bin/lazyman +7 -7
- data/lazyman.gemspec +4 -3
- data/lib/lazyman/generators/lazyman/.rspec +3 -1
- data/lib/lazyman/generators/lazyman/app/matchers/.empty_directory +5 -5
- data/lib/lazyman/generators/lazyman/app/pages/components/.empty_directory +5 -5
- data/lib/lazyman/generators/lazyman/app/reports/.empty_directory +5 -5
- data/lib/lazyman/generators/lazyman/config/lazyman_formatter.rb +462 -0
- data/spec/lazy_page_spec.rb +44 -44
- metadata +27 -26
data/Gemfile.lock
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://ruby.taobao.org/
|
3
|
-
specs:
|
4
|
-
active_support (3.0.0)
|
5
|
-
activesupport (= 3.0.0)
|
6
|
-
activesupport (3.0.0)
|
7
|
-
childprocess (0.3.9)
|
8
|
-
ffi (~> 1.0, >= 1.0.11)
|
9
|
-
data_magic (0.14)
|
10
|
-
faker (>= 1.1.2)
|
11
|
-
yml_reader (>= 0.2)
|
12
|
-
diff-lcs (1.2.2)
|
13
|
-
faker (1.1.2)
|
14
|
-
i18n (~> 0.5)
|
15
|
-
ffi (1.6.0-x86-mingw32)
|
16
|
-
git (1.2.5)
|
17
|
-
i18n (0.6.4)
|
18
|
-
jeweler (1.8.4)
|
19
|
-
bundler (~> 1.0)
|
20
|
-
git (>= 1.2.5)
|
21
|
-
rake
|
22
|
-
rdoc
|
23
|
-
json (1.7.7)
|
24
|
-
multi_json (1.7.2)
|
25
|
-
page-object (0.8.6.1)
|
26
|
-
page_navigation (>= 0.7)
|
27
|
-
selenium-webdriver (>= 2.31.0)
|
28
|
-
watir-webdriver (>= 0.6.2)
|
29
|
-
page_navigation (0.7)
|
30
|
-
data_magic (>= 0.14)
|
31
|
-
rake (10.0.4)
|
32
|
-
rdoc (3.12.2)
|
33
|
-
json (~> 1.4)
|
34
|
-
rspec (2.13.0)
|
35
|
-
rspec-core (~> 2.13.0)
|
36
|
-
rspec-expectations (~> 2.13.0)
|
37
|
-
rspec-mocks (~> 2.13.0)
|
38
|
-
rspec-core (2.13.1)
|
39
|
-
rspec-expectations (2.13.0)
|
40
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
-
rspec-mocks (2.13.0)
|
42
|
-
rubyzip (0.9.9)
|
43
|
-
selenium-webdriver (2.31.0)
|
44
|
-
childprocess (>= 0.2.5)
|
45
|
-
multi_json (~> 1.0)
|
46
|
-
rubyzip
|
47
|
-
websocket (~> 1.0.4)
|
48
|
-
thor (0.14.6)
|
49
|
-
watir-webdriver (0.6.2)
|
50
|
-
selenium-webdriver (>= 2.18.0)
|
51
|
-
websocket (1.0.7)
|
52
|
-
yml_reader (0.2)
|
53
|
-
|
54
|
-
PLATFORMS
|
55
|
-
x86-mingw32
|
56
|
-
|
57
|
-
DEPENDENCIES
|
58
|
-
active_support (~> 3.0.0)
|
59
|
-
bundler (~> 1.0.0)
|
60
|
-
jeweler (~> 1.8.4)
|
61
|
-
page-object (~> 0.8.6.1)
|
62
|
-
rdoc (~> 3.12)
|
63
|
-
rspec (~> 2.13.0)
|
64
|
-
thor (~> 0.14.6)
|
1
|
+
GEM
|
2
|
+
remote: http://ruby.taobao.org/
|
3
|
+
specs:
|
4
|
+
active_support (3.0.0)
|
5
|
+
activesupport (= 3.0.0)
|
6
|
+
activesupport (3.0.0)
|
7
|
+
childprocess (0.3.9)
|
8
|
+
ffi (~> 1.0, >= 1.0.11)
|
9
|
+
data_magic (0.14)
|
10
|
+
faker (>= 1.1.2)
|
11
|
+
yml_reader (>= 0.2)
|
12
|
+
diff-lcs (1.2.2)
|
13
|
+
faker (1.1.2)
|
14
|
+
i18n (~> 0.5)
|
15
|
+
ffi (1.6.0-x86-mingw32)
|
16
|
+
git (1.2.5)
|
17
|
+
i18n (0.6.4)
|
18
|
+
jeweler (1.8.4)
|
19
|
+
bundler (~> 1.0)
|
20
|
+
git (>= 1.2.5)
|
21
|
+
rake
|
22
|
+
rdoc
|
23
|
+
json (1.7.7)
|
24
|
+
multi_json (1.7.2)
|
25
|
+
page-object (0.8.6.1)
|
26
|
+
page_navigation (>= 0.7)
|
27
|
+
selenium-webdriver (>= 2.31.0)
|
28
|
+
watir-webdriver (>= 0.6.2)
|
29
|
+
page_navigation (0.7)
|
30
|
+
data_magic (>= 0.14)
|
31
|
+
rake (10.0.4)
|
32
|
+
rdoc (3.12.2)
|
33
|
+
json (~> 1.4)
|
34
|
+
rspec (2.13.0)
|
35
|
+
rspec-core (~> 2.13.0)
|
36
|
+
rspec-expectations (~> 2.13.0)
|
37
|
+
rspec-mocks (~> 2.13.0)
|
38
|
+
rspec-core (2.13.1)
|
39
|
+
rspec-expectations (2.13.0)
|
40
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
+
rspec-mocks (2.13.0)
|
42
|
+
rubyzip (0.9.9)
|
43
|
+
selenium-webdriver (2.31.0)
|
44
|
+
childprocess (>= 0.2.5)
|
45
|
+
multi_json (~> 1.0)
|
46
|
+
rubyzip
|
47
|
+
websocket (~> 1.0.4)
|
48
|
+
thor (0.14.6)
|
49
|
+
watir-webdriver (0.6.2)
|
50
|
+
selenium-webdriver (>= 2.18.0)
|
51
|
+
websocket (1.0.7)
|
52
|
+
yml_reader (0.2)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
x86-mingw32
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
active_support (~> 3.0.0)
|
59
|
+
bundler (~> 1.0.0)
|
60
|
+
jeweler (~> 1.8.4)
|
61
|
+
page-object (~> 0.8.6.1)
|
62
|
+
rdoc (~> 3.12)
|
63
|
+
rspec (~> 2.13.0)
|
64
|
+
thor (~> 0.14.6)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/bin/lazyman
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
lazyman_path = File.expand_path('../../lib', __FILE__)
|
4
|
-
puts lazyman_path
|
5
|
-
$:.unshift(lazyman_path)
|
6
|
-
|
7
|
-
require 'Lazyman/cli'
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lazyman_path = File.expand_path('../../lib', __FILE__)
|
4
|
+
puts lazyman_path
|
5
|
+
$:.unshift(lazyman_path)
|
6
|
+
|
7
|
+
require 'Lazyman/cli'
|
data/lazyman.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "lazyman"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["easonhan"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-11"
|
13
13
|
s.description = "A test framework using watir-webdriver rspec and page-object"
|
14
14
|
s.email = "nbkhic@qq.com"
|
15
15
|
s.executables = ["lazyman"]
|
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
"lib/lazyman/generators/lazyman/app/reports/.empty_directory",
|
46
46
|
"lib/lazyman/generators/lazyman/app/test_data/baidu.yml",
|
47
47
|
"lib/lazyman/generators/lazyman/config/config.yml",
|
48
|
+
"lib/lazyman/generators/lazyman/config/lazyman_formatter.rb",
|
48
49
|
"lib/lazyman/lazy_config.rb",
|
49
50
|
"lib/lazyman/lazy_initializer.rb",
|
50
51
|
"lib/lazyman/lazy_navigator.rb",
|
@@ -68,7 +69,7 @@ Gem::Specification.new do |s|
|
|
68
69
|
s.homepage = "https://github.com/easonhan007/lazyman"
|
69
70
|
s.licenses = ["MIT"]
|
70
71
|
s.require_paths = ["lib"]
|
71
|
-
s.rubygems_version = "1.8.
|
72
|
+
s.rubygems_version = "1.8.17"
|
72
73
|
s.summary = "A simple web automation test framework"
|
73
74
|
|
74
75
|
if s.respond_to? :specification_version then
|
@@ -1,5 +1,5 @@
|
|
1
|
-
lib/**/*.rb
|
2
|
-
-
|
3
|
-
README.md
|
4
|
-
License.txt
|
5
|
-
Changelog.md
|
1
|
+
lib/**/*.rb
|
2
|
+
-
|
3
|
+
README.md
|
4
|
+
License.txt
|
5
|
+
Changelog.md
|
@@ -1,5 +1,5 @@
|
|
1
|
-
lib/**/*.rb
|
2
|
-
-
|
3
|
-
README.md
|
4
|
-
License.txt
|
5
|
-
Changelog.md
|
1
|
+
lib/**/*.rb
|
2
|
+
-
|
3
|
+
README.md
|
4
|
+
License.txt
|
5
|
+
Changelog.md
|
@@ -1,5 +1,5 @@
|
|
1
|
-
lib/**/*.rb
|
2
|
-
-
|
3
|
-
README.md
|
4
|
-
License.txt
|
5
|
-
Changelog.md
|
1
|
+
lib/**/*.rb
|
2
|
+
-
|
3
|
+
README.md
|
4
|
+
License.txt
|
5
|
+
Changelog.md
|
@@ -0,0 +1,462 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'rspec/core/formatters/base_text_formatter'
|
3
|
+
|
4
|
+
module Lazyman
|
5
|
+
class LazymanFormatter < ::RSpec::Core::Formatters::BaseTextFormatter
|
6
|
+
include ERB::Util # for the #h method
|
7
|
+
|
8
|
+
def initialize(output)
|
9
|
+
output = File.new(File.expand_path(File.join('.', 'app', 'reports', "#{Time.now.strftime("%Y%m%d_%H%M%S")}.html")), 'w')
|
10
|
+
super(output)
|
11
|
+
@example_group_number = 0
|
12
|
+
@example_number = 0
|
13
|
+
@header_red = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def method_missing(m, *a, &b)
|
18
|
+
# no-op
|
19
|
+
end
|
20
|
+
|
21
|
+
public
|
22
|
+
def message(message)
|
23
|
+
end
|
24
|
+
|
25
|
+
# The number of the currently running example_group
|
26
|
+
def example_group_number
|
27
|
+
@example_group_number
|
28
|
+
end
|
29
|
+
|
30
|
+
# The number of the currently running example (a global counter)
|
31
|
+
def example_number
|
32
|
+
@example_number
|
33
|
+
end
|
34
|
+
|
35
|
+
def start(example_count)
|
36
|
+
super(example_count)
|
37
|
+
@output.puts html_header
|
38
|
+
@output.puts report_header
|
39
|
+
@output.flush
|
40
|
+
end
|
41
|
+
|
42
|
+
def example_group_started(example_group)
|
43
|
+
super(example_group)
|
44
|
+
@example_group_red = false
|
45
|
+
@example_group_number += 1
|
46
|
+
unless example_group_number == 1
|
47
|
+
@output.puts " </dl>"
|
48
|
+
@output.puts "</div>"
|
49
|
+
end
|
50
|
+
@output.puts "<div id=\"div_group_#{example_group_number}\" class=\"example_group passed\">"
|
51
|
+
@output.puts " <dl #{current_indentation}>"
|
52
|
+
@output.puts " <dt id=\"example_group_#{example_group_number}\" class=\"passed\">#{h(example_group.description)}</dt>"
|
53
|
+
@output.flush
|
54
|
+
end
|
55
|
+
|
56
|
+
def start_dump
|
57
|
+
@output.puts " </dl>"
|
58
|
+
@output.puts "</div>"
|
59
|
+
@output.flush
|
60
|
+
end
|
61
|
+
|
62
|
+
def example_started(example)
|
63
|
+
super(example)
|
64
|
+
@example_number += 1
|
65
|
+
end
|
66
|
+
|
67
|
+
def example_passed(example)
|
68
|
+
move_progress
|
69
|
+
@output.puts " <dd class=\"example passed\"><span class=\"passed_spec_name\">#{h(example.description)}</span><span class='duration'>#{sprintf("%.5f", example.execution_result[:run_time])}s</span></dd>"
|
70
|
+
@output.flush
|
71
|
+
end
|
72
|
+
|
73
|
+
def example_failed(example)
|
74
|
+
super(example)
|
75
|
+
exception = example.metadata[:execution_result][:exception]
|
76
|
+
extra = extra_failure_content(exception)
|
77
|
+
@output.puts " <script type=\"text/javascript\">makeRed('rspec-header');</script>" unless @header_red
|
78
|
+
@header_red = true
|
79
|
+
@output.puts " <script type=\"text/javascript\">makeRed('div_group_#{example_group_number}');</script>" unless @example_group_red
|
80
|
+
@output.puts " <script type=\"text/javascript\">makeRed('example_group_#{example_group_number}');</script>" unless @example_group_red
|
81
|
+
@example_group_red = true
|
82
|
+
move_progress
|
83
|
+
@output.puts " <dd class=\"example #{exception.pending_fixed? ? 'pending_fixed' : 'failed'}\">"
|
84
|
+
@output.puts " <span class=\"failed_spec_name\">#{h(example.description)}</span>"
|
85
|
+
@output.puts " <span class=\"duration\">#{sprintf('%.5f', example.execution_result[:run_time])}s</span>"
|
86
|
+
@output.puts " <div class=\"failure\" id=\"failure_#{@failed_examples.size}\">"
|
87
|
+
@output.puts " <div class=\"message\"><pre>#{h(exception.message)}</pre></div>" unless exception.nil?
|
88
|
+
@output.puts " <div class=\"backtrace\"><pre>#{format_backtrace(exception.backtrace, example).join("\n")}</pre></div>" if exception
|
89
|
+
@output.puts extra unless extra == ""
|
90
|
+
@output.puts "<a href=\"#{$navi.url}\">#{$navi.url}</a>" if $navi
|
91
|
+
@output.puts " </div>"
|
92
|
+
@output.puts " </dd>"
|
93
|
+
@output.flush
|
94
|
+
end
|
95
|
+
|
96
|
+
def example_pending(example)
|
97
|
+
message = example.metadata[:execution_result][:pending_message]
|
98
|
+
@output.puts " <script type=\"text/javascript\">makeYellow('rspec-header');</script>" unless @header_red
|
99
|
+
@output.puts " <script type=\"text/javascript\">makeYellow('div_group_#{example_group_number}');</script>" unless @example_group_red
|
100
|
+
@output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{example_group_number}');</script>" unless @example_group_red
|
101
|
+
move_progress
|
102
|
+
@output.puts " <dd class=\"example not_implemented\"><span class=\"not_implemented_spec_name\">#{h(example.description)} (PENDING: #{h(message)})</span></dd>"
|
103
|
+
@output.flush
|
104
|
+
end
|
105
|
+
|
106
|
+
# Override this method if you wish to output extra HTML for a failed spec. For example, you
|
107
|
+
# could output links to images or other files produced during the specs.
|
108
|
+
#
|
109
|
+
def extra_failure_content(exception)
|
110
|
+
require 'rspec/core/formatters/snippet_extractor'
|
111
|
+
backtrace = exception.backtrace.map {|line| backtrace_line(line)}
|
112
|
+
backtrace.compact!
|
113
|
+
@snippet_extractor ||= SnippetExtractor.new
|
114
|
+
" <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
|
115
|
+
end
|
116
|
+
|
117
|
+
def move_progress
|
118
|
+
@output.puts " <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
|
119
|
+
@output.flush
|
120
|
+
end
|
121
|
+
|
122
|
+
def percent_done
|
123
|
+
result = 100.0
|
124
|
+
if @example_count > 0
|
125
|
+
result = ((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
|
126
|
+
end
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
def dump_failures
|
131
|
+
end
|
132
|
+
|
133
|
+
def dump_pending
|
134
|
+
end
|
135
|
+
|
136
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
137
|
+
# TODO - kill dry_run?
|
138
|
+
if dry_run?
|
139
|
+
totals = "This was a dry-run"
|
140
|
+
else
|
141
|
+
totals = "#{example_count} example#{'s' unless example_count == 1}, "
|
142
|
+
totals << "#{failure_count} failure#{'s' unless failure_count == 1}"
|
143
|
+
totals << ", #{pending_count} pending" if pending_count > 0
|
144
|
+
end
|
145
|
+
@output.puts "<script type=\"text/javascript\">document.getElementById('duration').innerHTML = \"Finished in <strong>#{sprintf("%.5f", duration)} seconds</strong>\";</script>"
|
146
|
+
@output.puts "<script type=\"text/javascript\">document.getElementById('totals').innerHTML = \"#{totals}\";</script>"
|
147
|
+
@output.puts "</div>"
|
148
|
+
@output.puts "</div>"
|
149
|
+
@output.puts "</body>"
|
150
|
+
@output.puts "</html>"
|
151
|
+
@output.flush
|
152
|
+
end
|
153
|
+
|
154
|
+
def current_indentation
|
155
|
+
"style=\"margin-left: #{(example_group.ancestors.size - 1) * 15}px;\""
|
156
|
+
end
|
157
|
+
|
158
|
+
def html_header
|
159
|
+
<<-EOF
|
160
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
161
|
+
<!DOCTYPE html
|
162
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
163
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
164
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
165
|
+
<head>
|
166
|
+
<title>Lazyman Report</title>
|
167
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
168
|
+
<meta http-equiv="Expires" content="-1" />
|
169
|
+
<meta http-equiv="Pragma" content="no-cache" />
|
170
|
+
<style type="text/css">
|
171
|
+
body {
|
172
|
+
margin: 0;
|
173
|
+
padding: 0;
|
174
|
+
background: #fff;
|
175
|
+
font-size: 80%;
|
176
|
+
}
|
177
|
+
</style>
|
178
|
+
<script type="text/javascript">
|
179
|
+
// <![CDATA[
|
180
|
+
#{global_scripts}
|
181
|
+
// ]]>
|
182
|
+
</script>
|
183
|
+
<style type="text/css">
|
184
|
+
#{global_styles}
|
185
|
+
</style>
|
186
|
+
</head>
|
187
|
+
<body>
|
188
|
+
EOF
|
189
|
+
end
|
190
|
+
|
191
|
+
def report_header
|
192
|
+
<<-EOF
|
193
|
+
<div class="rspec-report">
|
194
|
+
|
195
|
+
<div id="rspec-header">
|
196
|
+
<div id="label">
|
197
|
+
<h1>Lazyman Report</h1>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
<div id="display-filters">
|
201
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
202
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
203
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div id="summary">
|
207
|
+
<p id="totals"> </p>
|
208
|
+
<p id="duration"> </p>
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
<div class="results">
|
214
|
+
EOF
|
215
|
+
end
|
216
|
+
|
217
|
+
def global_scripts
|
218
|
+
<<-EOF
|
219
|
+
|
220
|
+
function addClass(element_id, classname) {
|
221
|
+
document.getElementById(element_id).className += (" " + classname);
|
222
|
+
}
|
223
|
+
|
224
|
+
function removeClass(element_id, classname) {
|
225
|
+
var elem = document.getElementById(element_id);
|
226
|
+
var classlist = elem.className.replace(classname,'');
|
227
|
+
elem.className = classlist;
|
228
|
+
}
|
229
|
+
|
230
|
+
function moveProgressBar(percentDone) {
|
231
|
+
document.getElementById("rspec-header").style.width = percentDone +"%";
|
232
|
+
}
|
233
|
+
|
234
|
+
function makeRed(element_id) {
|
235
|
+
removeClass(element_id, 'passed');
|
236
|
+
removeClass(element_id, 'not_implemented');
|
237
|
+
addClass(element_id,'failed');
|
238
|
+
}
|
239
|
+
|
240
|
+
function makeYellow(element_id) {
|
241
|
+
var elem = document.getElementById(element_id);
|
242
|
+
if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
|
243
|
+
if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
|
244
|
+
removeClass(element_id, 'passed');
|
245
|
+
addClass(element_id,'not_implemented');
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
function apply_filters() {
|
251
|
+
var passed_filter = document.getElementById('passed_checkbox').checked;
|
252
|
+
var failed_filter = document.getElementById('failed_checkbox').checked;
|
253
|
+
var pending_filter = document.getElementById('pending_checkbox').checked;
|
254
|
+
|
255
|
+
assign_display_style("example passed", passed_filter);
|
256
|
+
assign_display_style("example failed", failed_filter);
|
257
|
+
assign_display_style("example not_implemented", pending_filter);
|
258
|
+
|
259
|
+
assign_display_style_for_group("example_group passed", passed_filter);
|
260
|
+
assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
|
261
|
+
assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
|
262
|
+
}
|
263
|
+
|
264
|
+
function get_display_style(display_flag) {
|
265
|
+
var style_mode = 'none';
|
266
|
+
if (display_flag == true) {
|
267
|
+
style_mode = 'block';
|
268
|
+
}
|
269
|
+
return style_mode;
|
270
|
+
}
|
271
|
+
|
272
|
+
function assign_display_style(classname, display_flag) {
|
273
|
+
var style_mode = get_display_style(display_flag);
|
274
|
+
var elems = document.getElementsByClassName(classname)
|
275
|
+
for (var i=0; i<elems.length;i++) {
|
276
|
+
elems[i].style.display = style_mode;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
|
281
|
+
var display_style_mode = get_display_style(display_flag);
|
282
|
+
var subgroup_style_mode = get_display_style(subgroup_flag);
|
283
|
+
var elems = document.getElementsByClassName(classname)
|
284
|
+
for (var i=0; i<elems.length;i++) {
|
285
|
+
var style_mode = display_style_mode;
|
286
|
+
if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
|
287
|
+
elems[i].style.display = subgroup_style_mode;
|
288
|
+
} else {
|
289
|
+
elems[i].style.display = display_style_mode;
|
290
|
+
}
|
291
|
+
}
|
292
|
+
}
|
293
|
+
EOF
|
294
|
+
end
|
295
|
+
|
296
|
+
def global_styles
|
297
|
+
<<-EOF
|
298
|
+
#rspec-header {
|
299
|
+
background: #65C400; color: #fff; height: 4em;
|
300
|
+
}
|
301
|
+
|
302
|
+
.rspec-report h1 {
|
303
|
+
margin: 0px 10px 0px 10px;
|
304
|
+
padding: 10px;
|
305
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
306
|
+
font-size: 1.8em;
|
307
|
+
position: absolute;
|
308
|
+
}
|
309
|
+
|
310
|
+
#label {
|
311
|
+
float:left;
|
312
|
+
}
|
313
|
+
|
314
|
+
#display-filters {
|
315
|
+
float:left;
|
316
|
+
padding: 28px 0 0 40%;
|
317
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
318
|
+
}
|
319
|
+
|
320
|
+
#summary {
|
321
|
+
float:right;
|
322
|
+
padding: 5px 10px;
|
323
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
324
|
+
text-align: right;
|
325
|
+
}
|
326
|
+
|
327
|
+
#summary p {
|
328
|
+
margin: 0 0 0 2px;
|
329
|
+
}
|
330
|
+
|
331
|
+
#summary #totals {
|
332
|
+
font-size: 1.2em;
|
333
|
+
}
|
334
|
+
|
335
|
+
.example_group {
|
336
|
+
margin: 0 10px 5px;
|
337
|
+
background: #fff;
|
338
|
+
}
|
339
|
+
|
340
|
+
dl {
|
341
|
+
margin: 0; padding: 0 0 5px;
|
342
|
+
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
|
343
|
+
}
|
344
|
+
|
345
|
+
dt {
|
346
|
+
padding: 3px;
|
347
|
+
background: #65C400;
|
348
|
+
color: #fff;
|
349
|
+
font-weight: bold;
|
350
|
+
}
|
351
|
+
|
352
|
+
dd {
|
353
|
+
margin: 5px 0 5px 5px;
|
354
|
+
padding: 3px 3px 3px 18px;
|
355
|
+
}
|
356
|
+
|
357
|
+
dd .duration {
|
358
|
+
padding-left: 5px;
|
359
|
+
text-align: right;
|
360
|
+
right: 0px;
|
361
|
+
float:right;
|
362
|
+
}
|
363
|
+
|
364
|
+
dd.example.passed {
|
365
|
+
border-left: 5px solid #65C400;
|
366
|
+
border-bottom: 1px solid #65C400;
|
367
|
+
background: #DBFFB4; color: #3D7700;
|
368
|
+
}
|
369
|
+
|
370
|
+
dd.example.not_implemented {
|
371
|
+
border-left: 5px solid #FAF834;
|
372
|
+
border-bottom: 1px solid #FAF834;
|
373
|
+
background: #FCFB98; color: #131313;
|
374
|
+
}
|
375
|
+
|
376
|
+
dd.example.pending_fixed {
|
377
|
+
border-left: 5px solid #0000C2;
|
378
|
+
border-bottom: 1px solid #0000C2;
|
379
|
+
color: #0000C2; background: #D3FBFF;
|
380
|
+
}
|
381
|
+
|
382
|
+
dd.example.failed {
|
383
|
+
border-left: 5px solid #C20000;
|
384
|
+
border-bottom: 1px solid #C20000;
|
385
|
+
color: #C20000; background: #FFFBD3;
|
386
|
+
}
|
387
|
+
|
388
|
+
|
389
|
+
dt.not_implemented {
|
390
|
+
color: #000000; background: #FAF834;
|
391
|
+
}
|
392
|
+
|
393
|
+
dt.pending_fixed {
|
394
|
+
color: #FFFFFF; background: #C40D0D;
|
395
|
+
}
|
396
|
+
|
397
|
+
dt.failed {
|
398
|
+
color: #FFFFFF; background: #C40D0D;
|
399
|
+
}
|
400
|
+
|
401
|
+
|
402
|
+
#rspec-header.not_implemented {
|
403
|
+
color: #000000; background: #FAF834;
|
404
|
+
}
|
405
|
+
|
406
|
+
#rspec-header.pending_fixed {
|
407
|
+
color: #FFFFFF; background: #C40D0D;
|
408
|
+
}
|
409
|
+
|
410
|
+
#rspec-header.failed {
|
411
|
+
color: #FFFFFF; background: #C40D0D;
|
412
|
+
}
|
413
|
+
|
414
|
+
|
415
|
+
.backtrace {
|
416
|
+
color: #000;
|
417
|
+
font-size: 12px;
|
418
|
+
}
|
419
|
+
|
420
|
+
a {
|
421
|
+
color: #BE5C00;
|
422
|
+
}
|
423
|
+
|
424
|
+
/* Ruby code, style similar to vibrant ink */
|
425
|
+
.ruby {
|
426
|
+
font-size: 12px;
|
427
|
+
font-family: monospace;
|
428
|
+
color: white;
|
429
|
+
background-color: black;
|
430
|
+
padding: 0.1em 0 0.2em 0;
|
431
|
+
}
|
432
|
+
|
433
|
+
.ruby .keyword { color: #FF6600; }
|
434
|
+
.ruby .constant { color: #339999; }
|
435
|
+
.ruby .attribute { color: white; }
|
436
|
+
.ruby .global { color: white; }
|
437
|
+
.ruby .module { color: white; }
|
438
|
+
.ruby .class { color: white; }
|
439
|
+
.ruby .string { color: #66FF00; }
|
440
|
+
.ruby .ident { color: white; }
|
441
|
+
.ruby .method { color: #FFCC00; }
|
442
|
+
.ruby .number { color: white; }
|
443
|
+
.ruby .char { color: white; }
|
444
|
+
.ruby .comment { color: #9933CC; }
|
445
|
+
.ruby .symbol { color: white; }
|
446
|
+
.ruby .regex { color: #44B4CC; }
|
447
|
+
.ruby .punct { color: white; }
|
448
|
+
.ruby .escape { color: white; }
|
449
|
+
.ruby .interp { color: white; }
|
450
|
+
.ruby .expr { color: white; }
|
451
|
+
|
452
|
+
.ruby .offending { background-color: gray; }
|
453
|
+
.ruby .linenum {
|
454
|
+
width: 75px;
|
455
|
+
padding: 0.1em 1em 0.2em 0;
|
456
|
+
color: #000000;
|
457
|
+
background-color: #FFFBD3;
|
458
|
+
}
|
459
|
+
EOF
|
460
|
+
end
|
461
|
+
end
|
462
|
+
end
|
data/spec/lazy_page_spec.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Lazyman::Page do
|
4
|
-
before :all do
|
5
|
-
@app_name = 'test'
|
6
|
-
Lazyman::Initializer.new File.dirname(__FILE__), @app_name
|
7
|
-
end
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
@browser = mock_watir_browser
|
11
|
-
end
|
12
|
-
|
13
|
-
def mock_watir_browser
|
14
|
-
watir_browser = double('watir')
|
15
|
-
watir_browser.stub!(:is_a?).with(anything()).and_return(false)
|
16
|
-
watir_browser.stub!(:is_a?).with(Watir::Browser).and_return(true)
|
17
|
-
watir_browser
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'method missing' do
|
21
|
-
@browser.stub :close
|
22
|
-
@browser.should_receive :close
|
23
|
-
Lazyman::Page.new(@browser).close
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should turn to page' do
|
27
|
-
p = Lazyman::Page.new(@browser).turn_to TestPage
|
28
|
-
p.is_a?(TestPage).should be_true
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should data driven with hash' do
|
32
|
-
btn = double();
|
33
|
-
hash = {:one => 'click', :two => 'ok'}
|
34
|
-
|
35
|
-
p = TestPage.new(@browser)
|
36
|
-
p.stub(:one).and_return(btn)
|
37
|
-
p.stub(:two=)
|
38
|
-
btn.should_receive(:click)
|
39
|
-
p.should_receive(:one)
|
40
|
-
p.should_receive(:two=).with('ok')
|
41
|
-
p.data_driven(hash)
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lazyman::Page do
|
4
|
+
before :all do
|
5
|
+
@app_name = 'test'
|
6
|
+
Lazyman::Initializer.new File.dirname(__FILE__), @app_name
|
7
|
+
end
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@browser = mock_watir_browser
|
11
|
+
end
|
12
|
+
|
13
|
+
def mock_watir_browser
|
14
|
+
watir_browser = double('watir')
|
15
|
+
watir_browser.stub!(:is_a?).with(anything()).and_return(false)
|
16
|
+
watir_browser.stub!(:is_a?).with(Watir::Browser).and_return(true)
|
17
|
+
watir_browser
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'method missing' do
|
21
|
+
@browser.stub :close
|
22
|
+
@browser.should_receive :close
|
23
|
+
Lazyman::Page.new(@browser).close
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should turn to page' do
|
27
|
+
p = Lazyman::Page.new(@browser).turn_to TestPage
|
28
|
+
p.is_a?(TestPage).should be_true
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should data driven with hash' do
|
32
|
+
btn = double();
|
33
|
+
hash = {:one => 'click', :two => 'ok'}
|
34
|
+
|
35
|
+
p = TestPage.new(@browser)
|
36
|
+
p.stub(:one).and_return(btn)
|
37
|
+
p.stub(:two=)
|
38
|
+
btn.should_receive(:click)
|
39
|
+
p.should_receive(:one)
|
40
|
+
p.should_receive(:two=).with('ok')
|
41
|
+
p.data_driven(hash)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazyman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &22521168 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.13.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22521168
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: page-object
|
27
|
-
requirement: &
|
27
|
+
requirement: &22520868 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.6.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *22520868
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: thor
|
38
|
-
requirement: &
|
38
|
+
requirement: &22520556 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.14.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *22520556
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: active_support
|
49
|
-
requirement: &
|
49
|
+
requirement: &22520232 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.0.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *22520232
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rdoc
|
60
|
-
requirement: &
|
60
|
+
requirement: &22519920 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '3.12'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *22519920
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &22519620 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.0.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *22519620
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: jeweler
|
82
|
-
requirement: &
|
82
|
+
requirement: &22519284 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 1.8.4
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *22519284
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &22518924 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 2.13.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *22518924
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: page-object
|
104
|
-
requirement: &
|
104
|
+
requirement: &22518624 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: 0.8.6.1
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *22518624
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: thor
|
115
|
-
requirement: &
|
115
|
+
requirement: &22518324 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 0.14.6
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *22518324
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: active_support
|
126
|
-
requirement: &
|
126
|
+
requirement: &22518024 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: 3.0.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *22518024
|
135
135
|
description: A test framework using watir-webdriver rspec and page-object
|
136
136
|
email: nbkhic@qq.com
|
137
137
|
executables:
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/lazyman/generators/lazyman/app/reports/.empty_directory
|
169
169
|
- lib/lazyman/generators/lazyman/app/test_data/baidu.yml
|
170
170
|
- lib/lazyman/generators/lazyman/config/config.yml
|
171
|
+
- lib/lazyman/generators/lazyman/config/lazyman_formatter.rb
|
171
172
|
- lib/lazyman/lazy_config.rb
|
172
173
|
- lib/lazyman/lazy_initializer.rb
|
173
174
|
- lib/lazyman/lazy_navigator.rb
|
@@ -202,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
203
|
version: '0'
|
203
204
|
segments:
|
204
205
|
- 0
|
205
|
-
hash:
|
206
|
+
hash: 973188593
|
206
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
208
|
none: false
|
208
209
|
requirements:
|
@@ -211,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
212
|
version: '0'
|
212
213
|
requirements: []
|
213
214
|
rubyforge_project:
|
214
|
-
rubygems_version: 1.8.
|
215
|
+
rubygems_version: 1.8.17
|
215
216
|
signing_key:
|
216
217
|
specification_version: 3
|
217
218
|
summary: A simple web automation test framework
|