lazyman 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/VERSION +1 -1
- data/lazyman.gemspec +9 -2
- data/lib/lazyman.rb +1 -0
- data/lib/lazyman/cli.rb +7 -4
- data/lib/lazyman/ext/string.rb +10 -0
- data/lib/lazyman/generators/lazyman/app/cases/examples/baidu_example_spec.rb +1 -1
- data/lib/lazyman/generators/lazyman/app/cases/examples/google_example_spec.rb +16 -0
- data/lib/lazyman/generators/lazyman/app/cases/spec_helper.rb.tt +11 -2
- data/lib/lazyman/generators/lazyman/app/pages/google/google_page.rb.tt +18 -0
- data/lib/lazyman/generators/lazyman/app/pages/google/google_search_result_page.rb.tt +4 -0
- data/lib/lazyman/generators/lazyman/bin/console +7 -0
- data/lib/lazyman/generators/lazyman/bin/console.bat +6 -0
- data/lib/lazyman/generators/lazyman/bin/setup.rb.tt +12 -0
- data/lib/lazyman/generators/lazyman/config/config.yml +1 -0
- data/lib/lazyman/generators/lazyman/config/lazyman_formatter.rb +11 -11
- metadata +32 -25
data/README.md
CHANGED
@@ -36,11 +36,11 @@ By default, lazyman runs examples using chrome browser, so make sure you install
|
|
36
36
|
Using following command to make everything running.
|
37
37
|
|
38
38
|
cd your_project_name
|
39
|
-
lazyman go
|
40
|
-
or
|
41
|
-
rspec -f doc
|
39
|
+
lazyman go # or rspec
|
42
40
|
|
43
|
-
|
41
|
+
Lazyman go command supports all the rspec options and it is the recommend way.
|
42
|
+
|
43
|
+
You can find test report in app/reports folder. It is a html file with current time stamp.
|
44
44
|
|
45
45
|
Understand lazyman project structure
|
46
46
|
------------------------------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
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.5"
|
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-17"
|
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"]
|
@@ -32,8 +32,10 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/lazyman.rb",
|
33
33
|
"lib/lazyman/cli.rb",
|
34
34
|
"lib/lazyman/errors.rb",
|
35
|
+
"lib/lazyman/ext/string.rb",
|
35
36
|
"lib/lazyman/generators/lazyman/.rspec",
|
36
37
|
"lib/lazyman/generators/lazyman/app/cases/examples/baidu_example_spec.rb",
|
38
|
+
"lib/lazyman/generators/lazyman/app/cases/examples/google_example_spec.rb",
|
37
39
|
"lib/lazyman/generators/lazyman/app/cases/shared/.empty_directory",
|
38
40
|
"lib/lazyman/generators/lazyman/app/cases/spec_helper.rb.tt",
|
39
41
|
"lib/lazyman/generators/lazyman/app/matchers/.empty_directory",
|
@@ -42,8 +44,13 @@ Gem::Specification.new do |s|
|
|
42
44
|
"lib/lazyman/generators/lazyman/app/pages/baidu/baidu_page.rb.tt",
|
43
45
|
"lib/lazyman/generators/lazyman/app/pages/baidu/search_result_page.rb.tt",
|
44
46
|
"lib/lazyman/generators/lazyman/app/pages/components/.empty_directory",
|
47
|
+
"lib/lazyman/generators/lazyman/app/pages/google/google_page.rb.tt",
|
48
|
+
"lib/lazyman/generators/lazyman/app/pages/google/google_search_result_page.rb.tt",
|
45
49
|
"lib/lazyman/generators/lazyman/app/reports/.empty_directory",
|
46
50
|
"lib/lazyman/generators/lazyman/app/test_data/baidu.yml",
|
51
|
+
"lib/lazyman/generators/lazyman/bin/console",
|
52
|
+
"lib/lazyman/generators/lazyman/bin/console.bat",
|
53
|
+
"lib/lazyman/generators/lazyman/bin/setup.rb.tt",
|
47
54
|
"lib/lazyman/generators/lazyman/config/config.yml",
|
48
55
|
"lib/lazyman/generators/lazyman/config/lazyman_formatter.rb",
|
49
56
|
"lib/lazyman/lazy_config.rb",
|
data/lib/lazyman.rb
CHANGED
data/lib/lazyman/cli.rb
CHANGED
@@ -10,8 +10,7 @@ module Lazyman
|
|
10
10
|
File.join File.dirname(__FILE__), 'generators'
|
11
11
|
end
|
12
12
|
|
13
|
-
desc 'new
|
14
|
-
|
13
|
+
desc 'new', 'create a lazyman project'
|
15
14
|
def new
|
16
15
|
if app_name
|
17
16
|
directory 'lazyman', app_name
|
@@ -20,13 +19,17 @@ module Lazyman
|
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
desc 'go', 'run test case with rspec'
|
24
|
-
|
22
|
+
desc 'go ', 'run test case with rspec'
|
25
23
|
def go
|
26
24
|
ARGV.shift
|
27
25
|
puts "rspec #{ARGV.join('')}" if $debug
|
28
26
|
run "rspec #{ARGV.join('')}"
|
29
27
|
end
|
28
|
+
|
29
|
+
desc 'c ', 'open lazyman console'
|
30
|
+
def c
|
31
|
+
run 'bin/console'
|
32
|
+
end
|
30
33
|
|
31
34
|
end
|
32
35
|
CLI.start
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require File.expand_path 'app/cases/spec_helper'
|
3
|
+
|
4
|
+
describe 'Google example show you how to use lazyman', :google do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
@keyword = 'watir-webdriver'
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should have correct search result' do
|
11
|
+
google_page = $navi.goto_google_page
|
12
|
+
result_page = google_page.search_for @keyword
|
13
|
+
result_page.first_result.should eq 'Watir WebDriver | the most elegant way to use webdriver with ruby'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
ENV.delete 'HTTP_PROXY' if ENV['HTTP_PROXY']
|
1
2
|
require 'rubygems' #for ruby187
|
2
3
|
require 'erb'
|
3
4
|
require 'psych'
|
@@ -7,11 +8,19 @@ begin
|
|
7
8
|
rescue LoadError
|
8
9
|
puts 'you need using "gem install lazyman" to install lazyman first'
|
9
10
|
end
|
11
|
+
|
10
12
|
<% require 'active_support/all' %>
|
11
13
|
Lazyman::Initializer.new(File.expand_path(File.join('.')), '<%= app_name %>')
|
12
14
|
$:.unshift(File.expand_path File.join('.'))
|
13
15
|
|
14
16
|
RSpec.configure do |c|
|
17
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
18
|
+
|
19
|
+
unless($config.tags.empty?)
|
20
|
+
tags = $config.tags.lazy_to_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
c.filter_run tags
|
15
24
|
|
16
25
|
def test_data file
|
17
26
|
content = ''
|
@@ -23,11 +32,11 @@ RSpec.configure do |c|
|
|
23
32
|
Psych.load ERB.new(content).result(binding)
|
24
33
|
end
|
25
34
|
|
26
|
-
c.before(:
|
35
|
+
c.before(:suite) do
|
27
36
|
$navi = <%= app_name.camelize %>Navigator.new $config
|
28
37
|
end
|
29
38
|
|
30
|
-
c.after(:
|
39
|
+
c.after(:suite) do
|
31
40
|
$navi.close
|
32
41
|
end
|
33
42
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require File.expand_path 'app/pages/google/google_search_result_page'
|
3
|
+
|
4
|
+
class GooglePage < <%= app_name.camelize%>Page
|
5
|
+
page_url 'www.google.com.hk'
|
6
|
+
|
7
|
+
text_field 'keyword', name: 'q'
|
8
|
+
button 'search', name: 'btnK'
|
9
|
+
|
10
|
+
def search_for kw
|
11
|
+
self.keyword = kw
|
12
|
+
self.keyword_element.send_keys :return
|
13
|
+
# example show you how to use wait_until_present
|
14
|
+
@browser.table(id: 'nav').wait_until_present
|
15
|
+
turn_to GoogleSearchResultPage
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
def test_data file
|
2
|
+
content = ''
|
3
|
+
file_path = File.expand_path(File.join('.', 'app', 'test_data', "#{file}.yml"))
|
4
|
+
raise "Can not find #{file}.yml" unless File.exists?(file_path)
|
5
|
+
File.open(file_path, 'r') do |handle|
|
6
|
+
content = handle.read
|
7
|
+
end
|
8
|
+
Psych.load ERB.new(content).result(binding)
|
9
|
+
end
|
10
|
+
<% require 'active_support/all' %>
|
11
|
+
$navi = <%= app_name.camelize %>Navigator.new $config
|
12
|
+
|
@@ -74,7 +74,7 @@ module Lazyman
|
|
74
74
|
super(example)
|
75
75
|
exception = example.metadata[:execution_result][:exception]
|
76
76
|
extra = extra_failure_content(exception)
|
77
|
-
@output.puts " <script type=\"text/javascript\">makeRed('
|
77
|
+
@output.puts " <script type=\"text/javascript\">makeRed('lazyman-header');</script>" unless @header_red
|
78
78
|
@header_red = true
|
79
79
|
@output.puts " <script type=\"text/javascript\">makeRed('div_group_#{example_group_number}');</script>" unless @example_group_red
|
80
80
|
@output.puts " <script type=\"text/javascript\">makeRed('example_group_#{example_group_number}');</script>" unless @example_group_red
|
@@ -95,7 +95,7 @@ module Lazyman
|
|
95
95
|
|
96
96
|
def example_pending(example)
|
97
97
|
message = example.metadata[:execution_result][:pending_message]
|
98
|
-
@output.puts " <script type=\"text/javascript\">makeYellow('
|
98
|
+
@output.puts " <script type=\"text/javascript\">makeYellow('lazyman-header');</script>" unless @header_red
|
99
99
|
@output.puts " <script type=\"text/javascript\">makeYellow('div_group_#{example_group_number}');</script>" unless @example_group_red
|
100
100
|
@output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{example_group_number}');</script>" unless @example_group_red
|
101
101
|
move_progress
|
@@ -110,7 +110,7 @@ module Lazyman
|
|
110
110
|
require 'rspec/core/formatters/snippet_extractor'
|
111
111
|
backtrace = exception.backtrace.map {|line| backtrace_line(line)}
|
112
112
|
backtrace.compact!
|
113
|
-
@snippet_extractor ||= SnippetExtractor.new
|
113
|
+
@snippet_extractor ||= ::RSpec::Core::Formatters::SnippetExtractor.new
|
114
114
|
" <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
|
115
115
|
end
|
116
116
|
|
@@ -190,9 +190,9 @@ EOF
|
|
190
190
|
|
191
191
|
def report_header
|
192
192
|
<<-EOF
|
193
|
-
<div class="
|
193
|
+
<div class="lazyman-report">
|
194
194
|
|
195
|
-
<div id="
|
195
|
+
<div id="lazyman-header">
|
196
196
|
<div id="label">
|
197
197
|
<h1>Lazyman Report</h1>
|
198
198
|
</div>
|
@@ -228,7 +228,7 @@ elem.className = classlist;
|
|
228
228
|
}
|
229
229
|
|
230
230
|
function moveProgressBar(percentDone) {
|
231
|
-
document.getElementById("
|
231
|
+
document.getElementById("lazyman-header").style.width = percentDone +"%";
|
232
232
|
}
|
233
233
|
|
234
234
|
function makeRed(element_id) {
|
@@ -295,11 +295,11 @@ EOF
|
|
295
295
|
|
296
296
|
def global_styles
|
297
297
|
<<-EOF
|
298
|
-
#
|
298
|
+
#lazyman-header {
|
299
299
|
background: #65C400; color: #fff; height: 4em;
|
300
300
|
}
|
301
301
|
|
302
|
-
.
|
302
|
+
.lazyman-report h1 {
|
303
303
|
margin: 0px 10px 0px 10px;
|
304
304
|
padding: 10px;
|
305
305
|
font-family: "Lucida Grande", Helvetica, sans-serif;
|
@@ -399,15 +399,15 @@ color: #FFFFFF; background: #C40D0D;
|
|
399
399
|
}
|
400
400
|
|
401
401
|
|
402
|
-
#
|
402
|
+
#lazyman-header.not_implemented {
|
403
403
|
color: #000000; background: #FAF834;
|
404
404
|
}
|
405
405
|
|
406
|
-
#
|
406
|
+
#lazyman-header.pending_fixed {
|
407
407
|
color: #FFFFFF; background: #C40D0D;
|
408
408
|
}
|
409
409
|
|
410
|
-
#
|
410
|
+
#lazyman-header.failed {
|
411
411
|
color: #FFFFFF; background: #C40D0D;
|
412
412
|
}
|
413
413
|
|
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.5
|
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-17 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &26888076 !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: *26888076
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: page-object
|
27
|
-
requirement: &
|
27
|
+
requirement: &26887752 !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: *26887752
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: thor
|
38
|
-
requirement: &
|
38
|
+
requirement: &26887416 !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: *26887416
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: active_support
|
49
|
-
requirement: &
|
49
|
+
requirement: &26887116 !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: *26887116
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rdoc
|
60
|
-
requirement: &
|
60
|
+
requirement: &26886792 !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: *26886792
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &26886432 !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: *26886432
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: jeweler
|
82
|
-
requirement: &
|
82
|
+
requirement: &26886144 !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: *26886144
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &26885784 !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: *26885784
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: page-object
|
104
|
-
requirement: &
|
104
|
+
requirement: &26885400 !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: *26885400
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: thor
|
115
|
-
requirement: &
|
115
|
+
requirement: &26885052 !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: *26885052
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: active_support
|
126
|
-
requirement: &
|
126
|
+
requirement: &26884752 !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: *26884752
|
135
135
|
description: A test framework using watir-webdriver rspec and page-object
|
136
136
|
email: nbkhic@qq.com
|
137
137
|
executables:
|
@@ -155,8 +155,10 @@ files:
|
|
155
155
|
- lib/lazyman.rb
|
156
156
|
- lib/lazyman/cli.rb
|
157
157
|
- lib/lazyman/errors.rb
|
158
|
+
- lib/lazyman/ext/string.rb
|
158
159
|
- lib/lazyman/generators/lazyman/.rspec
|
159
160
|
- lib/lazyman/generators/lazyman/app/cases/examples/baidu_example_spec.rb
|
161
|
+
- lib/lazyman/generators/lazyman/app/cases/examples/google_example_spec.rb
|
160
162
|
- lib/lazyman/generators/lazyman/app/cases/shared/.empty_directory
|
161
163
|
- lib/lazyman/generators/lazyman/app/cases/spec_helper.rb.tt
|
162
164
|
- lib/lazyman/generators/lazyman/app/matchers/.empty_directory
|
@@ -165,8 +167,13 @@ files:
|
|
165
167
|
- lib/lazyman/generators/lazyman/app/pages/baidu/baidu_page.rb.tt
|
166
168
|
- lib/lazyman/generators/lazyman/app/pages/baidu/search_result_page.rb.tt
|
167
169
|
- lib/lazyman/generators/lazyman/app/pages/components/.empty_directory
|
170
|
+
- lib/lazyman/generators/lazyman/app/pages/google/google_page.rb.tt
|
171
|
+
- lib/lazyman/generators/lazyman/app/pages/google/google_search_result_page.rb.tt
|
168
172
|
- lib/lazyman/generators/lazyman/app/reports/.empty_directory
|
169
173
|
- lib/lazyman/generators/lazyman/app/test_data/baidu.yml
|
174
|
+
- lib/lazyman/generators/lazyman/bin/console
|
175
|
+
- lib/lazyman/generators/lazyman/bin/console.bat
|
176
|
+
- lib/lazyman/generators/lazyman/bin/setup.rb.tt
|
170
177
|
- lib/lazyman/generators/lazyman/config/config.yml
|
171
178
|
- lib/lazyman/generators/lazyman/config/lazyman_formatter.rb
|
172
179
|
- lib/lazyman/lazy_config.rb
|
@@ -203,7 +210,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
210
|
version: '0'
|
204
211
|
segments:
|
205
212
|
- 0
|
206
|
-
hash:
|
213
|
+
hash: -526333347
|
207
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
215
|
none: false
|
209
216
|
requirements:
|