selenium-framework 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/userextension/pre_requisite.rb +18 -18
- data/lib/userextension/user_extension.rb +25 -3
- data/lib/userextension/utilities.rb +27 -2
- metadata +128 -107
- checksums.yaml +0 -15
@@ -14,24 +14,24 @@ class PreRequisite
|
|
14
14
|
|
15
15
|
public
|
16
16
|
def self.create_build_structure(store_path)
|
17
|
-
build_path = store_path +
|
17
|
+
build_path = store_path + '/builds/'
|
18
18
|
Dir.chdir(build_path)
|
19
19
|
if Dir.entries(build_path).size == 2
|
20
|
-
build_number =
|
20
|
+
build_number = '0'
|
21
21
|
Dir.mkdir(build_number)
|
22
22
|
else
|
23
23
|
dir_list_new = []
|
24
24
|
dir_list = Dir.entries(build_path)
|
25
|
-
dir_list.delete(
|
26
|
-
dir_list.delete(
|
27
|
-
dir_list.map {|a| dir_list_new.push(a.to_i) }
|
25
|
+
dir_list.delete('.')
|
26
|
+
dir_list.delete('..')
|
27
|
+
dir_list.map { |a| dir_list_new.push(a.to_i) }
|
28
28
|
build_number = dir_list_new.max + 1
|
29
29
|
build_number = build_number.to_s
|
30
30
|
Dir.mkdir(build_number)
|
31
31
|
end
|
32
32
|
Dir.chdir(build_number)
|
33
|
-
build_number_path = build_path + build_number +
|
34
|
-
build_internal_dir = ['screenshots','logs','reports']
|
33
|
+
build_number_path = build_path + build_number + '/'
|
34
|
+
build_internal_dir = ['screenshots', 'logs', 'reports']
|
35
35
|
for dir_counter in 0..build_internal_dir.length-1
|
36
36
|
create_dir_inside_build(build_internal_dir[dir_counter], build_number_path)
|
37
37
|
end
|
@@ -40,30 +40,30 @@ class PreRequisite
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.create_screenshot_directory_path(store_path, build_number_path)
|
43
|
-
Dir.chdir(build_number_path +
|
44
|
-
FileUtils.touch
|
45
|
-
screenshot_path = build_number_path +
|
43
|
+
Dir.chdir(build_number_path + 'screenshots/')
|
44
|
+
FileUtils.touch '.gitignore'
|
45
|
+
screenshot_path = build_number_path + 'screenshots/'
|
46
46
|
Dir.chdir(store_path)
|
47
47
|
return screenshot_path
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.create_report_file(store_path, build_number_path)
|
51
|
-
Dir.chdir(build_number_path +
|
52
|
-
report_file = build_number_path +
|
51
|
+
Dir.chdir(build_number_path + 'reports/')
|
52
|
+
report_file = build_number_path + 'reports/' + 'report.csv'
|
53
53
|
FileUtils.touch(report_file)
|
54
|
-
CSV.open(report_file,
|
55
|
-
csv_file << [
|
54
|
+
CSV.open(report_file, 'wb') do |csv_file|
|
55
|
+
csv_file << ['BROWSER', 'TEST_ID', 'TEST_CASE', 'RESULT']
|
56
56
|
end
|
57
57
|
Dir.chdir(store_path)
|
58
58
|
return report_file
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.create_log_file(store_path, build_number_path)
|
62
|
-
Dir.chdir(build_number_path +
|
63
|
-
log_file = build_number_path +
|
62
|
+
Dir.chdir(build_number_path + 'logs/')
|
63
|
+
log_file = build_number_path + 'logs/' + 'execution.log'
|
64
64
|
FileUtils.touch(log_file)
|
65
|
-
File.open(log_file,
|
66
|
-
txt_file.puts
|
65
|
+
File.open(log_file, 'wb') do |txt_file|
|
66
|
+
txt_file.puts 'LOGS WITH RESULTS'
|
67
67
|
end
|
68
68
|
Dir.chdir(store_path)
|
69
69
|
return log_file
|
@@ -166,7 +166,7 @@ class UserExtension
|
|
166
166
|
end
|
167
167
|
|
168
168
|
|
169
|
-
def self.record_video_stop_and_save(headless_obj,filename)
|
169
|
+
def self.record_video_stop_and_save(headless_obj, filename)
|
170
170
|
os = RUBY_PLATFORM
|
171
171
|
if os.include? "linux"
|
172
172
|
headless_obj.video.stop_and_save(filename)
|
@@ -185,8 +185,7 @@ class UserExtension
|
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
188
|
-
|
189
|
-
def self.capture_screenshot(selenium_diver,filename)
|
188
|
+
def self.capture_screenshot(selenium_diver, filename)
|
190
189
|
browser_name = selenium_diver.capabilities.browser_name
|
191
190
|
unless (browser_name.include? "safari")
|
192
191
|
selenium_diver.save_screenshot filename
|
@@ -195,4 +194,27 @@ class UserExtension
|
|
195
194
|
end
|
196
195
|
end
|
197
196
|
|
197
|
+
def self.dob_year(yrs_old)
|
198
|
+
current_year = Time.now.year
|
199
|
+
year= rand(current_year-100..current_year-yrs_old)
|
200
|
+
end
|
201
|
+
|
202
|
+
def self.dob_month
|
203
|
+
month = %w{January February March April May June July August September October November December}.sample
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.dob_date(month, year)
|
207
|
+
if month=='January' || month=='March' || month=='May' || month =='July' || month == 'August' || month=='October' || month == 'December'
|
208
|
+
day = rand(1..31)
|
209
|
+
elsif month== 'Febaury'
|
210
|
+
if ((year % 4 == 0) && !(year % 100 == 0) || (year % 400 == 0))
|
211
|
+
day = rand(1..29)
|
212
|
+
else
|
213
|
+
day = rand(1..28)
|
214
|
+
end
|
215
|
+
else
|
216
|
+
day = rand(1..30)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
198
220
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class Utility
|
2
2
|
|
3
3
|
def self.zip(dir, zip_dir, remove_after = false)
|
4
|
-
Zip::ZipFile.open(zip_dir, Zip::ZipFile::CREATE)do |zipfile|
|
4
|
+
Zip::ZipFile.open(zip_dir, Zip::ZipFile::CREATE) do |zipfile|
|
5
5
|
Find.find(dir) do |path|
|
6
6
|
Find.prune if File.basename(path)[0] == ?.
|
7
7
|
dest = /#{dir}\/(\w.*)/.match(path)
|
8
8
|
# Skip files if they exists
|
9
9
|
begin
|
10
|
-
zipfile.add(dest[1],path) if dest
|
10
|
+
zipfile.add(dest[1], path) if dest
|
11
11
|
rescue Zip::ZipEntryExistsError
|
12
12
|
end
|
13
13
|
end
|
@@ -15,4 +15,29 @@ class Utility
|
|
15
15
|
FileUtils.rm_rf(dir) if remove_after
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.email(email_id, build_zip)
|
19
|
+
Mail.defaults do
|
20
|
+
delivery_method :smtp, {:address => 'smtp.sendgrid.net',
|
21
|
+
:port => 587,
|
22
|
+
:domain => 'vtr.com',
|
23
|
+
:user_name => 'locamotiv',
|
24
|
+
:password => 'locamotiv',
|
25
|
+
:authentication => 'plain',
|
26
|
+
:enable_starttls_auto => true}
|
27
|
+
end
|
28
|
+
|
29
|
+
mail = Mail.new do
|
30
|
+
to [email_id.to_s]
|
31
|
+
from 'vtr@weboniselab.com'
|
32
|
+
subject Time.now.to_s + 'Test - Automation Script Result'
|
33
|
+
|
34
|
+
html_part do
|
35
|
+
content_type 'text/html; charset=UTF-8'
|
36
|
+
body '<b>Script Result</b>'
|
37
|
+
end
|
38
|
+
add_file build_zip
|
39
|
+
end
|
40
|
+
mail.deliver!
|
41
|
+
end
|
42
|
+
|
18
43
|
end
|
metadata
CHANGED
@@ -1,122 +1,131 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-framework
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 5
|
10
|
+
version: 1.0.5
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
12
|
+
authors:
|
7
13
|
- Suyog Sakegaonkar, Thiyagarajan Veluchamy
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
17
|
+
|
18
|
+
date: 2013-05-03 00:00:00 +05:30
|
19
|
+
default_executable: testframe
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
14
22
|
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ! '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
23
|
prerelease: false
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- - ! '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
34
33
|
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: selenium-webdriver
|
35
37
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
- - ! '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
48
47
|
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: mail
|
49
51
|
prerelease: false
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
62
61
|
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: faker
|
63
65
|
prerelease: false
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
- - ! '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
76
75
|
type: :runtime
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: nokogiri
|
77
79
|
prerelease: false
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
- - ! '>='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
90
89
|
type: :runtime
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: selenium-client
|
91
93
|
prerelease: false
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
- - ! '>='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
104
103
|
type: :runtime
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: pry
|
105
107
|
prerelease: false
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
type: :runtime
|
118
|
+
version_requirements: *id007
|
111
119
|
description: Selenium Automation FrameWork
|
112
120
|
email: suyogsakegaonkar@gmail.com, thiyagarajannv@gmail.com
|
113
|
-
executables:
|
121
|
+
executables:
|
114
122
|
- testframe
|
115
123
|
extensions: []
|
116
|
-
|
124
|
+
|
125
|
+
extra_rdoc_files:
|
117
126
|
- LICENSE
|
118
127
|
- README.md
|
119
|
-
files:
|
128
|
+
files:
|
120
129
|
- lib/userextension/user_extension.rb
|
121
130
|
- lib/selenium-framework.rb
|
122
131
|
- lib/modules/login/login.rb
|
@@ -129,27 +138,39 @@ files:
|
|
129
138
|
- LICENSE
|
130
139
|
- README.md
|
131
140
|
- bin/testframe
|
141
|
+
has_rdoc: true
|
132
142
|
homepage: https://github.com/webonise/AutomationFramework
|
133
143
|
licenses: []
|
134
|
-
|
144
|
+
|
135
145
|
post_install_message: Successfully get installed
|
136
146
|
rdoc_options: []
|
137
|
-
|
147
|
+
|
148
|
+
require_paths:
|
138
149
|
- lib
|
139
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
hash: 3
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
version: "0"
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
hash: 3
|
165
|
+
segments:
|
166
|
+
- 0
|
167
|
+
version: "0"
|
149
168
|
requirements: []
|
169
|
+
|
150
170
|
rubyforge_project:
|
151
|
-
rubygems_version:
|
171
|
+
rubygems_version: 1.6.2
|
152
172
|
signing_key:
|
153
|
-
specification_version:
|
173
|
+
specification_version: 3
|
154
174
|
summary: This gem is used for selenium automation framework
|
155
175
|
test_files: []
|
176
|
+
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NmNkMjFhYjljN2Y0YWU1MGQ5YWEwMzRlZTZhNTc1Y2RlZjJmNzlmNQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MThmNTZlMTUxOWM2ZGRhZDc1MTBmMWYzNTliNGZhOTc3ODZlZGJkZg==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MjBmY2IzODAzNTIwZDI5OTg4ODc0OTk2OTUyNmMzZWU5MTgwZTNhNTg3OTBl
|
10
|
-
MTg5OGRiYmViM2E1NmYyNDQ2OWMwMTk1NDM1OWY1OTdiMGQxYTkxODM0YjU5
|
11
|
-
OTg4YWQwZjkwMGNjMDg0MjQ2MmVlNWYwOTkyYjNmOTFlMzlhYzI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTE1NTg2ZTg3ODA0NmM5MTc4ZGU4N2Y2MjAwZDBkYzIzOGQ3NjgyY2EwYmIx
|
14
|
-
MDk3MTVjY2QwOWUzNGU2YTM3M2M2ODRiZDA1NzI4NmFmOGFlM2YwMjAwNzY0
|
15
|
-
YzRjMGMyZWM4NDQ3N2M2YTBlOTlmMWJlNTIyMmFhNTUzZDU4Mzk=
|