selenium-framework 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +2 -2
- data/README.md +68 -2
- data/bin/copyfiles/include.rb +2 -1
- data/bin/testframe +0 -1
- data/lib/selenium-framework.rb +2 -0
- data/lib/userextension/user_extension.rb +26 -0
- data/lib/userextension/utilities.rb +1 -2
- metadata +4 -4
data/LICENSE
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
Copyright (c) 2013
|
1
|
+
Copyright (c) 2013 Webonise Lab
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
5
5
|
"Software"), to deal in the Software without restriction, including
|
6
6
|
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell
|
7
|
+
distribute, sublicense, and/or sell cot pies of the Software, and to
|
8
8
|
permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
the following conditions:
|
10
10
|
|
data/README.md
CHANGED
@@ -1,3 +1,69 @@
|
|
1
|
-
|
1
|
+
= selenium-framework
|
2
2
|
|
3
|
-
|
3
|
+
http://www.github.com/webonise
|
4
|
+
Selenium Framework is an Functional Testing Service that transparently distributes your functional tests across multiple operating systems with different versions of all major browsers AND captures a screen shot, Reports, Log. This eliminates the need to have multiple vm's on your computer or the need for multiple machines on your test to test your web application. Running your tests remotely will dramatically speed up in-browser web testing and leave more time to and create a slide show available to confirm visuals making it easy for you to improve your web application.
|
5
|
+
|
6
|
+
== Install
|
7
|
+
|
8
|
+
=== Ruby 1.9.3 and above
|
9
|
+
|
10
|
+
refer installation in pages
|
11
|
+
|
12
|
+
|
13
|
+
== Configure
|
14
|
+
|
15
|
+
In configure/selenium_framework.yml you will need to define the application
|
16
|
+
* mode
|
17
|
+
* default_browser_url
|
18
|
+
* application_name
|
19
|
+
* local_browser
|
20
|
+
* browsers
|
21
|
+
* email
|
22
|
+
|
23
|
+
== Creating Tests
|
24
|
+
|
25
|
+
=== Write the testcase
|
26
|
+
class Google
|
27
|
+
def self.google(test_id)
|
28
|
+
@search = "My Test Name"
|
29
|
+
$driver.get $base_url
|
30
|
+
$driver.find_element(:name, "q").send_keys @search
|
31
|
+
$driver.find_element(:name, "btnK").click
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
=== Include testcases
|
36
|
+
open the includes.rb and include the testcase file
|
37
|
+
|
38
|
+
=== Calling methods
|
39
|
+
open the main project file call like below
|
40
|
+
def test_google
|
41
|
+
Google.google 1
|
42
|
+
end
|
43
|
+
|
44
|
+
== Save the screenshot
|
45
|
+
include the below line wherever requiered and change the file name as you wish
|
46
|
+
$driver.save_screenshot($screenshot_directory_path+'/'+test_id.to_s+'-pass.png')
|
47
|
+
|
48
|
+
== Report the testcase status
|
49
|
+
UserExtension.write_result_to_csv($report_file, test_id, 'google search', 'PASS', '')
|
50
|
+
|
51
|
+
== Report the log
|
52
|
+
def self.google(test_id)
|
53
|
+
begin
|
54
|
+
your testcase
|
55
|
+
rescue Exception => e
|
56
|
+
UserExtension.write_result_to_csv($report_file, test_id, 'google search', 'Fail', '')
|
57
|
+
UserExtension.write_logs_to_text_file($log_file, e.message)
|
58
|
+
$driver.save_screenshot($screenshot_directory_path+'/'+test_id.to_s+'-log.png')
|
59
|
+
end
|
60
|
+
|
61
|
+
== Selenium Setup
|
62
|
+
Download the latest version of selenium grid from http://seleniumhq.org/download/
|
63
|
+
|
64
|
+
===Using a Custom Selenium Server
|
65
|
+
'java --jar /path/to/your/customer/selenium-server.jar'
|
66
|
+
|
67
|
+
== Copyright
|
68
|
+
|
69
|
+
Copyright (c) 2013 Webonise Lab Pvt Ltd. See LICENSE for details.
|
data/bin/copyfiles/include.rb
CHANGED
data/bin/testframe
CHANGED
data/lib/selenium-framework.rb
CHANGED
@@ -2,6 +2,7 @@ require 'selenium-framework'
|
|
2
2
|
require 'userextension/user_extension.rb'
|
3
3
|
require 'userextension/pre_requisite.rb'
|
4
4
|
require 'userextension/utilities.rb'
|
5
|
+
require 'modules/login/login.rb'
|
5
6
|
require 'time'
|
6
7
|
require 'fileutils'
|
7
8
|
require 'csv'
|
@@ -11,6 +12,7 @@ require 'yaml'
|
|
11
12
|
require 'rubygems'
|
12
13
|
require 'zip/zip'
|
13
14
|
require 'find'
|
15
|
+
require 'xmlsimple'
|
14
16
|
require 'random-word'
|
15
17
|
|
16
18
|
|
@@ -57,6 +57,32 @@ class UserExtension
|
|
57
57
|
return date.strftime("%d-%m-%Y")
|
58
58
|
end
|
59
59
|
|
60
|
+
def self.generate_year(yrs_old)
|
61
|
+
current_year = Time.now.year
|
62
|
+
year= rand(current_year-100..current_year-yrs_old)
|
63
|
+
return year
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.generate_month
|
67
|
+
month = %w{January February March April May June July August September October November December}.sample
|
68
|
+
return month
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.generate_day(month, year)
|
72
|
+
if month=='January' || month=='March' || month=='May' || month =='July' || month == 'August' || month=='October' || month == 'December'
|
73
|
+
day = rand(1..31)
|
74
|
+
elsif month== 'Febaury'
|
75
|
+
if ((year % 4 == 0) && !(year % 100 == 0) || (year % 400 == 0))
|
76
|
+
day = rand(1..29)
|
77
|
+
else
|
78
|
+
day = rand(1..28)
|
79
|
+
end
|
80
|
+
else
|
81
|
+
day = rand(1..30)
|
82
|
+
end
|
83
|
+
return day
|
84
|
+
end
|
85
|
+
|
60
86
|
# Call this function this way "generate_alphanumeric_string(length)".
|
61
87
|
# This function will generate a random alpha-numeric string and return it.
|
62
88
|
def self.generate_alphanumeric_string(length)
|
@@ -15,6 +15,7 @@ class Utility
|
|
15
15
|
FileUtils.rm_rf(dir) if remove_after
|
16
16
|
end
|
17
17
|
|
18
|
+
|
18
19
|
def self.email(from_email_id, to_email_id, cc_email_id, prj_name, build_zip)
|
19
20
|
Mail.defaults do
|
20
21
|
delivery_method :smtp, {:address => 'smtp.sendgrid.net',
|
@@ -25,13 +26,11 @@ class Utility
|
|
25
26
|
:authentication => 'plain',
|
26
27
|
:enable_starttls_auto => true}
|
27
28
|
end
|
28
|
-
|
29
29
|
mail = Mail.new do
|
30
30
|
from [from_email_id.to_s]
|
31
31
|
to [to_email_id.to_s]
|
32
32
|
cc [cc_email_id.to_s]
|
33
33
|
subject Time.now.to_s + prj_name +' Test - Automation Script Result'
|
34
|
-
|
35
34
|
html_part do
|
36
35
|
content_type 'text/html; charset=UTF-8'
|
37
36
|
body '<b>Script Result</b>'
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Webonise Lab
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -140,7 +140,7 @@ dependencies:
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: 1.3.0
|
142
142
|
description: Selenium Automation FrameWork
|
143
|
-
email:
|
143
|
+
email: support@weboniselab.com
|
144
144
|
executables:
|
145
145
|
- testframe
|
146
146
|
extensions: []
|