Ifd_Automation 1.4.0 → 1.5.0

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.
@@ -1,5 +1,5 @@
1
1
  module Ifd
2
2
  module Automation
3
- VERSION = '1.4.0'
3
+ VERSION = '1.5.0'
4
4
  end
5
5
  end
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.6.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.11.2
196
+ 1.12.3
@@ -1,6 +1,4 @@
1
- #Author: Anh Pham
2
-
3
- @LOGIN
4
1
  Feature: Testing login functionality
5
- Scenario: Test Case for Demo
6
- Given I navigate to Demo page
2
+ Scenario Outline:
3
+ Given I am on Login Page
4
+ Scenarios:
@@ -1,3 +1,3 @@
1
- When /I navigate to Demo page/ do
2
- step %{I am on Login Page}
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 'mail'
15
- require 'capybara'
16
- require 'capybara/cucumber'
17
- require 'test/unit'
18
- require 'test/unit/assertions'
19
- require 'action_mailer'
20
- require 'rubygems'
21
- require 'yaml'
22
- # require 'rest-client'
23
- require 'Ifd_Automation'
24
-
25
- $_CFWEB['Default Browser'] = PROJECT_CONFIG['default_browser']
26
- $_CFWEB['Wait Time'] = PROJECT_CONFIG['wait_time']
27
- $_CFWEB['Page Address'] = PROJECT_CONFIG['test_page_address']
28
- $selenium_grid_url = PROJECT_CONFIG['selenium_grid']
29
- $data_source_username = PROJECT_CONFIG['data_source_username']
30
- $data_source_password = PROJECT_CONFIG['data_source_password']
31
- $data_source_url = PROJECT_CONFIG['data_source_url']
32
- $db_type = PROJECT_CONFIG['db_type']
33
- $WS_URL = PROJECT_CONFIG['WS_URL']
34
- $SEND_EMAIL_ADDRESS = 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['RECEIVE_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
- if ENV["SELENIUM"] == 'remote'
66
- Capybara.app_host = $_CFWEB['Page Address']
67
- Capybara.default_wait_time = $_CFWEB['Wait Time']
68
- Capybara.default_driver = :selenium
69
- Capybara.register_driver :selenium do |app|
70
- if $_CFWEB['Default Browser'] == 'firefox'
71
- profile = Selenium::WebDriver::Firefox::Profile.new
72
- profile['browser.download.dir'] = $_CFWEB['Download Dir']
73
- profile['browser.download.folderList'] = 2
74
- profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
75
- capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
76
- Capybara::Selenium::Driver.new(app,
77
- :browser => :remote,
78
- :url => $selenium_grid_url,
79
- :desired_capabilities => capabilities)
80
- elsif $_CFWEB['Default Browser'] == 'internet_explorer'
81
- capabilities = Selenium::WebDriver::Remote::Capabilities.internet_explorer
82
- Capybara::Selenium::Driver.new(app,
83
- :browser => :remote,
84
- :url => $selenium_grid_url,
85
- :desired_capabilities => capabilities)
86
- elsif $_CFWEB['Default Browser'] == 'chrome'
87
- prefs = {:download => {:prompt_for_download => false, :default_directory => $_CFWEB['Download Dir']}}
88
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
89
- capabilities['chromeOptions'] = {'prefs' => prefs}
90
- Capybara::Selenium::Driver.new(app, :browser => :remote,
91
- :url => $selenium_grid_url,
92
- :desired_capabilities => capabilities)
93
- else
94
- puts("Not support browser...")
95
- end
96
- end
97
- else
98
- ENV["SELENIUM"] == 'local'
99
- Capybara.configure do |config|
100
- config.app_host = $_CFWEB['Page Address']
101
- config.default_wait_time = $_CFWEB['Wait Time']
102
- config.run_server = false
103
- config.default_driver = :selenium
104
- config.default_selector = :css
105
- config.ignore_hidden_elements = true
106
- #config.visible_text_only = true
107
- end
108
- Capybara.register_driver :selenium do |app|
109
- if $_CFWEB['Default Browser'] == 'firefox'
110
- profile = Selenium::WebDriver::Firefox::Profile.new
111
- profile['browser.download.folderList'] = 2
112
- profile['browser.download.dir'] = $_CFWEB['Download Dir']
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: firefox
10
- wait_time: 30
11
- test_page_address: http://10.5.1.200:55602/
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.0
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-04-25 00:00:00.000000000 Z
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: