selenium-framework 0.0.5 → 1.0.2
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/LICENSE +20 -0
- data/README.md +3 -0
- data/bin/copyfiles/Gemfile +1 -2
- data/bin/copyfiles/include.rb +2 -1
- data/bin/copyfiles/project_file.rb +25 -17
- data/bin/copyfiles/selenium-framework.yml +5 -0
- data/bin/{framework → testframe} +80 -25
- data/lib/selenium-framework.rb +2 -0
- data/lib/userextension/pre_requisite.rb +72 -0
- data/lib/userextension/user_extension.rb +5 -47
- metadata +142 -45
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Suyod & VTR
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/bin/copyfiles/Gemfile
CHANGED
data/bin/copyfiles/include.rb
CHANGED
@@ -2,24 +2,32 @@ require './include.rb'
|
|
2
2
|
|
3
3
|
class Project < Test::Unit::TestCase
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
$
|
9
|
-
$
|
10
|
-
$driver.manage.timeouts.implicit_wait = 180
|
11
|
-
@verification_errors = []
|
12
|
-
end
|
5
|
+
@@browser = "firefox"
|
6
|
+
build_path = PreRequisite.create_build_structure(Dir.pwd)
|
7
|
+
$screenshot_directory_path = PreRequisite.create_screenshot_directory_path(Dir.pwd.to_s, build_path)
|
8
|
+
$report_file = PreRequisite.create_report_file(Dir.pwd.to_s, build_path)
|
9
|
+
$log_file = PreRequisite.create_log_file(Dir.pwd.to_s, build_path)
|
13
10
|
|
14
|
-
|
15
|
-
$driver.quit
|
16
|
-
assert_equal [],@verification_errors
|
17
|
-
end
|
11
|
+
SeleniumConfig = YAML.load_file(Dir.pwd.to_s + '/Libraries/selenium-framework.yml')
|
18
12
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
def setup
|
14
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
15
|
+
client.timeout = 120 # seconds
|
16
|
+
$driver = Selenium::WebDriver.for(:remote, :http_client => client, :url => 'http://<IP ADDRESS>:<PORT NUMBER>/wd/hub', :desired_capabilities => @@browser.to_sym)
|
17
|
+
$base_url = 'http://<WEBSITE URL>'
|
18
|
+
$driver.manage.timeouts.implicit_wait = 180
|
19
|
+
@verification_errors = []
|
20
|
+
end
|
21
|
+
|
22
|
+
def teardown
|
23
|
+
$driver.quit
|
24
|
+
assert_equal [], @verification_errors
|
25
|
+
end
|
26
|
+
|
27
|
+
def verify(&blk)
|
28
|
+
yield
|
29
|
+
rescue Test::Unit::AssertionFailedError => ex
|
30
|
+
@verification_errors << ex
|
31
|
+
end
|
24
32
|
|
25
33
|
end
|
data/bin/{framework → testframe}
RENAMED
@@ -4,9 +4,9 @@ require 'readline'
|
|
4
4
|
|
5
5
|
|
6
6
|
def print_path(filename, filepath, project_directory_path)
|
7
|
-
path = filepath +
|
7
|
+
path = filepath +'/'+ filename
|
8
8
|
path = path.to_s
|
9
|
-
puts
|
9
|
+
puts 'create ' + path.split(project_directory_path.to_s)[1].to_s
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_dir(dirname, directory_path, project_directory_path)
|
@@ -15,21 +15,22 @@ def create_dir(dirname, directory_path, project_directory_path)
|
|
15
15
|
Dir.mkdir(dirname)
|
16
16
|
print_path(dirname, directory_path, project_directory_path)
|
17
17
|
end
|
18
|
-
Dir.chdir(directory_path +
|
19
|
-
unless (File.exists?(
|
20
|
-
FileUtils.touch
|
21
|
-
print_path(
|
18
|
+
Dir.chdir(directory_path + '/' + dirname)
|
19
|
+
unless (File.exists?('.gitignore'))
|
20
|
+
FileUtils.touch '.gitignore'
|
21
|
+
print_path('.gitignore', directory_path + '/' + dirname, project_directory_path)
|
22
22
|
end
|
23
23
|
Dir.chdir(directory_path)
|
24
24
|
end
|
25
25
|
|
26
26
|
def help_text
|
27
|
-
puts "Usage: \n\
|
27
|
+
puts "Usage: \n\ttestframe new <PROJECT_PATH> [options] \n\ttestframe update <PROJECT_PATH> \n\ntestframe options: \n\t-h, [--help]\t# Show this help message and quit\n\nRuntime options: \n\t-f, [--force]\t# Overwrite files that already exist"
|
28
28
|
exit
|
29
29
|
end
|
30
30
|
|
31
|
+
internal_dir = ['libraries', 'testcases','config','builds']
|
31
32
|
|
32
|
-
if ARGV[0] == nil || ARGV[1] == nil || (ARGV[0] !='new' && ARGV[0] !='update'
|
33
|
+
if ARGV[0] == nil || ARGV[1] == nil || (ARGV[0] !='new' && ARGV[0] !='update') || ARGV[0] == '-h' || ARGV[0] == '--help'
|
33
34
|
help_text
|
34
35
|
end
|
35
36
|
force_flag = 0
|
@@ -52,7 +53,6 @@ if ARGV[0] == 'update'
|
|
52
53
|
end
|
53
54
|
|
54
55
|
|
55
|
-
|
56
56
|
project_name = ARGV[1]
|
57
57
|
project_directory_path = Dir.pwd
|
58
58
|
puts "\n"
|
@@ -80,7 +80,7 @@ if exist_flag == 1 && update_flag == 0
|
|
80
80
|
FileUtils.touch project_main_file
|
81
81
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/project_file.rb"
|
82
82
|
destination = project_directory_path + "/" + project_name + "/" + project_main_file
|
83
|
-
FileUtils.copy_file(source,destination)
|
83
|
+
FileUtils.copy_file(source, destination)
|
84
84
|
outdata = File.read(destination).gsub("Project", project_name.capitalize)
|
85
85
|
File.open(destination, 'w') do |out|
|
86
86
|
out << outdata
|
@@ -90,23 +90,32 @@ if exist_flag == 1 && update_flag == 0
|
|
90
90
|
FileUtils.touch "include.rb"
|
91
91
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/include.rb"
|
92
92
|
destination = project_directory_path + "/" + project_name + "/include.rb"
|
93
|
-
FileUtils.copy_file(source,destination)
|
93
|
+
FileUtils.copy_file(source, destination)
|
94
94
|
print_path("include.rb", project_directory_path + "/" + project_name, project_directory_path)
|
95
95
|
|
96
96
|
FileUtils.touch "Gemfile"
|
97
97
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/Gemfile"
|
98
98
|
destination = project_directory_path + "/" + project_name + "/Gemfile"
|
99
|
-
FileUtils.copy_file(source,destination)
|
99
|
+
FileUtils.copy_file(source, destination)
|
100
100
|
print_path("Gemfile", project_directory_path + "/" + project_name, project_directory_path)
|
101
101
|
|
102
102
|
Dir.chdir(project_directory_path)
|
103
103
|
# internal_dir -- array for storing framework directory names
|
104
|
-
internal_dir = [
|
104
|
+
# internal_dir = ['libraries', 'testcases','config','builds']
|
105
105
|
directory_path = project_directory_path + "/" + project_name
|
106
106
|
# dir_counter -- iterator for the loop
|
107
107
|
for dir_counter in 0..internal_dir.length-1
|
108
108
|
create_dir(internal_dir[dir_counter], directory_path, project_directory_path)
|
109
109
|
end
|
110
|
+
|
111
|
+
Dir.chdir('config')
|
112
|
+
FileUtils.touch 'selenium-framework.yml'
|
113
|
+
source = File.expand_path File.dirname(__FILE__).to_s + '/copyfiles/selenium-framework.yml'
|
114
|
+
destination = project_directory_path + '/' + project_name + '/config/selenium-framework.yml'
|
115
|
+
FileUtils.copy_file(source, destination)
|
116
|
+
Dir.chdir(project_directory_path)
|
117
|
+
print_path('config/selenium-framework.yml', project_directory_path + '/' + project_name, project_directory_path)
|
118
|
+
|
110
119
|
puts "\nFramework for #{project_name} is created..."
|
111
120
|
puts "\nbundle install"
|
112
121
|
Dir.chdir(project_directory_path + "/" + project_name)
|
@@ -116,7 +125,7 @@ end
|
|
116
125
|
|
117
126
|
if exist_flag == 2
|
118
127
|
timestamp = Time.now
|
119
|
-
timestamp = timestamp.strftime(
|
128
|
+
timestamp = timestamp.strftime('%d-%m-%Y-%H-%M-%S')
|
120
129
|
timestamp = timestamp.to_s
|
121
130
|
old_prject_name = project_name
|
122
131
|
new_project_name = project_name+'_'+timestamp
|
@@ -130,7 +139,7 @@ if exist_flag == 2
|
|
130
139
|
FileUtils.touch project_main_file
|
131
140
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/project_file.rb"
|
132
141
|
destination = project_directory_path + "/" + project_name + "/" + project_main_file
|
133
|
-
FileUtils.copy_file(source,destination)
|
142
|
+
FileUtils.copy_file(source, destination)
|
134
143
|
outdata = File.read(destination).gsub("Project", project_name.capitalize)
|
135
144
|
File.open(destination, 'w') do |out|
|
136
145
|
out << outdata
|
@@ -140,23 +149,32 @@ if exist_flag == 2
|
|
140
149
|
FileUtils.touch "include.rb"
|
141
150
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/include.rb"
|
142
151
|
destination = project_directory_path + "/" + project_name + "/include.rb"
|
143
|
-
FileUtils.copy_file(source,destination)
|
152
|
+
FileUtils.copy_file(source, destination)
|
144
153
|
print_path("include.rb", project_directory_path + "/" + project_name, project_directory_path)
|
145
154
|
|
146
155
|
FileUtils.touch "Gemfile"
|
147
156
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/Gemfile"
|
148
157
|
destination = project_directory_path + "/" + project_name + "/Gemfile"
|
149
|
-
FileUtils.copy_file(source,destination)
|
158
|
+
FileUtils.copy_file(source, destination)
|
150
159
|
print_path("Gemfile", project_directory_path + "/" + project_name, project_directory_path)
|
151
160
|
|
152
161
|
Dir.chdir(project_directory_path)
|
153
162
|
# internal_dir -- array for storing framework directory names
|
154
|
-
internal_dir = [
|
163
|
+
# internal_dir = ['libraries', 'testcases','config','builds']
|
155
164
|
directory_path = project_directory_path + "/" + project_name
|
156
165
|
# dir_counter -- iterator for the loop
|
157
166
|
for dir_counter in 0..internal_dir.length-1
|
158
167
|
create_dir(internal_dir[dir_counter], directory_path, project_directory_path)
|
159
168
|
end
|
169
|
+
|
170
|
+
Dir.chdir('config')
|
171
|
+
FileUtils.touch 'selenium-framework.yml'
|
172
|
+
source = File.expand_path File.dirname(__FILE__).to_s + '/copyfiles/selenium-framework.yml'
|
173
|
+
destination = project_directory_path + '/' + project_name + '/config/selenium-framework.yml'
|
174
|
+
FileUtils.copy_file(source, destination)
|
175
|
+
Dir.chdir(project_directory_path)
|
176
|
+
print_path('config/selenium-framework.yml', project_directory_path + '/' + project_name, project_directory_path)
|
177
|
+
|
160
178
|
puts "\nFramework for #{project_name} is created..."
|
161
179
|
puts "\nbundle install"
|
162
180
|
Dir.chdir(project_directory_path + "/" + project_name)
|
@@ -175,36 +193,48 @@ if exist_flag == 3
|
|
175
193
|
FileUtils.touch project_main_file
|
176
194
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/project_file.rb"
|
177
195
|
destination = project_directory_path + "/" + project_name + "/" + project_main_file
|
178
|
-
FileUtils.copy_file(source,destination)
|
196
|
+
FileUtils.copy_file(source, destination)
|
179
197
|
outdata = File.read(destination).gsub("Project", project_name.capitalize)
|
180
198
|
File.open(destination, 'w') do |out|
|
181
199
|
out << outdata
|
182
200
|
end
|
183
201
|
print_path(project_main_file, project_directory_path + "/" + project_name, project_directory_path)
|
184
202
|
end
|
203
|
+
|
185
204
|
unless (File.exists?("include.rb"))
|
186
205
|
FileUtils.touch "include.rb"
|
187
206
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/include.rb"
|
188
207
|
destination = project_directory_path + "/" + project_name + "/include.rb"
|
189
|
-
FileUtils.copy_file(source,destination)
|
208
|
+
FileUtils.copy_file(source, destination)
|
190
209
|
print_path("include.rb", project_directory_path + "/" + project_name, project_directory_path)
|
191
210
|
end
|
192
211
|
unless (File.exists?("Gemfile"))
|
193
212
|
FileUtils.touch "Gemfile"
|
194
213
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/Gemfile"
|
195
214
|
destination = project_directory_path + "/" + project_name + "/Gemfile"
|
196
|
-
FileUtils.copy_file(source,destination)
|
215
|
+
FileUtils.copy_file(source, destination)
|
197
216
|
print_path("Gemfile", project_directory_path + "/" + project_name, project_directory_path)
|
198
217
|
end
|
199
218
|
|
200
219
|
Dir.chdir(project_directory_path)
|
201
220
|
# internal_dir -- array for storing framework directory names
|
202
|
-
internal_dir = [
|
221
|
+
# internal_dir = ['libraries', 'testcases','config','builds']
|
203
222
|
directory_path = project_directory_path + "/" + project_name
|
204
223
|
# dir_counter -- iterator for the loop
|
205
224
|
for dir_counter in 0..internal_dir.length-1
|
206
225
|
create_dir(internal_dir[dir_counter], directory_path, project_directory_path)
|
207
226
|
end
|
227
|
+
|
228
|
+
unless (File.exists?('/config/selenium-framework.yml'))
|
229
|
+
Dir.chdir('config')
|
230
|
+
FileUtils.touch 'selenium-framework.yml'
|
231
|
+
source = File.expand_path File.dirname(__FILE__).to_s + '/copyfiles/selenium-framework.yml'
|
232
|
+
destination = project_directory_path + '/' + project_name + '/config/selenium-framework.yml'
|
233
|
+
FileUtils.copy_file(source, destination)
|
234
|
+
Dir.chdir(project_directory_path)
|
235
|
+
print_path('config/selenium-framework.yml', project_directory_path + '/' + project_name, project_directory_path)
|
236
|
+
end
|
237
|
+
|
208
238
|
puts "\nFramework for #{project_name} is created..."
|
209
239
|
puts "\nbundle install"
|
210
240
|
Dir.chdir(project_directory_path + "/" + project_name)
|
@@ -229,12 +259,15 @@ if update_flag ==1
|
|
229
259
|
Dir.chdir(project_directory_path + "/" + project_name)
|
230
260
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/include.rb"
|
231
261
|
destination = "include.rb"
|
232
|
-
compare_result_1 =
|
262
|
+
compare_result_1 = FileUtils.compare_file(source, destination).to_s
|
233
263
|
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/Gemfile"
|
234
264
|
destination = "Gemfile"
|
235
|
-
compare_result_2 =
|
265
|
+
compare_result_2 = FileUtils.compare_file(source, destination).to_s
|
266
|
+
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/selenium-framework.yml"
|
267
|
+
destination = "/config/selenium-framework.yml"
|
268
|
+
compare_result_3 = FileUtils.compare_file(source, destination).to_s
|
236
269
|
|
237
|
-
if ("true".casecmp compare_result_1) == 0 && ("true".casecmp compare_result_2) == 0
|
270
|
+
if ("true".casecmp compare_result_1) == 0 && ("true".casecmp compare_result_2) == 0 && ("true".casecmp compare_result_3) == 0
|
238
271
|
puts "\nFramework for #{project_name} is already updated..."
|
239
272
|
puts "\nbundle install"
|
240
273
|
Dir.chdir(project_directory_path + "/" + project_name)
|
@@ -287,6 +320,28 @@ if update_flag ==1
|
|
287
320
|
end
|
288
321
|
print_path("Gemfile", project_directory_path + "/" + project_name, project_directory_path)
|
289
322
|
|
323
|
+
source = File.expand_path File.dirname(__FILE__).to_s + "/copyfiles/selenium-framework.yml"
|
324
|
+
destination = "/config/selenium-framework.yml"
|
325
|
+
source_data = Array.new
|
326
|
+
source_data = IO.readlines(source)
|
327
|
+
destination_data = Array.new
|
328
|
+
destination_data = IO.readlines(destination)
|
329
|
+
source_data.each do |thing|
|
330
|
+
present_flag = destination_data.include? thing
|
331
|
+
present_flag = present_flag.to_s
|
332
|
+
if ("false".casecmp present_flag) == 0
|
333
|
+
#File.open(destination, 'a+') { |file| file.write(thing.to_s) }
|
334
|
+
f = File.open(destination, "r+")
|
335
|
+
lines = f.readlines
|
336
|
+
f.close
|
337
|
+
lines = [thing] + lines
|
338
|
+
output = File.new(destination, "w")
|
339
|
+
lines.each { |line| output.write line }
|
340
|
+
output.close
|
341
|
+
end
|
342
|
+
end
|
343
|
+
print_path("/config/selenium-framework.yml", project_directory_path + "/" + project_name, project_directory_path)
|
344
|
+
|
290
345
|
puts "\nFramework for #{project_name} is updated..."
|
291
346
|
puts "\nbundle install"
|
292
347
|
Dir.chdir(project_directory_path + "/" + project_name)
|
data/lib/selenium-framework.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'selenium-framework'
|
2
2
|
require 'userextension/user_extension.rb'
|
3
|
+
require 'userextension/pre_requisite.rb'
|
3
4
|
require 'modules/login/login.rb'
|
4
5
|
require 'time'
|
5
6
|
require 'fileutils'
|
6
7
|
require 'csv'
|
7
8
|
require 'faker'
|
8
9
|
require 'headless'
|
10
|
+
require 'yaml'
|
9
11
|
|
10
12
|
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class PreRequisite
|
2
|
+
private
|
3
|
+
def self.create_dir_inside_build(dirname, directory_path)
|
4
|
+
Dir.chdir(directory_path)
|
5
|
+
unless (File.exists?(dirname))
|
6
|
+
Dir.mkdir(dirname)
|
7
|
+
end
|
8
|
+
Dir.chdir(directory_path + '/' + dirname)
|
9
|
+
unless (File.exists?('.gitignore'))
|
10
|
+
FileUtils.touch '.gitignore'
|
11
|
+
end
|
12
|
+
Dir.chdir(directory_path)
|
13
|
+
end
|
14
|
+
|
15
|
+
public
|
16
|
+
def self.create_build_structure(store_path)
|
17
|
+
build_path = store_path + "/builds/"
|
18
|
+
Dir.chdir(build_path)
|
19
|
+
if Dir.entries(build_path).size == 2
|
20
|
+
build_number = "0"
|
21
|
+
Dir.mkdir(build_number)
|
22
|
+
else
|
23
|
+
dir_list_new = []
|
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) }
|
28
|
+
build_number = dir_list_new.max + 1
|
29
|
+
build_number = build_number.to_s
|
30
|
+
Dir.mkdir(build_number)
|
31
|
+
end
|
32
|
+
Dir.chdir(build_number)
|
33
|
+
build_number_path = build_path + build_number + "/"
|
34
|
+
build_internal_dir = ['screenshots','logs','reports']
|
35
|
+
for dir_counter in 0..build_internal_dir.length-1
|
36
|
+
create_dir_inside_build(build_internal_dir[dir_counter], build_number_path)
|
37
|
+
end
|
38
|
+
Dir.chdir(store_path)
|
39
|
+
return build_number_path
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_screenshot_directory_path(store_path, build_number_path)
|
43
|
+
Dir.chdir(build_number_path + "screenshots/")
|
44
|
+
FileUtils.touch ".gitignore"
|
45
|
+
screenshot_path = build_number_path + "screenshots/"
|
46
|
+
Dir.chdir(store_path)
|
47
|
+
return screenshot_path
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.create_report_file(store_path, build_number_path)
|
51
|
+
Dir.chdir(build_number_path + "reports/")
|
52
|
+
report_file = build_number_path + "reports/" + "report.csv"
|
53
|
+
FileUtils.touch(report_file)
|
54
|
+
CSV.open(report_file, "wb") do |csv_file|
|
55
|
+
csv_file << ["BROWSER", "TEST_ID", "TEST_CASE", "RESULT"]
|
56
|
+
end
|
57
|
+
Dir.chdir(store_path)
|
58
|
+
return report_file
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.create_log_file(store_path, build_number_path)
|
62
|
+
Dir.chdir(build_number_path + "logs/")
|
63
|
+
log_file = build_number_path + "logs/" + "execution.log"
|
64
|
+
FileUtils.touch(log_file)
|
65
|
+
File.open(log_file, "wb") do |txt_file|
|
66
|
+
txt_file.puts "LOGS WITH RESULTS"
|
67
|
+
end
|
68
|
+
Dir.chdir(store_path)
|
69
|
+
return log_file
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -134,54 +134,12 @@ class UserExtension
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
# Call this function this way "pre_requisite(build_no,browser,timestamp)".
|
138
|
-
# This function will create the pre-requisites for the project.
|
139
|
-
def self.pre_requisite(build_no, browser, timestamp)
|
140
|
-
returning_array = Array.new
|
141
|
-
build_no = build_no.to_s
|
142
|
-
browser = browser.to_s
|
143
|
-
timestamp = timestamp.to_s
|
144
|
-
store_path = Dir.pwd
|
145
|
-
Dir.chdir("screenshots")
|
146
|
-
Dir.mkdir(build_no)
|
147
|
-
Dir.chdir(build_no)
|
148
|
-
Dir.mkdir(browser +"_"+ timestamp)
|
149
|
-
Dir.chdir(browser +"_"+ timestamp)
|
150
|
-
screenshot_path = store_path + "/screenshots/" + build_no + "/" + browser +"_"+ timestamp + "/"
|
151
|
-
returning_array.push(screenshot_path)
|
152
|
-
Dir.chdir(store_path)
|
153
|
-
|
154
|
-
Dir.chdir("reports")
|
155
|
-
Dir.mkdir(build_no)
|
156
|
-
report_path = store_path + "/reports/" + build_no + "/"
|
157
|
-
Dir.chdir(report_path)
|
158
|
-
report_file = report_path + build_no +"_" + browser +"_"+ timestamp + ".csv"
|
159
|
-
FileUtils.touch(report_file)
|
160
|
-
CSV.open(report_file, "wb") do |csv_file|
|
161
|
-
csv_file << ["TEST_ID", "TEST_CASE", "RESULT", "COMMENTS"]
|
162
|
-
end
|
163
|
-
returning_array.push(report_file)
|
164
|
-
broken_links_report_file = report_path + build_no +"_broken_links_" + timestamp + ".csv"
|
165
|
-
FileUtils.touch(broken_links_report_file)
|
166
|
-
CSV.open(broken_links_report_file, "wb") do |csv_file|
|
167
|
-
csv_file << ["LINK", "RESPONSE", "COMMENTS"]
|
168
|
-
end
|
169
|
-
returning_array.push(broken_links_report_file)
|
170
|
-
Dir.chdir(store_path)
|
171
|
-
|
172
|
-
Dir.chdir("logs")
|
173
|
-
Dir.mkdir(build_no)
|
174
|
-
log_path = store_path + "/logs/" + build_no + "/"
|
175
|
-
Dir.chdir(log_path)
|
176
|
-
log_file = log_path + build_no +"_" + browser + "_" + timestamp + ".log"
|
177
|
-
FileUtils.touch(log_file)
|
178
|
-
File.open(log_file, "wb") do |txt_file|
|
179
|
-
txt_file.puts "LOGS WITH RESULTS"
|
180
|
-
end
|
181
|
-
returning_array.push(log_file)
|
182
|
-
Dir.chdir(store_path)
|
183
137
|
|
184
|
-
|
138
|
+
def self.current_timestamp
|
139
|
+
timestamp = Time.now
|
140
|
+
timestamp = timestamp.strftime("%d-%m-%Y-%H-%M-%S")
|
141
|
+
timestamp = timestamp.to_s
|
142
|
+
return timestamp
|
185
143
|
end
|
186
144
|
|
187
145
|
|
metadata
CHANGED
@@ -1,73 +1,170 @@
|
|
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
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Suyog Sakegaonkar, Thiyagarajan Veluchamy
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: selenium-webdriver
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: mail
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: faker
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: nokogiri
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: selenium-client
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: pry
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
22
126
|
description: Selenium Automation FrameWork
|
23
127
|
email: suyogsakegaonkar@gmail.com, thiyagarajannv@gmail.com
|
24
|
-
executables:
|
25
|
-
-
|
128
|
+
executables:
|
129
|
+
- testframe
|
26
130
|
extensions: []
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
files:
|
131
|
+
extra_rdoc_files:
|
132
|
+
- LICENSE
|
133
|
+
- README.md
|
134
|
+
files:
|
31
135
|
- lib/userextension/user_extension.rb
|
32
136
|
- lib/selenium-framework.rb
|
33
137
|
- lib/modules/login/login.rb
|
34
138
|
- bin/copyfiles/Gemfile
|
139
|
+
- bin/copyfiles/selenium-framework.yml
|
35
140
|
- bin/copyfiles/include.rb
|
36
141
|
- bin/copyfiles/project_file.rb
|
37
|
-
-
|
38
|
-
|
142
|
+
- lib/userextension/pre_requisite.rb
|
143
|
+
- LICENSE
|
144
|
+
- README.md
|
145
|
+
- bin/testframe
|
39
146
|
homepage: https://github.com/webonise/AutomationFramework
|
40
147
|
licenses: []
|
41
|
-
|
42
|
-
post_install_message: ""
|
148
|
+
post_install_message: Successfully get installed
|
43
149
|
rdoc_options: []
|
44
|
-
|
45
|
-
require_paths:
|
150
|
+
require_paths:
|
46
151
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
153
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
53
|
-
|
54
|
-
- 0
|
55
|
-
version: "0"
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
159
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
version: "0"
|
160
|
+
requirements:
|
161
|
+
- - ! '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
65
164
|
requirements: []
|
66
|
-
|
67
165
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.
|
166
|
+
rubygems_version: 1.8.23
|
69
167
|
signing_key:
|
70
168
|
specification_version: 3
|
71
169
|
summary: This gem is used for selenium automation framework
|
72
170
|
test_files: []
|
73
|
-
|