Ifd_Automation 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/Ifd_Automation +25 -25
- data/bin/helper.rb +50 -50
- data/lib/Ifd_Automation.rb +1 -1
- data/lib/Ifd_Automation/assertion_steps.rb +96 -96
- data/lib/Ifd_Automation/email_steps.rb +91 -91
- data/lib/Ifd_Automation/methods/error_handling_methods.rb +86 -86
- data/lib/Ifd_Automation/methods/misc_methods.rb +33 -33
- data/lib/Ifd_Automation/methods/required_files.rb +33 -33
- data/lib/Ifd_Automation/methods/web_methods.rb +291 -291
- data/lib/Ifd_Automation/version.rb +1 -1
- data/project/Gemfile +2 -3
- data/project/Gemfile.lock +3 -3
- data/project/features/TestSuite/Login/login.feature +3 -5
- data/project/features/step_definitions/lib_steps/login_steps.rb +2 -2
- data/project/features/support/env.rb +112 -134
- data/project/features/support/hooks.rb +56 -56
- data/project/features/support/project_config.yml +3 -3
- metadata +2 -3
data/project/Gemfile
CHANGED
@@ -9,7 +9,7 @@ gem 'json', '1.8.3'
|
|
9
9
|
gem 'mysql2','0.3.18'
|
10
10
|
gem 'test-unit', '~> 3.1.2'
|
11
11
|
gem 'parallel_tests'
|
12
|
-
gem 'rest-client'
|
12
|
+
gem 'rest-client', '~> 1.8.0'
|
13
13
|
gem 'tiny_tds', '~> 0.6.2'
|
14
14
|
gem 'actionmailer', '~> 4.2.3'
|
15
15
|
gem 'email_spec'
|
@@ -17,5 +17,4 @@ gem 'rails'
|
|
17
17
|
gem 'rack-utf8_sanitizer'
|
18
18
|
gem 'mail'
|
19
19
|
gem 'chromedriver2-helper'
|
20
|
-
gem 'rautomation', '~> 0.17.0'
|
21
|
-
gem 'Ifd_Automation'
|
20
|
+
gem 'rautomation', '~> 0.17.0'
|
data/project/Gemfile.lock
CHANGED
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
nokogiri (>= 1.5.9)
|
77
77
|
mail (2.6.3)
|
78
78
|
mime-types (>= 1.16, < 3)
|
79
|
-
mime-types (2.
|
79
|
+
mime-types (2.99.1)
|
80
80
|
mini_portile (0.6.2)
|
81
81
|
minitest (5.8.1)
|
82
82
|
multi_json (1.11.2)
|
@@ -187,10 +187,10 @@ DEPENDENCIES
|
|
187
187
|
rack-utf8_sanitizer
|
188
188
|
rails
|
189
189
|
rautomation (~> 0.17.0)
|
190
|
-
rest-client
|
190
|
+
rest-client (~> 1.8.0)
|
191
191
|
rspec (~> 3.3.0)
|
192
192
|
test-unit (~> 3.1.2)
|
193
193
|
tiny_tds (~> 0.6.2)
|
194
194
|
|
195
195
|
BUNDLED WITH
|
196
|
-
1.
|
196
|
+
1.12.3
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
step %{
|
1
|
+
Then /^I test$/ do ||
|
2
|
+
step %{}
|
3
3
|
end
|
@@ -1,134 +1,112 @@
|
|
1
|
-
$_CFWEB = Hash.new
|
2
|
-
# Define global variables
|
3
|
-
$current_dir = File.expand_path(File.dirname(__FILE__))
|
4
|
-
$base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
|
5
|
-
$test_data_dir = $base_dir + '/features/TestData/'
|
6
|
-
$sql_dir = $base_dir + '/features/TestData/SqlScript/'
|
7
|
-
$_CFWEB['Download Dir'] = "#{$test_data_dir}DownloadFolder/"
|
8
|
-
$_CFWEB['Expected Data Dir'] = "#{$test_data_dir}/ExpectedDataFile/"
|
9
|
-
$globalData = YAML.load_file("#{$test_data_dir}/globalData.yml")
|
10
|
-
PROJECT_CONFIG = YAML.load_file("#{$current_dir}/project_config.yml")
|
11
|
-
$OBJECT = YAML.load_file("#{$base_dir}/features/step_definitions/repositories/project_object.yml")
|
12
|
-
|
13
|
-
STDOUT.sync = true
|
14
|
-
require '
|
15
|
-
require '
|
16
|
-
require 'capybara
|
17
|
-
require '
|
18
|
-
require 'test/unit/assertions'
|
19
|
-
require '
|
20
|
-
require '
|
21
|
-
require '
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
$_CFWEB['
|
26
|
-
$_CFWEB['
|
27
|
-
|
28
|
-
$
|
29
|
-
$
|
30
|
-
$
|
31
|
-
$
|
32
|
-
$
|
33
|
-
$
|
34
|
-
$
|
35
|
-
$SEND_EMAIL_PASSWORD = PROJECT_CONFIG['
|
36
|
-
$SEND_EMAIL_PORT = PROJECT_CONFIG['
|
37
|
-
$SEND_EMAIL_DOMAIN = PROJECT_CONFIG['
|
38
|
-
$RECEIVE_EMAIL_ADDRESS = PROJECT_CONFIG['
|
39
|
-
$RECEIVE_EMAIL_USERNAME = PROJECT_CONFIG['
|
40
|
-
$RECEIVE_EMAIL_PASSWORD = PROJECT_CONFIG['
|
41
|
-
$RECEIVE_EMAIL_PORT = PROJECT_CONFIG['
|
42
|
-
|
43
|
-
$_CFWEB['Print Log'] = true
|
44
|
-
$_CFWEB['Maximize Browser'] = true
|
45
|
-
|
46
|
-
Mail.defaults do
|
47
|
-
delivery_method :smtp, {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
retriever_method :pop3, {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf,application/x-pdf,application/octet-stream"
|
114
|
-
profile["pdfjs.disabled"] = true
|
115
|
-
Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
|
116
|
-
elsif $_CFWEB['Default Browser'] == 'internet_explorer'
|
117
|
-
Capybara::Selenium::Driver.new(app, :browser => :internet_explorer)
|
118
|
-
elsif $_CFWEB['Default Browser'] == 'chrome'
|
119
|
-
prefs = {:download => {
|
120
|
-
:prompt_for_download => false,
|
121
|
-
:default_directory => $_CFWEB['Download Dir']
|
122
|
-
}}
|
123
|
-
args = []
|
124
|
-
args << "--test-type" #to fix the error of chrome "you are using an unsupported command-line flag ignore-certificate-errors"
|
125
|
-
|
126
|
-
Capybara::Selenium::Driver.new(app, :browser => :chrome, :prefs => prefs, :args => args)
|
127
|
-
else
|
128
|
-
puts("Not support browser...")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
CI_REPORTS = 'features/reports'
|
133
|
-
World(Test::Unit::Assertions)
|
134
|
-
|
1
|
+
$_CFWEB = Hash.new
|
2
|
+
# Define global variables
|
3
|
+
$current_dir = File.expand_path(File.dirname(__FILE__))
|
4
|
+
$base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
|
5
|
+
$test_data_dir = $base_dir + '/features/TestData/'
|
6
|
+
$sql_dir = $base_dir + '/features/TestData/SqlScript/'
|
7
|
+
$_CFWEB['Download Dir'] = "#{$test_data_dir}DownloadFolder/"
|
8
|
+
$_CFWEB['Expected Data Dir'] = "#{$test_data_dir}/ExpectedDataFile/"
|
9
|
+
$globalData = YAML.load_file("#{$test_data_dir}/globalData.yml")
|
10
|
+
PROJECT_CONFIG = YAML.load_file("#{$current_dir}/project_config.yml")
|
11
|
+
$OBJECT = YAML.load_file("#{$base_dir}/features/step_definitions/repositories/project_object.yml")
|
12
|
+
|
13
|
+
STDOUT.sync = true
|
14
|
+
require 'rubygems'
|
15
|
+
require 'mail'
|
16
|
+
require 'capybara'
|
17
|
+
require 'capybara/cucumber'
|
18
|
+
require 'test/unit/assertions'
|
19
|
+
require 'yaml'
|
20
|
+
require 'action_mailer'
|
21
|
+
require 'email_spec'
|
22
|
+
require 'Ifd_Automation'
|
23
|
+
|
24
|
+
$_CFWEB['Default Browser'] = PROJECT_CONFIG['default_browser']
|
25
|
+
$_CFWEB['Wait Time'] = PROJECT_CONFIG['wait_time']
|
26
|
+
$_CFWEB['Page Address'] = PROJECT_CONFIG['test_page_address']
|
27
|
+
SELENIUM_SERVER = PROJECT_CONFIG['selenium_grid']
|
28
|
+
$data_source_username = PROJECT_CONFIG['data_source_username']
|
29
|
+
$data_source_password = PROJECT_CONFIG['data_source_password']
|
30
|
+
$data_source_url = PROJECT_CONFIG['data_source_url']
|
31
|
+
$db_type = PROJECT_CONFIG['db_type']
|
32
|
+
$WS_URL = PROJECT_CONFIG['ws_url']
|
33
|
+
$SEND_EMAIL_ADDRESS = PROJECT_CONFIG['send_email_address']
|
34
|
+
$SEND_EMAIL_USERNAME = PROJECT_CONFIG['send_email_username']
|
35
|
+
$SEND_EMAIL_PASSWORD = PROJECT_CONFIG['send_email_password']
|
36
|
+
$SEND_EMAIL_PORT = PROJECT_CONFIG['send_email_port']
|
37
|
+
$SEND_EMAIL_DOMAIN = PROJECT_CONFIG['send_email_domain']
|
38
|
+
$RECEIVE_EMAIL_ADDRESS = PROJECT_CONFIG['send_email_address']
|
39
|
+
$RECEIVE_EMAIL_USERNAME = PROJECT_CONFIG['receive_email_username']
|
40
|
+
$RECEIVE_EMAIL_PASSWORD = PROJECT_CONFIG['receive_email_password']
|
41
|
+
$RECEIVE_EMAIL_PORT = PROJECT_CONFIG['receive_email_port']
|
42
|
+
|
43
|
+
$_CFWEB['Print Log'] = true
|
44
|
+
$_CFWEB['Maximize Browser'] = true
|
45
|
+
|
46
|
+
Mail.defaults do
|
47
|
+
delivery_method :smtp, {
|
48
|
+
:enable_starttls_auto => true,
|
49
|
+
:address => $SEND_EMAIL_ADDRESS,
|
50
|
+
:port => $SEND_EMAIL_PORT,
|
51
|
+
:domain => $SEND_EMAIL_DOMAIN,
|
52
|
+
:authentication => :plain,
|
53
|
+
:user_name => $SEND_EMAIL_USERNAME,
|
54
|
+
:password => $SEND_EMAIL_PASSWORD
|
55
|
+
}
|
56
|
+
retriever_method :pop3, {
|
57
|
+
:address => $RECEIVE_EMAIL_ADDRESS,
|
58
|
+
:port => $RECEIVE_EMAIL_PORT,
|
59
|
+
:user_name => $RECEIVE_EMAIL_USERNAME,
|
60
|
+
:password => $RECEIVE_EMAIL_PASSWORD,
|
61
|
+
:enable_ssl => true
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
Capybara.configure do |config|
|
66
|
+
config.app_host = $_CFWEB['Page Address']
|
67
|
+
config.default_wait_time = $_CFWEB['Wait Time']
|
68
|
+
# config.run_server = false
|
69
|
+
config.default_driver = :selenium
|
70
|
+
config.default_selector = :css
|
71
|
+
config.ignore_hidden_elements = true
|
72
|
+
#config.visible_text_only = true
|
73
|
+
end
|
74
|
+
|
75
|
+
def register_selenium_remote_driver(browser)
|
76
|
+
Capybara.register_driver :selenium do |app|
|
77
|
+
Capybara::Selenium::Driver.new(app, browser: :remote, url: "http://#{SELENIUM_SERVER}:4444/wd/hub", desired_capabilities: browser.to_sym)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def register_selenium_local_driver(browser)
|
82
|
+
Capybara.register_driver :selenium do |app|
|
83
|
+
case browser
|
84
|
+
when "firefox"
|
85
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
86
|
+
profile['browser.download.folderList'] = 2
|
87
|
+
profile['browser.download.dir'] = $_CFWEB['Download Dir']
|
88
|
+
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf,application/x-pdf,application/octet-stream"
|
89
|
+
profile["pdfjs.disabled"] = true
|
90
|
+
Capybara::Selenium::Driver.new(app, :browser => browser.to_sym, :profile => profile)
|
91
|
+
when "chrome"
|
92
|
+
prefs = {:download => {
|
93
|
+
:prompt_for_download => false,
|
94
|
+
:default_directory => $_CFWEB['Download Dir']
|
95
|
+
}}
|
96
|
+
args = []
|
97
|
+
args << "--test-type" #to fix the error of chrome "you are using an unsupported command-line flag ignore-certificate-errors"
|
98
|
+
Capybara::Selenium::Driver.new(app, :browser => browser.to_sym, :prefs => prefs, :args => args)
|
99
|
+
when "internet_explorer"
|
100
|
+
Capybara::Selenium::Driver.new(app, :browser => browser.to_sym)
|
101
|
+
else
|
102
|
+
puts("Not support browser...")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
case ENV["SELENIUM"]
|
108
|
+
when "remote"
|
109
|
+
register_selenium_remote_driver($_CFWEB['Default Browser'])
|
110
|
+
else
|
111
|
+
register_selenium_local_driver($_CFWEB['Default Browser'])
|
112
|
+
end
|
@@ -1,57 +1,57 @@
|
|
1
|
-
#Only run IE browser
|
2
|
-
Before('@IE') do
|
3
|
-
$_Old_Default_Browser = $_CFWEB['Default Browser']
|
4
|
-
$_CFWEB['Default Browser'] = 'IE'
|
5
|
-
end
|
6
|
-
After('@IE') do
|
7
|
-
$_CFWEB['Default Browser'] = $_Old_Default_Browser
|
8
|
-
end
|
9
|
-
|
10
|
-
#Only run Chrome browser
|
11
|
-
Before('@CH') do
|
12
|
-
$_Old_Default_Browser = $_CFWEB['Default Browser']
|
13
|
-
$_CFWEB['Default Browser'] = 'CH'
|
14
|
-
end
|
15
|
-
After('@CH') do
|
16
|
-
$_CFWEB['Default Browser'] = $_Old_Default_Browser
|
17
|
-
end
|
18
|
-
|
19
|
-
#Only run Firefox browser
|
20
|
-
Before('@FF') do
|
21
|
-
$_Old_Default_Browser = $_CFWEB['Default Browser']
|
22
|
-
$_CFWEB['Default Browser'] = 'FF'
|
23
|
-
end
|
24
|
-
After('@FF') do
|
25
|
-
$_CFWEB['Default Browser'] = $_Old_Default_Browser
|
26
|
-
end
|
27
|
-
|
28
|
-
Before do
|
29
|
-
begin
|
30
|
-
browser = Capybara.current_session.driver.browser
|
31
|
-
browser.manage.delete_all_cookies
|
32
|
-
rescue StandardError => myStandardError
|
33
|
-
put_log "\n>>> Error: #{myStandardError}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
After do |scenario|
|
38
|
-
begin
|
39
|
-
Capybara.page.driver.quit
|
40
|
-
Capybara.send(:session_pool).delete_if { |key, value| key =~ /selenium/i }
|
41
|
-
rescue StandardError => myStandardError
|
42
|
-
put_log "\n>>> Error: #{myStandardError}"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
at_exit do
|
47
|
-
end
|
48
|
-
|
49
|
-
AfterConfiguration do |config|
|
50
|
-
end
|
51
|
-
|
52
|
-
Around do |scenario, block|
|
53
|
-
block.call
|
54
|
-
end
|
55
|
-
|
56
|
-
AfterStep do |scenario|
|
1
|
+
#Only run IE browser
|
2
|
+
Before('@IE') do
|
3
|
+
$_Old_Default_Browser = $_CFWEB['Default Browser']
|
4
|
+
$_CFWEB['Default Browser'] = 'IE'
|
5
|
+
end
|
6
|
+
After('@IE') do
|
7
|
+
$_CFWEB['Default Browser'] = $_Old_Default_Browser
|
8
|
+
end
|
9
|
+
|
10
|
+
#Only run Chrome browser
|
11
|
+
Before('@CH') do
|
12
|
+
$_Old_Default_Browser = $_CFWEB['Default Browser']
|
13
|
+
$_CFWEB['Default Browser'] = 'CH'
|
14
|
+
end
|
15
|
+
After('@CH') do
|
16
|
+
$_CFWEB['Default Browser'] = $_Old_Default_Browser
|
17
|
+
end
|
18
|
+
|
19
|
+
#Only run Firefox browser
|
20
|
+
Before('@FF') do
|
21
|
+
$_Old_Default_Browser = $_CFWEB['Default Browser']
|
22
|
+
$_CFWEB['Default Browser'] = 'FF'
|
23
|
+
end
|
24
|
+
After('@FF') do
|
25
|
+
$_CFWEB['Default Browser'] = $_Old_Default_Browser
|
26
|
+
end
|
27
|
+
|
28
|
+
Before do
|
29
|
+
begin
|
30
|
+
browser = Capybara.current_session.driver.browser
|
31
|
+
browser.manage.delete_all_cookies
|
32
|
+
rescue StandardError => myStandardError
|
33
|
+
put_log "\n>>> Error: #{myStandardError}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
After do |scenario|
|
38
|
+
begin
|
39
|
+
Capybara.page.driver.quit
|
40
|
+
Capybara.send(:session_pool).delete_if { |key, value| key =~ /selenium/i }
|
41
|
+
rescue StandardError => myStandardError
|
42
|
+
put_log "\n>>> Error: #{myStandardError}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
at_exit do
|
47
|
+
end
|
48
|
+
|
49
|
+
AfterConfiguration do |config|
|
50
|
+
end
|
51
|
+
|
52
|
+
Around do |scenario, block|
|
53
|
+
block.call
|
54
|
+
end
|
55
|
+
|
56
|
+
AfterStep do |scenario|
|
57
57
|
end
|
@@ -6,9 +6,9 @@
|
|
6
6
|
# :internet_explorer => "Internet Explorer"
|
7
7
|
# :chrome => "Chrome"
|
8
8
|
#---------------------------
|
9
|
-
default_browser:
|
10
|
-
wait_time:
|
11
|
-
test_page_address:
|
9
|
+
default_browser: chrome
|
10
|
+
wait_time: 10
|
11
|
+
test_page_address:
|
12
12
|
selenium_grid: http://10.5.1.202:5555/wd/hub
|
13
13
|
###################################################################
|
14
14
|
# DATABASE CONFIGURATION #
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Ifd_Automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anh Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -162,4 +162,3 @@ signing_key:
|
|
162
162
|
specification_version: 4
|
163
163
|
summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER
|
164
164
|
test_files: []
|
165
|
-
has_rdoc:
|