Ifd_Automation 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/bin/Ifd_Automation +34 -15
  3. data/bin/console +14 -0
  4. data/bin/documentation_generator.rb +119 -0
  5. data/bin/helper.rb +24 -19
  6. data/bin/setup +8 -0
  7. data/lib/Ifd_Automation.rb +2 -1
  8. data/lib/Ifd_Automation/all_steps.rb +8 -0
  9. data/lib/Ifd_Automation/database_steps.rb +106 -0
  10. data/lib/Ifd_Automation/email_steps.rb +67 -82
  11. data/lib/Ifd_Automation/file_steps.rb +30 -0
  12. data/lib/Ifd_Automation/{javascript_handling_steps.rb → javascript_steps.rb} +1 -2
  13. data/lib/Ifd_Automation/required_libs.rb +7 -0
  14. data/lib/Ifd_Automation/response.rb +105 -0
  15. data/lib/Ifd_Automation/ssh_steps.rb +47 -0
  16. data/lib/Ifd_Automation/version.rb +3 -5
  17. data/lib/Ifd_Automation/web_steps.rb +293 -0
  18. data/lib/Ifd_Automation/webservice_steps.rb +261 -0
  19. data/lib/{Ifd_Automation/methods/IFD_Assertion_methods.rb → Ifd_Automation_support/assertion_helpers.rb} +0 -1
  20. data/lib/Ifd_Automation_support/connection_helpers.rb +14 -0
  21. data/lib/{Ifd_Automation/methods → Ifd_Automation_support}/core.rb +103 -34
  22. data/lib/{Ifd_Automation/methods/javascript_handling_methods.rb → Ifd_Automation_support/javascript_helpers.rb} +0 -1
  23. data/lib/Ifd_Automation_support/mail_helpers.rb +17 -0
  24. data/lib/Ifd_Automation_support/selenium_sync_issues.rb +62 -0
  25. data/lib/{Ifd_Automation/methods/web_methods.rb → Ifd_Automation_support/web_steps_helpers.rb} +6 -1
  26. data/project/Gemfile +1 -19
  27. data/project/Gemfile.lock +203 -0
  28. data/project/features/TestData/globalData.yml +3 -11
  29. data/project/features/TestData/sshtest.txt +2 -0
  30. data/project/features/TestData/testfile.sql +2 -0
  31. data/project/features/{TestData/DownloadFolder/test.txt → TestSuite/test} +0 -0
  32. data/project/features/step_definitions/lib_steps/test.rb +16 -0
  33. data/project/features/step_definitions/repositories/project_object.yml +6 -6
  34. data/project/features/support/env.rb +46 -68
  35. data/project/features/support/project_config.yml +6 -37
  36. metadata +231 -51
  37. data/lib/Ifd_Automation/assertion_steps.rb +0 -96
  38. data/lib/Ifd_Automation/lib_file_steps.rb +0 -54
  39. data/lib/Ifd_Automation/lib_schema_data_steps.rb +0 -115
  40. data/lib/Ifd_Automation/lib_web_steps.rb +0 -184
  41. data/lib/Ifd_Automation/lib_webservice_steps.rb +0 -44
  42. data/lib/Ifd_Automation/methods/IFD_Connection.rb +0 -28
  43. data/lib/Ifd_Automation/methods/IFD_email_methods.rb +0 -16
  44. data/lib/Ifd_Automation/methods/IFD_webservice.rb +0 -17
  45. data/lib/Ifd_Automation/methods/database_methods.rb +0 -25
  46. data/lib/Ifd_Automation/methods/db_utils.rb +0 -37
  47. data/lib/Ifd_Automation/methods/error_handling_methods.rb +0 -87
  48. data/lib/Ifd_Automation/methods/lib_var.rb +0 -59
  49. data/lib/Ifd_Automation/methods/misc_methods.rb +0 -33
  50. data/lib/Ifd_Automation/methods/required_files.rb +0 -33
  51. data/lib/Ifd_Automation/methods/util.rb +0 -168
  52. data/lib/Ifd_Automation/methods/web_service_methods.rb +0 -63
  53. data/project/config/cucumber.yml +0 -3
  54. data/project/features/TestData/ExpectedDataFile/test.txt +0 -0
  55. data/project/features/TestData/SqlScript/test.sql +0 -0
  56. data/project/features/TestData/actual_images/infodation.jpg +0 -0
  57. data/project/features/TestData/expected_images/infodation.jpg +0 -0
  58. data/project/features/TestData/image_difference/infodation.jpg +0 -0
  59. data/project/features/TestData/screenshots/infodation.jpg +0 -0
  60. data/project/features/TestSuite/Login/login.feature +0 -11
  61. data/project/features/step_definitions/lib_steps/login_steps.rb +0 -16
