sfdc_se 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: acbe1f324cccc7e5301a9a1ef62523c0e58a2355
4
+ data.tar.gz: 85d1764163fbffd82f1d81949c7afd9f94d0e2c9
5
+ SHA512:
6
+ metadata.gz: 603ab0705724ed3baa30ee57936c02795cf8fcbcf2a76a10f10fe1bb370ddf0ea12e3c4feb182a41a2dbccfd4c6c38337ae3e5cc5317fb66575af2f05e55f213
7
+ data.tar.gz: 5b13f0769d7083a1d961f5eb1b959d9b5b43371f89f8d86439e44d9dcabe654100cf4a28dd742ed39b7d6fe033f108e2d09907d7762053c9b579392e7ebeded1
data/lib/sfdc_se.rb ADDED
@@ -0,0 +1,194 @@
1
+ require "sfdc_se/version"
2
+ require "rubygems"
3
+ require "selenium-webdriver"
4
+ require 'restforce'
5
+ require 'rforce'
6
+ require "sfdc_se/pages/page_setup"
7
+ require "sfdc_se/pages/page_deliverability"
8
+ require "sfdc_se/pages/page_homepagelayouts"
9
+ require "sfdc_se/pages/page_personalinformation"
10
+ require "sfdc_se/pages/page_profiles"
11
+ require "sfdc_se/pages/page_sharingsettings"
12
+ require "sfdc_se/pages/page_emailalerts"
13
+ require "sfdc_se/pages/page_fieldupdates"
14
+ require "sfdc_se/pages/page_passwordsecuritysetting"
15
+ require "sfdc_se/pages/page_translate"
16
+ require "sfdc_se/pages/page_renametabslabels"
17
+ require "sfdc_se/general/general"
18
+
19
+ module SfdcSe
20
+ class Driver
21
+
22
+ # -----------------------------
23
+ # initialize
24
+ # => opts:
25
+ # => :browserName = firefox, Chrome, etc (currently only providen for FF, default value)
26
+ # => :implicitWaitSec = the time out for implicit waits in secs; 30 sec default value
27
+ # => :explicitWaitSec = the time out for explicit waits in secs; 30 sec default value
28
+ #
29
+ def initialize(opts = {})
30
+ @browser=opts[:browserName] || 'firefox'.to_sym
31
+ if @browser.is_a? String
32
+ @browser.to_sym
33
+ end
34
+
35
+ @implicitWait=opts[:implicitWaitSec] || 30
36
+ if !@implicitWait.is_a?(Numeric)
37
+ @implicitWait.to_i
38
+ end
39
+
40
+ @explicitWait=opts[:explicitWaitSec] || 30
41
+ if !@explicitWait.is_a?(Numeric)
42
+ @explicitWait.to_i
43
+ end
44
+
45
+ @driver = Selenium::WebDriver.for @browser
46
+ @driver.manage.window.maximize
47
+ @driver.manage.timeouts.implicit_wait = @implicitWait
48
+ setExplicitWait @explicitWait
49
+ return @driver
50
+ end
51
+
52
+ # -----------------------------
53
+ # setExplicitWait
54
+ # => used to set the explicit waits in secs
55
+ # => secs = timeout in secs
56
+ #
57
+ def setExplicitWait(secs)
58
+ @explicitWait=secs || 30
59
+ if !@explicitWait.is_a?(Numeric)
60
+ @explicitWait.to_i
61
+ end
62
+ @wait=Selenium::WebDriver::Wait.new(:timeout => @explicitWait)
63
+ return @wait
64
+ end
65
+
66
+ # -----------------------------
67
+ # navigate_to
68
+ # => url = path to which the browser will navigate to
69
+ #
70
+ def navigate_to(url)
71
+ @driver.navigate.to url
72
+ end
73
+
74
+ # -----------------------------
75
+ # click_Continue_verifyUsername
76
+ # => url = path to which the browser will navigate to
77
+ #
78
+ def click_Continue_verifyUsername
79
+ if @driver.find_elements(:id => 'thePage:inputForm:continue').size > 0
80
+ @driver.find_element(:id => 'thePage:inputForm:continue').click
81
+ end
82
+ end
83
+
84
+ # -----------------------------
85
+ # navigate_to_setup
86
+ # => Navigates to the Setup section/page of SFDC
87
+ #
88
+ def navigate_to_setup
89
+ @driver.find_element(:id => 'userNavLabel').click
90
+ @driver.find_element(:link_text => 'Setup').click
91
+ end
92
+
93
+ # -----------------------------
94
+ # take screenshot
95
+ def save_screenshot(filename)
96
+ @driver.save_screenshot(filename)
97
+ end
98
+
99
+ # -----------------------------
100
+ # close
101
+ def close
102
+ @driver.quit
103
+ end
104
+
105
+ # -----------------------------
106
+ # Header Logo Verification
107
+ def verify_HeaderLogoExists
108
+ if @driver.find_elements(:id => "phHeaderLogoImage").size > 0
109
+ return true
110
+ else
111
+ return false
112
+ end
113
+ end
114
+
115
+ # -----------------------------
116
+ # Translation Abbreviation Converter
117
+ def convert_LanguageAbbreviation(sLanguageAbbrevation)
118
+ case sLanguageAbbrevation
119
+ when "zh_CN"
120
+ return "Chinese (Simplified)"
121
+ when "zh_TW"
122
+ return "Chinese (Traditional)"
123
+ when "da"
124
+ return "Danish"
125
+ when "nl_NL"
126
+ return "Dutch"
127
+ when "en_US"
128
+ return "English"
129
+ when "fi"
130
+ return "Finnish"
131
+ when "fr"
132
+ return "French"
133
+ when "de"
134
+ return "German"
135
+ when "it"
136
+ return "Italian"
137
+ when "ja"
138
+ return "Japanese"
139
+ when "ko"
140
+ return "Korean"
141
+ when "no"
142
+ return "Norwegian"
143
+ when "pt_BR"
144
+ return "Portuguese (Brazilian)"
145
+ when "ru"
146
+ return "Russian"
147
+ when "es"
148
+ return "Spanish"
149
+ when "es_MX"
150
+ return "Spanish (Mexican)"
151
+ when "sv"
152
+ return "Swedish"
153
+ when "th"
154
+ return "Thai"
155
+ when "ar"
156
+ return "Arabic"
157
+ when "bg"
158
+ return "Bulgarian"
159
+ when "hr"
160
+ return "Croatian"
161
+ when "cs"
162
+ return "Czech"
163
+ when "en_GB"
164
+ return "English (UK)"
165
+ when "el"
166
+ return "Greek"
167
+ when "iw"
168
+ return "Hebrew"
169
+ when "hu"
170
+ return "Hungarian"
171
+ when "in"
172
+ return "Indonesian"
173
+ when "pl"
174
+ return "Polish"
175
+ when "pt_PT"
176
+ return "Portuguese (European)"
177
+ when "ro"
178
+ return "Romanian"
179
+ when "sk"
180
+ return "Slovak"
181
+ when "sl"
182
+ return "Slovene"
183
+ when "tr"
184
+ return "Turkish"
185
+ when "uk"
186
+ return "Ukrainian"
187
+ when "vi"
188
+ return "Vietnamese"
189
+ end
190
+ end
191
+ # -----------------------------
192
+
193
+ end
194
+ end
@@ -0,0 +1,78 @@
1
+ # ----------------------------------------------
2
+ # - Page: General Operations, SOQL
3
+ # ----------------------------------------------
4
+
5
+ module SfdcSe
6
+ class Driver
7
+
8
+ # -----------------------------
9
+ def raw_login(username, password, host)
10
+ binding = RForce::Binding.new %{https://#{host}/services/Soap/u/36.0}
11
+ resp = binding.login( username, password )
12
+ server_url = resp[:loginResponse][:result][:serverUrl]
13
+ uri = URI(server_url)
14
+ {
15
+ :instance_url => %{#{uri.scheme}://#{uri.host}},
16
+ :oauth_token => resp[:loginResponse][:result][:sessionId]
17
+ }
18
+ end
19
+ # -----------------------------
20
+
21
+ # -----------------------------
22
+ def restforce_client(options)
23
+ Restforce.new( raw_login(options[:username], options[:password], (options[:sandbox] ? 'test.salesforce.com' : 'login.salesforce.com') ).merge(:api_version => '36.0') )
24
+ end
25
+ # -----------------------------
26
+
27
+ # -----------------------------
28
+ # get_LocaleSidKey(blnSandbox, sUserName, sPassword)
29
+ # => Returns the Org LocaleSidKey
30
+ def get_LocaleSidKey(blnSandbox, sUserName, sPassword)
31
+
32
+ ENV['http_proxy']='http://webproxy.merck.com:8080'
33
+ ENV['https_proxy']='https://webproxy.merck.com:8080'
34
+
35
+ client=restforce_client({:sandbox => blnSandbox, :username => sUserName, :password => sPassword})
36
+ resp_SOQL=client.query("SELECT LocaleSidKey FROM User WHERE Username = '#{sUserName}'")
37
+ if resp_SOQL.size == 1
38
+ resp_SOQL.each do |r|
39
+ return r['LocaleSidKey']
40
+ end
41
+ end
42
+
43
+ ENV.delete('HTTP_PROXY')
44
+ ENV.delete('HTTPS_PROXY')
45
+ end
46
+ # -----------------------------
47
+
48
+ # -----------------------------
49
+ # set_LocaleSidKey(blnSandbox, sUserName, sPassword, LocaleSidKey)
50
+ # => Returns true or false
51
+ def set_LocaleSidKey(blnSandbox, sUserName, sPassword, sLocaleSidKey)
52
+ ENV['http_proxy']='http://webproxy.merck.com:8080'
53
+ ENV['https_proxy']='https://webproxy.merck.com:8080'
54
+
55
+ blnRep=false
56
+
57
+ client=restforce_client({:sandbox => blnSandbox, :username => sUserName, :password => sPassword})
58
+ resp_SOQL=client.query("SELECT Id,LocaleSidKey FROM User WHERE Username = '#{sUserName}'")
59
+
60
+ if resp_SOQL.size > 0
61
+ resp_SOQL.each do |r|
62
+ if r['LocaleSidKey'] != sLocaleSidKey
63
+ client.update('User', Id: r['Id'], LocaleSidKey: sLocaleSidKey) ? blnRep=true : blnRep=false
64
+ elsif r['LocaleSidKey'] == sLocaleSidKey
65
+ blnRep=true
66
+ end
67
+ end
68
+ end
69
+
70
+ ENV.delete('HTTP_PROXY')
71
+ ENV.delete('HTTPS_PROXY')
72
+
73
+ return blnRep
74
+ end
75
+ # -----------------------------
76
+
77
+ end
78
+ end
@@ -0,0 +1,56 @@
1
+ # ------------------------
2
+ # - Page: Deliverability
3
+ # -- Body of the page
4
+ # ------------------------
5
+
6
+ module SfdcSe
7
+ class Driver
8
+ # -----------------------------
9
+ # click_Btn_DeliverabilitySave
10
+ # => Clicks the 'save' button and waits for the Success text message to be displayed
11
+ #
12
+ def click_Btn_Deliverability_Save
13
+ # -- Clicks the 'Save' button
14
+ @driver.find_element(:id => "thePage:theForm:editBlock:buttons:saveBtn").click
15
+ # -- Waits for the confirmation that the save was successful
16
+ wait.until{@driver.find_element(:id => "thePage:theForm:successText").displayed?}
17
+ end
18
+
19
+ # -----------------------------
20
+ # get_elements_AccessLevel
21
+ # => returns all the elements for the Access Level dropdown
22
+ def get_elements_Devliverability_AccessLevel
23
+ return @driver.find_elements(:xpath => "//td[@class='data2Col first last ']/select/option")
24
+ end
25
+
26
+ # -----------------------------
27
+ # get_CurrentSelection_AccessLevel
28
+ # => returns the currently selected value
29
+ #
30
+ def get_CurrentSelection_Devliverability_AccessLevel
31
+ # -- Deliverability > Access to Send Email > Access Level
32
+ options=get_elements_Devliverability_AccessLevel
33
+ options.each do |option|
34
+ if option.selected?
35
+ return option.text
36
+ end
37
+ end
38
+ end
39
+
40
+ # -----------------------------
41
+ # set_selection_AccessLevel
42
+ # => value = string of the value to select in the dropdown
43
+ # => returns the selected value
44
+ #
45
+ def set_selection_Devliverability_AccessLevel(value)
46
+ options=get_elements_Devliverability_AccessLevel
47
+ options.each do |option_s|
48
+ if option_s.text == value
49
+ option_s.click
50
+ return option_s.text
51
+ end
52
+ end
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,332 @@
1
+ # ----------------------------------------------
2
+ # - Page: Email Alerts
3
+ # ----------------------------------------------
4
+
5
+ module SfdcSe
6
+ class Driver
7
+
8
+ # -----------------------------
9
+ # click_btn_EmailAlertContinue
10
+ # => Clicks the 'Continue' button on the Email Alerts page
11
+ #
12
+ def click_Btn_EmailAlertContinue
13
+ @driver.find_element(:xpath => "//input[@class='btn' and @title='Continue']").click
14
+ end
15
+ # -----------------------------
16
+
17
+ # -----------------------------
18
+ # click_btn_EmailAlertsEditCancel
19
+ # => Clicks the 'Cancle' button on the Email Alerts Edit page
20
+ #
21
+ def click_btn_EmailAlertsEditCancel
22
+ @driver.find_element(:xpath => "//td[@id='bottomButtonRow']/input[@class='btn' and @title='Cancel']").click
23
+ end
24
+ # -----------------------------
25
+
26
+ # -----------------------------
27
+ # click_btn_EmailAlertEditSave
28
+ # => Clicks the 'Save' button on the Email Alerts Edit page
29
+ #
30
+ def click_btn_EmailAlertEditSave
31
+ # - Click the Save button and handle Alert if prompted; always Accept.
32
+ @driver.find_element(:xpath => "//td[@id='topButtonRow']/input[@class='btn' and @title='Save']").click
33
+ sMsg=""
34
+ a=@driver.switch_to.alert rescue "Exception happened"
35
+ if !(a == "Exception happened")
36
+ sMsg= "Accepting Alert: #{a.text}"
37
+ a.accept
38
+ end
39
+
40
+ # - Click the 'Bread Crumb' link to return to full Email Alert List View
41
+ @driver.find_element(:xpath => "//div[@class='ptBreadcrumb']/a").click
42
+
43
+ # - Return Text from Alert, if present
44
+ return sMsg
45
+ end
46
+ # -----------------------------
47
+
48
+ # -----------------------------
49
+ # click_btn_EmailAlertsNew
50
+ # => Clicks the 'New Email Alert' button on the Email Alerts page
51
+ #
52
+ def click_btn_EmailAlertsNew
53
+ @driver.find_element(:xpath => "//input[@class='btn' and @title='New Email Alert']").click
54
+ end
55
+ # -----------------------------
56
+
57
+ # -----------------------------
58
+ # get_EmailAlertsView_Options
59
+ # => returns all the elements for the Email Alerts dropdown
60
+ #
61
+ def get_EmailAlertsViewOptions
62
+ return @driver.find_elements(:xpath => "//select[@id='fcf' and @title='View:']/option")
63
+ end
64
+ # -----------------------------
65
+
66
+ # -----------------------------
67
+ # get_EmailAlertsTable
68
+ # => returns all the elements for the Email Alerts Table
69
+ def get_EmailAlertsTable
70
+ return @driver.find_elements(:xpath => "//table[@class='list']/tbody/tr")
71
+ end
72
+ # -----------------------------
73
+
74
+ # -----------------------------
75
+ # get_EmailAlertsEditTable
76
+ # => returns all the elements for the Email Alerts Edit Table
77
+ def get_EmailAlertsEditTable
78
+ return @driver.find_elements(:xpath => "//table[@class='detailList']/tbody/tr")
79
+ end
80
+ # -----------------------------
81
+
82
+ # -----------------------------
83
+ # set_EmailAlerts_View
84
+ # => sViewName = string value of the Sharing Setting option to select
85
+ # => Return = true or false
86
+ # => true = setting of view were successful
87
+ # => false = setting of view had an error
88
+ #
89
+ def set_EmailAlerts_View(sViewName)
90
+ blnViewSet=false
91
+ begin
92
+ get_EmailAlertsViewOptions.each do |option|
93
+ if option.text == sViewName
94
+ option.click unless option.selected?
95
+ blnViewSet=true
96
+ return blnViewSet
97
+ end
98
+ end
99
+ rescue
100
+ puts $!
101
+ puts $@
102
+ end
103
+ return blnViewSet
104
+ end
105
+ # -----------------------------
106
+
107
+ # -----------------------------
108
+ # click_Edit_EmailAlertsTable
109
+ # => sDescriptionName = string value of the Email Alert to click Edit
110
+ # => Return = true or false
111
+ # => true = value was found and 'edit' clicked
112
+ # => false =value was not found or had an error
113
+ #
114
+ def click_Edit_EmailAlertsTable(sDescriptionName)
115
+ blnEdit=false
116
+ get_EmailAlertsTable.each do |row|
117
+ if row.find_element(:xpath => "./th[1]").text == sDescriptionName
118
+ row.find_element(:xpath => "./td[1]/a[1]").click
119
+ blnEdit=true
120
+ break
121
+ end
122
+ end
123
+ return blnEdit
124
+ end
125
+ # -----------------------------
126
+
127
+ # -----------------------------
128
+ # get_EmailAlert_Configuration
129
+ # => Return = Hash {Key= Field Name/Type, Value=Field Value}
130
+ #
131
+ def get_EmailAlert_Configuration
132
+ response=Hash.new
133
+ get_EmailAlertsEditTable.each_with_index do |row, idx|
134
+ case idx
135
+ when 0,1
136
+ # 0 = Description, 1 = Uniique Name
137
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0
138
+ when 2
139
+ # - 2 = Object
140
+ response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text
141
+ when 4, 7, 8
142
+ # - 4,7 = Blank Row, 8 = Text, no configurable item
143
+ # - Do nothing, row not required
144
+ when 3
145
+ # - 3 = Email Template
146
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/span/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0
147
+ when 5
148
+ # - 5 = Recipient Type
149
+ $sSearchOpt=row.find_element(:xpath => "./td[2]/div/select/option[@selected='']").text
150
+ $sForField=row.find_element(:xpath => "./td[2]/div/input[@id='searchValue_userFilter']").attribute("value")
151
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]="#{$sSearchOpt};#{$sForField}"
152
+ when 6
153
+ # - 6 = Recipents
154
+ # - Get Selected Recipients
155
+ $aSelected=[]
156
+ row.find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[3]/select/option").each do |sr|
157
+ $aSelected.push(sr.text)
158
+ end
159
+ response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=$aSelected
160
+ when 9
161
+ # - 9 = Additional Emails
162
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/textarea").text
163
+ when 10
164
+ # - 10 = From Email Address
165
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text
166
+ when 11
167
+ # - 11 = Checkbox; Make this address the default From email address for this object's email alerts
168
+ row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? response[row.find_element(:xpath => "./td[2]/label").text]="false" : response[row.find_element(:xpath => "./td[2]/label").text]=row.find_element(:xpath => "./td[2]/input").attribute("checked")
169
+ # response[row.find_element(:xpath => "./td[2]/label").text]=row.find_element(:xpath => "./td[2]/input").attribute("value")
170
+ end
171
+ end
172
+ return response
173
+ end
174
+ # -----------------------------
175
+
176
+
177
+ # -----------------------------
178
+ # set_EmailAlert_Configuration
179
+ # => sObjName = string value of the object to set
180
+ # => hObjValues = Email Alert Field Hash {Field, Value}
181
+ # => addnew = Boolean, defaults to false unless true is passed
182
+ # - Set to true to create a new Email Alert (rather then adjusting the configuration of an existing one)
183
+ # => return = true/false
184
+ # - True = Email Alert Configuration was updated
185
+ # - False = Email Alert Configration was NOT updated
186
+ #
187
+ def set_EmailAlert_Configuration(sObjName, hObjValues, addnew=false)
188
+ addnew=false unless addnew==true
189
+ blnUpdateReturn=false
190
+ r=0
191
+
192
+ while r < get_EmailAlertsEditTable.length
193
+ case r
194
+ when 0,1
195
+ # 0 = Description, 1 = Uniique Name
196
+ if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/input").attribute("value"))
197
+ get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/input").send_keys(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")])
198
+ blnUpdateReturn=true
199
+ end
200
+ when 2
201
+ # - 2 = Object - Not configurable
202
+ if addnew
203
+ get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/select/option").each do |option|
204
+ if option.text == hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")]
205
+ option.click unless option.selected?
206
+ break
207
+ end
208
+ end
209
+ end
210
+ when 4, 7, 8
211
+ # - 4,7 = Blank Row, 8 = Text, no configurable item
212
+ # - Do nothing, row not required
213
+ when 3
214
+ # - 3 = Email Template
215
+ if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/span/input").attribute("value"))
216
+ get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/span/input").send_keys(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")])
217
+ blnUpdateReturn=true
218
+ end
219
+ when 5
220
+ # - 5 = Recipient Type - Not a configurable item, used for Selected Recipients section
221
+ $precedRow=get_EmailAlertsEditTable[r]
222
+ when 6
223
+ # - 6 = Recipents
224
+ #-Gets current Selected Recipents list
225
+ $aSelected=[]
226
+ get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[3]/select/option").each do |sr|
227
+ $aSelected.push(sr.text)
228
+ end
229
+
230
+ #-Returns the Recipents that need to be added to the Selected List
231
+ aAddRecipents=hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")]-$aSelected
232
+ if aAddRecipents.size > 0
233
+ # - Add Required Recipents
234
+ aAddRecipents.each do |adduser|
235
+ searchItem=""
236
+ searchName=""
237
+
238
+ case
239
+ when adduser.include?(": ")
240
+ searchItem=adduser[0..(adduser.index(": ")-1)]
241
+ searchItem="Public Groups" if adduser[0..(adduser.index(": ")-1)] == "Group"
242
+ searchName=adduser[(adduser.index(": ")+2)..-1]
243
+ when adduser == "Account Owner"
244
+ searchItem=adduser
245
+ searchName=adduser
246
+ when adduser.include?("Creator")
247
+ searchItem="Creator"
248
+ searchName=adduser
249
+ when adduser == "Lead or Contact Owner"
250
+ searchItem="Related Lead or Contact Owner"
251
+ searchName=adduser
252
+ when adduser.include?("Owner")
253
+ searchItem="Owner"
254
+ searchName=adduser
255
+ end
256
+
257
+ if !searchItem.nil?
258
+ $precedRow.find_elements(:xpath => "./td[2]/div/select/option").each do |option|
259
+ if option.text == searchItem
260
+ #-Recipient Type Search Option selection
261
+ option.click unless option.selected?
262
+
263
+ #-Recipient 'For' textbox, to narrow down 'Available Recipients' list
264
+ $precedRow.find_element(:xpath => "./td[2]/div/input[@type='text' and @id='searchValue_userFilter']").clear()
265
+ $precedRow.find_element(:xpath => "./td[2]/div/input[@type='text' and @id='searchValue_userFilter']").send_keys(searchName)
266
+ $precedRow.find_element(:xpath => "./td[2]/div/input[@class='btn' and @title='Find']").click
267
+
268
+ #-Select and move to right, Recipient (from Avialable list)
269
+ get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[1]/select/option").each do |option|
270
+ if option.text == adduser
271
+ option.click
272
+ end
273
+ end
274
+ get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/table/tbody/tr/td[2]/div[2]/a").click
275
+ end
276
+ end
277
+ end
278
+ end
279
+
280
+ blnUpdateReturn=true
281
+ end
282
+
283
+ #-Returns the Recipents that need to be removed from the current Selected List
284
+ aRemoveRecipents=$aSelected-hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")]
285
+ aRemoveRecipents=aRemoveRecipents-["--None--"]
286
+ if aRemoveRecipents.size > 0
287
+ aRemoveRecipents.each do |removeRecipient|
288
+ get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[3]/select/option").each do |option|
289
+ if option.text == removeRecipient
290
+ option.click unless option.selected?
291
+ end
292
+ end
293
+ get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/table/tbody/tr/td[2]/div[3]/a").click
294
+ end
295
+ puts "Recipents to Remove: #{aRemoveRecipents}"
296
+ blnUpdateReturn=true
297
+ end
298
+
299
+ when 9
300
+ # - 9 = Additional Emails
301
+ if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/textarea").text)
302
+ get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/textarea").send_keys(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")])
303
+ blnUpdateReturn=true
304
+ end
305
+ when 10
306
+ # - 10 = From Email Address
307
+ if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text)
308
+ get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/select/option").each do |option|
309
+ if option.text == hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label")]
310
+ option.click unless option.selected?
311
+ blnUpdateReturn=true
312
+ end
313
+ end
314
+ end
315
+
316
+ when 11
317
+ # - 11 = Checkbox; Make this address the default From email address for this object's email alerts
318
+ checkboxStatus=get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? "false" : "true"
319
+ if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/label").text] == checkboxStatus)
320
+ get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/input").click
321
+ blnUpdateReturn=true
322
+ end
323
+ end
324
+ r+=1
325
+ end
326
+
327
+ return blnUpdateReturn
328
+ end
329
+ # -----------------------------
330
+
331
+ end
332
+ end