zqframeworkOH 1.0.1
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.
- data/OneHealthGem/zqframeworkOH-1.0.0.gem +0 -0
- data/core/libs/BaseClassInstanceMethods.rb +22 -0
- data/core/libs/BaseClassMethods.rb +52 -0
- data/core/libs/Excel.rb +92 -0
- data/core/libs/UtilityMethods.rb +615 -0
- data/core/page/OneHealth_CommunityPage/OneHealthCommunityConstants.rb +22 -0
- data/core/page/OneHealth_CommunityPage/OneHealthCommunityPage.rb +119 -0
- data/core/page/OneHealth_JournalPage/OneHealthJournalConstants.rb +23 -0
- data/core/page/OneHealth_JournalPage/OneHealthJournalPage.rb +84 -0
- data/core/page/OneHealth_LoginPage/OneHealthLoginConstants.rb +10 -0
- data/core/page/OneHealth_LoginPage/OneHealthLoginPage.rb +43 -0
- data/core/zqframeworkOH.rb +22 -0
- data/zqframegem.gemspec +19 -0
- data/zqframeworkOH-1.0.0.gem +0 -0
- metadata +60 -0
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
=begin
|
2
|
+
Author: Gauang
|
3
|
+
Contains the setup, TearDown and Cleanup methods
|
4
|
+
=end
|
5
|
+
|
6
|
+
module BaseClassInstanceMethods
|
7
|
+
|
8
|
+
#Called automatically before each and every test
|
9
|
+
def setup
|
10
|
+
#p "setup"
|
11
|
+
end
|
12
|
+
|
13
|
+
#called Automatically after each and every test
|
14
|
+
def teardown
|
15
|
+
#p "teardown"
|
16
|
+
end
|
17
|
+
|
18
|
+
#called Automatically after each and every test but before teardown is called.
|
19
|
+
def cleanup
|
20
|
+
#p "cleanup"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
=begin
|
2
|
+
Author: Gaurang
|
3
|
+
Contains the Statup and Shutdown method
|
4
|
+
=end
|
5
|
+
require "#{File.dirname(__FILE__)}/UtilityMethods"
|
6
|
+
|
7
|
+
include UtilityMethods
|
8
|
+
module BaseClassMethods
|
9
|
+
|
10
|
+
#Called before first test method called of the class
|
11
|
+
def browstart(url)
|
12
|
+
#p "startup called"
|
13
|
+
@brow = readData("Browser","browserName")
|
14
|
+
if (@brow.downcase == 'firefox')
|
15
|
+
fireBrow(@brow)
|
16
|
+
elsif (@brow == 'ie')
|
17
|
+
ieBrow(@brow)
|
18
|
+
end
|
19
|
+
#navigate to the URL
|
20
|
+
#@url = readData("Browser","url")
|
21
|
+
safeLoadLink(60) {$browser.goto url}
|
22
|
+
$browser.wait
|
23
|
+
end
|
24
|
+
|
25
|
+
#Called after the last test method of the class called.
|
26
|
+
def shutdown
|
27
|
+
#p "shutdown called"
|
28
|
+
begin
|
29
|
+
$browser.close()
|
30
|
+
rescue JsshSocket::JSReferenceError
|
31
|
+
p "error occured at shutdown"
|
32
|
+
sleep(10)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def fireBrow(browser)
|
38
|
+
$browser = Watir::Browser.new :firefox
|
39
|
+
screen_width = $browser.execute_script("return screen.width;")
|
40
|
+
screen_height = $browser.execute_script("return screen.height;")
|
41
|
+
$browser.driver.manage.window.resize_to(screen_width,screen_height)
|
42
|
+
$browser.driver.manage.window.move_to(0,0)
|
43
|
+
return $browser
|
44
|
+
end
|
45
|
+
|
46
|
+
def ieBrow(browser)
|
47
|
+
$browser = Watir::Browser.new
|
48
|
+
$browser.maximize
|
49
|
+
return $browser
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
data/core/libs/Excel.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'win32ole'
|
2
|
+
|
3
|
+
=begin
|
4
|
+
Purpose: Class to read Excel file given the column name and scenario name
|
5
|
+
Author: Gaurang Shah
|
6
|
+
=end
|
7
|
+
|
8
|
+
class Excel
|
9
|
+
|
10
|
+
@@map = Array["a","b","c","d","e","f","g","h","i","j","k","l","m","o","p","q","r","s","t","u","v","w","x","y","z"]
|
11
|
+
#provide the path of the EXCEL file.. i.e. c:/demo.xls
|
12
|
+
#Provide the worksheet number if you have multiple worksheets
|
13
|
+
#If you will not provide the worksheet number by default it will take 1
|
14
|
+
def initialize(path, workSheetNumber=1)
|
15
|
+
@path=path
|
16
|
+
@workSheetNumber=workSheetNumber
|
17
|
+
end
|
18
|
+
|
19
|
+
def openExcel
|
20
|
+
@excel = WIN32OLE::new("excel.Application")
|
21
|
+
@workbook = @excel.Workbooks.Open(File.expand_path(File.dirname(__FILE__))+"/../Data/#{@path}")
|
22
|
+
|
23
|
+
@worksheet = @workbook.WorkSheets(@workSheetNumber)
|
24
|
+
# just to make sure macros are executed, if your sheet doesn't have macros you can skip this step.
|
25
|
+
@worksheet.Select
|
26
|
+
end #end openExcel
|
27
|
+
|
28
|
+
#Returns the EXCEL cell value based on provided ScenarioName and columnName
|
29
|
+
def getValue(scenarioName,columnName)
|
30
|
+
|
31
|
+
openExcel()
|
32
|
+
|
33
|
+
# Get the first column, Contains scenarion Names
|
34
|
+
column = @worksheet.range("a1:a100").Value
|
35
|
+
index=0
|
36
|
+
while(!column[index].to_s.eql?("[nil]")) do
|
37
|
+
index = index+1
|
38
|
+
end #while loop ends
|
39
|
+
|
40
|
+
|
41
|
+
@scenarios = Array.new(index)
|
42
|
+
for i in(0...index)do
|
43
|
+
@scenarios[i] = column[i]
|
44
|
+
end
|
45
|
+
|
46
|
+
#get the first line of excel, Header
|
47
|
+
columnNames = @worksheet.Rows(1).value[0]
|
48
|
+
|
49
|
+
#Find out the total number of columns
|
50
|
+
name=0
|
51
|
+
while(!columnNames[name].eql?(columnName)) do
|
52
|
+
# puts columnNames[name].to_s
|
53
|
+
name+=1;
|
54
|
+
end #While Ends
|
55
|
+
|
56
|
+
# name+=1;
|
57
|
+
|
58
|
+
begin
|
59
|
+
colData = @worksheet.Range("#{@@map[name]}1:#{@@map[name]}100").Value
|
60
|
+
rescue
|
61
|
+
return "Data Not Found: Invalid Column"
|
62
|
+
end
|
63
|
+
|
64
|
+
totalScenarios = @scenarios.length
|
65
|
+
for index in(0..totalScenarios) do
|
66
|
+
if(@scenarios[index].to_s.eql?("[\"" + scenarioName.chomp+ "\"]")) then
|
67
|
+
break;
|
68
|
+
end # If Ends
|
69
|
+
end #For Loop Ends
|
70
|
+
|
71
|
+
if(index >= totalScenarios) then
|
72
|
+
return "Data Not Found: Invalid Scenario"
|
73
|
+
end
|
74
|
+
index+=1;
|
75
|
+
|
76
|
+
value = @worksheet.range("#{@@map[name]}#{index}").value
|
77
|
+
@workbook.Close
|
78
|
+
@excel.Quit
|
79
|
+
|
80
|
+
if(value.nil?) then
|
81
|
+
return ""
|
82
|
+
end
|
83
|
+
|
84
|
+
return value
|
85
|
+
|
86
|
+
end #getValue
|
87
|
+
|
88
|
+
end #class ends
|
89
|
+
|
90
|
+
readExcel = Excel.new("gmail.xls")
|
91
|
+
#puts "gauang"
|
92
|
+
|
@@ -0,0 +1,615 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module UtilityMethods
|
4
|
+
$browser = nil
|
5
|
+
|
6
|
+
#safe Method to make sure that driver waits explicitly during refresh or navigation to a page
|
7
|
+
# accepts 'mytimeout' parameter which defines the time to wait before continuing to next
|
8
|
+
def safeLoadLink(mytimeout)
|
9
|
+
browser_loaded=0
|
10
|
+
while (browser_loaded == 0)
|
11
|
+
begin
|
12
|
+
browser_loaded=1
|
13
|
+
Timeout::timeout(mytimeout) do
|
14
|
+
yield
|
15
|
+
end
|
16
|
+
rescue Timeout::Error => e
|
17
|
+
puts "Page load timed out: #{e}"
|
18
|
+
browser_loaded=0
|
19
|
+
retry
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
#yamlpath method to accept the yaml path.
|
25
|
+
def yamlpath(path)
|
26
|
+
# Function that reads the .yaml file and returns the value
|
27
|
+
@@config = YAML.load_file(path)
|
28
|
+
end
|
29
|
+
#Method to read data from yaml file.
|
30
|
+
# This method accepts two parameters
|
31
|
+
#'fieldName' - This describes the name of the parameter
|
32
|
+
#' fieldname' - This describes the value of the parameter
|
33
|
+
def readData(fieldName, fieldValue)
|
34
|
+
if (@@config[fieldName][fieldValue].nil?) then
|
35
|
+
return ""
|
36
|
+
else
|
37
|
+
return @@config[fieldName][fieldValue]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Safe Sleep method to sleep for the desired number of seconds
|
42
|
+
#Accepts 'time' parameter
|
43
|
+
# time - This parameter holds the vaue of time in seconds until which the execution must stop
|
44
|
+
def safeSleep(time)
|
45
|
+
# sleep time
|
46
|
+
end
|
47
|
+
|
48
|
+
# Safe Click method to wait for object using wait_until_present and then click on object if exists
|
49
|
+
# Accepts locType, locBy, locValue as parameters
|
50
|
+
# locType - This contains the value of type of the Oject Locator
|
51
|
+
# locBy - This contains the 'By' value of the Object Locator
|
52
|
+
# locValue - This contains the value of the Object Locator
|
53
|
+
def safeClick(locType, locBy, locValue)
|
54
|
+
safeWaitUntilPresent(locType, locBy, locValue)
|
55
|
+
case locType.downcase
|
56
|
+
when "link"
|
57
|
+
case locBy.downcase
|
58
|
+
when "xpath"
|
59
|
+
$browser.link(:xpath, locValue).click
|
60
|
+
when "id"
|
61
|
+
$browser.link(:id, locValue).click
|
62
|
+
when "text"
|
63
|
+
$browser.link(:text, locValue).click
|
64
|
+
when "href"
|
65
|
+
$browser.link(:href, locValue).click
|
66
|
+
when "class"
|
67
|
+
$browser.link(:class, locValue).click
|
68
|
+
else
|
69
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locBy
|
70
|
+
end
|
71
|
+
when "button"
|
72
|
+
case locBy.downcase
|
73
|
+
when "xpath"
|
74
|
+
$browser.button(:xpath, locValue).click
|
75
|
+
when "id"
|
76
|
+
$browser.button(:id, locValue).click
|
77
|
+
when "text"
|
78
|
+
$browser.button(:text, locValue).click
|
79
|
+
when "href"
|
80
|
+
$browser.button(:href, locValue).click
|
81
|
+
when "class"
|
82
|
+
$browser.button(:class, locValue).click
|
83
|
+
when "value"
|
84
|
+
$browser.button(:value, locValue).click
|
85
|
+
else
|
86
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locBy
|
87
|
+
end
|
88
|
+
when "div"
|
89
|
+
case locBy.downcase
|
90
|
+
when "xpath"
|
91
|
+
$browser.div(:xpath, locValue).click
|
92
|
+
when "id"
|
93
|
+
$browser.div(:id, locValue).click
|
94
|
+
when "text"
|
95
|
+
$browser.div(:text, locValue).click
|
96
|
+
when "href"
|
97
|
+
$browser.div(:href, locValue).click
|
98
|
+
when "class"
|
99
|
+
$browser.div(:class, locValue).click
|
100
|
+
else
|
101
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locBy
|
102
|
+
end
|
103
|
+
when "span"
|
104
|
+
case locBy.downcase
|
105
|
+
when "xpath"
|
106
|
+
$browser.span(:xpath, locValue).click
|
107
|
+
when "id"
|
108
|
+
$browser.span(:id, locValue).click
|
109
|
+
when "text"
|
110
|
+
$browser.span(:text, locValue).click
|
111
|
+
when "href"
|
112
|
+
$browser.span(:href, locValue).click
|
113
|
+
when "class"
|
114
|
+
$browser.span(:class, locValue).click
|
115
|
+
else
|
116
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locBy
|
117
|
+
end
|
118
|
+
when "p"
|
119
|
+
case locBy.downcase
|
120
|
+
when "xpath"
|
121
|
+
$browser.p(:xpath, locValue).click
|
122
|
+
when "id"
|
123
|
+
$browser.p(:id, locValue).click
|
124
|
+
when "text"
|
125
|
+
$browser.p(:text, locValue).click
|
126
|
+
when "href"
|
127
|
+
$browser.p(:href, locValue).click
|
128
|
+
when "class"
|
129
|
+
$browser.p(:class, locValue).click
|
130
|
+
else
|
131
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locBy
|
132
|
+
end
|
133
|
+
when "h2"
|
134
|
+
case locBy.downcase
|
135
|
+
when "xpath"
|
136
|
+
$browser.h2(:xpath, locValue).click
|
137
|
+
when "id"
|
138
|
+
$browser.h2(:id, locValue).click
|
139
|
+
when "text"
|
140
|
+
$browser.h2(:text, locValue).click
|
141
|
+
when "href"
|
142
|
+
$browser.h2(:href, locValue).click
|
143
|
+
when "class"
|
144
|
+
$browser.h2(:class, locValue).click
|
145
|
+
else
|
146
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locBy
|
147
|
+
end
|
148
|
+
else
|
149
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locType
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Safe Type method to wait for object using wait_until_present and then type in object if exists
|
154
|
+
def safeType(locType, locBy, locValue, value)
|
155
|
+
safeWaitUntilPresent(locType, locBy, locValue)
|
156
|
+
case locType.downcase
|
157
|
+
when "text_field"
|
158
|
+
case locBy.downcase
|
159
|
+
when "xpath"
|
160
|
+
$browser.text_field(:xpath, locValue).send_keys value
|
161
|
+
when "id"
|
162
|
+
$browser.text_field(:id, locValue).send_keys value
|
163
|
+
when "text"
|
164
|
+
$browser.text_field(:text, locValue).send_keys value
|
165
|
+
when "name"
|
166
|
+
$browser.text_field(:name, locValue).send_keys value
|
167
|
+
when "class"
|
168
|
+
$browser.text_field(:class, locValue).send_keys value
|
169
|
+
else
|
170
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeType"
|
171
|
+
end
|
172
|
+
when "div"
|
173
|
+
case locBy.downcase
|
174
|
+
when "xpath"
|
175
|
+
$browser.div(:xpath, locValue).send_keys value
|
176
|
+
when "id"
|
177
|
+
$browser.div(:id, locValue).send_keys value
|
178
|
+
when "text"
|
179
|
+
$browser.div(:text, locValue).send_keys value
|
180
|
+
when "name"
|
181
|
+
$browser.div(:name, locValue).send_keys value
|
182
|
+
when "class"
|
183
|
+
$browser.div(:class, locValue).send_keys value
|
184
|
+
else
|
185
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeType"
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# Safe ClearType method to wait for object using wait_until_present and clear text field and then type in object if exists
|
191
|
+
def safeClearType(locType, locBy, locValue, value)
|
192
|
+
safeWaitUntilPresent(locType, locBy, locValue)
|
193
|
+
case locType.downcase
|
194
|
+
when "text_field"
|
195
|
+
case locBy.downcase
|
196
|
+
when "xpath"
|
197
|
+
$browser.text_field(:xpath, locValue).clear
|
198
|
+
$browser.text_field(:xpath, locValue).send_keys value
|
199
|
+
when "id"
|
200
|
+
$browser.text_field(:id, locValue).clear
|
201
|
+
$browser.text_field(:id, locValue).send_keys value
|
202
|
+
when "text"
|
203
|
+
$browser.text_field(:text, locValue).clear
|
204
|
+
$browser.text_field(:text, locValue).send_keys value
|
205
|
+
when "class"
|
206
|
+
$browser.text_field(:class, locValue).clear
|
207
|
+
$browser.text_field(:class, locValue).send_keys value
|
208
|
+
when "name"
|
209
|
+
$browser.text_field(:name, locValue).clear
|
210
|
+
$browser.text_field(:name, locValue).send_keys value
|
211
|
+
else
|
212
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeClearType"
|
213
|
+
end
|
214
|
+
when "div"
|
215
|
+
case locBy.downcase
|
216
|
+
when "xpath"
|
217
|
+
$browser.div(:xpath, locValue).clear
|
218
|
+
$browser.div(:xpath, locValue).send_keys value
|
219
|
+
when "id"
|
220
|
+
$browser.div(:id, locValue).clear
|
221
|
+
$browser.div(:id, locValue).send_keys value
|
222
|
+
when "text"
|
223
|
+
$browser.div(:text, locValue).clear
|
224
|
+
$browser.div(:text, locValue).send_keys value
|
225
|
+
when "name"
|
226
|
+
$browser.div(:name, locValue).clear
|
227
|
+
$browser.div(:name, locValue).send_keys value
|
228
|
+
when "class"
|
229
|
+
$browser.div(:class, locValue).clear
|
230
|
+
$browser.div(:class, locValue).send_keys value
|
231
|
+
else
|
232
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeClearType"
|
233
|
+
end
|
234
|
+
else
|
235
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+locType + "safeClearType"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Safe Flash method to wait for object using wait_until_present and then highlight the object
|
240
|
+
def safeFlash(locType, locBy, locValue)
|
241
|
+
safeWaitUntilPresent(locType, locBy, locValue)
|
242
|
+
case locType.downcase
|
243
|
+
when "link"
|
244
|
+
case locBy.downcase
|
245
|
+
when "xpath"
|
246
|
+
$browser.link(:xpath, locValue).flash
|
247
|
+
when "id"
|
248
|
+
$browser.link(:id, locValue).flash
|
249
|
+
when "text"
|
250
|
+
$browser.link(:text, locValue).flash
|
251
|
+
when "href"
|
252
|
+
$browser.link(:href, locValue).flash
|
253
|
+
when "class"
|
254
|
+
$browser.link(:class, locValue).flash
|
255
|
+
else
|
256
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeFlash"
|
257
|
+
end
|
258
|
+
when "button"
|
259
|
+
case locBy.downcase
|
260
|
+
when "xpath"
|
261
|
+
$browser.button(:xpath, locValue).flash
|
262
|
+
when "id"
|
263
|
+
$browser.button(:id, locValue).flash
|
264
|
+
when "text"
|
265
|
+
$browser.button(:text, locValue).flash
|
266
|
+
when "href"
|
267
|
+
$browser.button(:href, locValue).flash
|
268
|
+
when "class"
|
269
|
+
$browser.button(:class, locValue).flash
|
270
|
+
else
|
271
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeFlash"
|
272
|
+
end
|
273
|
+
when "text_field"
|
274
|
+
case locBy.downcase
|
275
|
+
when "xpath"
|
276
|
+
$browser.text_field(:xpath, locValue).flash
|
277
|
+
when "id"
|
278
|
+
$browser.text_field(:id, locValue).flash
|
279
|
+
when "text"
|
280
|
+
$browser.text_field(:text, locValue).flash
|
281
|
+
when "href"
|
282
|
+
$browser.text_field(:href, locValue).flash
|
283
|
+
when "class"
|
284
|
+
$browser.text_field(:class, locValue).flash
|
285
|
+
else
|
286
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeFlash"
|
287
|
+
end
|
288
|
+
when "div"
|
289
|
+
case locBy.downcase
|
290
|
+
when "xpath"
|
291
|
+
$browser.div(:xpath, locValue).flash
|
292
|
+
when "id"
|
293
|
+
$browser.div(:id, locValue).flash
|
294
|
+
when "text"
|
295
|
+
$browser.div(:text, locValue).flash
|
296
|
+
when "href"
|
297
|
+
$browser.div(:href, locValue).flash
|
298
|
+
when "class"
|
299
|
+
$browser.div(:class, locValue).flash
|
300
|
+
else
|
301
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeFlash"
|
302
|
+
end
|
303
|
+
when "span"
|
304
|
+
case locBy.downcase
|
305
|
+
when "xpath"
|
306
|
+
$browser.span(:xpath, locValue).flash
|
307
|
+
when "id"
|
308
|
+
$browser.span(:id, locValue).flash
|
309
|
+
when "text"
|
310
|
+
$browser.span(:text, locValue).flash
|
311
|
+
when "href"
|
312
|
+
$browser.span(:href, locValue).flash
|
313
|
+
when "class"
|
314
|
+
$browser.span(:class, locValue).flash
|
315
|
+
else
|
316
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeFlash"
|
317
|
+
end
|
318
|
+
when "h1"
|
319
|
+
case locBy.downcase
|
320
|
+
when "xpath"
|
321
|
+
$browser.h1(:xpath, locValue).flash
|
322
|
+
when "id"
|
323
|
+
$browser.h1(:id, locValue).flash
|
324
|
+
when "text"
|
325
|
+
$browser.h1(:text, locValue).flash
|
326
|
+
when "href"
|
327
|
+
$browser.h1(:href, locValue).flash
|
328
|
+
when "class"
|
329
|
+
$browser.h1(:class, locValue).flash
|
330
|
+
else
|
331
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeFlash"
|
332
|
+
end
|
333
|
+
else
|
334
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locType + "safeFlash"
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
# Safe Wait method to wait for object using wait_until_present
|
339
|
+
def safeWaitUntilPresent(locType, locBy, locValue)
|
340
|
+
begin
|
341
|
+
case locType.downcase
|
342
|
+
when "link"
|
343
|
+
case locBy.downcase
|
344
|
+
when "xpath"
|
345
|
+
$browser.link(:xpath, locValue).wait_until_present
|
346
|
+
when "id"
|
347
|
+
$browser.link(:id, locValue).wait_until_present
|
348
|
+
when "href"
|
349
|
+
$browser.link(:href, locValue).wait_until_present
|
350
|
+
when "text"
|
351
|
+
$browser.link(:text, locValue).wait_until_present
|
352
|
+
when "name"
|
353
|
+
$browser.link(:name, locValue).wait_until_present
|
354
|
+
when "class"
|
355
|
+
$browser.link(:class, locValue).wait_until_present
|
356
|
+
else
|
357
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
358
|
+
end
|
359
|
+
when "button"
|
360
|
+
case locBy.downcase
|
361
|
+
when "xpath"
|
362
|
+
$browser.button(:xpath, locValue).wait_until_present
|
363
|
+
when "id"
|
364
|
+
$browser.button(:id, locValue).wait_until_present
|
365
|
+
when "href"
|
366
|
+
$browser.button(:href, locValue).wait_until_present
|
367
|
+
when "text"
|
368
|
+
$browser.button(:text, locValue).wait_until_present
|
369
|
+
when "name"
|
370
|
+
$browser.button(:name, locValue).wait_until_present
|
371
|
+
when "class"
|
372
|
+
$browser.button(:class, locValue).wait_until_present
|
373
|
+
when "value"
|
374
|
+
$browser.button(:value, locValue).wait_until_present
|
375
|
+
else
|
376
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
377
|
+
end
|
378
|
+
when "text_field"
|
379
|
+
case locBy.downcase
|
380
|
+
when "xpath"
|
381
|
+
$browser.text_field(:xpath, locValue).wait_until_present
|
382
|
+
when "id"
|
383
|
+
$browser.text_field(:id, locValue).wait_until_present
|
384
|
+
when "href"
|
385
|
+
$browser.text_field(:href, locValue).wait_until_present
|
386
|
+
when "text"
|
387
|
+
$browser.text_field(:text, locValue).wait_until_present
|
388
|
+
when "name"
|
389
|
+
$browser.text_field(:name, locValue).wait_until_present
|
390
|
+
when "class"
|
391
|
+
$browser.text_field(:class, locValue).wait_until_present
|
392
|
+
else
|
393
|
+
puts "THE DEFINITION DOES NOT EXIST. dont PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
394
|
+
end
|
395
|
+
when "div"
|
396
|
+
case locBy.downcase
|
397
|
+
when "xpath"
|
398
|
+
$browser.div(:xpath, locValue).wait_until_present
|
399
|
+
when "id"
|
400
|
+
$browser.div(:id, locValue).wait_until_present
|
401
|
+
when "href"
|
402
|
+
$browser.div(:href, locValue).wait_until_present
|
403
|
+
when "text"
|
404
|
+
$browser.div(:text, locValue).wait_until_present
|
405
|
+
when "name"
|
406
|
+
$browser.div(:name, locValue).wait_until_present
|
407
|
+
when "class"
|
408
|
+
$browser.div(:class, locValue).wait_until_present
|
409
|
+
else
|
410
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
411
|
+
end
|
412
|
+
when "span"
|
413
|
+
case locBy.downcase
|
414
|
+
when "xpath"
|
415
|
+
$browser.span(:xpath, locValue).wait_until_present
|
416
|
+
when "id"
|
417
|
+
$browser.span(:id, locValue).wait_until_present
|
418
|
+
when "href"
|
419
|
+
$browser.span(:href, locValue).wait_until_present
|
420
|
+
when "text"
|
421
|
+
$browser.span(:text, locValue).wait_until_present
|
422
|
+
when "name"
|
423
|
+
$browser.span(:name, locValue).wait_until_present
|
424
|
+
when "class"
|
425
|
+
$browser.span(:class, locValue).wait_until_present
|
426
|
+
else
|
427
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
428
|
+
end
|
429
|
+
when "p"
|
430
|
+
case locBy.downcase
|
431
|
+
when "xpath"
|
432
|
+
$browser.p(:xpath, locValue).wait_until_present
|
433
|
+
when "id"
|
434
|
+
$browser.p(:id, locValue).wait_until_present
|
435
|
+
when "href"
|
436
|
+
$browser.p(:href, locValue).wait_until_present
|
437
|
+
when "text"
|
438
|
+
$browser.p(:text, locValue).wait_until_present
|
439
|
+
when "name"
|
440
|
+
$browser.p(:name, locValue).wait_until_present
|
441
|
+
when "class"
|
442
|
+
$browser.p(:class, locValue).wait_until_present
|
443
|
+
else
|
444
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
445
|
+
end
|
446
|
+
when "h1"
|
447
|
+
case locBy.downcase
|
448
|
+
when "xpath"
|
449
|
+
$browser.h1(:xpath, locValue).wait_until_present
|
450
|
+
when "id"
|
451
|
+
$browser.h1(:id, locValue).wait_until_present
|
452
|
+
when "href"
|
453
|
+
$browser.h1(:href, locValue).wait_until_present
|
454
|
+
when "text"
|
455
|
+
$browser.h1(:text, locValue).wait_until_present
|
456
|
+
when "name"
|
457
|
+
$browser.h1(:name, locValue).wait_until_present
|
458
|
+
when "class"
|
459
|
+
$browser.h1(:class, locValue).wait_until_present
|
460
|
+
else
|
461
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
462
|
+
end
|
463
|
+
when "h2"
|
464
|
+
case locBy.downcase
|
465
|
+
when "xpath"
|
466
|
+
$browser.h2(:xpath, locValue).wait_until_present
|
467
|
+
when "id"
|
468
|
+
$browser.h2(:id, locValue).wait_until_present
|
469
|
+
when "href"
|
470
|
+
$browser.h2(:href, locValue).wait_until_present
|
471
|
+
when "text"
|
472
|
+
$browser.h2(:text, locValue).wait_until_present
|
473
|
+
when "name"
|
474
|
+
$browser.h2(:name, locValue).wait_until_present
|
475
|
+
when "class"
|
476
|
+
$browser.h2(:class, locValue).wait_until_present
|
477
|
+
else
|
478
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
479
|
+
end
|
480
|
+
when "image"
|
481
|
+
case locBy.downcase
|
482
|
+
when "xpath"
|
483
|
+
$browser.image(:xpath, locValue).wait_until_present
|
484
|
+
when "id"
|
485
|
+
$browser.image(:id, locValue).wait_until_present
|
486
|
+
when "href"
|
487
|
+
$browser.image(:href, locValue).wait_until_present
|
488
|
+
when "text"
|
489
|
+
$browser.image(:text, locValue).wait_until_present
|
490
|
+
when "name"
|
491
|
+
$browser.image(:name, locValue).wait_until_present
|
492
|
+
when "class"
|
493
|
+
$browser.image(:class, locValue).wait_until_present
|
494
|
+
else
|
495
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + " safeWaitUntilPresent"
|
496
|
+
end
|
497
|
+
else
|
498
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locType + "safeWaitUntilPresent"
|
499
|
+
raise 'A test exception.'
|
500
|
+
end
|
501
|
+
rescue => e
|
502
|
+
raise "Could NOT FIND ELEMENT #{e.message}"
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
|
507
|
+
# Safe Wait method to wait for object using wait_while_present
|
508
|
+
def safeWaitWhilePresent(locType, locBy, locValue)
|
509
|
+
begin
|
510
|
+
case locType.downcase
|
511
|
+
when "link"
|
512
|
+
case locBy.downcase
|
513
|
+
when "xpath"
|
514
|
+
$browser.link(:xpath, locValue).wait_while_present
|
515
|
+
when "id"
|
516
|
+
$browser.link(:id, locValue).wait_while_present
|
517
|
+
when "href"
|
518
|
+
$browser.link(:href, locValue).wait_while_present
|
519
|
+
when "text"
|
520
|
+
$browser.link(:text, locValue).wait_while_present
|
521
|
+
when "name"
|
522
|
+
$browser.link(:name, locValue).wait_while_present
|
523
|
+
else
|
524
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeWaitWhilePresent"
|
525
|
+
end
|
526
|
+
when "button"
|
527
|
+
case locBy.downcase
|
528
|
+
when "xpath"
|
529
|
+
$browser.button(:xpath, locValue).wait_while_present
|
530
|
+
when "id"
|
531
|
+
$browser.button(:id, locValue).wait_while_present
|
532
|
+
when "href"
|
533
|
+
$browser.button(:href, locValue).wait_while_present
|
534
|
+
when "text"
|
535
|
+
$browser.button(:text, locValue).wait_while_present
|
536
|
+
when "name"
|
537
|
+
$browser.button(:name, locValue).wait_while_present
|
538
|
+
else
|
539
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeWaitWhilePresent"
|
540
|
+
end
|
541
|
+
when "text_field"
|
542
|
+
case locBy.downcase
|
543
|
+
when "xpath"
|
544
|
+
$browser.text_field(:xpath, locValue).wait_while_present
|
545
|
+
when "id"
|
546
|
+
$browser.text_field(:id, locValue).wait_while_present
|
547
|
+
when "href"
|
548
|
+
$browser.text_field(:href, locValue).wait_while_present
|
549
|
+
when "text"
|
550
|
+
$browser.text_field(:text, locValue).wait_while_present
|
551
|
+
when "name"
|
552
|
+
$browser.text_field(:name, locValue).wait_while_present
|
553
|
+
when "class"
|
554
|
+
$browser.text_field(:class, locValue).wait_while_present
|
555
|
+
else
|
556
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeWaitWhilePresent"
|
557
|
+
end
|
558
|
+
when "div"
|
559
|
+
case locBy.downcase
|
560
|
+
when "xpath"
|
561
|
+
$browser.div(:xpath, locValue).wait_while_present
|
562
|
+
when "id"
|
563
|
+
$browser.div(:id, locValue).wait_while_present
|
564
|
+
when "href"
|
565
|
+
$browser.div(:href, locValue).wait_while_present
|
566
|
+
when "text"
|
567
|
+
$browser.div(:text, locValue).wait_while_present
|
568
|
+
when "name"
|
569
|
+
$browser.div(:name, locValue).wait_while_present
|
570
|
+
when "class"
|
571
|
+
$browser.div(:class, locValue).wait_while_present
|
572
|
+
else
|
573
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeWaitWhilePresent"
|
574
|
+
end
|
575
|
+
when "span"
|
576
|
+
case locBy.downcase
|
577
|
+
when "xpath"
|
578
|
+
$browser.span(:xpath, locValue).wait_while_present
|
579
|
+
when "id"
|
580
|
+
$browser.span(:id, locValue).wait_while_present
|
581
|
+
when "href"
|
582
|
+
$browser.span(:href, locValue).wait_while_present
|
583
|
+
when "text"
|
584
|
+
$browser.span(:text, locValue).wait_while_present
|
585
|
+
when "name"
|
586
|
+
$browser.span(:name, locValue).wait_while_present
|
587
|
+
else
|
588
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeWaitWhilePresent"
|
589
|
+
end
|
590
|
+
when "p"
|
591
|
+
case locBy.downcase
|
592
|
+
when "xpath"
|
593
|
+
$browser.p(:xpath, locValue).wait_while_present
|
594
|
+
when "id"
|
595
|
+
$browser.p(:id, locValue).wait_while_present
|
596
|
+
when "href"
|
597
|
+
$browser.p(:href, locValue).wait_while_present
|
598
|
+
when "text"
|
599
|
+
$browser.p(:text, locValue).wait_while_present
|
600
|
+
when "name"
|
601
|
+
$browser.p(:name, locValue).wait_while_present
|
602
|
+
else
|
603
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locBy + "safeWaitWhilePresent"
|
604
|
+
end
|
605
|
+
else
|
606
|
+
puts "THE DEFINITION DOES NOT EXIST. PLEASE DEFINE"+ locType + "safeWaitWhilePresent"
|
607
|
+
end
|
608
|
+
rescue => e
|
609
|
+
puts "Could NOT FIND ELEMENT #{e.message}"
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module OneHealthCommunityConstants
|
4
|
+
$communitiesLink_href = "/#/communities"
|
5
|
+
$communityPageHeader_text = "Communities"
|
6
|
+
$communityJoinButton_text = "Join"
|
7
|
+
$communityClockPopup_id = "dialog-box"
|
8
|
+
$communityClockdateField_class = "clock_date right hasDatepicker"
|
9
|
+
$communityCalendarObject_id = "ui-datepicker-div"
|
10
|
+
$communityClockSavebutton_class = "button rounded action-save"
|
11
|
+
$communitySucessNotificationOkButton_text = "Ok"
|
12
|
+
$communityEndlessLoader_id = "endless_loader"
|
13
|
+
$searchInputField_class = "search-input"
|
14
|
+
$searchResultHearder_class = "profile_name"
|
15
|
+
$clockMonthOnLeftSide_xpath = ".//div[@class = 'month_count count']"
|
16
|
+
$clockDayOnLeftSide_xpath = ".//div[@class = 'day_count count']"
|
17
|
+
$FirstClock_xpath = ".//*[@id='clocks']/div/div/div/div[1]"
|
18
|
+
$clockDelete_class = "action-clock-remove"
|
19
|
+
$communitySettingsLink_xpath = ".//*[@id='main-header']/div/h1/span[2]/div"
|
20
|
+
$communityUnjoinNotification_class = "dialog-confirm"
|
21
|
+
$confirmUnjoinButton_class ="action-confirm button rounded"
|
22
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
|
2
|
+
require "#{File.dirname(__FILE__)}/../../libs/UtilityMethods"
|
3
|
+
require "#{File.dirname(__FILE__)}/OneHealthCommunityConstants"
|
4
|
+
|
5
|
+
module OneHealthCommunityPage
|
6
|
+
|
7
|
+
def selectCommunityfromList(communityNmae)
|
8
|
+
safeFlash("link", "href", $communitiesLink_href)
|
9
|
+
safeClick("link", "href", $communitiesLink_href )
|
10
|
+
safeWaitUntilPresent("span", "text", $communityPageHeader_text)
|
11
|
+
safeClick("link", "text", communityNmae)
|
12
|
+
safeWaitUntilPresent("button", "text", $communityJoinButton_text)
|
13
|
+
end
|
14
|
+
|
15
|
+
def joinCommunityAndAddClock
|
16
|
+
safeClick("button", "text", $communityJoinButton_text)
|
17
|
+
safeWaitUntilPresent("div", "id", $communityClockPopup_id)
|
18
|
+
safeType("text_field", "class", $communityClockdateField_class, "04/01/2013")
|
19
|
+
$browser.send_keys :enter
|
20
|
+
safeWaitWhilePresent("div", "id",$communityCalendarObject_id )
|
21
|
+
safeClick("button", "class", $communityClockSavebutton_class)
|
22
|
+
safeClick("button", "text", $communitySucessNotificationOkButton_text)
|
23
|
+
safeWaitWhilePresent("div", "id", $communityEndlessLoader_id)
|
24
|
+
end
|
25
|
+
|
26
|
+
def navigateToJoinedCommunity(communityname)
|
27
|
+
$joinedCommunity = communityname
|
28
|
+
assert($browser.link(:xpath, ".//a[contains(text(), '"+communityname+"')]").exists? == true, "NOT ABLE TO FIND" + communityname+" NAME IN THE LSIT OF COMMUNITIES JOINED")
|
29
|
+
safeClick("link", "xpath", ".//a[contains(text(), '"+$joinedCommunity+"')]")
|
30
|
+
safeWaitUntilPresent("span", "xpath", ".//span[contains (text(), '"+$joinedCommunity+"')]")
|
31
|
+
safeFlash("span", "xpath", ".//span[contains (text(), '"+$joinedCommunity+"')]")
|
32
|
+
end
|
33
|
+
|
34
|
+
def verifyCommunityJoin
|
35
|
+
assert($browser.span(:xpath, ".//span[contains (text(), '"+$joinedCommunity+"')]").exists? == true, "JOINED COMMUNITY "+$joinedCommunity+" VERIFICATION FAILED")
|
36
|
+
safeFlash("span", "xpath", ".//span[contains (text(), '"+$joinedCommunity+"')]")
|
37
|
+
puts "COMMUNITY JOINED VERIFICATION SUCCESFULLY"
|
38
|
+
end
|
39
|
+
|
40
|
+
def verifyAddedClock
|
41
|
+
assert($browser.div(:xpath, ".//div[contains(text(), '"+$joinedCommunity+"')]").exists? == true, "Clock Added for the user for Community "+$joinedCommunity+" is not displayed.")
|
42
|
+
safeFlash("div", "xpath", ".//div[contains(text(), '"+$joinedCommunity+"')]")
|
43
|
+
puts "Clock Added Is Diplayed for the Joined Community " +$joinedCommunity
|
44
|
+
end
|
45
|
+
|
46
|
+
def searchAndVerify(username)
|
47
|
+
safeFlash("text_field", "class", $searchInputField_class)
|
48
|
+
safeType("text_field", "class", $searchInputField_class, username)
|
49
|
+
safeType("text_field", "class", $searchInputField_class, :enter)
|
50
|
+
safeWaitUntilPresent("h1", "class", $searchResultHearder_class)
|
51
|
+
assert($browser.h1(:xpath, ".//h1[contains(text(), '" +username+"')]").exists? == true, "Username searched is NOT matching the resuolts displayed. Please verify")
|
52
|
+
puts "Username Searched '"+username+"' is Displyed in the Results"
|
53
|
+
safeFlash("h1", "xpath", ".//h1[contains(text(), '" +username+"')]")
|
54
|
+
$commname = $browser.div(:class, "comm_name").text
|
55
|
+
assert(($commname == $joinedCommunity) == true, "Clock for '"+username+"' does not exist for the community joined earlier")
|
56
|
+
verifyAddedClock
|
57
|
+
puts "user with name '"+ username+ "' is having clocks for the Joined Community '"+ $joinedCommunity+"'"
|
58
|
+
end
|
59
|
+
|
60
|
+
def getOldDate
|
61
|
+
nowDate = DateTime.now
|
62
|
+
prevDate = nowDate<<2
|
63
|
+
previousDate = prevDate.strftime("%m/%d/%Y")
|
64
|
+
return previousDate
|
65
|
+
end
|
66
|
+
|
67
|
+
def updateClock
|
68
|
+
assert($browser.div(:xpath, ".//div[contains(text(), '"+$joinedCommunity+"')]").exists? == true, "Clock Added for the user for Community "+$joinedCommunity+" is not displayed.")
|
69
|
+
safeClick("div", "xpath", ".//div[contains(text(), '"+$joinedCommunity+"')]")
|
70
|
+
safeWaitUntilPresent("div", "id", $communityClockPopup_id)
|
71
|
+
$prevdate = getOldDate
|
72
|
+
puts $prevdate
|
73
|
+
safeClearType("text_field", "class", $communityClockdateField_class, $prevdate)
|
74
|
+
$browser.send_keys :enter
|
75
|
+
#safeType("text_field", "class", $communityClockdateField_class, :enter)
|
76
|
+
safeWaitWhilePresent("div", "id",$communityCalendarObject_id )
|
77
|
+
safeClick("button", "class", $communityClockSavebutton_class)
|
78
|
+
safeClick("button", "text", $communitySucessNotificationOkButton_text)
|
79
|
+
safeWaitWhilePresent("div", "id", $communityEndlessLoader_id)
|
80
|
+
end
|
81
|
+
|
82
|
+
def verifyUpdatedClock
|
83
|
+
assert($browser.div(:xpath, ".//div[contains(text(), '"+$joinedCommunity+"')]").exists? == true, "Clock Added for the user for Community "+$joinedCommunity+" is not displayed.")
|
84
|
+
monthvalue = $browser.div(:xpath, $clockMonthOnLeftSide_xpath).text.to_s
|
85
|
+
dayvalue = $browser.div(:xpath, $clockDayOnLeftSide_xpath).text
|
86
|
+
assert((monthvalue.eql? "2") == true, "The Clock has Day count greater than 0. Date is NOT updated properly")
|
87
|
+
assert((dayvalue.eql? "0"), "The Clock has Day count greater than 0. Date is NOT updated properly")
|
88
|
+
safeFlash("div", "xpath", $FirstClock_xpath)
|
89
|
+
puts "The Date is updated properly. The value in Months is '"+monthvalue +"' and Day value is '"+dayvalue +"'. When the Updated date is '"+$prevdate+"'."
|
90
|
+
end
|
91
|
+
|
92
|
+
def deleteClock
|
93
|
+
assert($browser.div(:xpath, ".//div[contains(text(), '"+$joinedCommunity+"')]").exists? == true, "Clock Added for the user for Community "+$joinedCommunity+" is not displayed.")
|
94
|
+
safeClick("div", "xpath", ".//div[contains(text(), '"+$joinedCommunity+"')]")
|
95
|
+
safeClick("link", "class", $clockDelete_class)
|
96
|
+
safeClick("button", "text", $communitySucessNotificationOkButton_text)
|
97
|
+
safeWaitWhilePresent("div", "id", $communityEndlessLoader_id)
|
98
|
+
end
|
99
|
+
|
100
|
+
def verifyDeleteClock
|
101
|
+
assert($browser.div(:xpath, ".//div[contains(text(), '"+$joinedCommunity+"')]").exists? != true, "Clock Exists for the Community "+$joinedCommunity+" . Deletion NOT Successful.")
|
102
|
+
puts "Clock Deleted Sucessfully for the Community '"+$joinedCommunity+"'."
|
103
|
+
end
|
104
|
+
|
105
|
+
def unjoinCommunity
|
106
|
+
navigateToJoinedCommunity($joinedCommunity)
|
107
|
+
safeFlash("div", "xpath", $communitySettingsLink_xpath)
|
108
|
+
safeClick("div", "xpath", $communitySettingsLink_xpath)
|
109
|
+
$browser.div(:class, "dd_menu_button community_menu_button").li(:text, "Unjoin community").click
|
110
|
+
safeWaitUntilPresent("div", "class", $communityUnjoinNotification_class)
|
111
|
+
safeClick("button","class", $confirmUnjoinButton_class)
|
112
|
+
end
|
113
|
+
|
114
|
+
def verifyCommunityUnjoin
|
115
|
+
assert($browser.div(:xpath, ".//a[contains (text(), '"+$joinedCommunity+"')]").exists? != true, "Community still Exists in Left Menu. Community Unjoin Succesful.")
|
116
|
+
puts "Community Unjoin SuccessFul"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
module OneHealthJournalConstants
|
5
|
+
|
6
|
+
$journalLink_id = "nav_primary_journals"
|
7
|
+
$journalHeader_xpath = ".//h1[contains(text(), 'My Journal')]"
|
8
|
+
$newJournalEntryCreation_class = "rounded secondary_button add_journal_button processed"
|
9
|
+
$titlecreateTextbox_class = "add_journal_title_text processed"
|
10
|
+
$messagecreateTextbox_class = "add_journal_message_text processed"
|
11
|
+
$publishcreateJournalbutton_class = "publish_journal button rounded processed"
|
12
|
+
$firstJournalLink_xpath = "(.//a[@class='title_link'])[1]"
|
13
|
+
$firstJournalEntry_xpath = ".//*[@id='main']/ul/li[1]/div/h3/p/a[1]"
|
14
|
+
$firstJournalEditButton_xpath = "(.//a[@class = 'edit_journal_post'])[1]"
|
15
|
+
$titleEditTextbox_class ="edit_journal_title_text processed"
|
16
|
+
$messageEditTextbox_class = "edit_journal_message_text processed"
|
17
|
+
$updateJournalButton_value = "Update Journal"
|
18
|
+
$deleteJournalLink_text = "Delete"
|
19
|
+
$homebutton_class = "noti_icon noti_home"
|
20
|
+
$homepageheaderLogo_class = "recovery_logo"
|
21
|
+
$succesDialog_class = "dialog-message"
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
|
2
|
+
require "#{File.dirname(__FILE__)}/../../libs/UtilityMethods"
|
3
|
+
require "#{File.dirname(__FILE__)}/OneHealthJournalConstants"
|
4
|
+
|
5
|
+
|
6
|
+
module OneHealthJournalPage
|
7
|
+
|
8
|
+
def verifyEmoticonJournal
|
9
|
+
clickJournal
|
10
|
+
$emoticonjournaltext = $browser.link(:xpath, $firstJournalEntry_xpath).text
|
11
|
+
if ($emoticonjournaltext.include? $emoticon)
|
12
|
+
safeFlash("link", "xpath", $firstJournalEntry_xpath)
|
13
|
+
puts "Emoticon on Journal Page Verified. The First Journal Entry has emoticon as " + $emoticon
|
14
|
+
else
|
15
|
+
puts "FAILED AUTHENTICATION"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def clickJournal
|
20
|
+
safeClick("link", "id", $journalLink_id)
|
21
|
+
safeWaitUntilPresent("h1", "xpath", $journalHeader_xpath)
|
22
|
+
safeFlash("h1", "xpath", $journalHeader_xpath)
|
23
|
+
end
|
24
|
+
|
25
|
+
def addJournal(titleText, messageText)
|
26
|
+
$titleText = titleText
|
27
|
+
safeWaitUntilPresent("button", "class", $newJournalEntryCreation_class)
|
28
|
+
safeClick("button", "class", $newJournalEntryCreation_class)
|
29
|
+
safeClearType("text_field", "class", $titlecreateTextbox_class, titleText)
|
30
|
+
safeClearType("text_field", "class", $messagecreateTextbox_class, messageText)
|
31
|
+
safeClick("button", "class", $publishcreateJournalbutton_class)
|
32
|
+
safeWaitWhilePresent("div", "class", $succesDialog_class)
|
33
|
+
safeSleep(5)
|
34
|
+
end
|
35
|
+
|
36
|
+
def verifyJournalCreated
|
37
|
+
assert($browser.link(:xpath, "(.//*[contains(text(), '"+ $titleText +"')])[1]").exists? == true, "Unable to Find the First Link with given Text. Journal Creation Failed")
|
38
|
+
safeFlash("link", "xpath", "(.//*[contains(text(), '"+ $titleText +"')])[1]")
|
39
|
+
puts "Journal Created Sucessful. First Journal Entry has Title "+ $titleText
|
40
|
+
end
|
41
|
+
|
42
|
+
def updateJournal(titleEditText, messageEditText )
|
43
|
+
$titleEditText = titleEditText
|
44
|
+
safeClick("link", "xpath", $firstJournalEditButton_xpath)
|
45
|
+
safeType("text_field", "class", $titleEditTextbox_class, titleEditText)
|
46
|
+
safeType("text_field", "class", $messageEditTextbox_class, messageEditText)
|
47
|
+
safeClick("button", "value", $updateJournalButton_value )
|
48
|
+
safeWaitWhilePresent("div", "class", $succesDialog_class)
|
49
|
+
safeSleep(5)
|
50
|
+
end
|
51
|
+
|
52
|
+
def verifyUpdateJournal
|
53
|
+
assert($browser.link(:xpath, "(.//*[contains(text(), '"+ $titleEditText +"')])[1]").exists? == true, "First Link Doesn't Contain Edited Text. Journal Update Failed")
|
54
|
+
safeFlash("link", "xpath", $firstJournalLink_xpath)
|
55
|
+
puts "Journal EDITED and First Entry contains "+$titleEditText +" in the TITLE"
|
56
|
+
end
|
57
|
+
|
58
|
+
def deleteJournal
|
59
|
+
safeFlash("link", "xpath", $firstJournalEditButton_xpath)
|
60
|
+
safeClick("link", "xpath", $firstJournalEditButton_xpath)
|
61
|
+
safeClick("link", "text", $deleteJournalLink_text)
|
62
|
+
safeWaitWhilePresent("div", "class", $succesDialog_class)
|
63
|
+
safeSleep(5)
|
64
|
+
end
|
65
|
+
|
66
|
+
def verifyJournalDeleted
|
67
|
+
assert($browser.link(:xpath, "(.//a[contains(text(), '"+ $emoticon +"')])[1]").exists? == true, "First Link Doesn't Contain Emoticon Text. Journal Deletion Failed")
|
68
|
+
safeFlash("link", "xpath", "(.//a[contains(text(), '"+ $emoticon +"')])[1]")
|
69
|
+
puts "JOURNAL DELETED SUCCESSFULLY. Now the First Entry on Journal has Title " + $emoticon
|
70
|
+
end
|
71
|
+
|
72
|
+
def navigatetoHome
|
73
|
+
safeClick("span", "class", $homebutton_class)
|
74
|
+
safeWaitUntilPresent("image", "class", $homepageheaderLogo_class)
|
75
|
+
end
|
76
|
+
|
77
|
+
def refreshPage
|
78
|
+
safeWaitUntilPresent("div", "class", $succesDialog_class)
|
79
|
+
safeClick("h2", "id", "dialog-remove")
|
80
|
+
safeWaitUntilPresent("h1", "xpath", $journalHeader_xpath)
|
81
|
+
$browser.refresh
|
82
|
+
safeWaitUntilPresent("h1", "xpath", $journalHeader_xpath)
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'watir-webdriver'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'date'
|
4
|
+
require 'ci/reporter/rake/test_unit_loader.rb'
|
5
|
+
require "#{File.dirname(__FILE__)}/OneHealthLoginConstants"
|
6
|
+
require "#{File.dirname(__FILE__)}/../../libs/UtilityMethods"
|
7
|
+
|
8
|
+
module OneHealthLoginPage
|
9
|
+
def login(username, password)
|
10
|
+
safeClearType("text_field", "id", $usrName_textfield_id, username)
|
11
|
+
safeClearType("text_field", "id", $password_textfield_id, password)
|
12
|
+
safeClick("button", "text", $loginbutton_button_text)
|
13
|
+
end
|
14
|
+
|
15
|
+
def smileySelect(emotion)
|
16
|
+
$emoticon = emotion
|
17
|
+
safeWaitUntilPresent("p", "text", emotion)
|
18
|
+
safeClick("p", "text", emotion)
|
19
|
+
end
|
20
|
+
|
21
|
+
def verifyLogin
|
22
|
+
safeWaitWhilePresent("div", "id", "dialog-box")
|
23
|
+
safeWaitUntilPresent("link", "text", "[Logout]")
|
24
|
+
assert($browser.link(:text, "[Logout]").exists? == true, "LOGIN NOT SUCCESFUL. PLEASE CHECK")
|
25
|
+
puts "LOGIN SUCCESFUL"
|
26
|
+
end
|
27
|
+
|
28
|
+
def verifyEmoticonHome
|
29
|
+
assert($browser.div(:xpath, ".//div[contains(text(), '"+$emoticon+"')]").exists? == true)
|
30
|
+
#assert($browser.div(:xpath, ".//div[contains(text(), 'XYZ')]").exists? == true, "Emoticon Verification on Home Page Failed. Unable to Find Element with selected Emoticon")
|
31
|
+
safeFlash("div", "xpath",".//div[contains(text(), '"+$emoticon+"')]" )
|
32
|
+
puts "Emoticon Selected is " + $emoticon + ". Verification of Emoticon on Home Page Succesfuly"
|
33
|
+
end
|
34
|
+
|
35
|
+
def logoutandVerify
|
36
|
+
safeClick("link", "text", $logoutlink_link_text)
|
37
|
+
safeWaitUntilPresent("button", "text", $loginbutton_button_text)
|
38
|
+
if(assert($browser.button(:text, $loginbutton_button_text).exists? == true, "LOGOUT NOT SUCCESFUL PLS CHECK"))
|
39
|
+
safeFlash("button", "text", $loginbutton_button_text)
|
40
|
+
puts "LOGOUT SUCCESFUL"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'libs/BaseClassMethods'
|
2
|
+
require 'libs/UtilityMethods'
|
3
|
+
require 'page/OneHealth_CommunityPage/OneHealthCommunityPage'
|
4
|
+
require 'page/OneHealth_CommunityPage/OneHealthCommunityConstants'
|
5
|
+
require 'page/OneHealth_JournalPage/OneHealthJournalPage'
|
6
|
+
require 'page/OneHealth_JournalPage/OneHealthJournalConstants'
|
7
|
+
require 'page/OneHealth_LoginPage/OneHealthLoginPage'
|
8
|
+
require 'page/OneHealth_LoginPage/OneHealthLoginConstants'
|
9
|
+
|
10
|
+
|
11
|
+
include BaseClassMethods
|
12
|
+
include OneHealthLoginPage
|
13
|
+
include OneHealthCommunityPage
|
14
|
+
include OneHealthJournalPage
|
15
|
+
include UtilityMethods
|
16
|
+
|
17
|
+
module OhFramezq
|
18
|
+
|
19
|
+
class OneHealth
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/zqframegem.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../core", __FILE__)
|
3
|
+
$:.push File.expand_path("../core/libs", __FILE__)
|
4
|
+
$:.push File.expand_path("../core/page", __FILE__)
|
5
|
+
#require "mygem/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = %q{zqframeworkOH}
|
9
|
+
s.version = "1.0.1"
|
10
|
+
s.date = %q{2013-04-29}
|
11
|
+
s.authors = ["Pawan"]
|
12
|
+
s.email = ["pawan@zenqa.com"]
|
13
|
+
s.homepage = ""
|
14
|
+
s.summary = "FrameWork GEM"
|
15
|
+
s.description = "GEM for FrameWork"
|
16
|
+
s.files = Dir.glob '**/*'
|
17
|
+
#+Dir['core/libs/*.rb']+Dir['core/page/*.rb']+Dir['core/page/**/*']
|
18
|
+
s.require_paths = ["core"]
|
19
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zqframeworkOH
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pawan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: GEM for FrameWork
|
15
|
+
email:
|
16
|
+
- pawan@zenqa.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- core/libs/BaseClassInstanceMethods.rb
|
22
|
+
- core/libs/BaseClassMethods.rb
|
23
|
+
- core/libs/Excel.rb
|
24
|
+
- core/libs/UtilityMethods.rb
|
25
|
+
- core/page/OneHealth_CommunityPage/OneHealthCommunityConstants.rb
|
26
|
+
- core/page/OneHealth_CommunityPage/OneHealthCommunityPage.rb
|
27
|
+
- core/page/OneHealth_JournalPage/OneHealthJournalConstants.rb
|
28
|
+
- core/page/OneHealth_JournalPage/OneHealthJournalPage.rb
|
29
|
+
- core/page/OneHealth_LoginPage/OneHealthLoginConstants.rb
|
30
|
+
- core/page/OneHealth_LoginPage/OneHealthLoginPage.rb
|
31
|
+
- core/zqframeworkOH.rb
|
32
|
+
- OneHealthGem/zqframeworkOH-1.0.0.gem
|
33
|
+
- zqframegem.gemspec
|
34
|
+
- zqframeworkOH-1.0.0.gem
|
35
|
+
- zqframeworkOH-1.0.1.gem
|
36
|
+
homepage: ''
|
37
|
+
licenses: []
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- core
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.8.24
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: FrameWork GEM
|
60
|
+
test_files: []
|