@@ -0,0 +1,62 @@
1
+ # coding: UTF-8
2
+
3
+ module SeleniumSyncIssues
4
+ RETRY_ERRORS = %w[
5
+ Capybara::ElementNotFound
6
+ Spec::Expectations::ExpectationNotMetError
7
+ RSpec::Expectations::ExpectationNotMetError
8
+ Minitest::Assertion
9
+ Capybara::Poltergeist::ClickFailed
10
+ Capybara::ExpectationNotMet
11
+ Selenium::WebDriver::Error::StaleElementReferenceError
12
+ Selenium::WebDriver::Error::NoAlertPresentError
13
+ Selenium::WebDriver::Error::ElementNotVisibleError
14
+ Selenium::WebDriver::Error::NoSuchFrameError
15
+ Selenium::WebDriver::Error::NoAlertPresentError
16
+ Selenium::WebDriver::Error::JavascriptError
17
+ Selenium::WebDriver::Error::UnknownError
18
+ ]
19
+
20
+ class CapybaraWrapper
21
+ def self.default_max_wait_time
22
+ if Capybara.respond_to?(:default_max_wait_time)
23
+ Capybara.default_max_wait_time
24
+ else
25
+ Capybara.default_wait_time
26
+ end
27
+ end
28
+
29
+ def self.default_max_wait_time=(value)
30
+ if Capybara.respond_to?(:default_max_wait_time=)
31
+ Capybara.default_max_wait_time = value
32
+ else
33
+ Capybara.default_wait_time = value
34
+ end
35
+ end
36
+ end
37
+
38
+ # This is similiar but not entirely the same as Capybara::Node::Base#wait_until or Capybara::Session#wait_until
39
+ def patiently(seconds = CapybaraWrapper.default_max_wait_time, &block)
40
+ old_wait_time = CapybaraWrapper.default_max_wait_time
41
+ # dont make nested wait_untils use up all the alloted time
42
+ CapybaraWrapper.default_max_wait_time = 0 # for we are a jealous gem
43
+ if page.driver.wait?
44
+ start_time = Time.now
45
+ begin
46
+ block.call
47
+ rescue Exception => e
48
+ raise e unless RETRY_ERRORS.include?(e.class.name)
49
+ raise e if (Time.now - start_time) >= seconds
50
+ sleep(0.05)
51
+ raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if Time.now == start_time
52
+ retry
53
+ end
54
+ else
55
+ block.call
56
+ end
57
+ ensure
58
+ CapybaraWrapper.default_max_wait_time = old_wait_time
59
+ end
60
+ end
61
+
62
+ World(SeleniumSyncIssues)
@@ -1,5 +1,5 @@
1
1
  require 'net/https'
2
- require_relative 'required_files'
2
+ # require 'Ifd_Automation_support/core'
3
3
 
4
4
  # This file contains assertion methods which are called from assertion_steps.rb
5
5
 
@@ -289,3 +289,8 @@ def take_screenshot
289
289
  cur_time = Time.now.strftime('%Y%m%d%H%M%S%L')
290
290
  page.driver.browser.save_screenshot($test_data_dir + '/screenshots/screenshot' + cur_time + '.png')
291
291
  end
