Ifd_Automation 2.6 → 2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/bin/generate.rb +21 -3
  3. data/bin/helper.rb +5 -4
  4. data/lib/Ifd_Automation/require_libs.rb +9 -6
  5. data/lib/Ifd_Automation/version.rb +1 -1
  6. data/lib/helper/{assertion_helpers.rb → assertion_helper.rb} +5 -5
  7. data/lib/helper/auto_util.rb +164 -0
  8. data/lib/helper/database_helper.rb +81 -0
  9. data/lib/helper/file_helper.rb +36 -0
  10. data/lib/helper/mail_helper.rb +58 -0
  11. data/lib/helper/rest_helper.rb +91 -0
  12. data/lib/helper/soap_helper.rb +59 -0
  13. data/lib/helper/ssh_helper.rb +39 -0
  14. data/lib/helper/web_steps_helper.rb +447 -0
  15. data/project/Dockerfile +20 -0
  16. data/project/Gemfile.lock +176 -0
  17. data/project/README.md +60 -0
  18. data/project/cucumber.yml +6 -0
  19. data/project/docker-compose.yml +7 -0
  20. data/project/features/TestData/globalData.yml +3 -1
  21. data/project/features/TestSuite/WebGUI.feature +16 -2
  22. data/project/features/step_definitions/IFD_Libraries/REST_steps.rb +34 -0
  23. data/project/features/step_definitions/IFD_Libraries/SOAP_steps.rb +38 -0
  24. data/project/features/step_definitions/IFD_Libraries/database_steps.rb +44 -0
  25. data/{lib/Ifd_Automation/dynamic_store_vavue_steps.rb → project/features/step_definitions/IFD_Libraries/dynamic_store_value_steps.rb} +8 -10
  26. data/project/features/step_definitions/IFD_Libraries/email_steps.rb +36 -0
  27. data/project/features/step_definitions/IFD_Libraries/file_steps.rb +11 -0
  28. data/project/features/step_definitions/IFD_Libraries/ssh_steps.rb +20 -0
  29. data/{lib/Ifd_Automation → project/features/step_definitions/IFD_Libraries}/web_steps.rb +18 -8
  30. data/project/features/step_definitions/lib_steps/actionwords.rb +14 -10
  31. data/project/features/step_definitions/lib_steps/steps.rb +6 -0
  32. data/project/features/step_definitions/repositories/project_object.yml +2 -6
  33. data/project/features/support/env.rb +18 -18
  34. data/project/features/support/hooks.rb +22 -59
  35. metadata +45 -17
  36. data/lib/Ifd_Automation/REST_steps.rb +0 -90
  37. data/lib/Ifd_Automation/SOAP_steps.rb +0 -68
  38. data/lib/Ifd_Automation/database_steps.rb +0 -80
  39. data/lib/Ifd_Automation/email_steps.rb +0 -72
  40. data/lib/Ifd_Automation/file_steps.rb +0 -24
  41. data/lib/Ifd_Automation/ssh_steps.rb +0 -38
  42. data/lib/helper/auto_utils.rb +0 -67
  43. data/lib/helper/connection_helpers.rb +0 -15
  44. data/lib/helper/core.rb +0 -646
  45. data/lib/helper/mail_helpers.rb +0 -17
  46. data/lib/helper/web_steps_helpers.rb +0 -176
  47. data/project/features/step_definitions/lib_steps/test.rb +0 -6
