Ifd_Automation 2.5 → 2.6
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.
- checksums.yaml +4 -4
- data/lib/Ifd_Automation/version.rb +1 -1
- data/lib/helper/core.rb +162 -16
- data/project/features/TestSuite/WebGUI.feature +1 -1
- data/project/features/step_definitions/lib_steps/test.rb +4 -4
- data/project/features/step_definitions/repositories/project_object.yml +6 -6
- metadata +2 -3
- data/project/tmp/TEST-features-TestSuite-WebGUI.xml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50379b4f70392e54a4fecada673f5b782d7bade7
|
4
|
+
data.tar.gz: 17ee65f3d63d198a1ea8ecc083ee3bfb71ed1c48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df1ef8d0f8250b21d6b399136d89104dbe84c3cbf11f47355bbcfc6b34f95c6b2f44370598e1e78059d952012340909b6e3c4a559df2b473be4b77584996e655
|
7
|
+
data.tar.gz: bc3a3c78688863735e4ad1477aadde5e714a4b9566984d20bffce457e1dbd361d41f0cf51f169e1b0a637ed1b69aa55c00561ec368a42c1853e7c3ee60f3d8c9
|
data/lib/helper/core.rb
CHANGED
@@ -34,9 +34,9 @@ end
|
|
34
34
|
|
35
35
|
def get_xpath_value_from_object_file string_object
|
36
36
|
string_object = string_object.gsub(/"/, "'")
|
37
|
-
|
37
|
+
puts "String_object: #{string_object}"
|
38
38
|
locator_matching = /(.*?)(\{.*?\})/.match(string_object)
|
39
|
-
|
39
|
+
puts "locator_matching : #{locator_matching}"
|
40
40
|
dyn_pros = {}
|
41
41
|
if locator_matching != nil
|
42
42
|
string_object = locator_matching[1]
|
@@ -56,7 +56,7 @@ def get_xpath_value_from_object_file string_object
|
|
56
56
|
if hash_object != nil
|
57
57
|
hash_object.each { |k, v|
|
58
58
|
k = k.to_s.upcase
|
59
|
-
|
59
|
+
put_log "\n#{k} =~ /ph_/i and dyn_pros[#{k}]: #{k =~ /ph_/i and dyn_pros[k] != nil}"
|
60
60
|
if k =~ /ph_/i
|
61
61
|
if dyn_pros[k] != nil
|
62
62
|
# Assign place holder value to place holder property, also remove prefix ph_ from property key,
|
@@ -78,7 +78,127 @@ def get_xpath_value_from_object_file string_object
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# Find object by Xpath
|
81
|
+
# def find_object string_object
|
82
|
+
# p ":find object--"
|
83
|
+
# startTime = Time.new.to_i
|
84
|
+
# string_object = string_object.gsub(/"/, "'")
|
85
|
+
# locator_matching = /(.*?)(\{.*?\})/.match(string_object)
|
86
|
+
# dyn_pros = {}
|
87
|
+
# if locator_matching != nil
|
88
|
+
# string_object = locator_matching[1]
|
89
|
+
# eval(locator_matching[2].gsub(/['][\s,\t]*?:[\s,\t]*?[']?/, "'=>'")).each { |k, v|
|
90
|
+
# dyn_pros[k.to_s.upcase] = v
|
91
|
+
# }
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# hash_object = $OBJECT[string_object]
|
95
|
+
# p "hash_object--------#{hash_object}"
|
96
|
+
# if hash_object == nil
|
97
|
+
# put_log ">>> OBJECT NAME MAYBE NOT FOUND!!!"
|
98
|
+
# # true.should eq false
|
99
|
+
# expect(true).to eq(false)
|
100
|
+
# end
|
101
|
+
# upcase_attrb = {}
|
102
|
+
# if hash_object != nil
|
103
|
+
# hash_object.each { |k, v|
|
104
|
+
# k = k.to_s.upcase
|
105
|
+
# p "\n#{k} =~ /ph_/i and dyn_pros[#{k}]: #{k =~ /ph_/i and dyn_pros[k] != nil}"
|
106
|
+
# if k =~ /ph_/i
|
107
|
+
# if dyn_pros[k] != nil
|
108
|
+
# # Assign place holder value to place holder property, also remove prefix ph_ from property key,
|
109
|
+
# # also remove this pl from dyn_pros <= should be consider to continue transfer into inner object in relation
|
110
|
+
# if v =~ /<ph_value>/i
|
111
|
+
# upcase_attrb[k[3..k.size-1]] = v.gsub(/<ph_value>/i, dyn_pros[k])
|
112
|
+
# else
|
113
|
+
# upcase_attrb[k[3..k.size-1]] = dyn_pros[k]
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# dyn_pros.delete(k)
|
117
|
+
# end
|
118
|
+
# else
|
119
|
+
# upcase_attrb[k.to_s.upcase] = v
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# }
|
123
|
+
# end
|
124
|
+
# p ":upcase_attrb----#{upcase_attrb}"
|
125
|
+
# if upcase_attrb.size > 0
|
126
|
+
# strId = ""
|
127
|
+
# strClass = ""
|
128
|
+
# strName = ""
|
129
|
+
# strTagname = ""
|
130
|
+
# strXpathSelector = ""
|
131
|
+
# strText = ""
|
132
|
+
#
|
133
|
+
# index = nil
|
134
|
+
# upcase_attrb.each { |key, value|
|
135
|
+
# upcase_key = key.to_s.upcase
|
136
|
+
# if upcase_key == "XPATH_SELECTOR"
|
137
|
+
# strXpathSelector = value
|
138
|
+
# end
|
139
|
+
# }
|
140
|
+
# continue_run = true
|
141
|
+
#
|
142
|
+
# if continue_run == true
|
143
|
+
# begin
|
144
|
+
# if strXpathSelector != nil and strXpathSelector.size > 0
|
145
|
+
# p "---------------------:get_objects_by_XpathSelector"
|
146
|
+
# foundElements = get_objects_by_XpathSelector(strXpathSelector)
|
147
|
+
# else
|
148
|
+
# #Generate Selector
|
149
|
+
# strGenerateXpathSel = ""
|
150
|
+
# strGenerateXpathSel = generate_xpath_selector(strId, strClass, strName, strTagname)
|
151
|
+
# if strGenerateXpathSel.length > 0
|
152
|
+
# foundElements = get_objects_by_XpathSelector(strGenerateXpathSel)
|
153
|
+
# end
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
# if foundElements == nil or foundElements.size == 0
|
157
|
+
# currentTime = Time.new.to_i
|
158
|
+
# else
|
159
|
+
# # put_log "\nBREAK!!!"
|
160
|
+
# break
|
161
|
+
# end
|
162
|
+
# test = currentTime - startTime
|
163
|
+
# # put_log "\n#TIMEOUNT:#{test} < #{$_CFWEB['Wait Time']}"
|
164
|
+
# sleep(0.5)
|
165
|
+
# end while (currentTime - startTime) < $_CFWEB['Wait Time']
|
166
|
+
#
|
167
|
+
# if foundElements != nil or foundElements.size != 0
|
168
|
+
# if index != nil and index.to_i >= 0
|
169
|
+
# matched_index = 0;
|
170
|
+
# return_element = nil
|
171
|
+
# foundElements.each { |cur_element|
|
172
|
+
# passCheck = find_object_check_object(cur_element, strId, strText)
|
173
|
+
# if passCheck
|
174
|
+
# if matched_index == index.to_i
|
175
|
+
# return_element = cur_element
|
176
|
+
# break
|
177
|
+
# else
|
178
|
+
# matched_index = matched_index + 1
|
179
|
+
# end
|
180
|
+
# end
|
181
|
+
# }
|
182
|
+
# return return_element
|
183
|
+
# else
|
184
|
+
# return_element = nil
|
185
|
+
# foundElements.each { |cur_element|
|
186
|
+
# passCheck = find_object_check_object(cur_element, strId, strText)
|
187
|
+
# if passCheck
|
188
|
+
# return_element = cur_element
|
189
|
+
# break
|
190
|
+
# end
|
191
|
+
# }
|
192
|
+
# return return_element
|
193
|
+
# end # if index != nil and index.to_i >= 0
|
194
|
+
# end #if foundElements != nil or foundElements.length != 0
|
195
|
+
# end #if continue = true
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# return nil
|
199
|
+
# end
|
81
200
|
def find_object string_object
|
201
|
+
p ":find object--"
|
82
202
|
startTime = Time.new.to_i
|
83
203
|
string_object = string_object.gsub(/"/, "'")
|
84
204
|
locator_matching = /(.*?)(\{.*?\})/.match(string_object)
|
@@ -91,6 +211,7 @@ def find_object string_object
|
|
91
211
|
end
|
92
212
|
|
93
213
|
hash_object = $OBJECT[string_object]
|
214
|
+
p "hash_object--------#{hash_object}"
|
94
215
|
if hash_object == nil
|
95
216
|
put_log ">>> OBJECT NAME MAYBE NOT FOUND!!!"
|
96
217
|
# true.should eq false
|
@@ -100,7 +221,7 @@ def find_object string_object
|
|
100
221
|
if hash_object != nil
|
101
222
|
hash_object.each { |k, v|
|
102
223
|
k = k.to_s.upcase
|
103
|
-
|
224
|
+
p "\n#{k} =~ /ph_/i and dyn_pros[#{k}]: #{k =~ /ph_/i and dyn_pros[k] != nil}"
|
104
225
|
if k =~ /ph_/i
|
105
226
|
if dyn_pros[k] != nil
|
106
227
|
# Assign place holder value to place holder property, also remove prefix ph_ from property key,
|
@@ -119,34 +240,47 @@ def find_object string_object
|
|
119
240
|
|
120
241
|
}
|
121
242
|
end
|
243
|
+
p ":upcase_attrb----#{upcase_attrb}"
|
244
|
+
p ":dyn_pros----#{dyn_pros}"
|
122
245
|
if upcase_attrb.size > 0
|
123
246
|
strId = ""
|
124
247
|
strClass = ""
|
125
248
|
strName = ""
|
126
249
|
strTagname = ""
|
127
250
|
strXpathSelector = ""
|
251
|
+
strCssSelecor = ""
|
128
252
|
strText = ""
|
129
253
|
|
130
254
|
index = nil
|
131
255
|
upcase_attrb.each { |key, value|
|
132
256
|
upcase_key = key.to_s.upcase
|
133
|
-
|
134
|
-
|
257
|
+
case upcase_key
|
258
|
+
when "XPATH_SELECTOR"
|
259
|
+
strXpathSelector = value
|
260
|
+
when "CSS_SELECTOR"
|
261
|
+
strCssSelecor = value
|
135
262
|
end
|
263
|
+
# if upcase_key == "XPATH_SELECTOR"
|
264
|
+
# strXpathSelector = value
|
265
|
+
# end
|
136
266
|
}
|
137
267
|
continue_run = true
|
138
268
|
|
139
269
|
if continue_run == true
|
140
270
|
begin
|
141
271
|
if strXpathSelector != nil and strXpathSelector.size > 0
|
272
|
+
p "---------------------:get_objects_by_XpathSelector"
|
142
273
|
foundElements = get_objects_by_XpathSelector(strXpathSelector)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
274
|
+
elsif strCssSelecor != nil and strCssSelecor.size > 0
|
275
|
+
p "---------------------:get_objects_by_CssSelector"
|
276
|
+
foundElements = get_objects_by_CssSelector(strCssSelecor)
|
277
|
+
# else
|
278
|
+
# #Generate Selector
|
279
|
+
# strGenerateXpathSel = ""
|
280
|
+
# strGenerateXpathSel = generate_xpath_selector(strId, strClass, strName, strTagname)
|
281
|
+
# if strGenerateXpathSel.length > 0
|
282
|
+
# foundElements = get_objects_by_XpathSelector(strGenerateXpathSel)
|
283
|
+
# end
|
150
284
|
end
|
151
285
|
|
152
286
|
if foundElements == nil or foundElements.size == 0
|
@@ -162,7 +296,7 @@ def find_object string_object
|
|
162
296
|
|
163
297
|
if foundElements != nil or foundElements.size != 0
|
164
298
|
if index != nil and index.to_i >= 0
|
165
|
-
matched_index = 0
|
299
|
+
matched_index = 0
|
166
300
|
return_element = nil
|
167
301
|
foundElements.each { |cur_element|
|
168
302
|
passCheck = find_object_check_object(cur_element, strId, strText)
|
@@ -193,7 +327,6 @@ def find_object string_object
|
|
193
327
|
|
194
328
|
return nil
|
195
329
|
end
|
196
|
-
|
197
330
|
#Generate Xpath Selector
|
198
331
|
def generate_xpath_selector(strId, strClass, strName, strTagname)
|
199
332
|
strGenerateXpathSel = ""
|
@@ -220,7 +353,7 @@ end
|
|
220
353
|
|
221
354
|
#Get object by XpathSelector
|
222
355
|
def get_objects_by_XpathSelector(strXpathSelector)
|
223
|
-
|
356
|
+
p "-----strXpathSelector: #{strXpathSelector}"
|
224
357
|
foundElements = nil
|
225
358
|
begin
|
226
359
|
foundElements = page.all(:xpath, strXpathSelector)
|
@@ -231,6 +364,19 @@ def get_objects_by_XpathSelector(strXpathSelector)
|
|
231
364
|
return foundElements
|
232
365
|
end
|
233
366
|
|
367
|
+
#Get object by CSS Selector
|
368
|
+
def get_objects_by_CssSelector(strCSSSelector)
|
369
|
+
p "---strCSSSelector---:#{strCSSSelector}"
|
370
|
+
foundElements = nil
|
371
|
+
begin
|
372
|
+
foundElements = page.all(:css, strCSSSelector)
|
373
|
+
rescue StandardError => myStandardError
|
374
|
+
put_log "\n>>> Error: #{myStandardError}"
|
375
|
+
end
|
376
|
+
|
377
|
+
return foundElements
|
378
|
+
end
|
379
|
+
|
234
380
|
#Find/Check the object by ID and Text
|
235
381
|
def find_object_check_object cur_element, strId, strText
|
236
382
|
passCheck = true
|
@@ -1,4 +1,4 @@
|
|
1
1
|
Feature: Example feature for GUI testing
|
2
2
|
|
3
3
|
Scenario: testing case for web interaction
|
4
|
-
Given I login to the system with user and pass "
|
4
|
+
Given I login to the system with user and pass "https://mymupgrade.infodation.com/?lang=en" "test" "test"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'actionwords'
|
2
|
-
World(Actionwords)
|
2
|
+
World(Actionwords)
|
3
3
|
|
4
|
-
Given /I login to the system with user and pass "(.*)" "(.*)" "(.*)"/ do |url, user, pass|
|
5
|
-
|
6
|
-
end
|
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
|
@@ -1,6 +1,6 @@
|
|
1
|
-
header.button_login: {
|
2
|
-
header.button_cookie: {
|
3
|
-
login.textbox_username: {
|
4
|
-
login.textbox_password: {
|
5
|
-
login.label_message_error: {
|
6
|
-
login.button_login: {
|
1
|
+
header.button_login: {css_selector: '#login-from>h2>a>button'}
|
2
|
+
header.button_cookie: {css_selector: '#btn-give-cookie-consent'}
|
3
|
+
login.textbox_username: {css_selector: '#login_user'}
|
4
|
+
login.textbox_password: {css_selector: '#login_pass'}
|
5
|
+
login.label_message_error: {css_selector: '.ifd-message-error'}
|
6
|
+
login.button_login: {css_selector: '#wp-submit'}
|
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: '2.
|
4
|
+
version: '2.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anh Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -262,7 +262,6 @@ files:
|
|
262
262
|
- project/features/step_definitions/repositories/project_object.yml
|
263
263
|
- project/features/support/env.rb
|
264
264
|
- project/features/support/hooks.rb
|
265
|
-
- project/tmp/TEST-features-TestSuite-WebGUI.xml
|
266
265
|
homepage: http://rubygems.org/gems/ifd_automation
|
267
266
|
licenses:
|
268
267
|
- MIT
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<testsuite failures="1" errors="0" skipped="0" tests="1" time="0.054199" name="Example feature for GUI testing">
|
3
|
-
<testcase classname="Example feature for GUI testing" name="testing case for web interaction" time="0.054199">
|
4
|
-
<failure message="failed testing case for web interaction" type="failed">
|
5
|
-
<![CDATA[Scenario: testing case for web interaction
|
6
|
-
|
7
|
-
Given I print the value of "ad"
|
8
|
-
|
9
|
-
Message:
|
10
|
-
]]>
|
11
|
-
<![CDATA[undefined local variable or method `ad' for #<Object:0x63e6b68> (NameError)
|
12
|
-
features/TestSuite/WebGUI.feature:7:in `Given I print the value of "ad"']]>
|
13
|
-
</failure>
|
14
|
-
<system-out>
|
15
|
-
<![CDATA["-asdfas"
|
16
|
-
]]>
|
17
|
-
</system-out>
|
18
|
-
<system-err>
|
19
|
-
<![CDATA[]]>
|
20
|
-
</system-err>
|
21
|
-
</testcase>
|
22
|
-
</testsuite>
|