awetestlib 0.1.0-x86-mingw32 → 0.1.1-x86-mingw32

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 (3) hide show
  1. data/lib/version.rb +1 -1
  2. data/test/zoho_util.rb +485 -484
  3. metadata +3 -3
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Awetestlib
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  VERSION_DATE = "2012-08-14"
4
4
  end
data/test/zoho_util.rb CHANGED
@@ -1,484 +1,485 @@
1
- module ZohoUtil
2
-
3
- def run
4
- if @xls_path
5
- get_variables(@xls_path, :role)
6
- @login.each_key do |key|
7
- if @login[key]['enabled'] == 'Y'
8
- @user = @login[key]['userid']
9
- @pass = @login[key]['password']
10
- @role = @login[key]['role']
11
- @url1 = @login[key]['url']
12
- debug_to_report("@user: #{@user}, @pass: #{@pass}, @role: #{@role} (#{__LINE__})")
13
- break
14
- end
15
- end
16
- end
17
-
18
- #userid = "joeklienwatir@gmail.com" #@zohologin.cell(2,2)
19
- #password = 'watir001' #@zohologin.cell(2,3)
20
- #login_url = "https://accounts.zoho.com/login?serviceurl=https://www.zoho.com/&hide_signup=true&css=https://www.zoho.com/css/login.css"
21
- home_url = 'https://crm.zoho.com/crm/ShowHomePage.do'
22
- validation = 'Welcome joeklienwatir at Software'
23
-
24
- browser = open_browser
25
- go_to_url(browser, @url1)
26
- zoho_login(browser, @user, @pass, home_url, validation)
27
- run_test(browser)
28
- logout(browser)
29
-
30
- rescue
31
- fatal_to_log("#{@myName} '#{$!}'")
32
- browser.close
33
- raise
34
- end
35
-
36
- def zoho_login(browser, userid, password, url, validation = 'Welcome joeklienwatir at Software')
37
- mark_testlevel("#{__method__.to_s.titleize}", 8)
38
- set_textfield_by_name(browser, 'lid', userid)
39
- set_textfield_by_name(browser, 'pwd', password)
40
- click_button_by_value(browser, 'Sign In')
41
- go_to_url(browser, url)
42
- validate_text(browser, validation)
43
- end
44
-
45
- def navigate_to_crm(browser)
46
- mark_testlevel("#{__method__.to_s.titleize}", 3)
47
- click_text(browser, 'CRM')
48
- end
49
-
50
- def navigate_to_project(browser)
51
- mark_testlevel("#{__method__.to_s.titleize}", 3)
52
- click_text(browser, 'Projects')
53
- end
54
-
55
- def signout(browser)
56
- mark_testlevel("#{__method__.to_s.titleize}", 8)
57
- click_text(browser, /Sign Out/)
58
- end
59
-
60
- def create_blank_new_account(browser)
61
- mark_testlevel("#{__method__.to_s.titleize}", 3)
62
- click_text(browser, 'New Account')
63
- validate_text(browser, 'Create Account')
64
- click_button_by_value(browser, 'Save')
65
- sleep(1)
66
- close_popup('Message from webpage')
67
- end
68
-
69
- def export_accounts(browser)
70
- mark_testlevel("#{__method__.to_s.titleize}", 5)
71
- click_text(browser, 'Setup')
72
- sleep_for(2)
73
- click_text(browser, 'Export Data')
74
- sleep_for(2)
75
- select_option_by_name_and_option_value(browser, 'module', 'Accounts')
76
- if @use_sikuli
77
- run_sikuli_script("exportaccounts")
78
- close_popup('File Download')
79
- else
80
- #click_button_no_wait_by_value(browser, 'Export')
81
- # Make sure popups are allowed by browser
82
-
83
- mark_testlevel("#{__method__.to_s.titleize} Download", 4)
84
- filename = 'Account_Export.cvs'
85
- filepath = "#{@myRoot}/#{filename}"
86
- filepath.gsub!('/', '\\')
87
- message_to_log("#{filepath.to_s}")
88
- if File.exist?(filepath)
89
- File.delete(filepath)
90
- end
91
- sleep(3)
92
-
93
- click_button_no_wait_by_value(browser, 'Export')
94
- sleep_for(5)
95
- close_popup('Message from webpage', 'Are you sure?')
96
- sleep_for(1)
97
-
98
- click_button_no_wait_by_value(browser, 'Export')
99
- sleep_for(3)
100
- close_popup('Message from webpage', 'Are you sure?')
101
- sleep_for(3)
102
-
103
- save_file1(filepath)
104
- sleep_for(4)
105
-
106
- #if popup_exists?(popup, 'File Download')
107
- # save_file(filepath)
108
- # click_popup_button('File Download', 'Save')
109
- # file_download(browser)
110
- # save_file_orig(filepath)
111
- # close_popup_by_button_title(popup, 'Close', 'Download Complete')
112
- #end
113
- end
114
- end
115
-
116
- def import_accounts(browser)
117
- mark_testlevel("#{__method__.to_s.titleize}", 5)
118
- #click_class(browser, 'menuOn', 'Accounts')
119
- click_text(browser, 'Accounts')
120
- click_text(browser, 'Import Accounts')
121
- click(browser, :button, :value, 'Import Accounts')
122
- validate_text(browser, 'Import Accounts')
123
- #click_button_by_name(browser, 'theFile')
124
- #file_upload(filepath)
125
- #click_button_by_class(browser, 'button')
126
- #select_option_by_name_and_option_value(browser, 'CrmAccount:ACCOUNTNAME', 'Account Name')
127
- #click_button_by_class(browser, 'button')
128
- #click_button_by_value(browser, 'Import')
129
- #validate_no_text(browser, '0', 'No of Records added:')
130
- end
131
-
132
- def verify_accounts(browser)
133
- mark_testlevel("#{__method__.to_s.titleize}", 5)
134
- click_text(browser, 'Accounts')
135
- validate_text(browser, '<No Accounts found >')
136
- #select_option_by_class_and_option_value(browser, 'select', 'My Accounts')
137
- #sleep(1)
138
- #select_option_by_class_and_option_value(browser, 'select', 'New This Week')
139
- #sleep(1)
140
- #select_option_by_class_and_option_value(browser, 'select', 'New Last Week')
141
- #sleep(1)
142
- #select_option_by_class_and_option_value(browser, 'select', 'Unread Accounts')
143
- #sleep(1)
144
- end
145
-
146
- def reports(browser)
147
- mark_testlevel("#{__method__.to_s.titleize}", 6)
148
- click_text(browser, 'Reports')
149
- validate_text(browser, 'Recently Accessed Reports')
150
- validate_text(browser, '<No Recent Reports Found >')
151
- end
152
-
153
- def search_accounts(browser)
154
- mark_testlevel("#{__method__.to_s.titleize}", 6)
155
- select_option_by_name_and_option_value(browser, 'searchCategory', 'Accounts')
156
- set_textfield_by_id(browser, 'searchword', 'Test Account #1')
157
- click_button_by_value(browser, 'Go')
158
- sleep(3)
159
- validate_text(browser, 'Search Results')
160
- end
161
-
162
- def clone_account(browser)
163
- mark_testlevel("#{__method__.to_s.titleize}", 5)
164
- click_text(browser, 'Home')
165
- sleep(1)
166
- validate_text(browser, 'Welcome tester at Software')
167
- click_text(browser, 'Tester')
168
- sleep(2)
169
- validate_text(browser, 'Lead Details')
170
- validate_text(browser, 'Lead Information')
171
- click_button_by_name(browser, 'Clone')
172
- sleep(2)
173
- validate_text(browser, 'Clone Account')
174
- click_button_by_value(browser, 'Save')
175
- end
176
-
177
- def pagination(browser)
178
- mark_testlevel("#{__method__.to_s.titleize}", 6)
179
- click_text(browser, 'Accounts')
180
- sleep(1)
181
- click_text(browser, 'A')
182
- sleep(1)
183
- click_text(browser, 'B')
184
- sleep(1)
185
- click_text(browser, 'C')
186
- sleep(1)
187
- click_text(browser, 'D')
188
- sleep(1)
189
- click_text(browser, 'E')
190
- sleep(1)
191
- click_text(browser, 'F')
192
- sleep(1)
193
- end
194
-
195
- def click_headers(browser)
196
- mark_testlevel("#{__method__.to_s.titleize}", 6)
197
- click_text(browser, 'Leads')
198
- sleep(1)
199
- click_text(browser, 'Accounts')
200
- sleep(1)
201
- click_text(browser, 'Contacts')
202
- sleep(1)
203
- click_text(browser, 'Potentials')
204
- sleep(1)
205
- click_text(browser, 'Campaigns')
206
- sleep(1)
207
- click_text(browser, 'Reports')
208
- sleep(1)
209
- click_text(browser, 'Dashboards')
210
- sleep(1)
211
- click_text(browser, 'Activities')
212
- sleep(1)
213
- click_text(browser, 'Cases')
214
- sleep(1)
215
- end
216
-
217
- def new_lead(browser)
218
- mark_testlevel("#{__method__.to_s.titleize}", 3)
219
- click_text(browser, 'Leads')
220
- sleep(2)
221
- validate_text(browser, 'Leads: All Open Leads')
222
- click_button_by_value(browser, 'New Lead ')
223
- sleep(2)
224
- validate_text(browser, 'Create Lead')
225
- select_option_by_name_and_option_value(browser, 'property(saltName)', 'Mr.')
226
- #browser.select_list(:name, 'property(saltName)').select_value(Mr.)
227
-
228
- set_textfield_by_name(browser, 'property(Company)', 'Test Zoho Company')
229
- set_textfield_by_name(browser, 'property(Last Name)', 'Tester')
230
- set_textfield_by_name(browser, 'property(Phone)', '415-999-9999')
231
-
232
- select_option_by_name_and_option_value(browser, 'property(Lead Source)', 'Advertisement')
233
- select_option_by_name_and_option_value(browser, 'property(Industry)', 'ASP')
234
- select_option_by_name_and_option_value(browser, 'property(Lead Status)', 'Contacted')
235
- select_option_by_name_and_option_value(browser, 'property(Rating)', 'Active')
236
-
237
-
238
- browser.image(:title, 'Calculator').click
239
- sleep(4)
240
- attach_popup_by_url(browser, "https://crmold.zoho.com/crm/Calc.do?currFld=property(Annual%20Revenue)")
241
- sleep(3)
242
- close_modal_ie(browser, 'Calculator')
243
- set_checkbox_by_name(browser, 'property(Email Opt Out)')
244
- sleep(2)
245
- clear_checkbox_by_name(browser, 'property(Email Opt Out)')
246
-
247
-
248
- set_textfield_by_name(browser, 'property(Street)', '1600 Holloway Avenue') ## Address
249
- set_textfield_by_name(browser, 'property(State)', 'California')
250
- set_textfield_by_name(browser, 'property(City)', 'San Francisco')
251
- set_textfield_by_name(browser, 'property(Zip Code)', '94541')
252
- set_textfield_by_name(browser, 'property(Country)', 'USA')
253
-
254
- set_textfield_by_name(browser, 'property(Description)', 'This is a description')
255
- click_button_by_value(browser, 'Save')
256
- sleep(2)
257
- end
258
-
259
- def find_leads(browser)
260
- mark_testlevel("#{__method__.to_s.titleize}", 5)
261
- click_text(browser, 'Leads')
262
- sleep(1)
263
- set_textfield_by_name(browser, 'newsearchString', 'Test Zoho Company')
264
- click_button_by_name(browser, 'Go')
265
- sleep(2)
266
- validate_text(browser, 'Test Zoho Company')
267
- end
268
-
269
- def leads_delete_message(browser)
270
- mark_testlevel("#{__method__.to_s.titleize}", 4)
271
- click_text(browser, 'Leads')
272
- sleep(1)
273
- set_checkbox_by_name(browser, 'allcheck')
274
- sleep(1)
275
- clear_checkbox_by_name(browser, 'allcheck')
276
- sleep(1)
277
- click_button_by_value(browser, 'Delete')
278
- sleep(1)
279
- close_popup('Message from webpage')
280
- end
281
-
282
- def find_lead_reports(browser) ## Find Lead Reports by Source
283
- mark_testlevel("#{__method__.to_s.titleize}", 6)
284
- click_text(browser, 'Reports')
285
- sleep(2)
286
- click_text(browser, 'Lead Reports')
287
- sleep(2)
288
- click_text(browser, 'Leads By Source')
289
- sleep(2)
290
- validate_text(browser, 'Leads By Source')
291
-
292
- select_option_by_name_and_option_value(browser, 'stdDateFilter', 'today')
293
- click_button_by_value(browser, 'Apply Filter')
294
- sleep(2)
295
- validate_text(browser, 'tester')
296
- end
297
-
298
- def create_chart(browser)
299
- mark_testlevel("#{__method__.to_s.titleize}", 7)
300
- click_button_by_value(browser, 'Delete Chart')
301
- sleep(2)
302
- click_button_by_value(browser, 'Create Chart')
303
- sleep(2)
304
- validate_text(browser, 'Create Chart: Leads By Source')
305
-
306
- browser.frame(:name, 'chartLayer').cell(:text, 'Vertical Bar').click
307
-
308
- #click_id(browser, 'chart1') ## Vertical Bar chart
309
- sleep(2)
310
- click_button_by_value(browser, 'Save')
311
- sleep(3)
312
- end
313
-
314
- def create_campaign(browser)
315
- mark_testlevel("#{__method__.to_s.titleize}", 7)
316
- click_text(browser, 'Home')
317
- sleep(1)
318
- click_text(browser, 'Create Campaign')
319
- set_textfield_by_name(browser, 'property(Campaign Name)', 'Zoho Campaign')
320
- select_option_by_name_and_option_value(browser, 'property(Type)', 'Conference')
321
- select_option_by_name_and_option_value(browser, 'property(Status)', 'Planning')
322
- sleep(1)
323
- set_textfield_by_name(browser, 'property(Start Date)', '03/11/2012')
324
- set_textfield_by_name(browser, 'property(End Date)', '05/20/2012')
325
- #browser.button(:onclick, 'showCalc('property(Actual Cost)')'
326
-
327
- end
328
-
329
- def create_task(browser)
330
- mark_testlevel("#{__method__.to_s.titleize}", 8)
331
- click_text(browser, 'Home')
332
- sleep(1)
333
- click_text(browser, 'New Task')
334
- sleep(2)
335
- validate_text(browser, 'Create Task')
336
-
337
- browser.image(:title, 'Subject Name Lookup').click
338
- sleep(2)
339
- popup = attach_browser_by_url(browser, /Subject/)
340
-
341
- sleep(2)
342
- popup.link(:text, 'Product Demo').click
343
- validate_textfield_value_by_name(browser, /Subject/, 'Product Demo')
344
-
345
- set_textfield_by_name(browser, 'property(Due Date)', '03/11/2012')
346
- select_option_by_name_and_option_value(browser, 'property(leContModSel)', 'Leads')
347
- sleep(1)
348
- select_option_by_name_and_option_value(browser, 'property(leContModSel)', 'Contacts')
349
-
350
- browser.image(:id, 'modNameImg').click
351
- sleep(2)
352
- #attach_popup(browser, :title, /Zoho CRM - Account Name Lookup/)
353
- popup = attach_browser_by_url(browser, "https://crmold.zoho.com/crm/Search.do?searchmodule=Accounts&fldName=modname&fldId=modid&fldLabel=Accounts&fldValue=&user=undefined&condition=undefined")
354
- sleep(1)
355
- set_textfield_by_name(popup, 'fldValue', 'Test Account #1')
356
- click_button_by_value(popup, 'Go')
357
- popup.link(:text, 'Test Account #1').click
358
- close_modal_ie(browser, 'Account Name Lookup')
359
- sleep(2)
360
-
361
- select_option_by_name_and_option_value(browser, 'property(Status)', 'In Progress')
362
- select_option_by_name_and_option_value(browser, 'property(Priority)', 'Normal')
363
- set_textfield_by_name(browser, 'property(Description)', 'This is the task information')
364
- click_button_by_value(browser, 'Save')
365
- sleep(3)
366
- end
367
-
368
- ########################################################################
369
- # EVERYTHING BELOW: TEMPORARY OVERRIDES/ADDITIONS NOT YET IN SHAMISEN pmn 12jul1012
370
- ########################################################################
371
-
372
- def get_variables(file, login = :role, dbg = true)
373
- debug_to_log("#{__method__}: file = #{file}")
374
- debug_to_log("#{__method__}: role = #{login}")
375
-
376
- @var = Hash.new
377
- workbook = Excel.new(file)
378
- data_index = find_sheet_with_name(workbook, 'Data')
379
- workbook.default_sheet = workbook.sheets[data_index]
380
- var_col = 0
381
-
382
- 2.upto(workbook.last_column) do |col|
383
- scriptName = workbook.cell(1, col)
384
- if scriptName == @myName
385
- var_col = col
386
- break
387
- end
388
- end
389
-
390
- 2.upto(workbook.last_row) do |line|
391
- name = workbook.cell(line, 'A')
392
- value = workbook.cell(line, var_col).to_s.strip
393
- @var[name] = value
394
- end
395
-
396
- @var.keys.sort.each do |name|
397
- message_tolog("@var #{name}: '#{@var[name]}'")
398
- end if dbg
399
-
400
- @login = Hash.new
401
- login_col = 0
402
- role_col = 0
403
- userid_col = 0
404
- password_col = 0
405
- url_col = 0
406
- name_col = 0
407
- role_index = find_sheet_with_name(workbook, 'Login')
408
- if role_index >= 0
409
- workbook.default_sheet = workbook.sheets[role_index]
410
-
411
- 1.upto(workbook.last_column) do |col|
412
- a_cell = workbook.cell(1, col)
413
- case a_cell
414
- when @myName
415
- login_col = col
416
- break
417
- when 'role'
418
- role_col = col
419
- when 'userid'
420
- userid_col = col
421
- when 'password'
422
- password_col = col
423
- when 'url'
424
- url_col = col
425
- when 'name'
426
- name_col = col
427
- end
428
- end
429
-
430
- 2.upto(workbook.last_row) do |line|
431
- role = workbook.cell(line, role_col)
432
- userid = workbook.cell(line, userid_col)
433
- password = workbook.cell(line, password_col)
434
- url = workbook.cell(line, url_col)
435
- username = workbook.cell(line, name_col)
436
- enabled = workbook.cell(line, login_col).to_s
437
-
438
- case login
439
- when :id
440
- key = userid
441
- when :role
442
- key = role
443
- else
444
- key = role
445
- end
446
-
447
- @login[key] = Hash.new
448
- @login[key]['role'] = role
449
- @login[key]['userid'] = userid
450
- @login[key]['password'] = password
451
- @login[key]['url'] = url
452
- @login[key]['name'] = username
453
- @login[key]['enabled'] = enabled
454
-
455
- end
456
-
457
- @login.keys.sort.each do |key|
458
- message_tolog("@login (by #{login}): #{key}=>'#{@login[key].to_yaml}'")
459
- end if dbg
460
- end
461
-
462
- rescue
463
- fatal_to_log("#{__method__}: '#{$!}'")
464
- end
465
-
466
- def find_sheet_with_name(workbook, sheet_name)
467
- sheets = workbook.sheets
468
- idx = 0
469
- found = false
470
- sheets.each do |s|
471
- if s == sheet_name
472
- found = true
473
- break
474
- end
475
- idx += 1
476
- end
477
- if found
478
- idx
479
- else
480
- -1
481
- end
482
- end
483
-
484
- end
1
+ module ZohoUtil
2
+
3
+ def run
4
+ if @xls_path
5
+ get_variables(@xls_path, :role)
6
+ @login.each_key do |key|
7
+ if @login[key]['enabled'] == 'Y'
8
+ @user = @login[key]['userid']
9
+ @pass = @login[key]['password']
10
+ @role = @login[key]['role']
11
+ @url1 = @login[key]['url']
12
+ debug_to_report("@user: #{@user}, @pass: #{@pass}, @role: #{@role} (#{__LINE__})")
13
+ break
14
+ end
15
+ end
16
+ else
17
+ @user = "joeklienwatir@gmail.com"
18
+ @pass = 'watir001'
19
+ @url1 = "https://accounts.zoho.com/login?serviceurl=https://www.zoho.com/&hide_signup=true&css=https://www.zoho.com/css/login.css"
20
+ end
21
+
22
+ home_url = 'https://crm.zoho.com/crm/ShowHomePage.do'
23
+ validation = 'Welcome joeklienwatir at Software'
24
+
25
+ browser = open_browser
26
+ go_to_url(browser, @url1)
27
+ zoho_login(browser, @user, @pass, home_url, validation)
28
+ run_test(browser)
29
+ logout(browser)
30
+
31
+ rescue
32
+ fatal_to_log("#{@myName} '#{$!}'")
33
+ browser.close
34
+ raise
35
+ end
36
+
37
+ def zoho_login(browser, userid, password, url, validation = 'Welcome joeklienwatir at Software')
38
+ mark_testlevel("#{__method__.to_s.titleize}", 8)
39
+ set_textfield_by_name(browser, 'lid', userid)
40
+ set_textfield_by_name(browser, 'pwd', password)
41
+ click_button_by_value(browser, 'Sign In')
42
+ go_to_url(browser, url)
43
+ validate_text(browser, validation)
44
+ end
45
+
46
+ def navigate_to_crm(browser)
47
+ mark_testlevel("#{__method__.to_s.titleize}", 3)
48
+ click_text(browser, 'CRM')
49
+ end
50
+
51
+ def navigate_to_project(browser)
52
+ mark_testlevel("#{__method__.to_s.titleize}", 3)
53
+ click_text(browser, 'Projects')
54
+ end
55
+
56
+ def signout(browser)
57
+ mark_testlevel("#{__method__.to_s.titleize}", 8)
58
+ click_text(browser, /Sign Out/)
59
+ end
60
+
61
+ def create_blank_new_account(browser)
62
+ mark_testlevel("#{__method__.to_s.titleize}", 3)
63
+ click_text(browser, 'New Account')
64
+ validate_text(browser, 'Create Account')
65
+ click_button_by_value(browser, 'Save')
66
+ sleep(1)
67
+ close_popup('Message from webpage')
68
+ end
69
+
70
+ def export_accounts(browser)
71
+ mark_testlevel("#{__method__.to_s.titleize}", 5)
72
+ click_text(browser, 'Setup')
73
+ sleep_for(2)
74
+ click_text(browser, 'Export Data')
75
+ sleep_for(2)
76
+ select_option_by_name_and_option_value(browser, 'module', 'Accounts')
77
+ if @use_sikuli
78
+ run_sikuli_script("exportaccounts")
79
+ close_popup('File Download')
80
+ else
81
+ #click_button_no_wait_by_value(browser, 'Export')
82
+ # Make sure popups are allowed by browser
83
+
84
+ mark_testlevel("#{__method__.to_s.titleize} Download", 4)
85
+ filename = 'Account_Export.cvs'
86
+ filepath = "#{@myRoot}/#{filename}"
87
+ filepath.gsub!('/', '\\')
88
+ message_to_log("#{filepath.to_s}")
89
+ if File.exist?(filepath)
90
+ File.delete(filepath)
91
+ end
92
+ sleep(3)
93
+
94
+ click_button_no_wait_by_value(browser, 'Export')
95
+ sleep_for(5)
96
+ close_popup('Message from webpage', 'Are you sure?')
97
+ sleep_for(1)
98
+
99
+ click_button_no_wait_by_value(browser, 'Export')
100
+ sleep_for(3)
101
+ close_popup('Message from webpage', 'Are you sure?')
102
+ sleep_for(3)
103
+
104
+ save_file1(filepath)
105
+ sleep_for(4)
106
+
107
+ #if popup_exists?(popup, 'File Download')
108
+ # save_file(filepath)
109
+ # click_popup_button('File Download', 'Save')
110
+ # file_download(browser)
111
+ # save_file_orig(filepath)
112
+ # close_popup_by_button_title(popup, 'Close', 'Download Complete')
113
+ #end
114
+ end
115
+ end
116
+
117
+ def import_accounts(browser)
118
+ mark_testlevel("#{__method__.to_s.titleize}", 5)
119
+ #click_class(browser, 'menuOn', 'Accounts')
120
+ click_text(browser, 'Accounts')
121
+ click_text(browser, 'Import Accounts')
122
+ click(browser, :button, :value, 'Import Accounts')
123
+ validate_text(browser, 'Import Accounts')
124
+ #click_button_by_name(browser, 'theFile')
125
+ #file_upload(filepath)
126
+ #click_button_by_class(browser, 'button')
127
+ #select_option_by_name_and_option_value(browser, 'CrmAccount:ACCOUNTNAME', 'Account Name')
128
+ #click_button_by_class(browser, 'button')
129
+ #click_button_by_value(browser, 'Import')
130
+ #validate_no_text(browser, '0', 'No of Records added:')
131
+ end
132
+
133
+ def verify_accounts(browser)
134
+ mark_testlevel("#{__method__.to_s.titleize}", 5)
135
+ click_text(browser, 'Accounts')
136
+ validate_text(browser, '<No Accounts found >')
137
+ #select_option_by_class_and_option_value(browser, 'select', 'My Accounts')
138
+ #sleep(1)
139
+ #select_option_by_class_and_option_value(browser, 'select', 'New This Week')
140
+ #sleep(1)
141
+ #select_option_by_class_and_option_value(browser, 'select', 'New Last Week')
142
+ #sleep(1)
143
+ #select_option_by_class_and_option_value(browser, 'select', 'Unread Accounts')
144
+ #sleep(1)
145
+ end
146
+
147
+ def reports(browser)
148
+ mark_testlevel("#{__method__.to_s.titleize}", 6)
149
+ click_text(browser, 'Reports')
150
+ validate_text(browser, 'Recently Accessed Reports')
151
+ validate_text(browser, '<No Recent Reports Found >')
152
+ end
153
+
154
+ def search_accounts(browser)
155
+ mark_testlevel("#{__method__.to_s.titleize}", 6)
156
+ select_option_by_name_and_option_value(browser, 'searchCategory', 'Accounts')
157
+ set_textfield_by_id(browser, 'searchword', 'Test Account #1')
158
+ click_button_by_value(browser, 'Go')
159
+ sleep(3)
160
+ validate_text(browser, 'Search Results')
161
+ end
162
+
163
+ def clone_account(browser)
164
+ mark_testlevel("#{__method__.to_s.titleize}", 5)
165
+ click_text(browser, 'Home')
166
+ sleep(1)
167
+ validate_text(browser, 'Welcome tester at Software')
168
+ click_text(browser, 'Tester')
169
+ sleep(2)
170
+ validate_text(browser, 'Lead Details')
171
+ validate_text(browser, 'Lead Information')
172
+ click_button_by_name(browser, 'Clone')
173
+ sleep(2)
174
+ validate_text(browser, 'Clone Account')
175
+ click_button_by_value(browser, 'Save')
176
+ end
177
+
178
+ def pagination(browser)
179
+ mark_testlevel("#{__method__.to_s.titleize}", 6)
180
+ click_text(browser, 'Accounts')
181
+ sleep(1)
182
+ click_text(browser, 'A')
183
+ sleep(1)
184
+ click_text(browser, 'B')
185
+ sleep(1)
186
+ click_text(browser, 'C')
187
+ sleep(1)
188
+ click_text(browser, 'D')
189
+ sleep(1)
190
+ click_text(browser, 'E')
191
+ sleep(1)
192
+ click_text(browser, 'F')
193
+ sleep(1)
194
+ end
195
+
196
+ def click_headers(browser)
197
+ mark_testlevel("#{__method__.to_s.titleize}", 6)
198
+ click_text(browser, 'Leads')
199
+ sleep(1)
200
+ click_text(browser, 'Accounts')
201
+ sleep(1)
202
+ click_text(browser, 'Contacts')
203
+ sleep(1)
204
+ click_text(browser, 'Potentials')
205
+ sleep(1)
206
+ click_text(browser, 'Campaigns')
207
+ sleep(1)
208
+ click_text(browser, 'Reports')
209
+ sleep(1)
210
+ click_text(browser, 'Dashboards')
211
+ sleep(1)
212
+ click_text(browser, 'Activities')
213
+ sleep(1)
214
+ click_text(browser, 'Cases')
215
+ sleep(1)
216
+ end
217
+
218
+ def new_lead(browser)
219
+ mark_testlevel("#{__method__.to_s.titleize}", 3)
220
+ click_text(browser, 'Leads')
221
+ sleep(2)
222
+ validate_text(browser, 'Leads: All Open Leads')
223
+ click_button_by_value(browser, 'New Lead ')
224
+ sleep(2)
225
+ validate_text(browser, 'Create Lead')
226
+ select_option_by_name_and_option_value(browser, 'property(saltName)', 'Mr.')
227
+ #browser.select_list(:name, 'property(saltName)').select_value(Mr.)
228
+
229
+ set_textfield_by_name(browser, 'property(Company)', 'Test Zoho Company')
230
+ set_textfield_by_name(browser, 'property(Last Name)', 'Tester')
231
+ set_textfield_by_name(browser, 'property(Phone)', '415-999-9999')
232
+
233
+ select_option_by_name_and_option_value(browser, 'property(Lead Source)', 'Advertisement')
234
+ select_option_by_name_and_option_value(browser, 'property(Industry)', 'ASP')
235
+ select_option_by_name_and_option_value(browser, 'property(Lead Status)', 'Contacted')
236
+ select_option_by_name_and_option_value(browser, 'property(Rating)', 'Active')
237
+
238
+
239
+ browser.image(:title, 'Calculator').click
240
+ sleep(4)
241
+ attach_popup_by_url(browser, "https://crmold.zoho.com/crm/Calc.do?currFld=property(Annual%20Revenue)")
242
+ sleep(3)
243
+ close_modal_ie(browser, 'Calculator')
244
+ set_checkbox_by_name(browser, 'property(Email Opt Out)')
245
+ sleep(2)
246
+ clear_checkbox_by_name(browser, 'property(Email Opt Out)')
247
+
248
+
249
+ set_textfield_by_name(browser, 'property(Street)', '1600 Holloway Avenue') ## Address
250
+ set_textfield_by_name(browser, 'property(State)', 'California')
251
+ set_textfield_by_name(browser, 'property(City)', 'San Francisco')
252
+ set_textfield_by_name(browser, 'property(Zip Code)', '94541')
253
+ set_textfield_by_name(browser, 'property(Country)', 'USA')
254
+
255
+ set_textfield_by_name(browser, 'property(Description)', 'This is a description')
256
+ click_button_by_value(browser, 'Save')
257
+ sleep(2)
258
+ end
259
+
260
+ def find_leads(browser)
261
+ mark_testlevel("#{__method__.to_s.titleize}", 5)
262
+ click_text(browser, 'Leads')
263
+ sleep(1)
264
+ set_textfield_by_name(browser, 'newsearchString', 'Test Zoho Company')
265
+ click_button_by_name(browser, 'Go')
266
+ sleep(2)
267
+ validate_text(browser, 'Test Zoho Company')
268
+ end
269
+
270
+ def leads_delete_message(browser)
271
+ mark_testlevel("#{__method__.to_s.titleize}", 4)
272
+ click_text(browser, 'Leads')
273
+ sleep(1)
274
+ set_checkbox_by_name(browser, 'allcheck')
275
+ sleep(1)
276
+ clear_checkbox_by_name(browser, 'allcheck')
277
+ sleep(1)
278
+ click_button_by_value(browser, 'Delete')
279
+ sleep(1)
280
+ close_popup('Message from webpage')
281
+ end
282
+
283
+ def find_lead_reports(browser) ## Find Lead Reports by Source
284
+ mark_testlevel("#{__method__.to_s.titleize}", 6)
285
+ click_text(browser, 'Reports')
286
+ sleep(2)
287
+ click_text(browser, 'Lead Reports')
288
+ sleep(2)
289
+ click_text(browser, 'Leads By Source')
290
+ sleep(2)
291
+ validate_text(browser, 'Leads By Source')
292
+
293
+ select_option_by_name_and_option_value(browser, 'stdDateFilter', 'today')
294
+ click_button_by_value(browser, 'Apply Filter')
295
+ sleep(2)
296
+ validate_text(browser, 'tester')
297
+ end
298
+
299
+ def create_chart(browser)
300
+ mark_testlevel("#{__method__.to_s.titleize}", 7)
301
+ click_button_by_value(browser, 'Delete Chart')
302
+ sleep(2)
303
+ click_button_by_value(browser, 'Create Chart')
304
+ sleep(2)
305
+ validate_text(browser, 'Create Chart: Leads By Source')
306
+
307
+ browser.frame(:name, 'chartLayer').cell(:text, 'Vertical Bar').click
308
+
309
+ #click_id(browser, 'chart1') ## Vertical Bar chart
310
+ sleep(2)
311
+ click_button_by_value(browser, 'Save')
312
+ sleep(3)
313
+ end
314
+
315
+ def create_campaign(browser)
316
+ mark_testlevel("#{__method__.to_s.titleize}", 7)
317
+ click_text(browser, 'Home')
318
+ sleep(1)
319
+ click_text(browser, 'Create Campaign')
320
+ set_textfield_by_name(browser, 'property(Campaign Name)', 'Zoho Campaign')
321
+ select_option_by_name_and_option_value(browser, 'property(Type)', 'Conference')
322
+ select_option_by_name_and_option_value(browser, 'property(Status)', 'Planning')
323
+ sleep(1)
324
+ set_textfield_by_name(browser, 'property(Start Date)', '03/11/2012')
325
+ set_textfield_by_name(browser, 'property(End Date)', '05/20/2012')
326
+ #browser.button(:onclick, 'showCalc('property(Actual Cost)')'
327
+
328
+ end
329
+
330
+ def create_task(browser)
331
+ mark_testlevel("#{__method__.to_s.titleize}", 8)
332
+ click_text(browser, 'Home')
333
+ sleep(1)
334
+ click_text(browser, 'New Task')
335
+ sleep(2)
336
+ validate_text(browser, 'Create Task')
337
+
338
+ browser.image(:title, 'Subject Name Lookup').click
339
+ sleep(2)
340
+ popup = attach_browser_by_url(browser, /Subject/)
341
+
342
+ sleep(2)
343
+ popup.link(:text, 'Product Demo').click
344
+ validate_textfield_value_by_name(browser, /Subject/, 'Product Demo')
345
+
346
+ set_textfield_by_name(browser, 'property(Due Date)', '03/11/2012')
347
+ select_option_by_name_and_option_value(browser, 'property(leContModSel)', 'Leads')
348
+ sleep(1)
349
+ select_option_by_name_and_option_value(browser, 'property(leContModSel)', 'Contacts')
350
+
351
+ browser.image(:id, 'modNameImg').click
352
+ sleep(2)
353
+ #attach_popup(browser, :title, /Zoho CRM - Account Name Lookup/)
354
+ popup = attach_browser_by_url(browser, "https://crmold.zoho.com/crm/Search.do?searchmodule=Accounts&fldName=modname&fldId=modid&fldLabel=Accounts&fldValue=&user=undefined&condition=undefined")
355
+ sleep(1)
356
+ set_textfield_by_name(popup, 'fldValue', 'Test Account #1')
357
+ click_button_by_value(popup, 'Go')
358
+ popup.link(:text, 'Test Account #1').click
359
+ close_modal_ie(browser, 'Account Name Lookup')
360
+ sleep(2)
361
+
362
+ select_option_by_name_and_option_value(browser, 'property(Status)', 'In Progress')
363
+ select_option_by_name_and_option_value(browser, 'property(Priority)', 'Normal')
364
+ set_textfield_by_name(browser, 'property(Description)', 'This is the task information')
365
+ click_button_by_value(browser, 'Save')
366
+ sleep(3)
367
+ end
368
+
369
+ ########################################################################
370
+ # EVERYTHING BELOW: TEMPORARY OVERRIDES/ADDITIONS NOT YET IN SHAMISEN pmn 12jul1012
371
+ ########################################################################
372
+
373
+ def get_variables(file, login = :role, dbg = true)
374
+ debug_to_log("#{__method__}: file = #{file}")
375
+ debug_to_log("#{__method__}: role = #{login}")
376
+
377
+ @var = Hash.new
378
+ workbook = Excel.new(file)
379
+ data_index = find_sheet_with_name(workbook, 'Data')
380
+ workbook.default_sheet = workbook.sheets[data_index]
381
+ var_col = 0
382
+
383
+ 2.upto(workbook.last_column) do |col|
384
+ scriptName = workbook.cell(1, col)
385
+ if scriptName == @myName
386
+ var_col = col
387
+ break
388
+ end
389
+ end
390
+
391
+ 2.upto(workbook.last_row) do |line|
392
+ name = workbook.cell(line, 'A')
393
+ value = workbook.cell(line, var_col).to_s.strip
394
+ @var[name] = value
395
+ end
396
+
397
+ @var.keys.sort.each do |name|
398
+ message_tolog("@var #{name}: '#{@var[name]}'")
399
+ end if dbg
400
+
401
+ @login = Hash.new
402
+ login_col = 0
403
+ role_col = 0
404
+ userid_col = 0
405
+ password_col = 0
406
+ url_col = 0
407
+ name_col = 0
408
+ role_index = find_sheet_with_name(workbook, 'Login')
409
+ if role_index >= 0
410
+ workbook.default_sheet = workbook.sheets[role_index]
411
+
412
+ 1.upto(workbook.last_column) do |col|
413
+ a_cell = workbook.cell(1, col)
414
+ case a_cell
415
+ when @myName
416
+ login_col = col
417
+ break
418
+ when 'role'
419
+ role_col = col
420
+ when 'userid'
421
+ userid_col = col
422
+ when 'password'
423
+ password_col = col
424
+ when 'url'
425
+ url_col = col
426
+ when 'name'
427
+ name_col = col
428
+ end
429
+ end
430
+
431
+ 2.upto(workbook.last_row) do |line|
432
+ role = workbook.cell(line, role_col)
433
+ userid = workbook.cell(line, userid_col)
434
+ password = workbook.cell(line, password_col)
435
+ url = workbook.cell(line, url_col)
436
+ username = workbook.cell(line, name_col)
437
+ enabled = workbook.cell(line, login_col).to_s
438
+
439
+ case login
440
+ when :id
441
+ key = userid
442
+ when :role
443
+ key = role
444
+ else
445
+ key = role
446
+ end
447
+
448
+ @login[key] = Hash.new
449
+ @login[key]['role'] = role
450
+ @login[key]['userid'] = userid
451
+ @login[key]['password'] = password
452
+ @login[key]['url'] = url
453
+ @login[key]['name'] = username
454
+ @login[key]['enabled'] = enabled
455
+
456
+ end
457
+
458
+ @login.keys.sort.each do |key|
459
+ message_tolog("@login (by #{login}): #{key}=>'#{@login[key].to_yaml}'")
460
+ end if dbg
461
+ end
462
+
463
+ rescue
464
+ fatal_to_log("#{__method__}: '#{$!}'")
465
+ end
466
+
467
+ def find_sheet_with_name(workbook, sheet_name)
468
+ sheets = workbook.sheets
469
+ idx = 0
470
+ found = false
471
+ sheets.each do |s|
472
+ if s == sheet_name
473
+ found = true
474
+ break
475
+ end
476
+ idx += 1
477
+ end
478
+ if found
479
+ idx
480
+ else
481
+ -1
482
+ end
483
+ end
484
+
485
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awetestlib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Anthony Woo