292
+
293
+ def get_element_attribute(access_type, access_name, attribute_name)
294
+ $driver.find_element(:"#{access_type}" => "#{access_name}").attribute("#{attribute_name}")
295
+ end
296
+
data/project/Gemfile CHANGED
@@ -1,21 +1,3 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'capybara', '~> 2.4.4'
4
- gem 'httparty', '~> 0.13.5'
5
- gem 'csv-diff', '~> 0.3.0'
6
- gem 'rspec', '~> 3.3.0'
7
- gem 'gherkin', '~>2.12.2'
8
- gem 'json', '1.8.3'
9
- #gem 'mysql2','0.3.18'
10
- gem 'test-unit', '~> 3.1.2'
11
- gem 'parallel_tests'
12
- gem 'rest-client', '~> 1.8.0'
13
- gem 'tiny_tds', '~> 0.6.2'
14
- gem 'actionmailer', '~> 4.2.3'
15
- gem 'email_spec'
16
- gem 'rails'
17
- gem 'rack-utf8_sanitizer'
18
- gem 'mail'
19
- gem 'chromedriver2-helper'
20
- gem 'rautomation', '~> 0.17.0'
21
- gem 'headless', '~> 2.2', '>= 2.2.3'
3
+ gem 'Ifd_Automation'
@@ -0,0 +1,203 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ Ifd_Automation (0.1.8)
5
+ appium_lib (>= 4.0.0, > 4.1.0)
6
+ chunky_png (>= 1.3.0, > 1.3.3)
7
+ cucumber (>= 1.3.18, > 2.0.0)
8
+ selenium-webdriver (>= 2.46.2, > 2.46.2)
9
+ actionmailer (5.0.0.1)
10
+ actionpack (= 5.0.0.1)
11
+ actionview (= 5.0.0.1)
12
+ activejob (= 5.0.0.1)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 2.0)
15
+ actionpack (5.0.0.1)
16
+ actionview (= 5.0.0.1)
17
+ activesupport (= 5.0.0.1)
18
+ rack (~> 2.0)
19
+ rack-test (~> 0.6.3)
20
+ rails-dom-testing (~> 2.0)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (5.0.0.1)
23
+ activesupport (= 5.0.0.1)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ activejob (5.0.0.1)
29
+ activesupport (= 5.0.0.1)
30
+ globalid (>= 0.3.6)
31
+ activemodel (5.0.0.1)
32
+ activesupport (= 5.0.0.1)
33
+ activerecord (5.0.0.1)
34
+ activemodel (= 5.0.0.1)
35
+ activesupport (= 5.0.0.1)
36
+ arel (~> 7.0)
37
+ activesupport (5.0.0.1)
38
+ concurrent-ruby (~> 1.0, >= 1.0.2)
39
+ i18n (~> 0.7)
40
+ minitest (~> 5.1)
41
+ tzinfo (~> 1.1)
42
+ addressable (2.4.0)
43
+ akami (1.3.1)
44
+ gyoku (>= 0.4.0)
45
+ nokogiri
46
+ appium_lib (8.0.2)
47
+ awesome_print (~> 1.6)
48
+ json (~> 1.8)
49
+ nokogiri (~> 1.6.6)
50
+ selenium-webdriver (~> 2.49)
51
+ tomlrb (~> 1.1)
52
+ arel (7.1.4)
53
+ awesome_print (1.7.0)
54
+ builder (3.2.2)
55
+ capybara (2.10.1)
56
+ addressable
57
+ mime-types (>= 1.16)
58
+ nokogiri (>= 1.3.3)
59
+ rack (>= 1.0.0)
60
+ rack-test (>= 0.5.4)
61
+ xpath (~> 2.0)
62
+ childprocess (0.5.9)
63
+ ffi (~> 1.0, >= 1.0.11)
64
+ chunky_png (1.3.7)
65
+ concurrent-ruby (1.0.2)
66
+ cucumber (2.4.0)
67
+ builder (>= 2.1.2)
68
+ cucumber-core (~> 1.5.0)
69
+ cucumber-wire (~> 0.0.1)
70
+ diff-lcs (>= 1.1.3)
71
+ gherkin (~> 4.0)
72
+ multi_json (>= 1.7.5, < 2.0)
73
+ multi_test (>= 0.1.2)
74
+ cucumber-core (1.5.0)
75
+ gherkin (~> 4.0)
76
+ cucumber-wire (0.0.1)
77
+ diff-lcs (1.2.5)
78
+ domain_name (0.5.20160826)
79
+ unf (>= 0.0.5, < 1.0.0)
80
+ erubis (2.7.0)
81
+ ffi (1.9.14)
82
+ ffi (1.9.14-x64-mingw32)
83
+ ffi (1.9.14-x86-mingw32)
84
+ gherkin (4.0.0)
85
+ globalid (0.3.7)
86
+ activesupport (>= 4.1.0)
87
+ gyoku (1.3.1)
88
+ builder (>= 2.1.2)
89
+ http-cookie (1.0.3)
90
+ domain_name (~> 0.5)
91
+ httpi (2.4.2)
92
+ rack
93
+ socksify
94
+ i18n (0.7.0)
95
+ json (1.8.3)
96
+ json-schema (2.7.0)
97
+ addressable (>= 2.4)
98
+ jsonpath (0.5.8)
99
+ multi_json
100
+ loofah (2.0.3)
101
+ nokogiri (>= 1.5.9)
102
+ mail (2.6.4)
103
+ mime-types (>= 1.16, < 4)
104
+ mime-types (3.1)
105
+ mime-types-data (~> 3.2015)
106
+ mime-types-data (3.2016.0521)
107
+ mini_portile2 (2.1.0)
108
+ minitest (5.9.1)
109
+ multi_json (1.12.1)
110
+ multi_test (0.1.2)
111
+ mysql2 (0.4.4)
112
+ mysql2 (0.4.4-x64-mingw32)
113
+ mysql2 (0.4.4-x86-mingw32)
114
+ net-ssh (3.2.0)
115
+ netrc (0.11.0)
116
+ nokogiri (1.6.8.1)
117
+ mini_portile2 (~> 2.1.0)
118
+ nokogiri (1.6.8.1-x64-mingw32)
119
+ mini_portile2 (~> 2.1.0)
120
+ nokogiri (1.6.8.1-x86-mingw32)
121
+ mini_portile2 (~> 2.1.0)
122
+ nori (2.6.0)
123
+ rack (2.0.1)
124
+ rack-test (0.6.3)
125
+ rack (>= 1.0)
126
+ rails-dom-testing (2.0.1)
127
+ activesupport (>= 4.2.0, < 6.0)
128
+ nokogiri (~> 1.6.0)
129
+ rails-html-sanitizer (1.0.3)
130
+ loofah (~> 2.0)
131
+ rest-client (2.0.0)
132
+ http-cookie (>= 1.0.2, < 2.0)
133
+ mime-types (>= 1.16, < 4.0)
134
+ netrc (~> 0.8)
135
+ rest-client (2.0.0-x64-mingw32)
136
+ ffi (~> 1.9)
137
+ http-cookie (>= 1.0.2, < 2.0)
138
+ mime-types (>= 1.16, < 4.0)
139
+ netrc (~> 0.8)
140
+ rest-client (2.0.0-x86-mingw32)
141
+ ffi (~> 1.9)
142
+ http-cookie (>= 1.0.2, < 2.0)
143
+ mime-types (>= 1.16, < 4.0)
144
+ netrc (~> 0.8)
145
+ rubyzip (1.2.0)
146
+ savon (2.11.1)
147
+ akami (~> 1.2)
148
+ builder (>= 2.1.2)
149
+ gyoku (~> 1.2)
150
+ httpi (~> 2.3)
151
+ nokogiri (>= 1.4.0)
152
+ nori (~> 2.4)
153
+ wasabi (~> 3.4)
154
+ selenium-webdriver (2.53.4)
155
+ childprocess (~> 0.5)
156
+ rubyzip (~> 1.0)
157
+ websocket (~> 1.0)
158
+ socksify (1.7.0)
159
+ thread_safe (0.3.5)
160
+ tiny_tds (1.0.5)
161
+ mini_portile2 (~> 2.0)
162
+ tiny_tds (1.0.5-x64-mingw32)
163
+ mini_portile2 (~> 2.0)
164
+ tiny_tds (1.0.5-x86-mingw32)
165
+ mini_portile2 (~> 2.0)
166
+ tomlrb (1.2.3)
167
+ tzinfo (1.2.2)
168
+ thread_safe (~> 0.1)
169
+ unf (0.1.4)
170
+ unf_ext
171
+ unf_ext (0.0.7.2)
172
+ unf_ext (0.0.7.2-x64-mingw32)
173
+ unf_ext (0.0.7.2-x86-mingw32)
174
+ wasabi (3.5.0)
175
+ httpi (~> 2.0)
176
+ nokogiri (>= 1.4.2)
177
+ websocket (1.2.3)
178
+ xpath (2.0.0)
179
+ nokogiri (~> 1.3)
180
+
181
+ PLATFORMS
182
+ ruby
183
+ x64-mingw32
184
+ x86-mingw32
185
+
186
+ DEPENDENCIES
187
+ Ifd_Automation
188
+ actionmailer
189
+ activerecord
190
+ capybara
191
+ cucumber
192
+ json-schema (~> 2.7)
193
+ jsonpath (~> 0.5.8)
194
+ mail
195
+ mysql2 (~> 0.4.4)
196
+ net-ssh (~> 3.2)
197
+ rest-client (~> 2.0)
198
+ savon (~> 2.11.0)
199
+ selenium-webdriver (~> 2.46)
200
+ tiny_tds (~> 1.0, >= 1.0.5)
201
+
202
+ BUNDLED WITH
203
+ 1.13.5
@@ -1,11 +1,3 @@
1
- username_cuong1: cuong.huynh@infodation.vn
2
- password_cuong1: 123456
3
- username_cuong2: infodationvn.jenkins@gmail.com
4
- password_cuong2: 123456
5
- admin_username: admin
6
- admin_password: MyMethods123%
7
- bookcolor_red: DE2C19
8
- bookcolor_orange: F66506
9
- bookcolor_black: 191919
10
- bookcolor_white: E6E6E6
11
- bookcolor_yellow: F5C504
1
+ testpage: http://google.com
2
+ testREST: https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty
3
+
@@ -0,0 +1,2 @@
1
+ pwd
2
+ ls
@@ -0,0 +1,2 @@
1
+ delete from autofeatures where id=12;
2
+ delete from autofeatures where id=13;
@@ -0,0 +1,16 @@
1
+ # When /^I login into system with username "(.*)" and password "(.*)"$/ do |username, password|
2
+ # steps %Q{
3
+ # I click on "mym_header.button_cookie"
4
+ # I click on "mym_header.button_login"
5
+ # I set text on "mym_login.textbox_username" with "#{username}"
6
+ # I set text on "mym_login.textbox_password" with "#{password}"
7
+ # I click on "mym_login.button_login"
8
+ # I wait for 2 seconds
9
+ # }
10
+ # end
11
+ #
12
+ # Then /^I should see the error message "(.*)" display$/ do |errormessage|
13
+ # steps %Q{
14
+ # I check property "mym_login.label_message_error" with "text" has value "#{errormessage}"
15
+ # }
16
+ # end
@@ -1,6 +1,6 @@
1
- #textbox_admin_username: {xpath_selector: '//*[@id="UserName"]'}
2
- #textbox_admin_password: {xpath_selector: '//*[@id="Password"]'}
3
- #button_admin_login: {xpath_selector: '//*[@class="btn btn-primary"]'}
4
- #textbox_newUserName: {xpath_selector: '//*[@id="newUserName"]'}
5
- #button_createNewUser: {xpath_selector: '//*[@class="btn btn-primary-newUser"]'}
6
- #label_message: {xpath_selector: '//form/div/fieldset/div[2]'}
1
+ #mym_header.button_login: {xpath_selector: '//*[@class="btn ifd-btn-black"]'}
2
+ #mym_header.button_cookie: {xpath_selector: '//*[@id="btn-give-cookie-consent"]'}
3
+ #mym_login.textbox_username: {xpath_selector: '//*[@id="login_user"]'}
4
+ #mym_login.textbox_password: {xpath_selector: '//*[@id="login_pass"]'}
5
+ #mym_login.label_message_error: {xpath_selector: '//*[@class="ifd-message-error"]'}
6
+ #mym_login.button_login: {xpath_selector: '//*[@id="wp-submit"]'}
@@ -1,68 +1,61 @@
1
1
  $_CFWEB = Hash.new
