lazyman 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -6
- data/Gemfile.lock +64 -64
- data/VERSION +1 -1
- data/bin/lazyman +7 -7
- data/lazyman.gemspec +21 -21
- data/lib/lazyman/ext/string.rb +12 -12
- data/lib/lazyman/generators/lazyman/.rspec +3 -3
- data/lib/lazyman/generators/lazyman/app/cases/baidu_and_google/google_example_spec.rb +16 -16
- data/lib/lazyman/generators/lazyman/app/cases/shared/login.rb +11 -11
- 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/pages/components/menu.rb +6 -6
- data/lib/lazyman/generators/lazyman/app/pages/google/google_page.rb.tt +16 -16
- data/lib/lazyman/generators/lazyman/app/pages/google/google_search_result_page.rb.tt +4 -4
- data/lib/lazyman/generators/lazyman/app/reports/.empty_directory +5 -5
- data/lib/lazyman/generators/lazyman/bin/console +7 -7
- data/lib/lazyman/generators/lazyman/bin/console.bat +6 -6
- data/lib/lazyman/generators/lazyman/bin/setup.rb.tt +12 -12
- data/lib/lazyman/generators/lazyman/config/lazyman_formatter.rb +24 -24
- data/spec/lazy_page_spec.rb +44 -44
- data/spec/string_spec.rb +10 -10
- metadata +32 -32
data/Gemfile
CHANGED
@@ -5,17 +5,17 @@ source "http://ruby.taobao.org"
|
|
5
5
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
gem "rspec", "
|
9
|
-
gem "page-object", "
|
10
|
-
gem "thor", "
|
8
|
+
gem "rspec", ">= 2.13.0"
|
9
|
+
gem "page-object", ">= 0.8.6.1"
|
10
|
+
gem "thor", ">= 0.14.6"
|
11
11
|
gem "active_support", "~> 3.0.0"
|
12
12
|
|
13
13
|
group :development do
|
14
14
|
gem "rdoc", "~> 3.12"
|
15
15
|
gem "bundler", "~> 1.0.0"
|
16
16
|
gem "jeweler", "~> 1.8.4"
|
17
|
-
gem "rspec", "
|
18
|
-
gem "page-object", "
|
19
|
-
gem "thor", "
|
17
|
+
gem "rspec", ">= 2.13.0"
|
18
|
+
gem "page-object", ">= 0.8.6.1"
|
19
|
+
gem "thor", ">= 0.14.6"
|
20
20
|
gem "active_support", "~> 3.0.0"
|
21
21
|
end
|
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 (
|
62
|
-
rdoc (~> 3.12)
|
63
|
-
rspec (
|
64
|
-
thor (
|
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.11
|
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.11"
|
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-
|
12
|
+
s.date = "2013-07-15"
|
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"]
|
@@ -84,48 +84,48 @@ Gem::Specification.new do |s|
|
|
84
84
|
s.homepage = "https://github.com/easonhan007/lazyman"
|
85
85
|
s.licenses = ["MIT"]
|
86
86
|
s.require_paths = ["lib"]
|
87
|
-
s.rubygems_version = "1.8.
|
87
|
+
s.rubygems_version = "1.8.17"
|
88
88
|
s.summary = "A simple web automation test framework"
|
89
89
|
|
90
90
|
if s.respond_to? :specification_version then
|
91
91
|
s.specification_version = 3
|
92
92
|
|
93
93
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
94
|
-
s.add_runtime_dependency(%q<rspec>, ["
|
95
|
-
s.add_runtime_dependency(%q<page-object>, ["
|
96
|
-
s.add_runtime_dependency(%q<thor>, ["
|
94
|
+
s.add_runtime_dependency(%q<rspec>, [">= 2.13.0"])
|
95
|
+
s.add_runtime_dependency(%q<page-object>, [">= 0.8.6.1"])
|
96
|
+
s.add_runtime_dependency(%q<thor>, [">= 0.14.6"])
|
97
97
|
s.add_runtime_dependency(%q<active_support>, ["~> 3.0.0"])
|
98
98
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
99
99
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
100
100
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
101
|
-
s.add_development_dependency(%q<rspec>, ["
|
102
|
-
s.add_development_dependency(%q<page-object>, ["
|
103
|
-
s.add_development_dependency(%q<thor>, ["
|
101
|
+
s.add_development_dependency(%q<rspec>, [">= 2.13.0"])
|
102
|
+
s.add_development_dependency(%q<page-object>, [">= 0.8.6.1"])
|
103
|
+
s.add_development_dependency(%q<thor>, [">= 0.14.6"])
|
104
104
|
s.add_development_dependency(%q<active_support>, ["~> 3.0.0"])
|
105
105
|
else
|
106
|
-
s.add_dependency(%q<rspec>, ["
|
107
|
-
s.add_dependency(%q<page-object>, ["
|
108
|
-
s.add_dependency(%q<thor>, ["
|
106
|
+
s.add_dependency(%q<rspec>, [">= 2.13.0"])
|
107
|
+
s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
|
108
|
+
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
109
109
|
s.add_dependency(%q<active_support>, ["~> 3.0.0"])
|
110
110
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
111
111
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
112
112
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
113
|
-
s.add_dependency(%q<rspec>, ["
|
114
|
-
s.add_dependency(%q<page-object>, ["
|
115
|
-
s.add_dependency(%q<thor>, ["
|
113
|
+
s.add_dependency(%q<rspec>, [">= 2.13.0"])
|
114
|
+
s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
|
115
|
+
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
116
116
|
s.add_dependency(%q<active_support>, ["~> 3.0.0"])
|
117
117
|
end
|
118
118
|
else
|
119
|
-
s.add_dependency(%q<rspec>, ["
|
120
|
-
s.add_dependency(%q<page-object>, ["
|
121
|
-
s.add_dependency(%q<thor>, ["
|
119
|
+
s.add_dependency(%q<rspec>, [">= 2.13.0"])
|
120
|
+
s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
|
121
|
+
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
122
122
|
s.add_dependency(%q<active_support>, ["~> 3.0.0"])
|
123
123
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
124
124
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
125
125
|
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
126
|
-
s.add_dependency(%q<rspec>, ["
|
127
|
-
s.add_dependency(%q<page-object>, ["
|
128
|
-
s.add_dependency(%q<thor>, ["
|
126
|
+
s.add_dependency(%q<rspec>, [">= 2.13.0"])
|
127
|
+
s.add_dependency(%q<page-object>, [">= 0.8.6.1"])
|
128
|
+
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
129
129
|
s.add_dependency(%q<active_support>, ["~> 3.0.0"])
|
130
130
|
end
|
131
131
|
end
|
data/lib/lazyman/ext/string.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
class String
|
2
|
-
def lazy_to_hash
|
3
|
-
hash = { }
|
4
|
-
return hash if self.empty?
|
5
|
-
arr = self.split(',').map { |i| i.strip }
|
6
|
-
arr.each do |key|
|
7
|
-
hash[key.to_sym] = true
|
8
|
-
end #each
|
9
|
-
hash
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
1
|
+
class String
|
2
|
+
def lazy_to_hash
|
3
|
+
hash = { }
|
4
|
+
return hash if self.empty?
|
5
|
+
arr = self.split(',').map { |i| i.strip }
|
6
|
+
arr.each do |key|
|
7
|
+
hash[key.to_sym] = true
|
8
|
+
end #each
|
9
|
+
hash
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
--default-path=./app/cases
|
2
|
-
--format Lazyman::LazymanFormatter
|
3
|
-
-r ./config/lazyman_formatter.rb
|
1
|
+
--default-path=./app/cases
|
2
|
+
--format Lazyman::LazymanFormatter
|
3
|
+
-r ./config/lazyman_formatter.rb
|
@@ -1,16 +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
|
+
#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,11 +1,11 @@
|
|
1
|
-
shared_examples 'login' do
|
2
|
-
it 'should login' do
|
3
|
-
data = test_data('login_user')
|
4
|
-
user = data['demo']['name']
|
5
|
-
password = data['demo']['password']
|
6
|
-
|
7
|
-
login_page = $navi.goto_login_page
|
8
|
-
my_view_page = login_page.login user, password
|
9
|
-
my_view_page.report_issue?.should be_true
|
10
|
-
end
|
11
|
-
end
|
1
|
+
shared_examples 'login' do
|
2
|
+
it 'should login' do
|
3
|
+
data = test_data('login_user')
|
4
|
+
user = data['demo']['name']
|
5
|
+
password = data['demo']['password']
|
6
|
+
|
7
|
+
login_page = $navi.goto_login_page
|
8
|
+
my_view_page = login_page.login user, password
|
9
|
+
my_view_page.report_issue?.should be_true
|
10
|
+
end
|
11
|
+
end
|
@@ -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,6 +1,6 @@
|
|
1
|
-
module Menu
|
2
|
-
include PageObject
|
3
|
-
link 'main', text: 'Main'
|
4
|
-
link 'logout', text: 'Logout'
|
5
|
-
link 'report_issue', text: 'Report Issue'
|
6
|
-
end
|
1
|
+
module Menu
|
2
|
+
include PageObject
|
3
|
+
link 'main', text: 'Main'
|
4
|
+
link 'logout', text: 'Logout'
|
5
|
+
link 'report_issue', text: 'Report Issue'
|
6
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
class GooglePage < <%= app_name.camelize%>Page
|
3
|
-
page_url 'www.google.com.hk'
|
4
|
-
|
5
|
-
text_field 'keyword', name: 'q'
|
6
|
-
button 'search', name: 'btnK'
|
7
|
-
|
8
|
-
def search_for kw
|
9
|
-
self.keyword = kw
|
10
|
-
self.keyword_element.send_keys :return
|
11
|
-
# example show you how to use wait_until_present
|
12
|
-
@browser.table(id: 'nav').wait_until_present
|
13
|
-
turn_to GoogleSearchResultPage
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
1
|
+
#encoding: utf-8
|
2
|
+
class GooglePage < <%= app_name.camelize%>Page
|
3
|
+
page_url 'www.google.com.hk'
|
4
|
+
|
5
|
+
text_field 'keyword', name: 'q'
|
6
|
+
button 'search', name: 'btnK'
|
7
|
+
|
8
|
+
def search_for kw
|
9
|
+
self.keyword = kw
|
10
|
+
self.keyword_element.send_keys :return
|
11
|
+
# example show you how to use wait_until_present
|
12
|
+
@browser.table(id: 'nav').wait_until_present
|
13
|
+
turn_to GoogleSearchResultPage
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
class GoogleSearchResultPage < <%= app_name.camelize%>Page
|
3
|
-
h3 'first_result', index: 0
|
4
|
-
end
|
1
|
+
#encoding: utf-8
|
2
|
+
class GoogleSearchResultPage < <%= app_name.camelize%>Page
|
3
|
+
h3 'first_result', index: 0
|
4
|
+
end
|
@@ -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,7 +1,7 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
spec_helper = File.expand_path(File.join('.', 'app', 'cases', 'spec_helper.rb'))
|
4
|
-
|
5
|
-
setup = File.join(File.dirname(__FILE__), 'setup.rb')
|
6
|
-
|
7
|
-
exec "irb -r rspec -r #{spec_helper} -r #{setup} -r irb/completion --simple-prompt --readline"
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
spec_helper = File.expand_path(File.join('.', 'app', 'cases', 'spec_helper.rb'))
|
4
|
+
|
5
|
+
setup = File.join(File.dirname(__FILE__), 'setup.rb')
|
6
|
+
|
7
|
+
exec "irb -r rspec -r #{spec_helper} -r #{setup} -r irb/completion --simple-prompt --readline"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
@ECHO OFF
|
2
|
-
IF NOT "%~f0" == "~f0" GOTO :WinNT
|
3
|
-
@"ruby.exe" "" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
4
|
-
GOTO :EOF
|
5
|
-
:WinNT
|
6
|
-
@"ruby.exe" "%~dpn0" %*
|
1
|
+
@ECHO OFF
|
2
|
+
IF NOT "%~f0" == "~f0" GOTO :WinNT
|
3
|
+
@"ruby.exe" "" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
4
|
+
GOTO :EOF
|
5
|
+
:WinNT
|
6
|
+
@"ruby.exe" "%~dpn0" %*
|
@@ -1,12 +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
|
-
|
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
|
+
|
@@ -1,24 +1,24 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'rspec/core/formatters/html_formatter'
|
3
|
-
|
4
|
-
module Lazyman
|
5
|
-
class LazymanFormatter < ::RSpec::Core::Formatters::HtmlFormatter
|
6
|
-
def initialize(output)
|
7
|
-
output = File.new(File.expand_path(File.join('.', 'app', 'reports', "#{Time.now.strftime("%Y%m%d_%H%M%S")}.html")), 'w')
|
8
|
-
super(output)
|
9
|
-
@printer.class.send(:define_method, 'puts') do |what|
|
10
|
-
@output.puts what
|
11
|
-
end #define_method
|
12
|
-
end
|
13
|
-
|
14
|
-
def example_failed(example)
|
15
|
-
super(example)
|
16
|
-
if $navi
|
17
|
-
failed_url = $navi.url rescue $navi.current_url
|
18
|
-
@printer.puts "<a target=\"_blank\" href=\"#{failed_url}\">failed url is [#{failed_url}]</a>"
|
19
|
-
@printer.puts '<br />'
|
20
|
-
@printer.flush
|
21
|
-
end #if
|
22
|
-
end
|
23
|
-
end #LazymanFormatter
|
24
|
-
end #Lazyman
|
1
|
+
require 'erb'
|
2
|
+
require 'rspec/core/formatters/html_formatter'
|
3
|
+
|
4
|
+
module Lazyman
|
5
|
+
class LazymanFormatter < ::RSpec::Core::Formatters::HtmlFormatter
|
6
|
+
def initialize(output)
|
7
|
+
output = File.new(File.expand_path(File.join('.', 'app', 'reports', "#{Time.now.strftime("%Y%m%d_%H%M%S")}.html")), 'w')
|
8
|
+
super(output)
|
9
|
+
@printer.class.send(:define_method, 'puts') do |what|
|
10
|
+
@output.puts what
|
11
|
+
end #define_method
|
12
|
+
end
|
13
|
+
|
14
|
+
def example_failed(example)
|
15
|
+
super(example)
|
16
|
+
if $navi
|
17
|
+
failed_url = $navi.url rescue $navi.current_url
|
18
|
+
@printer.puts "<a target=\"_blank\" href=\"#{failed_url}\">failed url is [#{failed_url}]</a>"
|
19
|
+
@printer.puts '<br />'
|
20
|
+
@printer.flush
|
21
|
+
end #if
|
22
|
+
end
|
23
|
+
end #LazymanFormatter
|
24
|
+
end #Lazyman
|
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
|
data/spec/string_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe String do
|
4
|
-
|
5
|
-
it 'lazy_to_hash should have correct behavor' do
|
6
|
-
str = 'a, b, c, d'
|
7
|
-
str.lazy_to_hash.should eq({a: true, b: true, c: true, d: true})
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
|
5
|
+
it 'lazy_to_hash should have correct behavor' do
|
6
|
+
str = 'a, b, c, d'
|
7
|
+
str.lazy_to_hash.should eq({a: true, b: true, c: true, d: true})
|
8
|
+
end
|
9
|
+
|
10
|
+
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.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,44 +9,44 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-15 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &26280684 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.13.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *26280684
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: page-object
|
27
|
-
requirement: &
|
27
|
+
requirement: &26280024 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.8.6.1
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *26280024
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: thor
|
38
|
-
requirement: &
|
38
|
+
requirement: &26208504 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.14.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *26208504
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: active_support
|
49
|
-
requirement: &
|
49
|
+
requirement: &26207712 !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: *26207712
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rdoc
|
60
|
-
requirement: &
|
60
|
+
requirement: &26207100 !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: *26207100
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &26206524 !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: *26206524
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: jeweler
|
82
|
-
requirement: &
|
82
|
+
requirement: &26205984 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,43 +87,43 @@ dependencies:
|
|
87
87
|
version: 1.8.4
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *26205984
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &26205528 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ! '>='
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: 2.13.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *26205528
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: page-object
|
104
|
-
requirement: &
|
104
|
+
requirement: &26204772 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 0.8.6.1
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *26204772
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: thor
|
115
|
-
requirement: &
|
115
|
+
requirement: &26204220 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
|
-
- -
|
118
|
+
- - ! '>='
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: 0.14.6
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *26204220
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: active_support
|
126
|
-
requirement: &
|
126
|
+
requirement: &26203644 !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: *26203644
|
135
135
|
description: A test framework using watir-webdriver rspec and page-object
|
136
136
|
email: nbkhic@qq.com
|
137
137
|
executables:
|
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
218
|
version: '0'
|
219
219
|
segments:
|
220
220
|
- 0
|
221
|
-
hash:
|
221
|
+
hash: 621047791
|
222
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
223
|
none: false
|
224
224
|
requirements:
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
|
-
rubygems_version: 1.8.
|
230
|
+
rubygems_version: 1.8.17
|
231
231
|
signing_key:
|
232
232
|
specification_version: 3
|
233
233
|
summary: A simple web automation test framework
|