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.
@@ -0,0 +1,321 @@
1
+ # -----------------------------------------------
2
+ # - Page: Setup Navigation Bar (left hand side) -
3
+ # -----------------------------------------------
4
+
5
+ module SfdcSe
6
+ class Driver
7
+ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
8
+ # ------------------------------------------------------------
9
+ # ---- Under the Personal Setup Section of the Setup Menu ----
10
+ # ------------------------------------------------------------
11
+ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
12
+
13
+ # -----------------------------
14
+ # click_MyPersonalInformation_icon
15
+ # => Clicks the arrow icon for 'My Personal Information' from the Setup Menu
16
+ #
17
+ def click_MyPersonalInformation_icon
18
+ @driver.find_element(:id => 'PersonalInfo_icon').click if @driver.find_element(:id => 'PersonalInfo').attribute("class") == "parent"
19
+ end
20
+
21
+ # -----------------------------
22
+ # click_MyPersonalInformation
23
+ # => Clicks the link for 'My Personal Information' from the Setup Menu
24
+ #
25
+ def click_MyPersonalInformation
26
+ @driver.find_element(:id => 'PersonalInfo_font').click
27
+ end
28
+
29
+ # -----------------------------
30
+ # click_MyPersonalInformation_PersonalInformation
31
+ # => Clicks the Personal Information link under My Personal Information from the Setup Menu
32
+ #
33
+ def click_MyPersonalInformation_PersonalInformation
34
+ @driver.find_element(:id => 'PersonalInformation_font').click
35
+ end
36
+
37
+ # -----------------------------
38
+ # navigate_MyPersonalInformation_PersonalInformation
39
+ # => Navigates to the Personal Information page
40
+ #
41
+ def navigate_MyPersonalInformation_PersonalInformation
42
+ click_MyPersonalInformation_icon
43
+ click_MyPersonalInformation_PersonalInformation
44
+ end
45
+
46
+ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
47
+ # ------------------------------------------------------
48
+ # ----Under the App Setup Section of the Setup Menu ----
49
+ # ------------------------------------------------------
50
+ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
51
+
52
+ # ---------------------------
53
+ # ---- Customize Section ----
54
+ # ---------------------------
55
+
56
+ # -----------------------------
57
+ # click_Customize_icon
58
+ # => Clicks the arrow icon for Customize from the Setup Menu
59
+ #
60
+ def click_Customize_icon
61
+ @driver.find_element(:id => "Customize_icon").click if @driver.find_element(:id => "Customize").attribute("class") == "parent"
62
+ end
63
+ # -----------------------------
64
+
65
+ # -----------------------------
66
+ # click_Customize
67
+ # => Clicks the link for Customize from the Setup Menu
68
+ #
69
+ def click_Customize
70
+ @driver.find_element(:link_text => "Customize").click
71
+ end
72
+ # -----------------------------
73
+
74
+ # -----------------------------
75
+ # click_Home_icon
76
+ # => Clicks the arrow icon for Home from the Setup Menu
77
+ #
78
+ def click_Home_icon
79
+ @driver.find_element(:id => "Home_icon").click if @driver.find_element(:id => "Home").attribute("class") == "parent"
80
+ end
81
+ # -----------------------------
82
+
83
+ # -----------------------------
84
+ # click_Home
85
+ # => Clicks the link for Home from the Setup Menu
86
+ #
87
+ def click_Home
88
+ @driver.find_element(:id => "Home_font").click
89
+ end
90
+ # -----------------------------
91
+
92
+ # -----------------------------
93
+ # click_HomePageLayouts
94
+ # => Clicks the link for Home Page Layouts from the Setup Menu
95
+ #
96
+ def click_HomePageLayouts
97
+ @driver.find_element(:id => "HomePageLayouts_font").click
98
+ end
99
+ # -----------------------------
100
+
101
+ # -----------------------------
102
+ # navigate_Customize_Home_HomePageLayouts
103
+ #
104
+ def navigate_Customize_Home_HomePageLayouts
105
+ click_Customize_icon
106
+ click_Home_icon
107
+ click_HomePageLayouts
108
+ end
109
+ # -----------------------------
110
+
111
+ # -----------------------------
112
+ # click_Create_icon
113
+ # => Clicks the arrow icon for Create from the Setup Menu
114
+ #
115
+ def click_Create_icon
116
+ @driver.find_element(:id => "DevTools_icon").click if @driver.find_element(:xpath => "//div[@id='DevTools']/a/img").attribute("title").include? "Expand"
117
+ end
118
+ # -----------------------------
119
+
120
+ # -----------------------------
121
+ # click_WorkflowApprovals_icon
122
+ # => Clicks the arrow icon for Workflow & Approvals from the Setup Menu
123
+ #
124
+ def click_WorkflowApprovals_icon
125
+ @driver.find_element(:id => "Workflow_icon").click if @driver.find_element(:xpath => "//a[@id='Workflow_icon']/img").attribute("title").include? "Expand"
126
+ end
127
+ # -----------------------------
128
+
129
+ # -----------------------------
130
+ # click_EmailAlerts
131
+ # => Clicks the link for Email Alerts from the Setup Menu
132
+ #
133
+ def click_EmailAlerts
134
+ @driver.find_element(:id => "WorkflowEmails_font").click
135
+ end
136
+ # -----------------------------
137
+
138
+ # -----------------------------
139
+ # click_FieldUpdates
140
+ # => Clicks the link for Field Updates from the Setup Menu
141
+ #
142
+ def click_FieldUpdates
143
+ @driver.find_element(:id => "WorkflowFieldUpdates_font").click
144
+ end
145
+ # -----------------------------
146
+
147
+ # -----------------------------
148
+ # navigate_Create_WorkflowApprovals_EmailAlerts
149
+ # => Navigates to the Create > Workflow & Approvals > Email Alerts from the Setup Menu
150
+ #
151
+ def navigate_Create_WorkflowApprovals_EmailAlerts
152
+ click_Create_icon
153
+ click_WorkflowApprovals_icon
154
+ click_EmailAlerts
155
+ end
156
+ # -----------------------------
157
+
158
+ # -----------------------------
159
+ # navigate_Create_WorkflowApprovals_FieldUpdates
160
+ # => Navigates to the Create > Workflow & Approvals > Field Updates from the Setup Menu
161
+ #
162
+ def navigate_Create_WorkflowApprovals_FieldUpdates
163
+ click_Create_icon
164
+ click_WorkflowApprovals_icon
165
+ click_FieldUpdates
166
+ end
167
+ # -----------------------------
168
+
169
+ # -----------------------------
170
+ # click_TabNamesLabels_arrow
171
+ # => Clicks the arrow icon for Tab Names and Labels from the Setup Menu
172
+ #
173
+ def click_TabNamesLabels_arrow
174
+ @driver.find_element(:id => "Tab_icon").click if @driver.find_element(:id => "Tab").attribute("class") == "parent"
175
+ end
176
+ # -----------------------------
177
+
178
+ # -----------------------------
179
+ # click_RenameTabsLabels_TabNamesLabels
180
+ # => Clicks the link for Rename Tabs and Labels from the Setup Menu
181
+ #
182
+ def click_RenameTabsLabels_TabNamesLabels
183
+ @driver.find_element(:id => "RenameTab_font").click
184
+ end
185
+ # -----------------------------
186
+
187
+ # -----------------------------
188
+ # navigate_Customize_TabNamesLabels_RenameTabsLabels
189
+ # => Navigates to the Customize > Tab Names and Labels > Rename Tabs and Labels from the Setup Menu
190
+ #
191
+ def navigate_Customize_TabNamesLabels_RenameTabsLabels
192
+ click_Customize_icon
193
+ click_TabNamesLabels_arrow
194
+ click_RenameTabsLabels_TabNamesLabels
195
+ end
196
+ # -----------------------------
197
+
198
+ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
199
+ # ------------------------------------------------------------------
200
+ # ---- Under the Administration Setup Section of the Setup Menu ----
201
+ # ------------------------------------------------------------------
202
+ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
203
+
204
+ # -----------------------------
205
+ # click_ManageUsers_arrow
206
+ # => Clicks the arrow icon for Manage Users from the Setup Menu
207
+ #
208
+ def click_ManageUsers_arrow
209
+ @driver.find_element(:id => 'Users_icon').click if @driver.find_element(:xpath => "//a[@id='Users_icon']/img").attribute("title").include? "Expand"
210
+ end
211
+ # -----------------------------
212
+
213
+ # -----------------------------
214
+ # click_Manageusers_Profiles
215
+ # => Clicks the Profiles link under Manager Users from the Setup Menu
216
+ #
217
+ def click_Manageusers_Profiles
218
+ # -- Click the 'arrow icon' for Manage Users from Setup Nav Bar
219
+ @driver.find_element(:id => 'EnhancedProfiles_font').click
220
+ end
221
+ # -----------------------------
222
+
223
+ # -----------------------------
224
+ # navigate_ManageUsers_Profiles
225
+ # => Navigates to the Manage Users Profiles page
226
+ #
227
+ def navigate_ManageUsers_Profiles
228
+ click_ManageUsers_arrow
229
+ click_Manageusers_Profiles
230
+ end
231
+ # -----------------------------
232
+
233
+ # -----------------------------
234
+ # click_EmailAdministration_icon
235
+ # => Clicks the arrow icon for Email Administration from the Setup Menu
236
+ #
237
+ def click_EmailAdministration_icon
238
+ # -- Click the 'arrow icon' for Email Administration from Setup Nav Bar
239
+ @driver.find_element(:id => 'EmailAdmin_icon').click if @driver.find_element(:id => 'EmailAdmin').attribute("class") == "parent"
240
+ end
241
+ # -----------------------------
242
+
243
+ # -----------------------------
244
+ # click_EmailAdministration_Deliverability
245
+ # => Clicks the Deliverability link under Email Administration from the Setup Menu
246
+ #
247
+ def click_EmailAdministration_Deliverability
248
+ # -- Click the 'Deliverability' from the Setup Nav Bar
249
+ @driver.find_element(:id => 'OrgEmailSettings_font').click
250
+ end
251
+ # -----------------------------
252
+
253
+ # -----------------------------
254
+ # navigate_EmailAdministration_Deliverability
255
+ # => Navigates to the Email Administration Deliverability page
256
+ #
257
+ def navigate_EmailAdministration_Deliverability
258
+ click_EmailAdministration_icon
259
+ click_EmailAdministration_Deliverability
260
+ end
261
+ # -----------------------------
262
+
263
+ # -----------------------------
264
+ # click_SecurityControls_arrow
265
+ # => Clicks the arrow icon for Security Controls under Administrative Setup from the Setup Menu
266
+ #
267
+ def click_SecurityControls_arrow
268
+ @driver.find_element(:id => 'Security_icon').click if @driver.find_element(:id => 'Security').attribute("class") == "parent"
269
+ end
270
+ # -----------------------------
271
+
272
+ # -----------------------------
273
+ # click_SharingSettings_SecurityControls
274
+ # => Clicks the Sharing Settings link under Security Controls from the Setup Menu
275
+ #
276
+ def click_SharingSettings_SecurityControls
277
+ @driver.find_element(:id => 'SecuritySharing_font').click
278
+ end
279
+ # -----------------------------
280
+
281
+ # -----------------------------
282
+ # navigate_SecurityControls_SharingSettings
283
+ # => Navigates to the Security Control > Sharing Settings page
284
+ #
285
+ def navigate_SecurityControls_SharingSettings
286
+ click_SecurityControls_arrow
287
+ click_SharingSettings_SecurityControls
288
+ end
289
+ # -----------------------------
290
+
291
+ # -----------------------------
292
+ # click_TranslationWorkbench_arrow
293
+ # => Clicks the arrow icon for Translations Workbench under Administrative Setup from the Setup Menu
294
+ #
295
+ def click_TranslationWorkbench_arrow
296
+ # @driver.find_element(:id => 'LabelWorkbench_icon').click if @driver.find_element(:id => 'LabelWorkbench').attribute("class") == "parent"
297
+ @driver.find_element(:id => 'LabelWorkbench_icon').click if @driver.find_element(:xpath => "//a[@id='LabelWorkbench_icon']/img").attribute("title").include? "Expand"
298
+ end
299
+ # -----------------------------
300
+
301
+ # -----------------------------
302
+ # click_Translate_TranslationWorkbench
303
+ # => Clicks the Translate link under Translation Workbench from the Setup Menu
304
+ #
305
+ def click_Translate_TranslationWorkbench
306
+ @driver.find_element(:id => 'LabelWorkbenchTranslate_font').click
307
+ end
308
+ # -----------------------------
309
+
310
+ # -----------------------------
311
+ # navigate_TranslationWorkbench_Translate
312
+ # => Navigates to Translation Workbench > Translate from the Setup Menu
313
+ #
314
+ def navigate_TranslationWorkbench_Translate
315
+ click_TranslationWorkbench_arrow
316
+ click_Translate_TranslationWorkbench
317
+ end
318
+ # -----------------------------
319
+
320
+ end
321
+ end
@@ -0,0 +1,264 @@
1
+ # ----------------------------------------------
2
+ # - Page: Sharing Settings
3
+ # ----------------------------------------------
4
+
5
+ module SfdcSe
6
+ class Driver
7
+
8
+ # -----------------------------
9
+ # get_SharingSettingOptions
10
+ # => returns all the elements for the Sharing Settings dropdown
11
+ def get_SharingSettingOptions
12
+ return @driver.find_elements(:xpath => "//select[@id='st']/option")
13
+ end
14
+ # -----------------------------
15
+
16
+ # -----------------------------
17
+ # get_SharingSettingAccessTable
18
+ # => returns all the elements for the Sharing Settings Access Table
19
+ def get_SharingSettingAccessTable
20
+ return @driver.find_elements(:xpath => "//table[@class='list']/tbody/tr")
21
+ end
22
+ # -----------------------------
23
+
24
+ # -----------------------------
25
+ # get_SharingSettingAccessTable_Edit
26
+ # => returns all the elements for the Sharing Settings Access Table
27
+ def get_SharingSettingAccessTable_Edit
28
+ return @driver.find_elements(:xpath => "//table[@class='detailList']/tbody/tr")
29
+ end
30
+ # -----------------------------
31
+
32
+
33
+ # -----------------------------
34
+ # click_Btn_SharingSettingsAccess_Edit
35
+ # => clicks the Edit button on the Sharing Setting Access Page
36
+ def click_Btn_SharingSettingsAccess_Edit
37
+ @driver.find_element(:xpath => "//input[@title = 'Edit' and @class='btn']").click
38
+ end
39
+ # -----------------------------
40
+
41
+
42
+ # -----------------------------
43
+ # click_Btn_SharingSettingsAccess_Save
44
+ # => clicks the Save button on the Sharing Setting Access Page
45
+ def click_Btn_SharingSettingsAccess_Save
46
+ sMsg=""
47
+ @driver.find_element(:xpath => "//input[@title = 'Save' and @class='btn']").click
48
+
49
+ a= @driver.switch_to.alert rescue "Exception happened"
50
+ if !(a == "Exception happened")
51
+ if a.text.include? "All sharing rules will be recalculated based on the new defaults"
52
+ sMsg= "Accepting Alert: #{a.text}"
53
+ a.accept
54
+ else
55
+ sMsg= "NOT Accepting Alert: #{a.text}"
56
+ a.dismiss
57
+ end
58
+ end
59
+ return sMsg
60
+ end
61
+ # -----------------------------
62
+
63
+
64
+ # -----------------------------
65
+ # click_Btn_SharingSettingsAccess_SavePrompt_OK
66
+ # => clicks the Save button on the Sharing Setting Access Page
67
+ def click_Btn_SharingSettingsAccess_SavePrompt_OK
68
+ cWindowHandle=@driver.window_handle
69
+ puts "Current Window Handle: #{cWindowHandle}"
70
+ puts "Open Windoes of browser: #{@driver.window_handles}"
71
+ @driver.window_handles.each do |win|
72
+ if !(win == cWindowHandle)
73
+ @driver.switch_to(win)
74
+ @driver.action.send_keys("\n").perform
75
+ @driver.switch_to(cWindowHandle)
76
+ end
77
+ end
78
+
79
+ end
80
+ # -----------------------------
81
+
82
+
83
+
84
+ # -----------------------------
85
+ # set_SharingSetting_View
86
+ # => sViewName = string value of the Sharing Setting option to select
87
+ # => Return = true or false
88
+ # => true = setting of view were successful
89
+ # => false = setting of view had an error
90
+ #
91
+ def set_SharingSetting_View(sViewName)
92
+ blnViewSet=false
93
+ begin
94
+ get_SharingSettingOptions.each do |option|
95
+ if option.text == sViewName
96
+ option.click unless option.selected?
97
+ blnViewSet=true
98
+ return blnViewSet
99
+ end
100
+ end
101
+ rescue
102
+ puts $!
103
+ puts $@
104
+ end
105
+ return blnViewSet
106
+ end
107
+ # -----------------------------
108
+
109
+ # -----------------------------
110
+ # => sObjName = string value of the sharing setting object to return
111
+ # => Return = Hash of column values for indicated object name
112
+ #
113
+ def get_SharingSettingsAccess(sObjName)
114
+ $accessHeaders=[]
115
+ response=Hash.new
116
+
117
+ get_SharingSettingAccessTable.each_with_index do |row, index|
118
+ if index == 0
119
+ # - Get headers
120
+ row.find_elements(:xpath => "./th").each do |h|
121
+ $accessHeaders.push(h.text)
122
+ end
123
+ else
124
+ # - Get Values for matching Object Name
125
+ if row.find_element(:xpath => "./th").text == sObjName
126
+ response[$accessHeaders[1]]=row.find_element(:xpath => "./td[1]").text
127
+ response[$accessHeaders[2]]=row.find_element(:xpath => "./td[2]").text
128
+ response[$accessHeaders[3]]=row.find_element(:xpath => "./td/img").attribute("title") unless row.find_elements(:xpath => "./td[3]//*").size == 0
129
+ break
130
+ end
131
+ end
132
+ end
133
+
134
+ return response
135
+ end
136
+ # -----------------------------
137
+
138
+ # -----------------------------
139
+ # => sObjName = string value of the sharing setting object to return
140
+ # => hOjbValues = Hash of the values to verify for the sObjName
141
+ # => Return = true/false
142
+ # - True if values match
143
+ # - False if values do not match
144
+ #
145
+ def verify_SharingSettingsAccess(sObjName, hObjValues)
146
+ @driver.manage.timeouts.implicit_wait = 0
147
+ blnVerify=true
148
+ $accessHeaders=[]
149
+
150
+ # hObjValues[sObjName].each do |k,v|
151
+ # puts "\t\t#{k}: #{v}"
152
+ # end
153
+
154
+ get_SharingSettingAccessTable.each_with_index do |row, index|
155
+ if index == 0
156
+ # - Get headers
157
+ row.find_elements(:xpath => "./th").each do |h|
158
+ $accessHeaders.push(h.text)
159
+ end
160
+ else
161
+ # Check values against hObjValues
162
+ if row.find_element(:xpath => "./th").text == sObjName
163
+ if !(hObjValues[sObjName][$accessHeaders[1]]==row.find_element(:xpath => "./td[1]").text)
164
+ puts "#{$accessHeaders[1]}: #{hObjValues[sObjName][$accessHeaders[1]]} | #{row.find_element(:xpath => "./td[1]").text}"
165
+ blnVerify=false
166
+ end
167
+
168
+ if !(hObjValues[sObjName][$accessHeaders[2]]==row.find_element(:xpath => "./td[2]").text)
169
+ puts "#{$accessHeaders[2]}: #{hObjValues[sObjName][$accessHeaders[2]]} | #{row.find_element(:xpath => "./td[2]").text}"
170
+ blnVerify=false
171
+ end
172
+
173
+ if row.find_elements(:xpath => "./td[3]//*").size > 0
174
+ if !(hObjValues[sObjName][$accessHeaders[3]]==row.find_element(:xpath => "./td/img").attribute("title"))
175
+ puts "#{$accessHeaders[3]}: #{hObjValues[sObjName][$accessHeaders[3]]} | #{row.find_element(:xpath => "./td/img").attribute("title")}"
176
+ blnVerify=false
177
+ end
178
+ end
179
+
180
+ break
181
+ end
182
+ end
183
+ end
184
+
185
+ @driver.manage.timeouts.implicit_wait = @implicitWait
186
+ return blnVerify
187
+ end
188
+ # -----------------------------
189
+
190
+
191
+ # -----------------------------
192
+ # => sObjName = string value of the sharing setting object to return
193
+ # => hOjbValues = Hash of the values to verify for the sObjName
194
+ # => Return = true/false
195
+ # - True if values match
196
+ # - False if values do not match
197
+ #
198
+ def set_SharingSettingAccess_Edit(sObjName, hObjValues)
199
+ @driver.manage.timeouts.implicit_wait = 0
200
+ blnUpdateSuccessful=false
201
+ $accessHeaders=[]
202
+
203
+ # - Perform Update Actions
204
+ get_SharingSettingAccessTable_Edit.each_with_index do |row, index|
205
+ if index == 0
206
+ # - Get headers
207
+ row.find_elements(:xpath => "./th").each do |h|
208
+ $accessHeaders.push(h.text)
209
+ end
210
+ else
211
+ # - Perform Updates to columns
212
+ if row.find_element(:xpath => "./td[1]").text == sObjName
213
+ # - Column: Default Internal Access (dropdown selection)
214
+ if row.find_elements(:xpath => "./td[2]//*").size > 0
215
+ if !(hObjValues[sObjName][$accessHeaders[1]]==row.find_element(:xpath => "./td[2]/select/option[@selected='selected']").text)
216
+ row.find_elements(:xpath => "./td[2]/select/option").each do |option|
217
+ if option.text == hObjValues[sObjName][$accessHeaders[1]]
218
+ option.click unless option.selected?
219
+ # puts "-- ** Set Default Internal Access **"
220
+ blnUpdateSuccessful=true
221
+ end
222
+ end
223
+ end
224
+ end
225
+
226
+ # - Column: Default External Access (dropdown selection)
227
+ if row.find_elements(:xpath => "./td[3]//*").size > 0
228
+ if !(hObjValues[sObjName][$accessHeaders[2]]==row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text)
229
+ row.find_elements(:xpath => "./td[3]/select/option").each do |option|
230
+ if option.text == hObjValues[sObjName][$accessHeaders[1]]
231
+ option.click unless option.selected?
232
+ # puts "-- ** Set Default External Access **"
233
+ blnUpdateSuccessful=true
234
+ end
235
+ end
236
+ end
237
+ end
238
+
239
+ # - Grant Access Using Hierarchies (checkbox)
240
+ if row.find_element(:xpath => "./td[4]/input").attribute("disabled").nil?
241
+ # puts "Checkbox Not Disabled"
242
+ if (hObjValues[sObjName][$accessHeaders[3]]) == "Checked"
243
+ row.find_element(:xpath => "./td[4]/input[@type='checkbox']").click unless !row.find_element(:xpath => "./td[4]/input").attribute("checked").nil?
244
+ blnUpdateSuccessful=true
245
+ else
246
+ row.find_element(:xpath => "./td[4]/input[@type='checkbox']").click unless row.find_element(:xpath => "./td[4]/input").attribute("checked").nil?
247
+ blnUpdateSuccessful=true
248
+ end
249
+ # else
250
+ # puts "Checkbox Disabled"
251
+ end
252
+
253
+ break
254
+ end
255
+ end
256
+ end
257
+
258
+ @driver.manage.timeouts.implicit_wait = @implicitWait
259
+ return blnUpdateSuccessful
260
+ end
261
+ # -----------------------------
262
+
263
+ end
264
+ end