2
- # Define global variables
3
2
  $current_dir = File.expand_path(File.dirname(__FILE__))
4
3
  $base_dir = File.expand_path(File.dirname(__FILE__) + '/../..')
5
4
  $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
5
  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
-
6
+ $PARAMS = YAML.load_file("#{$test_data_dir}/globalData.yml")
13
7
  STDOUT.sync = true
14
8
  require 'rubygems'
15
- require 'mail'
16
9
  require 'capybara'
17
10
  require 'capybara/cucumber'
18
- require 'test/unit/assertions'
19
11
  require 'yaml'
20
- #require 'action_mailer'
21
- require 'email_spec'
12
+ require 'selenium-webdriver'
22
13
  require 'Ifd_Automation'
14
+ # require File.expand_path('../lib/Ifd_Automation/email_steps.rb')
15
+ # require File.expand_path('../lib/Ifd_Automation/file_steps.rb')
16
+ # require File.expand_path('../lib/Ifd_Automation/ssh_steps.rb')
17
+ # require File.expand_path('../lib/Ifd_Automation/database_steps.rb')
18
+ # require File.expand_path('../lib/Ifd_Automation/web_steps.rb')
19
+ # require File.expand_path('../lib/Ifd_Automation/webservice_steps.rb')
20
+ # require File.expand_path('../lib/Ifd_Automation/response.rb')
21
+ # require File.expand_path('../lib/Ifd_Automation_support/selenium_sync_issues.rb')
22
+ # require File.expand_path('../lib/Ifd_Automation_support/core.rb')
23
+ # require File.expand_path('../lib/Ifd_Automation_support/web_steps_helpers.rb')
24
+ # require File.expand_path('../lib/Ifd_Automation_support/mail_helpers.rb')
25
+ # require File.expand_path('../lib/Ifd_Automation_support/assertion_helpers.rb')
26
+ # require File.expand_path('../lib/Ifd_Automation_support/web_service_helpers.rb')
23
27
 