@@ -1,17 +0,0 @@
1
- require 'mail'
2
- # require 'email_spec'
3
- # include EmailSpec::Helpers
4
- # include EmailSpec::Matcher
5
- class Email
6
- def self.send_email(to_address, subject, body_email, attachments)
7
- include Mail::Matchers
8
- # Mail::TestMailer.deliveries.clear
9
- Mail.deliver do
10
- from "abc@gmail.com"
11
- to to_address if to_address
12
- subject subject if subject
13
- body body_email if body_email
14
- add_file attachments if attachments
15
- end
16
- end
17
- end
@@ -1,176 +0,0 @@
1
- require 'net/https'
2
-
3
- # Open Browser with config-able maximize browser option
4
- def execute_openbrowser url_site #, redirect
5
- begin
6
- if $_CFWEB['Maximize Browser'] == true
7
- page.driver.browser.manage.window.maximize
8
- end
9
- rescue StandardError => myStandardError
10
- raise "\n>>> Error: #{myStandardError}"
11
- end
12
-
13
- if url_site == ""
14
- raise "\n>>> Error: Null web page URL."
15
- else
16
- visit(url_site)
17
- end
18
- end
19
-
20
- # Click on element
21
- def execute_click element
22
- foundElement = find_object(element)
23
- if foundElement != nil
24
- page.driver.execute_script('window.focus();')
25
- startTime = Time.new.to_i
26
- begin
27
- sleep(0.5)
28
- currentTime = Time.new.to_i
29
- end while (foundElement.native.enabled? == false and (currentTime - startTime) < $_CFWEB['Wait Time'])
30
- page.driver.browser.execute_script("arguments[0].scrollIntoView(true);", foundElement.native)
31
- page.driver.browser.action.click(foundElement.native)
32
- foundElement.native.send_keys(:return)
33
- else
34
- raise "\nError >> Not found object: #{element}"
35
- end
36
- end
37
-
38
- def double_click(element)
39
- foundElement = find_object(element)
40
- if foundElement != nil
41
- begin
42
- page.driver.browser.action.double_click(foundElement.native)
43
- rescue StandardError => myStandardError
44
- raise "\n>>> Error: #{myStandardError}"
45
- end
46
- else
47
- raise "\nError >> Not found object: #{element}"
48
- exit
49
- end
50
- end
51
-
52
- #Enter text to element
53
- def execute_settext element, text
54
- foundElement = find_object(element)
55
- if foundElement != nil
56
- begin
57
- foundElement.set(text)
58
- rescue StandardError => myStandardError
59
- raise "\n>>> Error: #{myStandardError}"
60
- end
61
- else
62
- raise "\nError >> Not found object: #{element}"
63
- exit
64
- end
65
- end
66
-
67
- # Method to maximize browser
68
- def maximize_browser
69
- page.driver.browser.manage.window.maximize
70
- end
71
-
72
- # Method to switch to window by title
73
- def switch_to_window_by_title window_title
74
- $previous_window = page.driver.browser.window_handle
75
- window_found = false
76
- page.driver.browser.window_handles.each{ |handle|
77
- page.driver.browser.switch_to.window handle
78
- if page.title == window_title
79
- window_found = true
80
- break
81
- end
82
- }
83
- raise "Window having title \"#{window_title}\" not found" if not window_found
84
- end
85
-
86
- # method to scroll page to top or end
87
- def scroll_page(to)
88
- if to == 'end'
89
- page.driver.execute_script('window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));')
90
- elsif to == 'top'
91
- page.driver.execute_script('window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);')
92
- else
93
- raise "Exception : Invalid Direction (only scroll \"top\" or \"end\")"
94
- end
95
- end
96
-
97
- Then /^I should( not)? see page title as (.*)$/ do |present, title|
98
- check_title(title, present.empty?)
99
- end
100
-
101
- # Method to verify title
102
- # param 1 : String : expected title
103
- # param 2 : Boolean : test case [true or flase]
104
- def check_title(title, test_case)
105
- page_title = page.title
106
- if test_case
107
- if page_title != "#{title}"
108
- raise "Page Title Not Matched, Actual Page Title : #{page_title}, Expected Page Title : #{title}"
109
- end
110
- else
111
- if page_title == "#{title}"
112
- raise "Page Title Matched, Actual Page Title: #{page_title}"
113
- end
114
- end
115
- end
116
-
117
- # method to check javascript pop-up alert text
118
- def check_alert_text(text)
119
- alert = page.driver.browser.switch_to.alert.text
120
- if alert != text
121
- raise "Text on alert pop up not matched, Actual Text : #{alert}, Expected Text : #{text}"
122
- end
123
- end
124
-
125
-
126
- # Select
127
- def execute_select element, text
128
- #select(text, :xpath => element)
129
- foundElement = find_object(element)
130
-
131
- if foundElement != nil
132
- option_value = page.evaluate_script("$(\"##{foundElement[:id]} option:contains('#{text}')\").val()")
133
- page.execute_script("$('##{foundElement[:id]}').val('#{option_value}')")
134
- page.execute_script("$('##{foundElement[:id]}').trigger('liszt:updated').trigger('change')")
135
- else
136
- put_log "\nError >> Not found object: #{element}"
137
- exit
138
- end
139
- end
140
-
141
- def execute_mousehoverandclick element
142
- foundElement = find_object(element)
143
- if foundElement != nil
144
- # page.driver.browser.mouse.move_to(foundElement.native, element)
145
- # page.driver.browser.mouse.click(foundElement.native)
146
- page.driver.browser.action.move_to(foundElement.native, element).click.perform
147
- # driver.action.move_to(foundElement.native).click
148
- sleep(2)
149
- else
150
- put_log "\nError >> Not found object: #{element}"
151
- end
152
- end
153
-
154
- def remove_element_attribute element, attr
155
- foundElement = find_object(element)
156
- if foundElement != nil
157
- page.driver.browser.execute_script("arguments[0].removeAttribute('#{attr}');", foundElement.native)
158
- else
159
- put_log "\nError >> Not found object: #{element}"
160
- end
161
- end
162
-
163
- # Set state
164
- def execute_setstate element, state
165
- foundElement = find_object(element)
166
- if foundElement != nil
167
- if state.upcase == "TRUE"
168
- foundElement.select_option
169
- else
170
- foundElement.unselect_option
171
- end
172
- else
173
- put_log "\nError >> Not found object: #{element}"
174
- exit
175
- end
176
- end
@@ -1,6 +0,0 @@
1
- require_relative 'actionwords'
2
- World(Actionwords)
3
-
4
- Given /I login to the system with user and pass "(.*)" "(.*)" "(.*)"/ do |url, user, pass|
5
- login_to_system_with_user_and_pass(url,user,pass)
6
- end