Ifd_Automation 1.6.0 → 1.7.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.
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
@@ -1,17 +0,0 @@
1
- class IFD_WS
2
-
3
- def self.send_XML_post_webservice(host,type,data)
4
- url = "#{host}/#{type}"
5
- puts url
6
- WebServiceMethods.send_XML_post_request(url,data)
7
- end
8
-
9
- def self.send_get_MYM_webservice(host,type,data)
10
- url = "#{host}/#{type}?#{data}"
11
- WebServiceMethods.send_get_request(url)
12
- end
13
-
14
- end
15
-
16
-
17
-
@@ -1,25 +0,0 @@
1
- class DatabaseMethods
2
- def self.execute_select (schema,sql)
3
- case $db_type.to_sym
4
- when :sql_server then
5
- conn = IFD_Connections.get_sql_server_db_connection(schema)
6
- conn.execute sql
7
- when :mysql then
8
- conn = IFD_Connections.get_mysql_db_connection(schema)
9
- conn.query sql
10
- else
11
- raise "*** ERROR: schema type (#{$db_type}) is not supported (SQL SERVER, MY SQL)."
12
- end
13
- end
14
-
15
- def self.close_connection (schema)
16
- case $db_type.to_sym
17
- when :sql_server then
18
- conn = IFD_Connections.get_sql_server_db_connection(schema)
19
- conn.close
20
- when :mysql then
21
- conn = IFD_Connections.get_mysql_db_connection(schema)
22
- conn.close
23
- end
24
- end
25
- end
@@ -1,37 +0,0 @@
1
- class DB_Utils
2
- def self.sql_value_format(value)
3
- if value.nil?
4
- return 'null'
5
- else
6
- value = value.gsub("'","''") if value.kind_of? String
7
- return "'#{value}'"
8
- end
9
- end
10
-
11
- def self.sql_value_format_prefix_wildcard(value)
12
- if value.nil?
13
- return 'null'
14
- else
15
- value = value.gsub("'","''") if value.kind_of? String
16
- return "'#{value}%'"
17
- end
18
- end
19
-
20
- def self.sql_value_format_suffix_wildcard(value)
21
- if value.nil?
22
- return 'null'
23
- else
24
- value = value.gsub("'","''") if value.kind_of? String
25
- return "'%#{value}'"
26
- end
27
- end
28
-
29
- def self.sql_value_format_wildcard(value)
30
- if value.nil?
31
- return 'null'
32
- else
33
- value = value.gsub("'","''") if value.kind_of? String
34
- return "'%#{value}%'"
35
- end
36
- end
37
- end
@@ -1,87 +0,0 @@
1
- # Error handling methods
2
-
3
- # Method to check browser type
4
- def validate_parameters(platform, browser_type, app_path)
5
- if platform == 'desktop'
6
- if !%w(ff ie chrome safari opera).include? browser_type
7
- print_error_desktop
8
- end
9
- elsif platform == 'android'
10
- print_error_android browser_type, app_path
11
- elsif platform == 'iOS'
12
- puts "Not Implemented..."
13
- # print_error_ios browser_type, app_path
14
- else
15
- print_invalid_platform
16
- end
17
- end
18
-
19
- # print error for desktop
20
- def print_error_desktop
21
- puts "\nInappropraite desktop browser : \"#{ENV['BROWSER']}\""
22
- puts "\nUsage : cucumber BROWSER=browser_name"
23
- puts "\nBrowser Supported :\n"
24
- puts "\n1.ie\n2.chrome\n3.ff\n4.safari\n5.opera"
25
- Process.exit(0)
26
- end
27
-
28
- # print error for android
29
- def print_error_android(browser_type, app_path)
30
- if browser_type=='ff' and app_path==nil
31
- puts "\nOops... not mentioned \"Browser\" or \"App path\""
32
- print_error_android_app
33
- print_error_android_web
34
- Process.exit(0)
35
- elsif browser_type!='ff' and !%w(native chrome).include? browser_type
36
- puts "\nOops... not supported browser"
37
- print_error_android_web
38
- Process.exit(0)
39
- end
40
- end
41
-
42
- # print error for android app
43
- def print_error_android_app
44
- puts "\nTo run test on android app"
45
- puts "\n Usage : cucumber PLATFORM=android APP_PATH=path/to/app"
46
- end
47
-
48
- # print error for android web
49
- def print_error_android_web
50
- puts "\nTo run test on android mobile web"
51
- puts "\n Usage : cucumber PLATFORM=android BROWSER=browser_name"
52
- puts "\n Supported browsers are \"chrome\" and \"native\""
53
- end
54
-
55
- # print error for ios
56
- def print_error_ios
57
- if browser_type=='ff' and app_path==nil
58
- puts "\nOops... not mentioned \"Browser\" or \"App path\""
59
- print_error_ios_app
60
- print_error_ios_web
61
- Process.exit(0)
62
- elsif browser_type!='safari'
63
- puts "\nOops... not supported browser"
64
- print_error_ios_app_web
65
- Process.exit(0)
66
- end
67
- end
68
-
69
- # print error for ios app
70
- def print_error_ios_app
71
- puts "\nTo run test on iOS App"
72
- puts "\n Usage : cucumber PLATFORM=iOS APP_PATH=path/to/app"
73
- end
74
-
75
- # print error for ios web
76
- def print_error_ios_web
77
- puts "\nTo run test on iOS mobile web"
78
- puts "\n Usage : cucumber PLATFORM=iOS BROWSER=safari"
79
- end
80
-
81
- # print error if invalid platform
82
- def print_invalid_platform
83
- puts "\nOops... Invalid Platform"
84
- puts "\nSupported platform are \"android\" and \"iOS\"."
85
- puts "\nTo run on Desktop no need to mention platform."
86
- Process.exit(0)
87
- end
@@ -1,59 +0,0 @@
1
- def var_collect string_var
2
- if string_var =~ /^.*{year}.*$/
3
- string_var = replace_year(string_var)
4
- end
5
-
6
- if string_var =~ /^.*{month}.*$/
7
- string_var = replace_month(string_var)
8
- end
9
-
10
- if string_var =~ /^.*{day}.*$/
11
- string_var = replace_day(string_var)
12
- end
13
-
14
- if string_var =~ /^.*{store_value}.*$/
15
- string_var = $context_value
16
- end
17
-
18
- return string_var
19
- end
20
-
21
- def replace_year str
22
- t = Time.now()
23
- return str.gsub("{year}", t.year.to_s)
24
- end
25
-
26
- def replace_month str
27
- t = Time.now()
28
- _month = t.month
29
- if _month < 10
30
- return str.gsub("{month}", "0#{_month.to_s}")
31
- else
32
- return str.gsub("{month}", "#{_month.to_s}")
33
- end
34
- return str
35
- end
36
-
37
- def replace_day str
38
- t = Time.now()
39
- _day = t.day
40
- if _day < 10
41
- return str.gsub("{day}", "0#{_day.to_s}")
42
- else
43
- return str.gsub("{day}", "#{_day.to_s}")
44
- end
45
- return str
46
- end
47
-
48
- def replace_pipe str_pipe
49
- # put_log ">>>> #{str_pipe}"
50
- if str_pipe =~ /^.*{pipe}.*$/
51
- return str_pipe.gsub("{pipe}", "|")
52
- end
53
- return str_pipe
54
- end
55
-
56
-
57
-
58
-
59
-
@@ -1,33 +0,0 @@
1
- # custome exception class
2
- class TestCaseFailed < Exception
3
- end
4
- #
5
- # # WAIT instance for explicit wait
6
- # WAIT = Selenium::WebDriver::Wait.new(:timeout => 30)
7
- #
8
- # # method to validate locator
9
- # def valid_locator_type? type
10
- # %w(id class css name xpath).include? type
11
- # end
12
- #
13
- # def validate_locator type
14
- # raise "Invalid locator type - #{type}" unless valid_locator_type? type
15
- # end
16
- #
17
- # # method to validate dropdown selector
18
- # def valid_option_by? option_by
19
- # %w(text value index).include? option_by
20
- # end
21
- #
22
- # def validate_option_by option_by
23
- # raise "Invalid option by - #{option_by}" unless valid_option_by? option_by
24
- # end
25
- #
26
- # # Return android device name and android version using adb command
27
- # def get_device_info
28
- # IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}
29
- # $device += ' '
30
- # IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}
31
- # IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}
32
- # return $device, $os_version
33
- # end
@@ -1,33 +0,0 @@
1
- require 'rubygems'
2
- require 'selenium-webdriver'
3
- require 'chunky_png'
4
- require 'open-uri'
5
- require 'rbconfig'
6
- # require 'appium_lib'
7
- require 'rubygems'
8
- require 'yaml'
9
- require 'cucumber'
10
- require 'mysql2'
11
- require 'httparty'
12
- require 'csv'
13
- require 'rack/utf8_sanitizer'
14
- require 'rautomation'
15
- require 'net/https'
16
- include RbConfig
17
-
18
- require_relative 'misc_methods'
19
- require_relative 'error_handling_methods'
20
- require_relative 'core'
21
- require_relative 'database_methods'
22
- require_relative 'db_utils'
23
- require_relative 'IFD_Assertion_methods'
24
- require_relative 'IFD_Connection'
25
- require_relative 'IFD_email_methods'
26
- require_relative 'IFD_webservice'
27
- require_relative 'javascript_handling_methods'
28
- require_relative 'lib_var'
29
- require_relative 'util'
30
- require_relative 'web_methods'
31
- require_relative 'web_service_methods'
32
-
33
-
@@ -1,168 +0,0 @@
1
- class Util
2
-
3
- #-----------------------------------------------------
4
- # support define and bind variable dynamically
5
- #-----------------------------------------------------
6
- $dyn_vars = nil
7
-
8
- # set value to a variable
9
- def self.set_var(var_name, var_value)
10
- if $dyn_vars == nil
11
- $dyn_vars = binding
12
- end
13
- strEval = var_name + "=" + var_value
14
- eval strEval, $dyn_vars
15
- end
16
-
17
- # bind string with $dyn_vars context
18
- def self.bind_with_dyn_vars(str)
19
- if $dyn_vars == nil
20
- $dyn_vars = binding
21
- end
22
-
23
- strEval = '"' + str +'"'
24
- return eval strEval, $dyn_vars
25
- end
26
-
27
- # bind json with $dyn_vars context
28
- def self.bind_json_with_dyn_vars(data_json)
29
- if data_json.kind_of? Hash
30
- data_json.each_pair { |k,v|
31
- data_json[k] = Util.bind_json_with_dyn_vars(v)
32
- }
33
- for i in 0..data_json.keys.size - 1
34
- if data_json.keys[i] != Util.bind_with_dyn_vars(data_json.keys[i])
35
- k = Util.bind_with_dyn_vars(data_json.keys[i])
36
- v = data_json[data_json.keys[i]]
37
-
38
- data_json.delete(data_json.keys[i])
39
- data_json[k] = v
40
- end
41
- end
42
- return data_json
43
- elsif data_json.kind_of? Array
44
- for i in 0..data_json.size - 1
45
- data_json[i] = Util.bind_json_with_dyn_vars(data_json[i])
46
- end
47
- return data_json
48
- elsif data_json.kind_of? String
49
- return Util.bind_with_dyn_vars(data_json)
50
- else
51
- raise "*** ERROR: unexpected error at cirrus_utils. Util.bind_json_with_dyn_vars function."
52
- end
53
- end
54
-
55
- def self.read_table_data_from_steps_with_header(table_data)
56
- # The table include header so the loop starting from 1 instead of 0
57
- json_array = Array.new
58
- for i in 1..table_data.size - 1
59
- json_temp = Hash.new
60
- for j in 0..table_data[0].size - 1
61
- json_temp[table_data[0][j]] = table_data[i][j]
62
- end
63
- json_array << json_temp
64
- end
65
-
66
- # get dyn_vars if any
67
- json_array = Util.bind_json_with_dyn_vars(json_array)
68
-
69
- # replace [[TODAY]] with current time
70
- json_array = Util.replace_json_with_date_holders(json_array)
71
- json_array
72
- end
73
-
74
- def self.replace_json_with_date_holders(json_string)
75
- # replace [[TODAY]] = current date
76
- # replace [[NULL]] = nil
77
-
78
- if json_string.kind_of? Hash
79
- #puts "Hash: #{json_string}"
80
- json_string.each_pair {|k, v|
81
- json_string[k] = replace_json_with_date_holders(v)
82
- }
83
- return json_string
84
- elsif json_string.kind_of? Array
85
- #puts "Array: #{json_string}"
86
- for i in 0..json_string.size - 1
87
- json_string[i] = replace_json_with_date_holders(json_string[i])
88
- end
89
- return json_string
90
- elsif json_string.kind_of? String
91
- #puts "String: #{json_string}"
92
- if json_string.include? "[[TODAY]]"
93
- json_string = eval json_string.gsub("[[TODAY]]", "Date.today")
94
- json_string = json_string.strftime('%Y-%m-%d')
95
- end
96
- if json_string == "[[NULL]]"
97
- json_string = nil
98
- end
99
-
100
- return json_string
101
- else
102
- raise "*** ERROR: unexpected error at Environment.replace_json_with_date_holder function."
103
- end
104
- end
105
-
106
- def self.convert_to_symbol_json(json)
107
- begin
108
- json = JSON.parse(json)
109
- rescue
110
- end
111
-
112
- if json.kind_of? Hash
113
- json_sym = Hash.new()
114
- json.each {|k,v|
115
- json_sym[k.downcase.to_sym] = convert_to_symbol_json(v)
116
- }
117
- return json_sym
118
- elsif json.kind_of? Array
119
- array_sym = Array.new()
120
- json.each {|temp|
121
- array_sym << convert_to_symbol_json(temp)
122
- }
123
- return array_sym
124
- else
125
- return json
126
- end
127
- end
128
-
129
- def self.generate_condition_statement(condition_json, wildcard_type = nil)
130
- v_condition = ''
131
-
132
- condition_json.each_pair { |col, vals|
133
- #puts "DatabaseMethods.generate_condition_statement.col: #{col}"
134
- #puts "DatabaseMethods.generate_condition_statement.vals: #{vals}"
135
- condition = ''
136
- if vals.nil?
137
- condition = "#{col} is null"
138
- # elsif self.metadata[:datetime_cols].include? col.downcase.to_sym
139
- # condition = "#{col} >= to_date(#{DB_Utils.sql_value_format(vals)}, 'yyyy-mm-dd') AND #{col} < to_date(#{DB_Utils.sql_value_format(vals)}, 'yyyy-mm-dd') + 1"
140
- else
141
- vals = vals.to_s.split(',') unless vals.kind_of? Array
142
-
143
- vals = vals.map { |val|
144
- if wildcard_type.nil?
145
- DB_Utils.sql_value_format(val)
146
- else
147
- case wildcard_type.to_s.downcase.to_sym
148
- when :prefix
149
- DB_Utils.sql_value_format_prefix_wildcard(val)
150
- when :suffix
151
- DB_Utils.sql_value_format_suffix_wildcard(val)
152
- when :wildcard
153
- DB_Utils.sql_value_format_wildcard(val)
154
- else
155
- DB_Utils.sql_value_format(val)
156
- end
157
- end
158
- }
159
- vals.each { |val|
160
- temp_condition = val == 'null' ? "#{col} is #{val}" : "#{col} like #{val}"
161
- condition += condition.empty? ? temp_condition : " OR #{temp_condition}"
162
- }
163
- end
164
- v_condition += v_condition.empty? ? "(#{condition})" : " AND (#{condition})"
165
- }
166
- v_condition
167
- end
168
- end