24
-
25
- $_CFWEB['Default Browser'] = PROJECT_CONFIG['default_browser']
28
+ $_CFWEB['Default Browser'] = PROJECT_CONFIG['default_browser'].downcase
26
29
  $_CFWEB['Wait Time'] = PROJECT_CONFIG['wait_time']
27
30
  $_CFWEB['Page Address'] = PROJECT_CONFIG['test_page_address']
28
31
  SELENIUM_SERVER = 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_address']
32
+
33
+ $_CFWEB['Print Log'] = true
34
+ $_CFWEB['Maximize Browser'] = true
35
+
35
36
  $SEND_EMAIL_USERNAME = PROJECT_CONFIG['send_email_username']
36
37
  $SEND_EMAIL_PASSWORD = PROJECT_CONFIG['send_email_password']
37
- $SEND_EMAIL_PORT = PROJECT_CONFIG['send_email_port']
38
- $SEND_EMAIL_DOMAIN = PROJECT_CONFIG['send_email_domain']
39
- $RECEIVE_EMAIL_ADDRESS = PROJECT_CONFIG['send_email_address']
40
38
  $RECEIVE_EMAIL_USERNAME = PROJECT_CONFIG['receive_email_username']
41
39
  $RECEIVE_EMAIL_PASSWORD = PROJECT_CONFIG['receive_email_password']
