awetestlib 0.1.28 → 0.1.29pre1
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/.gitattributes +22 -22
- data/.gitignore +69 -69
- data/.yardopts +7 -7
- data/README.md +108 -108
- data/awetestlib.gemspec +57 -57
- data/awetestlib.windows.gemspec +41 -41
- data/awetestlib_notes.txt +4 -4
- data/awetestlib_osx.gemspec +47 -48
- data/bin/awetestlib +99 -99
- data/bin/awetestlib-android-setup.rb +26 -26
- data/bin/awetestlib-cucumber-setup.rb +28 -28
- data/bin/awetestlib-driver-setup.rb +21 -21
- data/bin/awetestlib-helpers.rb +41 -41
- data/bin/awetestlib-mobile-app-setup.rb +31 -31
- data/bin/awetestlib-netbeans-setup.rb +58 -58
- data/bin/awetestlib-regression-setup.rb +15 -15
- data/bin/awetestlib-rubymine-setup.rb +39 -39
- data/drivers/chromedriver.exe +0 -0
- data/ext/Rakefile +1 -1
- data/ext/mkrf_conf.rb +27 -27
- data/lib/awetestlib/html_report.rb +142 -142
- data/lib/awetestlib/logging.rb +366 -366
- data/lib/awetestlib/regression/browser.rb +1380 -1375
- data/lib/awetestlib/regression/drag_and_drop.rb +421 -420
- data/lib/awetestlib/regression/find.rb +345 -345
- data/lib/awetestlib/regression/legacy.rb +1187 -1187
- data/lib/awetestlib/regression/page_data.rb +191 -191
- data/lib/awetestlib/regression/runner.rb +307 -307
- data/lib/awetestlib/regression/tables.rb +627 -619
- data/lib/awetestlib/regression/user_input.rb +576 -576
- data/lib/awetestlib/regression/utilities.rb +1046 -988
- data/lib/awetestlib/regression/validations.rb +1093 -1074
- data/lib/awetestlib/regression/waits.rb +470 -470
- data/lib/awetestlib/runner.rb +18 -18
- data/lib/awetestlib.rb +41 -41
- data/lib/patches/README +2 -2
- data/lib/patches/firewatir.rb +106 -106
- data/lib/patches/watir.rb +175 -175
- data/lib/version.rb +2 -2
- data/license.txt +13 -13
- data/netbeans_setup.md +29 -29
- data/rdoc_test.bat +1 -1
- data/rubymine_setup.md +23 -23
- data/setup_samples/sample_android/features/dk.mejer.hansen.control.FlyingColorsPlayerAidActivity.apk +0 -0
- data/setup_samples/sample_android/features/sample_android.feature +5 -5
- data/setup_samples/sample_android/features/step_definitions/calabash_steps.rb +1 -1
- data/setup_samples/sample_android/features/support/app_installation_hooks.rb +36 -36
- data/setup_samples/sample_android/features/support/app_life_cycle_hooks.rb +14 -14
- data/setup_samples/sample_android/features/test_servers/8ba795a0288381ae346b67867b586881_0.3.2.apk +0 -0
- data/setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb +76 -76
- data/setup_samples/sample_cucumber/features/yahoo_mail.feature +11 -11
- data/setup_samples/sample_mobile_app/features/my_first.feature +14 -14
- data/setup_samples/sample_mobile_app/features/step_definitions/predefined_webview_steps.rb +80 -80
- data/setup_samples/sample_mobile_app/features/support/env.rb +2 -2
- data/setup_samples/sample_netbeans/demo.rb +86 -86
- data/setup_samples/sample_netbeans/nbproject/configs/Demo.properties +2 -2
- data/setup_samples/sample_netbeans/nbproject/private/config.properties +1 -1
- data/setup_samples/sample_netbeans/nbproject/private/configs/Demo.properties +2 -2
- data/setup_samples/sample_netbeans/nbproject/private/private.properties +2 -2
- data/setup_samples/sample_netbeans/nbproject/project.properties +5 -5
- data/setup_samples/sample_netbeans/nbproject/project.xml +13 -13
- data/setup_samples/sample_rubymine/.idea/encodings.xml +5 -5
- data/setup_samples/sample_rubymine/.idea/misc.xml +5 -5
- data/setup_samples/sample_rubymine/.idea/modules.xml +9 -9
- data/setup_samples/sample_rubymine/.idea/sample_rubymine.iml +9 -9
- data/setup_samples/sample_rubymine/.idea/scopes/scope_settings.xml +4 -4
- data/setup_samples/sample_rubymine/.idea/vcs.xml +7 -7
- data/setup_samples/sample_rubymine/.idea/workspace.xml +213 -213
- data/setup_samples/sample_rubymine/demo.rb +86 -86
- data/test/create_zoho.rb +66 -66
- data/test/create_zoho_account1.rb +68 -68
- data/test/create_zoho_account2.rb +72 -72
- data/test/demo.rb +87 -87
- data/test/google_search1.rb +16 -16
- data/test/google_search2.rb +19 -19
- data/test/login_1.rb +37 -37
- data/test/login_1a.rb +37 -37
- data/test/login_2.rb +32 -32
- data/test/zoho_exercise.rb +21 -21
- data/test/zoho_util.rb +487 -487
- data/tmp/placeholder.html +71 -71
- metadata +18 -49
@@ -1,59 +1,59 @@
|
|
1
|
-
def edit_config_file
|
2
|
-
@new_config_file = File.join(FileUtils.pwd, @proj_dir, "nbproject","private","configs", "Demo.properties")
|
3
|
-
@demo_script = File.join(FileUtils.pwd, @proj_dir, "demo.rb")
|
4
|
-
workspace_text = File.read(@new_config_file)
|
5
|
-
new_workspace_text = workspace_text.gsub(/SAMPLE-SCRIPT/,@demo_script )
|
6
|
-
new_workspace_text = new_workspace_text.gsub(/WORK-DIR/, File.dirname(@demo_script))
|
7
|
-
File.open(@new_config_file, "w") {|file| file.puts new_workspace_text}
|
8
|
-
end
|
9
|
-
|
10
|
-
def edit_private_file
|
11
|
-
@new_private_file = File.join(FileUtils.pwd, @proj_dir, "nbproject", "private", "private.properties")
|
12
|
-
@bin_dir = File.join(File.dirname(__FILE__))
|
13
|
-
workspace_text = File.read(@new_private_file)
|
14
|
-
new_workspace_text = workspace_text.gsub(/BIN-DIR/,@bin_dir )
|
15
|
-
File.open(@new_private_file, "w") {|file| file.puts new_workspace_text}
|
16
|
-
end
|
17
|
-
|
18
|
-
def edit_project_file
|
19
|
-
@new_project_file = File.join(FileUtils.pwd, @proj_dir, "nbproject", "project.xml")
|
20
|
-
project_text = File.read(@new_project_file)
|
21
|
-
new_project_text = project_text.gsub(/PROJECT-NAME/, @proj_dir)
|
22
|
-
File.open(@new_project_file, "w") {|file| file.puts new_project_text}
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
def awetestlib_netbeans_setup
|
28
|
-
if ARGV[1].nil?
|
29
|
-
@proj_dir = "sample_netbeans"
|
30
|
-
else
|
31
|
-
@proj_dir = ARGV[1]
|
32
|
-
end
|
33
|
-
|
34
|
-
@netbeans_dir = File.join(FileUtils.pwd, @proj_dir)
|
35
|
-
@source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_netbeans')
|
36
|
-
|
37
|
-
if File.exists?(@netbeans_dir)
|
38
|
-
puts "Netbeans project directory already exists."
|
39
|
-
exit 1
|
40
|
-
end
|
41
|
-
|
42
|
-
msg("Question") do
|
43
|
-
puts "I'm about to create a netbeans project named #{ARGV[1]} in this directory" if ARGV[1]
|
44
|
-
puts "I'm about to create a netbeans project named sample_netbeans in this directory" if ARGV[1].nil?
|
45
|
-
puts "Please hit return to confirm that's what you want."
|
46
|
-
puts "NOTE: You may need to run this command as an administrator."
|
47
|
-
end
|
48
|
-
exit 2 unless STDIN.gets.chomp == ''
|
49
|
-
|
50
|
-
FileUtils.cp_r(@source_dir, @netbeans_dir)
|
51
|
-
edit_config_file
|
52
|
-
edit_private_file
|
53
|
-
edit_project_file
|
54
|
-
|
55
|
-
msg("Info") do
|
56
|
-
puts "Configuring files and settings"
|
57
|
-
end
|
58
|
-
|
1
|
+
def edit_config_file
|
2
|
+
@new_config_file = File.join(FileUtils.pwd, @proj_dir, "nbproject","private","configs", "Demo.properties")
|
3
|
+
@demo_script = File.join(FileUtils.pwd, @proj_dir, "demo.rb")
|
4
|
+
workspace_text = File.read(@new_config_file)
|
5
|
+
new_workspace_text = workspace_text.gsub(/SAMPLE-SCRIPT/,@demo_script )
|
6
|
+
new_workspace_text = new_workspace_text.gsub(/WORK-DIR/, File.dirname(@demo_script))
|
7
|
+
File.open(@new_config_file, "w") {|file| file.puts new_workspace_text}
|
8
|
+
end
|
9
|
+
|
10
|
+
def edit_private_file
|
11
|
+
@new_private_file = File.join(FileUtils.pwd, @proj_dir, "nbproject", "private", "private.properties")
|
12
|
+
@bin_dir = File.join(File.dirname(__FILE__))
|
13
|
+
workspace_text = File.read(@new_private_file)
|
14
|
+
new_workspace_text = workspace_text.gsub(/BIN-DIR/,@bin_dir )
|
15
|
+
File.open(@new_private_file, "w") {|file| file.puts new_workspace_text}
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit_project_file
|
19
|
+
@new_project_file = File.join(FileUtils.pwd, @proj_dir, "nbproject", "project.xml")
|
20
|
+
project_text = File.read(@new_project_file)
|
21
|
+
new_project_text = project_text.gsub(/PROJECT-NAME/, @proj_dir)
|
22
|
+
File.open(@new_project_file, "w") {|file| file.puts new_project_text}
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def awetestlib_netbeans_setup
|
28
|
+
if ARGV[1].nil?
|
29
|
+
@proj_dir = "sample_netbeans"
|
30
|
+
else
|
31
|
+
@proj_dir = ARGV[1]
|
32
|
+
end
|
33
|
+
|
34
|
+
@netbeans_dir = File.join(FileUtils.pwd, @proj_dir)
|
35
|
+
@source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_netbeans')
|
36
|
+
|
37
|
+
if File.exists?(@netbeans_dir)
|
38
|
+
puts "Netbeans project directory already exists."
|
39
|
+
exit 1
|
40
|
+
end
|
41
|
+
|
42
|
+
msg("Question") do
|
43
|
+
puts "I'm about to create a netbeans project named #{ARGV[1]} in this directory" if ARGV[1]
|
44
|
+
puts "I'm about to create a netbeans project named sample_netbeans in this directory" if ARGV[1].nil?
|
45
|
+
puts "Please hit return to confirm that's what you want."
|
46
|
+
puts "NOTE: You may need to run this command as an administrator."
|
47
|
+
end
|
48
|
+
exit 2 unless STDIN.gets.chomp == ''
|
49
|
+
|
50
|
+
FileUtils.cp_r(@source_dir, @netbeans_dir)
|
51
|
+
edit_config_file
|
52
|
+
edit_private_file
|
53
|
+
edit_project_file
|
54
|
+
|
55
|
+
msg("Info") do
|
56
|
+
puts "Configuring files and settings"
|
57
|
+
end
|
58
|
+
|
59
59
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
def awetestlib_regression_setup
|
2
|
-
msg("Question") do
|
3
|
-
puts "I'm about to setup awetest regression support and register the AutoIt.dll"
|
4
|
-
puts "Please hit return to confirm that's what you want."
|
5
|
-
puts "NOTE: You may need to run this command as an administrator."
|
6
|
-
end
|
7
|
-
exit 2 unless STDIN.gets.chomp == ''
|
8
|
-
|
9
|
-
autoit_file = File.join(File.dirname(__FILE__),"AutoItX3.dll")
|
10
|
-
system("regsvr32 #{autoit_file}")
|
11
|
-
|
12
|
-
msg("Info") do
|
13
|
-
puts "Configuring files and settings"
|
14
|
-
end
|
15
|
-
|
1
|
+
def awetestlib_regression_setup
|
2
|
+
msg("Question") do
|
3
|
+
puts "I'm about to setup awetest regression support and register the AutoIt.dll"
|
4
|
+
puts "Please hit return to confirm that's what you want."
|
5
|
+
puts "NOTE: You may need to run this command as an administrator."
|
6
|
+
end
|
7
|
+
exit 2 unless STDIN.gets.chomp == ''
|
8
|
+
|
9
|
+
autoit_file = File.join(File.dirname(__FILE__),"AutoItX3.dll")
|
10
|
+
system("regsvr32 #{autoit_file}")
|
11
|
+
|
12
|
+
msg("Info") do
|
13
|
+
puts "Configuring files and settings"
|
14
|
+
end
|
15
|
+
|
16
16
|
end
|
@@ -1,40 +1,40 @@
|
|
1
|
-
def edit_config_file
|
2
|
-
@new_config_file = File.join(FileUtils.pwd, @proj_dir, ".idea", "workspace.xml")
|
3
|
-
@demo_script = File.join(FileUtils.pwd, @proj_dir, "demo.rb")
|
4
|
-
@awetestlib_file = File.join(File.dirname(__FILE__), "awetestlib")
|
5
|
-
workspace_text = File.read(@new_config_file)
|
6
|
-
new_workspace_text = workspace_text.gsub(/SAMPLE-SCRIPT/,@demo_script )
|
7
|
-
new_workspace_text = new_workspace_text.gsub(/RUBY-SCRIPT/, @awetestlib_file)
|
8
|
-
new_workspace_text = new_workspace_text.gsub(/WORK-DIR/, File.dirname(@demo_script))
|
9
|
-
File.open(@new_config_file, "w") {|file| file.puts new_workspace_text}
|
10
|
-
end
|
11
|
-
|
12
|
-
def awetestlib_rubymine_setup
|
13
|
-
if ARGV[1].nil?
|
14
|
-
@proj_dir = "sample_rubymine"
|
15
|
-
else
|
16
|
-
@proj_dir = ARGV[1]
|
17
|
-
end
|
18
|
-
|
19
|
-
@rubymine_dir = File.join(FileUtils.pwd, @proj_dir)
|
20
|
-
@source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_rubymine')
|
21
|
-
|
22
|
-
if File.exists?(@rubymine_dir)
|
23
|
-
puts "Rubymine project directory already exists."
|
24
|
-
exit 1
|
25
|
-
end
|
26
|
-
|
27
|
-
msg("Question") do
|
28
|
-
puts "I'm about to create a rubymine project named #{ARGV[1]} in this directory" if ARGV[1]
|
29
|
-
puts "I'm about to create a rubymine project named sample_rubymine in this directory" if ARGV[1].nil?
|
30
|
-
puts "Please hit return to confirm that's what you want."
|
31
|
-
puts "NOTE: You may need to run this command as an administrator."
|
32
|
-
end
|
33
|
-
exit 2 unless STDIN.gets.chomp == ''
|
34
|
-
FileUtils.cp_r(@source_dir, @rubymine_dir)
|
35
|
-
edit_config_file
|
36
|
-
msg("Info") do
|
37
|
-
puts "Configuring files and settings"
|
38
|
-
end
|
39
|
-
|
1
|
+
def edit_config_file
|
2
|
+
@new_config_file = File.join(FileUtils.pwd, @proj_dir, ".idea", "workspace.xml")
|
3
|
+
@demo_script = File.join(FileUtils.pwd, @proj_dir, "demo.rb")
|
4
|
+
@awetestlib_file = File.join(File.dirname(__FILE__), "awetestlib")
|
5
|
+
workspace_text = File.read(@new_config_file)
|
6
|
+
new_workspace_text = workspace_text.gsub(/SAMPLE-SCRIPT/,@demo_script )
|
7
|
+
new_workspace_text = new_workspace_text.gsub(/RUBY-SCRIPT/, @awetestlib_file)
|
8
|
+
new_workspace_text = new_workspace_text.gsub(/WORK-DIR/, File.dirname(@demo_script))
|
9
|
+
File.open(@new_config_file, "w") {|file| file.puts new_workspace_text}
|
10
|
+
end
|
11
|
+
|
12
|
+
def awetestlib_rubymine_setup
|
13
|
+
if ARGV[1].nil?
|
14
|
+
@proj_dir = "sample_rubymine"
|
15
|
+
else
|
16
|
+
@proj_dir = ARGV[1]
|
17
|
+
end
|
18
|
+
|
19
|
+
@rubymine_dir = File.join(FileUtils.pwd, @proj_dir)
|
20
|
+
@source_dir = File.join(File.dirname(__FILE__), '..', 'setup_samples', 'sample_rubymine')
|
21
|
+
|
22
|
+
if File.exists?(@rubymine_dir)
|
23
|
+
puts "Rubymine project directory already exists."
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
|
27
|
+
msg("Question") do
|
28
|
+
puts "I'm about to create a rubymine project named #{ARGV[1]} in this directory" if ARGV[1]
|
29
|
+
puts "I'm about to create a rubymine project named sample_rubymine in this directory" if ARGV[1].nil?
|
30
|
+
puts "Please hit return to confirm that's what you want."
|
31
|
+
puts "NOTE: You may need to run this command as an administrator."
|
32
|
+
end
|
33
|
+
exit 2 unless STDIN.gets.chomp == ''
|
34
|
+
FileUtils.cp_r(@source_dir, @rubymine_dir)
|
35
|
+
edit_config_file
|
36
|
+
msg("Info") do
|
37
|
+
puts "Configuring files and settings"
|
38
|
+
end
|
39
|
+
|
40
40
|
end
|
data/drivers/chromedriver.exe
CHANGED
File without changes
|
data/ext/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
task :default
|
1
|
+
task :default
|
data/ext/mkrf_conf.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
require 'rubygems/dependency_installer.rb'
|
2
|
-
using_windows = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
|
3
|
-
#using_jruby = defined?(JRUBY_VERSION)
|
4
|
-
using_osx = RUBY_PLATFORM =~ /darwin/
|
5
|
-
installer = Gem::DependencyInstaller.new
|
6
|
-
begin
|
7
|
-
puts "#{RUBY_PLATFORM}"
|
8
|
-
if using_windows
|
9
|
-
installer.install "watirloo", ">=0"
|
10
|
-
installer.install "win32-process", ">=0"
|
11
|
-
installer.install "win32-screenshot", ">=0"
|
12
|
-
installer.install "commonwatir", "=1.8.1"
|
13
|
-
installer.install "watir", "=1.8.1"
|
14
|
-
installer.install "firewatir", "=1.8.1"
|
15
|
-
elsif using_osx
|
16
|
-
installer.install "rb_appscript", ">=0"
|
17
|
-
installer.install "safariwatir", ">=0"
|
18
|
-
end
|
19
|
-
|
20
|
-
rescue
|
21
|
-
puts "#{$!}"
|
22
|
-
exit(1)
|
23
|
-
end
|
24
|
-
|
25
|
-
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
|
26
|
-
f.write("task :default\n")
|
27
|
-
f.close
|
1
|
+
require 'rubygems/dependency_installer.rb'
|
2
|
+
using_windows = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) || (RUBY_PLATFORM=~ /mswin|mingw/))
|
3
|
+
#using_jruby = defined?(JRUBY_VERSION)
|
4
|
+
using_osx = RUBY_PLATFORM =~ /darwin/
|
5
|
+
installer = Gem::DependencyInstaller.new
|
6
|
+
begin
|
7
|
+
puts "#{RUBY_PLATFORM}"
|
8
|
+
if using_windows
|
9
|
+
installer.install "watirloo", ">=0"
|
10
|
+
installer.install "win32-process", ">=0"
|
11
|
+
installer.install "win32-screenshot", ">=0"
|
12
|
+
installer.install "commonwatir", "=1.8.1"
|
13
|
+
installer.install "watir", "=1.8.1"
|
14
|
+
installer.install "firewatir", "=1.8.1"
|
15
|
+
elsif using_osx
|
16
|
+
installer.install "rb_appscript", ">=0"
|
17
|
+
installer.install "safariwatir", ">=0"
|
18
|
+
end
|
19
|
+
|
20
|
+
rescue
|
21
|
+
puts "#{$!}"
|
22
|
+
exit(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
|
26
|
+
f.write("task :default\n")
|
27
|
+
f.close
|
@@ -1,142 +1,142 @@
|
|
1
|
-
module Awetestlib
|
2
|
-
# Report generator for Awetestlib.
|
3
|
-
class HtmlReport
|
4
|
-
|
5
|
-
# Initialize the report class
|
6
|
-
# @private
|
7
|
-
def initialize(report_name)
|
8
|
-
@reportname = report_name
|
9
|
-
@reportContent1 = ''
|
10
|
-
@reportContent2 = ''
|
11
|
-
end
|
12
|
-
|
13
|
-
# Create a report
|
14
|
-
# @private
|
15
|
-
def create_report(reportName)
|
16
|
-
# Get current time
|
17
|
-
t = Time.now
|
18
|
-
|
19
|
-
# Create the report name
|
20
|
-
strTime = "#{t.strftime("%Y%m%d_%H%M%S")}"
|
21
|
-
strNiceTime = "#{t.strftime("%m/%d/%Y @ %H:%M:%S")}"
|
22
|
-
strTotalReport = "#{reportName}_#{strTime}.html"
|
23
|
-
|
24
|
-
# Create the HTML report
|
25
|
-
strFile = File.open(strTotalReport, 'w')
|
26
|
-
|
27
|
-
# Format the header of the HTML report
|
28
|
-
@reportContent1 = '<html>
|
29
|
-
<head>
|
30
|
-
<meta content=text/html; charset=ISO-8859-1 http-equiv=content-type>
|
31
|
-
<title>Awetestlib Test Run</title>
|
32
|
-
<style type=text/css>
|
33
|
-
.title { font-family: verdana; font-size: 30px; font-weight: bold; align: left; color: #000000;}
|
34
|
-
.bold_text { font-family: verdana; font-size: 12px; font-weight: bold;}
|
35
|
-
.bold_large_text { font-family: verdana; font-size: 13px; font-weight: bold;}
|
36
|
-
.normal_text { font-family: verdana; font-size: 12px; font-weight: normal;}
|
37
|
-
.small_text { font-family: verdana; font-size: 10px; font-weight: normal; }
|
38
|
-
.border { border: 1px solid #000000;}
|
39
|
-
.mark_testlevel_left { border-top: 1px solid #858585; border-left: 1px solid #858585;background-color:#E2F4FE;}
|
40
|
-
.mark_testlevel_right { border-top: 1px solid #858585; border-right: 1px solid #858585;background-color:#E2F4FE;}
|
41
|
-
.border_left { border-top: 1px solid #858585; border-left: 1px solid #858585; border-right: 1px solid #858585;}
|
42
|
-
.border_right { border-top: 1px solid #858585; border-right: 1px solid #858585;}
|
43
|
-
.result_ok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: green;}
|
44
|
-
.result_nok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: red;}
|
45
|
-
.overall_ok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: left; color: green;}
|
46
|
-
.overall_nok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: left; color: red;}
|
47
|
-
.bborder_left { border-top: 1px solid #858585; border-left: 1px solid #858585; border-bottom: 1px solid #858585; background-color:#858585;font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: white;}
|
48
|
-
.bborder_right { border-right: 1px solid #858585; background-color:#858585;font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: white;}
|
49
|
-
</style>
|
50
|
-
</head>
|
51
|
-
<body>
|
52
|
-
<br>
|
53
|
-
<center>
|
54
|
-
<table width=800 border=0 cellpadding=2 cellspacing=2>
|
55
|
-
<tbody>
|
56
|
-
<tr>
|
57
|
-
<td>
|
58
|
-
<table width=100% border=0 cellpadding=2 cellspacing=2>
|
59
|
-
<tbody>
|
60
|
-
<tr>
|
61
|
-
<td style=width: 150px;> </td>
|
62
|
-
<td align=left><img src="https://raw.github.com/3qilabs/awetestlib/develop/images/logo.png"></img></td>
|
63
|
-
<td align=right><p class=title>Test Report</p></td>
|
64
|
-
</tr>
|
65
|
-
</tbody>
|
66
|
-
</table>
|
67
|
-
<br>
|
68
|
-
<hr width=100% class=border size=1px>
|
69
|
-
<center>
|
70
|
-
<table border=0 width=95% cellpadding=2 cellspacing=2>
|
71
|
-
<tbody>
|
72
|
-
<tr>
|
73
|
-
<td width=20%><p class=bold_text>Script</p></td>
|
74
|
-
<td width=5%><p class=bold_text>:</p></td>
|
75
|
-
<td width=75%><p class=normal_text>' + @reportname.capitalize + '</p></td>
|
76
|
-
</tr>
|
77
|
-
<tr>
|
78
|
-
<td width=20%><p class=bold_text>Test Execution</p></td>
|
79
|
-
<td width=5%><p class=bold_text>:</p></td>
|
80
|
-
<td width=75%><p class=normal_text>' + strNiceTime + '</p></td>
|
81
|
-
</tr>
|
82
|
-
<tr>'
|
83
|
-
|
84
|
-
@reportContent2 = '</tr>
|
85
|
-
</tbody>
|
86
|
-
</table>
|
87
|
-
</center>
|
88
|
-
<br>
|
89
|
-
<center>
|
90
|
-
<table width=95% cellpadding=2 cellspacing=0>
|
91
|
-
<tbody>
|
92
|
-
<tr>
|
93
|
-
<td class=bborder_left width=80%><p>Test Step</p></td>
|
94
|
-
<td class=bborder_left width=20%><p>Result</p></td>
|
95
|
-
</tr>'
|
96
|
-
|
97
|
-
# Close the report
|
98
|
-
strFile.close
|
99
|
-
|
100
|
-
return strTotalReport
|
101
|
-
end
|
102
|
-
|
103
|
-
# Add a row to the report
|
104
|
-
# @private
|
105
|
-
def add_to_report(step, result, level = 1)
|
106
|
-
# Format the body of the HTML report
|
107
|
-
if (result == 'PASSED')
|
108
|
-
@reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
|
109
|
-
@reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_ok>' + result + '</p></td>'
|
110
|
-
elsif (result == 'FAILED')
|
111
|
-
@reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
|
112
|
-
@reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_nok>' + result + '</p></td>'
|
113
|
-
elsif level < 1
|
114
|
-
@reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
|
115
|
-
@reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_nok>' + result + '</p></td>'
|
116
|
-
else
|
117
|
-
@reportContent2 = @reportContent2 + '<tr><td class=mark_testlevel_left width=80%><p class=bold_large_text>' + step + '</p></td>'
|
118
|
-
@reportContent2 = @reportContent2 + '<td class=mark_testlevel_right width=20%><p class=result_nok>' + result + '</p></td>'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
# Close the report HTML
|
123
|
-
# @private
|
124
|
-
def finish_report(reportName)
|
125
|
-
# Open the HTML report
|
126
|
-
strFile = File.open(reportName, 'a')
|
127
|
-
|
128
|
-
@reportContent2 = @reportContent2 + '<tr>
|
129
|
-
<td class=bborder_left width=80%><p> </p></td>
|
130
|
-
<td class=bborder_left width=20%><p> </p></td>
|
131
|
-
</tr>
|
132
|
-
</table>'
|
133
|
-
|
134
|
-
strFile.puts(@reportContent1)
|
135
|
-
|
136
|
-
strFile.puts(@reportContent2)
|
137
|
-
|
138
|
-
# Close the report
|
139
|
-
strFile.close
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
1
|
+
module Awetestlib
|
2
|
+
# Report generator for Awetestlib.
|
3
|
+
class HtmlReport
|
4
|
+
|
5
|
+
# Initialize the report class
|
6
|
+
# @private
|
7
|
+
def initialize(report_name)
|
8
|
+
@reportname = report_name
|
9
|
+
@reportContent1 = ''
|
10
|
+
@reportContent2 = ''
|
11
|
+
end
|
12
|
+
|
13
|
+
# Create a report
|
14
|
+
# @private
|
15
|
+
def create_report(reportName)
|
16
|
+
# Get current time
|
17
|
+
t = Time.now
|
18
|
+
|
19
|
+
# Create the report name
|
20
|
+
strTime = "#{t.strftime("%Y%m%d_%H%M%S")}"
|
21
|
+
strNiceTime = "#{t.strftime("%m/%d/%Y @ %H:%M:%S")}"
|
22
|
+
strTotalReport = "#{reportName}_#{strTime}.html"
|
23
|
+
|
24
|
+
# Create the HTML report
|
25
|
+
strFile = File.open(strTotalReport, 'w')
|
26
|
+
|
27
|
+
# Format the header of the HTML report
|
28
|
+
@reportContent1 = '<html>
|
29
|
+
<head>
|
30
|
+
<meta content=text/html; charset=ISO-8859-1 http-equiv=content-type>
|
31
|
+
<title>Awetestlib Test Run</title>
|
32
|
+
<style type=text/css>
|
33
|
+
.title { font-family: verdana; font-size: 30px; font-weight: bold; align: left; color: #000000;}
|
34
|
+
.bold_text { font-family: verdana; font-size: 12px; font-weight: bold;}
|
35
|
+
.bold_large_text { font-family: verdana; font-size: 13px; font-weight: bold;}
|
36
|
+
.normal_text { font-family: verdana; font-size: 12px; font-weight: normal;}
|
37
|
+
.small_text { font-family: verdana; font-size: 10px; font-weight: normal; }
|
38
|
+
.border { border: 1px solid #000000;}
|
39
|
+
.mark_testlevel_left { border-top: 1px solid #858585; border-left: 1px solid #858585;background-color:#E2F4FE;}
|
40
|
+
.mark_testlevel_right { border-top: 1px solid #858585; border-right: 1px solid #858585;background-color:#E2F4FE;}
|
41
|
+
.border_left { border-top: 1px solid #858585; border-left: 1px solid #858585; border-right: 1px solid #858585;}
|
42
|
+
.border_right { border-top: 1px solid #858585; border-right: 1px solid #858585;}
|
43
|
+
.result_ok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: green;}
|
44
|
+
.result_nok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: red;}
|
45
|
+
.overall_ok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: left; color: green;}
|
46
|
+
.overall_nok { font-family: verdana; font-size: 12px; font-weight: bold; text-align: left; color: red;}
|
47
|
+
.bborder_left { border-top: 1px solid #858585; border-left: 1px solid #858585; border-bottom: 1px solid #858585; background-color:#858585;font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: white;}
|
48
|
+
.bborder_right { border-right: 1px solid #858585; background-color:#858585;font-family: verdana; font-size: 12px; font-weight: bold; text-align: center; color: white;}
|
49
|
+
</style>
|
50
|
+
</head>
|
51
|
+
<body>
|
52
|
+
<br>
|
53
|
+
<center>
|
54
|
+
<table width=800 border=0 cellpadding=2 cellspacing=2>
|
55
|
+
<tbody>
|
56
|
+
<tr>
|
57
|
+
<td>
|
58
|
+
<table width=100% border=0 cellpadding=2 cellspacing=2>
|
59
|
+
<tbody>
|
60
|
+
<tr>
|
61
|
+
<td style=width: 150px;> </td>
|
62
|
+
<td align=left><img src="https://raw.github.com/3qilabs/awetestlib/develop/images/logo.png"></img></td>
|
63
|
+
<td align=right><p class=title>Test Report</p></td>
|
64
|
+
</tr>
|
65
|
+
</tbody>
|
66
|
+
</table>
|
67
|
+
<br>
|
68
|
+
<hr width=100% class=border size=1px>
|
69
|
+
<center>
|
70
|
+
<table border=0 width=95% cellpadding=2 cellspacing=2>
|
71
|
+
<tbody>
|
72
|
+
<tr>
|
73
|
+
<td width=20%><p class=bold_text>Script</p></td>
|
74
|
+
<td width=5%><p class=bold_text>:</p></td>
|
75
|
+
<td width=75%><p class=normal_text>' + @reportname.capitalize + '</p></td>
|
76
|
+
</tr>
|
77
|
+
<tr>
|
78
|
+
<td width=20%><p class=bold_text>Test Execution</p></td>
|
79
|
+
<td width=5%><p class=bold_text>:</p></td>
|
80
|
+
<td width=75%><p class=normal_text>' + strNiceTime + '</p></td>
|
81
|
+
</tr>
|
82
|
+
<tr>'
|
83
|
+
|
84
|
+
@reportContent2 = '</tr>
|
85
|
+
</tbody>
|
86
|
+
</table>
|
87
|
+
</center>
|
88
|
+
<br>
|
89
|
+
<center>
|
90
|
+
<table width=95% cellpadding=2 cellspacing=0>
|
91
|
+
<tbody>
|
92
|
+
<tr>
|
93
|
+
<td class=bborder_left width=80%><p>Test Step</p></td>
|
94
|
+
<td class=bborder_left width=20%><p>Result</p></td>
|
95
|
+
</tr>'
|
96
|
+
|
97
|
+
# Close the report
|
98
|
+
strFile.close
|
99
|
+
|
100
|
+
return strTotalReport
|
101
|
+
end
|
102
|
+
|
103
|
+
# Add a row to the report
|
104
|
+
# @private
|
105
|
+
def add_to_report(step, result, level = 1)
|
106
|
+
# Format the body of the HTML report
|
107
|
+
if (result == 'PASSED')
|
108
|
+
@reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
|
109
|
+
@reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_ok>' + result + '</p></td>'
|
110
|
+
elsif (result == 'FAILED')
|
111
|
+
@reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
|
112
|
+
@reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_nok>' + result + '</p></td>'
|
113
|
+
elsif level < 1
|
114
|
+
@reportContent2 = @reportContent2 + '<tr><td class=border_left width=80%><p class=normal_text>' + step + '</p></td>'
|
115
|
+
@reportContent2 = @reportContent2 + '<td class=border_right width=20%><p class=result_nok>' + result + '</p></td>'
|
116
|
+
else
|
117
|
+
@reportContent2 = @reportContent2 + '<tr><td class=mark_testlevel_left width=80%><p class=bold_large_text>' + step + '</p></td>'
|
118
|
+
@reportContent2 = @reportContent2 + '<td class=mark_testlevel_right width=20%><p class=result_nok>' + result + '</p></td>'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Close the report HTML
|
123
|
+
# @private
|
124
|
+
def finish_report(reportName)
|
125
|
+
# Open the HTML report
|
126
|
+
strFile = File.open(reportName, 'a')
|
127
|
+
|
128
|
+
@reportContent2 = @reportContent2 + '<tr>
|
129
|
+
<td class=bborder_left width=80%><p> </p></td>
|
130
|
+
<td class=bborder_left width=20%><p> </p></td>
|
131
|
+
</tr>
|
132
|
+
</table>'
|
133
|
+
|
134
|
+
strFile.puts(@reportContent1)
|
135
|
+
|
136
|
+
strFile.puts(@reportContent2)
|
137
|
+
|
138
|
+
# Close the report
|
139
|
+
strFile.close
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|