42
- $RECEIVE_EMAIL_PORT = PROJECT_CONFIG['receive_email_port']
43
-
44
- $_CFWEB['Print Log'] = true
45
- $_CFWEB['Maximize Browser'] = true
46
40
 
47
41
  Mail.defaults do
48
42
  delivery_method :smtp, {
49
43
  :enable_starttls_auto => true,
50
- :address => $SEND_EMAIL_ADDRESS,
51
- :port => $SEND_EMAIL_PORT,
52
- :domain => $SEND_EMAIL_DOMAIN,
44
+ :address => 'smtp.gmail.com',
45
+ :port => 25,
46
+ :domain => 'gmail.com',
53
47
  :authentication => :plain,
54
48
  :user_name => $SEND_EMAIL_USERNAME,
55
49
  :password => $SEND_EMAIL_PASSWORD
56
50
  }
57
51
  retriever_method :pop3, {
58
- :address => $RECEIVE_EMAIL_ADDRESS,
59
- :port => $RECEIVE_EMAIL_PORT,
52
+ :address => 'pop.gmail.com',
53
+ :port => 995,
60
54
  :user_name => $RECEIVE_EMAIL_USERNAME,
61
55
  :password => $RECEIVE_EMAIL_PASSWORD,
62
56
  :enable_ssl => true
63
57
  }
64
58
  end
65
-
66
59
  Capybara.configure do |config|
67
60
  config.app_host = $_CFWEB['Page Address']
68
61
  config.default_wait_time = $_CFWEB['Wait Time']
@@ -82,46 +75,31 @@ end
82
75
  def register_selenium_local_driver(browser)
83
76
  Capybara.register_driver :selenium do |app|
84
77
  case browser
85
- when "firefox"
86
- profile = Selenium::WebDriver::Firefox::Profile.new
87
- profile['browser.download.folderList'] = 2
88
- profile['browser.download.dir'] = $_CFWEB['Download Dir']
89
- profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf,application/x-pdf,application/octet-stream"
90
- profile["pdfjs.disabled"] = true
91
- Capybara::Selenium::Driver.new(app, :browser => browser.to_sym, :profile => profile)
92
- when "chrome"
93
- prefs = {:download => {
94
- :prompt_for_download => false,
95
- :default_directory => $_CFWEB['Download Dir']
96
- }}
97
- args = []
98
- args << "--test-type" #to fix the error of chrome "you are using an unsupported command-line flag ignore-certificate-errors"
99
- Capybara::Selenium::Driver.new(app, :browser => browser.to_sym, :prefs => prefs, :args => args)
100
- when "internet_explorer"
101
- Capybara::Selenium::Driver.new(app, :browser => browser.to_sym)
102
- else
103
- puts("Not support browser...")
78
+ when "firefox"
79
+ profile = Selenium::WebDriver::Firefox::Profile.new
80
+ profile['browser.download.folderList'] = 2
81
+ profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf,application/x-pdf,application/octet-stream"
82
+ profile["pdfjs.disabled"] = true
83
+ Capybara::Selenium::Driver.new(app, :browser => browser.to_sym, :profile => profile)
84
+ when "chrome"
85
+ prefs = {:download => {
86
+ :prompt_for_download => false
87
+ }}
88
+ args = []
89
+ args << "--test-type" #to fix the error of chrome "you are using an unsupported command-line flag ignore-certificate-errors"
90
+ Capybara::Selenium::Driver.new(app, :browser => browser.to_sym, :prefs => prefs, :args => args)
91
+ when "internet_explorer"
92
+ Capybara::Selenium::Driver.new(app, :browser => browser.to_sym)
93
+ else
94
+ puts("Not support browser...")
104
95
  end
105
96
  end
106
97
  end
107
98
 
108
99
  case ENV["SELENIUM"]
109
- when "remote"
110
- register_selenium_remote_driver($_CFWEB['Default Browser'])
111
- else
112
- case ENV["HEADLESS"]
113
- when "true"
114
- require 'headless'
115
-
116
- headless = Headless.new
117
- headless.start
118
-
119
- at_exit do
120
- headless.destroy
121
- end
122
- else
123
- register_selenium_local_driver($_CFWEB['Default Browser'])
124
- end
100
+ when "remote"
101
+ register_selenium_remote_driver($_CFWEB['Default Browser'])
102
+ else
103
+ register_selenium_local_driver($_CFWEB['Default Browser'])
125
104
 
126
105
  end
127
-