sakai-oae-test-api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/lib/sakai-oae-test-api.rb +37 -0
- data/lib/sakai-oae-test-api/cle_frame_classes.rb +2160 -0
- data/lib/sakai-oae-test-api/gem_extensions.rb +168 -0
- data/lib/sakai-oae-test-api/global_methods.rb +109 -0
- data/lib/sakai-oae-test-api/page_classes.rb +1949 -0
- data/lib/sakai-oae-test-api/pop_up_dialogs.rb +1273 -0
- data/lib/sakai-oae-test-api/toolbars_and_menus.rb +745 -0
- data/lib/sakai-oae-test-api/widgets.rb +495 -0
- data/sakai-oae-test-api.gemspec +16 -0
- metadata +121 -0
@@ -0,0 +1,745 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
|
3
|
+
# The Topmost Header menu bar, present on most pages,
|
4
|
+
# plus the Footer contents, too. This module also contains
|
5
|
+
# references to the notification pop-ups that appear in the upper
|
6
|
+
# right.
|
7
|
+
module HeaderFooterBar
|
8
|
+
|
9
|
+
include PageObject
|
10
|
+
|
11
|
+
# Page Object Definitions
|
12
|
+
link(:help, :id=>"help_tab")
|
13
|
+
float_menu(:my_dashboard, "You", "My dashboard", "MyDashboard")
|
14
|
+
float_menu(:my_messages, "You", "My messages", "MyMessages")
|
15
|
+
float_menu(:my_profile, "You", "My profile", "MyProfileBasicInfo")
|
16
|
+
float_menu(:my_library, "You", "My library", "MyLibrary")
|
17
|
+
float_menu(:my_memberships, "You", "My memberships", "MyMemberships")
|
18
|
+
float_menu(:my_contacts, "You", "My contacts", "MyContacts")
|
19
|
+
float_menu(:create_a_group, "Create + Collect", "Create a group", "CreateGroups") # Note that this MUST be "create_a_group" because "create_group" is already a method.
|
20
|
+
float_menu(:create_a_course, "Create + Collect", "Create a course", "CreateCourses")
|
21
|
+
float_menu(:create_a_research_project, "Create + Collect", "Create a research project", "CreateResearch")
|
22
|
+
float_menu(:explore_all_categories, "Explore", "Browse all categories", "AllCategoriesPage")
|
23
|
+
float_menu(:explore_content,"Explore","Content", "ExploreContent")
|
24
|
+
float_menu(:explore_people,"Explore","People", "ExplorePeople")
|
25
|
+
float_menu(:explore_groups,"Explore","Groups","ExploreGroups")
|
26
|
+
float_menu(:explore_courses,"Explore","Courses","ExploreCourses")
|
27
|
+
float_menu(:explore_research,"Explore","Research projects","ExploreResearch")
|
28
|
+
alias explore_research_projects explore_research
|
29
|
+
|
30
|
+
# Don't use this button directly when opening the collector. Instead, use the "toggle_collector" method
|
31
|
+
# so that the Collector Widget module will be included in the object's Class.
|
32
|
+
# You *can* use this, however, to close the collector.
|
33
|
+
button(:collector, :class=>"topnavigation_menuitem_counts_container collector_toggle")
|
34
|
+
button(:save, :text=>"Save")
|
35
|
+
|
36
|
+
link(:explore, :text=>"Explore")
|
37
|
+
link(:browse_all_categories, :text=>"Browse all categories")
|
38
|
+
text_field(:header_search, :id=>"topnavigation_search_input")
|
39
|
+
link(:you, :text=>"You")
|
40
|
+
button(:messages_container_button, :id=>"topnavigation_messages_container")
|
41
|
+
link(:create_collect, :id=>"navigation_create_and_add_link")
|
42
|
+
link(:user_options_name, :id=>"topnavigation_user_options_name")
|
43
|
+
link(:help, :id=>"help_tab")
|
44
|
+
|
45
|
+
link(:see_all, :id=>"topnavigation_search_see_all")
|
46
|
+
|
47
|
+
# Sign-in Menu items...
|
48
|
+
button(:sign_in_menu, :id=>"topnavigation_user_options_login")
|
49
|
+
text_field(:username, :id=>"topnavigation_user_options_login_fields_username")
|
50
|
+
text_field(:password, :id=>"topnavigation_user_options_login_fields_password")
|
51
|
+
button(:sign_in, :id=>"topnavigation_user_options_login_button_login")
|
52
|
+
span(:login_error, :id=>"topnav_login_username_error")
|
53
|
+
link(:sign_up_link, :id=>"navigation_anon_signup_link")
|
54
|
+
|
55
|
+
# Footer elements
|
56
|
+
div(:footer, :id=>/footercontainer\d+/)
|
57
|
+
button(:sakai_OAE_logo, :id=>"footer_logo_button")
|
58
|
+
link(:acknowledgements_link, :href=>"/acknowledgements") # :text=>"Created in collaboration with the Sakai Community"
|
59
|
+
link(:user_agreement_link, :text=>"User Agreement")
|
60
|
+
button(:location_button, :id=>"footer_location")
|
61
|
+
button(:language_button, :id=>"footer_language")
|
62
|
+
paragraph(:debug_info, :id=>"footer_debug_info")
|
63
|
+
|
64
|
+
# Custom Methods
|
65
|
+
|
66
|
+
# The page object for the Explore link the footer. Defined as a custom
|
67
|
+
# method using Watir-webdriver, because of issues using PageObject to do it.
|
68
|
+
def explore_footer_link
|
69
|
+
self.span(:id=>"footer_links_right").link(:text=>"Explore")
|
70
|
+
end
|
71
|
+
|
72
|
+
# Clicks the Explore button in the footer and returns the
|
73
|
+
# Page class for the main login page (since that's the page that loads).
|
74
|
+
def explore_footer
|
75
|
+
explore_footer_link.click
|
76
|
+
sleep 1
|
77
|
+
self.wait_for_ajax
|
78
|
+
LoginPage.new @browser
|
79
|
+
end
|
80
|
+
|
81
|
+
# The page object for the Browse link the footer. Defined as a custom
|
82
|
+
# method because of issues using PageObject to do it.
|
83
|
+
def browse_footer_link
|
84
|
+
self.span(:id=>"footer_links_right").link(:text=>"Browse")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Clicks the Browse button in the footer
|
88
|
+
# And returns the AllCategories page class.
|
89
|
+
def browse_footer
|
90
|
+
browse_footer_link.click
|
91
|
+
self.wait_for_ajax
|
92
|
+
AllCategoriesPage.new @browser
|
93
|
+
end
|
94
|
+
|
95
|
+
# Clicks the Acknowledgements link in the page Footer.
|
96
|
+
def acknowledgements
|
97
|
+
self.acknowledgements_link
|
98
|
+
sleep 1
|
99
|
+
self.wait_for_ajax
|
100
|
+
Acknowledgements.new @browser
|
101
|
+
end
|
102
|
+
|
103
|
+
# Clicks the User Agreement link in the page footer.
|
104
|
+
def user_agreement
|
105
|
+
self.user_agreement_link
|
106
|
+
sleep 1
|
107
|
+
#wait_for_ajax
|
108
|
+
# New Class goes here.new @browser
|
109
|
+
end
|
110
|
+
|
111
|
+
# Clicks the location link in the page footer
|
112
|
+
def change_location
|
113
|
+
self.location_button
|
114
|
+
self.wait_for_ajax
|
115
|
+
self.class.class_eval { include AccountPreferencesPopUp }
|
116
|
+
end
|
117
|
+
|
118
|
+
# Clicks the language button in the page footer.
|
119
|
+
def change_language
|
120
|
+
self.language_button
|
121
|
+
self.wait_for_ajax
|
122
|
+
self.class.class_eval { include AccountPreferencesPopUp }
|
123
|
+
end
|
124
|
+
|
125
|
+
# A generic link-clicking method. It clicks on a page link with text that
|
126
|
+
# matches the supplied string. Since it uses Regex to find a match, the
|
127
|
+
# string can be a substring of the desired link's full text.
|
128
|
+
#
|
129
|
+
# This method should be used as AN ABSOLUTE LAST RESORT, however, since it does not
|
130
|
+
# instantiate a new page class. You will have to instantiate
|
131
|
+
# the target page class explicitly in the test script itself, if required.
|
132
|
+
def click_link(string)
|
133
|
+
name_link(string).click
|
134
|
+
self.wait_for_ajax
|
135
|
+
end
|
136
|
+
|
137
|
+
# Opens the User Options menu in the header menu bar,
|
138
|
+
# clicks the Preferences item, waits for the Account Preferences
|
139
|
+
# Pop up dialog to appear, and then includes the AccountPreferencesPopUp
|
140
|
+
# module in the currently instantiated Class Object.
|
141
|
+
def my_account
|
142
|
+
self.link(:id=>"topnavigation_user_options_name").fire_event("onmouseover")
|
143
|
+
self.link(:id=>"subnavigation_preferences_link").click
|
144
|
+
self.wait_for_ajax
|
145
|
+
self.class.class_eval { include AccountPreferencesPopUp }
|
146
|
+
end
|
147
|
+
|
148
|
+
# Logs in with the specified username and password variables.
|
149
|
+
# Returns the MyDashboard class object.
|
150
|
+
def login(username, password)
|
151
|
+
self.div(:id=>"topnavigation_user_options_login_wrapper").fire_event("onmouseover")
|
152
|
+
self.text_field(:id=>"topnavigation_user_options_login_fields_username").set username
|
153
|
+
self.text_field(:name=>"topnav_login_password").set password
|
154
|
+
self.button(:id=>"topnavigation_user_options_login_button_login").click
|
155
|
+
sleep 3 # TODO : Make into a wait clause
|
156
|
+
if self.button(:id=>"emailverify_continue_button").present?
|
157
|
+
self.button(:id=>"emailverify_continue_button").click
|
158
|
+
end
|
159
|
+
self.linger_for_ajax(2)
|
160
|
+
MyDashboard.new @browser
|
161
|
+
end
|
162
|
+
alias sign_in login
|
163
|
+
alias log_in login
|
164
|
+
|
165
|
+
# Clicks the Sign out command in the user menu in the header bar.
|
166
|
+
# returns the LoginPage class object.
|
167
|
+
def sign_out
|
168
|
+
self.link(:id=>"topnavigation_user_options_name").fire_event("onmouseover")
|
169
|
+
self.link(:id=>"subnavigation_logout_link").click
|
170
|
+
self.link(:text=>"Explore").wait_until_present
|
171
|
+
self.linger_for_ajax(2)
|
172
|
+
LoginPage.new @browser
|
173
|
+
end
|
174
|
+
alias logout sign_out
|
175
|
+
alias log_out sign_out
|
176
|
+
|
177
|
+
# Opens the Create + Add menu in the header bar,
|
178
|
+
# clicks on the Add Content item, waits for the Pop Up
|
179
|
+
# dialog to appear, then includes the AddContentContainer module
|
180
|
+
# in the currently instantiated Class Object.
|
181
|
+
def add_content
|
182
|
+
self.link(:id=>"navigation_create_and_add_link").fire_event("onmouseover")
|
183
|
+
self.link(:text=>"Add content").click
|
184
|
+
self.wait_until { self.text.include? "Collected items" }
|
185
|
+
self.class.class_eval { include AddContentContainer }
|
186
|
+
end
|
187
|
+
|
188
|
+
def add_collection
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
# Clicks the Colector icon in the header bar, to either display
|
193
|
+
# or hide the collector widget, depending on its current state.
|
194
|
+
def toggle_collector
|
195
|
+
self.collector
|
196
|
+
self.wait_for_ajax
|
197
|
+
self.class.class_eval { include CollectorWidget }
|
198
|
+
end
|
199
|
+
|
200
|
+
# Clicks the messages container button
|
201
|
+
def messages_container
|
202
|
+
self.messages_container_button
|
203
|
+
self.wait_for_ajax
|
204
|
+
self.class.class_eval { include MessagesContainerPopUp }
|
205
|
+
end
|
206
|
+
|
207
|
+
# Clicks the "Sign up" link. Returns the CreateNewAccount class object
|
208
|
+
def sign_up
|
209
|
+
self.sign_up_link
|
210
|
+
self.button(:id=>"save_account").wait_until_present
|
211
|
+
sleep 3
|
212
|
+
CreateNewAccount.new @browser
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
# This is the Header that appears in the Worlds context,
|
218
|
+
# So it appears for Courses, Groups, and Research
|
219
|
+
module HeaderBar
|
220
|
+
|
221
|
+
include PageObject
|
222
|
+
|
223
|
+
# Page Object Definitions
|
224
|
+
button(:join_group_button, :id=>/joinrequestbuttons_join_.*/)
|
225
|
+
button(:request_to_join_group_button, :id=>/joinrequestbuttons_request_.*/)
|
226
|
+
button(:request_pending_button, :id=>/joinrequestbuttons_pending_.*/)
|
227
|
+
button(:message_button, :text=>"Message")
|
228
|
+
|
229
|
+
# Custom Methods
|
230
|
+
|
231
|
+
# Returns the text contents of the page title div
|
232
|
+
def page_title
|
233
|
+
self.div(:id=>"s3d-page-container").div(:class=>"s3d-contentpage-title").text
|
234
|
+
end
|
235
|
+
|
236
|
+
# Clicks the "Join group" button.
|
237
|
+
def join_group
|
238
|
+
self.join_group_button
|
239
|
+
self.wait_until { notification_element.exists? }
|
240
|
+
end
|
241
|
+
|
242
|
+
# Clicks the "Request to join group" button
|
243
|
+
def request_to_join_group
|
244
|
+
self.request_to_join_group_button
|
245
|
+
self.wait_until { notification_element.exists? }
|
246
|
+
end
|
247
|
+
|
248
|
+
# Clicks the Message button in the page header (not the
|
249
|
+
# Header bar, but just below that), waits for the Message Pop Up
|
250
|
+
# dialog to load, and then includes the SendMessagePopUp
|
251
|
+
# module in the currently instantiated Class Object.
|
252
|
+
def message
|
253
|
+
self.message_button
|
254
|
+
self.wait_until { self.text.include? "Send Message" }
|
255
|
+
self.class.class_eval { include SendMessagePopUp }
|
256
|
+
end
|
257
|
+
|
258
|
+
# Clicks the Permissions button in the page header (below the
|
259
|
+
# Header bar, though), clicks "Add Content", then waits for the
|
260
|
+
# Add Content stuff to load, then includes the
|
261
|
+
# AddContentContainer module in the object's Class.
|
262
|
+
def add_content
|
263
|
+
self.button(:id=>"entity_group_permissions").click
|
264
|
+
self.button(:text=>"Add content").click
|
265
|
+
self.wait_until { self.text.include? "Collected items" }
|
266
|
+
self.class.class_eval { include AddContentContainer }
|
267
|
+
end
|
268
|
+
|
269
|
+
# Clicks the Permissions button in the page's header (distinct from
|
270
|
+
# the black header bar, mind you), clicks "Manage participants",
|
271
|
+
# waits for the Contacts and Memberships stuff to load, then
|
272
|
+
# includes the ManageParticipants module in the Class of the object
|
273
|
+
# calling the method.
|
274
|
+
def manage_participants
|
275
|
+
self.button(:id=>"entity_group_permissions").click
|
276
|
+
self.button(:text=>"Manage participants").click
|
277
|
+
self.wait_until { self.text.include? "My contacts and memberships" }
|
278
|
+
self.class.class_eval { include ManageParticipants }
|
279
|
+
end
|
280
|
+
|
281
|
+
# Clicks the "Join requests" item in the settings menu.
|
282
|
+
def join_requests
|
283
|
+
self.button(:id=>"entity_group_permissions").click
|
284
|
+
self.button(:id=>"ew_group_join_requests_link").click
|
285
|
+
self.wait_until { self.text.include? "Pending requests to join" }
|
286
|
+
self.class.class_eval { include PendingRequestsPopUp }
|
287
|
+
end
|
288
|
+
|
289
|
+
# Clicks the Permissions button in the page's header (distinct from
|
290
|
+
# the black header bar, mind you), clicks "Settings",
|
291
|
+
# waits for the Settings stuff to load, then
|
292
|
+
# includes the SettingsPopUp module in the Class of the object
|
293
|
+
# calling the method.
|
294
|
+
def settings
|
295
|
+
self.button(:id=>"entity_group_permissions").click
|
296
|
+
self.button(:text=>"Settings").click
|
297
|
+
sleep 0.4
|
298
|
+
self.wait_for_ajax
|
299
|
+
self.class.class_eval { include SettingsPopUp }
|
300
|
+
end
|
301
|
+
|
302
|
+
# Clicks the Permissions button in the page's header (distinct from
|
303
|
+
# the black header bar, mind you), clicks "Categories",
|
304
|
+
# waits for the Categories Pop Up to load, then
|
305
|
+
# includes the AddRemoveCategories module in the Class of the object
|
306
|
+
# calling the method.
|
307
|
+
def categories
|
308
|
+
self.button(:id=>"entity_group_permissions").click
|
309
|
+
self.button(:text=>"Categories").click
|
310
|
+
self.wait_until { self.text.include? "Assign a category" }
|
311
|
+
self.class.class_eval { include AddRemoveCategories }
|
312
|
+
end
|
313
|
+
|
314
|
+
# Clicks the down arrow next to the Avatar picture in the Page Header
|
315
|
+
# (not the Header bar), clicks the option to change the picture,
|
316
|
+
# then includes the ChangePicturePopup in the Class of the object
|
317
|
+
# calling the method.
|
318
|
+
def change_picture
|
319
|
+
self.div(:class=>"entity_profile_picture_down_arrow").fire_event("onclick")
|
320
|
+
self.link(:id=>"changepic_container_trigger").click
|
321
|
+
self.class.class_eval { include ChangePicturePopup }
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|
325
|
+
|
326
|
+
# Modules for the most robust Left Menu Bar--the one that has context menus
|
327
|
+
# attached to each of the bar's items, and is found in the context of a particular
|
328
|
+
# Course, Group, or Research.
|
329
|
+
module LeftMenuBar
|
330
|
+
|
331
|
+
include PageObject
|
332
|
+
|
333
|
+
# Page Object Definitions
|
334
|
+
# ...none yet
|
335
|
+
|
336
|
+
# Custom Methods
|
337
|
+
|
338
|
+
# Use this to click left menu items that refer to multi-paged documents.
|
339
|
+
# It expands the menu to display the document's sub-pages.
|
340
|
+
def expand(name)
|
341
|
+
self.div(:id=>"lhnavigation_container").link(:text=>name).click
|
342
|
+
end
|
343
|
+
|
344
|
+
# Changes the title of the specified page ("from_string")
|
345
|
+
# to the string value specified by to_string.
|
346
|
+
def change_title_of(from_string, to_string)
|
347
|
+
self.link(:class=>/lhnavigation_page_title_value/, :text=>from_string).hover
|
348
|
+
self.wait_for_ajax #.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>from_string).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
|
349
|
+
self.div(:class=>"lhnavigation_selected_submenu_image").hover
|
350
|
+
self.execute_script("$('#lhnavigation_submenu').css({left:'300px', top:'300px', display: 'block'})")
|
351
|
+
self.wait_for_ajax #.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
|
352
|
+
self.link(:id=>"lhavigation_submenu_edittitle").click
|
353
|
+
self.link(:class=>/lhnavigation_page_title_value/, :text=>from_string).parent.text_field(:class=>"lhnavigation_change_title").set("#{to_string}\n")
|
354
|
+
end
|
355
|
+
|
356
|
+
alias change_title change_title_of
|
357
|
+
|
358
|
+
# Deletes the page specified by page_name.
|
359
|
+
def delete_page(page_name)
|
360
|
+
self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
|
361
|
+
self.wait_for_ajax #.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
|
362
|
+
self.div(:class=>"lhnavigation_selected_submenu_image").hover
|
363
|
+
self.execute_script("$('#lhnavigation_submenu').css({left:'300px', top:'300px', display: 'block'})")
|
364
|
+
self.wait_for_ajax #.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
|
365
|
+
self.link(:id=>"lhavigation_submenu_deletepage").click
|
366
|
+
self.wait_for_ajax
|
367
|
+
self.class.class_eval { include DeletePagePopUp }
|
368
|
+
end
|
369
|
+
|
370
|
+
# Opens the Permissions Pop Up for the specified Page.
|
371
|
+
def permissions_for_page(page_name)
|
372
|
+
self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
|
373
|
+
self.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
|
374
|
+
self.div(:class=>"lhnavigation_selected_submenu_image").hover
|
375
|
+
self.execute_script("$('#lhnavigation_submenu').css({left:'328px', top:'349px', display: 'block'})")
|
376
|
+
self.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
|
377
|
+
self.link(:id=>"lhnavigation_submenu_permissions").click
|
378
|
+
sleep 0.2
|
379
|
+
self.wait_for_ajax
|
380
|
+
self.class.class_eval { include PermissionsPopUp }
|
381
|
+
end
|
382
|
+
|
383
|
+
alias permissions_of_page permissions_for_page
|
384
|
+
alias page_permissions permissions_for_page
|
385
|
+
|
386
|
+
# Opens the Profile Details for the specified Page by
|
387
|
+
# opening the page's drop-down menu in the left menu bar,
|
388
|
+
# clicking "View Profile", and then switching to the new
|
389
|
+
# browser tab/window that gets opened.
|
390
|
+
def view_profile_of_page(page_name)
|
391
|
+
self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
|
392
|
+
self.wait_for_ajax #.wait_until { self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible? }
|
393
|
+
self.div(:class=>"lhnavigation_selected_submenu_image").hover
|
394
|
+
self.execute_script("$('#lhnavigation_submenu').css({left:'328px', top:'349px', display: 'block'})")
|
395
|
+
self.wait_for_ajax #.wait_until { self.link(:id=>"lhavigation_submenu_edittitle").visible? }
|
396
|
+
self.link(:id=>"lhnavigation_submenu_profile").click
|
397
|
+
self.wait_for_ajax #.button(:title=>"Show debug info").wait_until_present
|
398
|
+
self.window(:title=>"rSmart | Content Profile").use
|
399
|
+
ContentDetailsPage.new self
|
400
|
+
end
|
401
|
+
|
402
|
+
alias view_profile_for_page view_profile_of_page
|
403
|
+
alias view_page_profile view_profile_of_page
|
404
|
+
|
405
|
+
# Clicks the "Add a new area" button.
|
406
|
+
def add_new_area
|
407
|
+
self.button(:id=>"group_create_new_area", :class=>"s3d-button s3d-header-button s3d-popout-button").click
|
408
|
+
self.wait_for_ajax
|
409
|
+
self.class.class_eval { include AddAreasPopUp }
|
410
|
+
end
|
411
|
+
|
412
|
+
alias add_a_new_area add_new_area
|
413
|
+
alias add_new_page add_new_area
|
414
|
+
|
415
|
+
# Returns an array containing the Course/Group area/page titles.
|
416
|
+
def public_pages
|
417
|
+
list = []
|
418
|
+
self.div(:id=>"lhnavigation_public_pages").links.each do |link|
|
419
|
+
list << link.text
|
420
|
+
end
|
421
|
+
return list
|
422
|
+
end
|
423
|
+
|
424
|
+
alias pages public_pages
|
425
|
+
alias areas public_pages
|
426
|
+
|
427
|
+
# Returns true if the specified page name appears in the list of items in the
|
428
|
+
# Left menu bar. Returns false if the specified menu can't be found.
|
429
|
+
# TODO - should be re-written to work more like the typical Ruby
|
430
|
+
# question-mark method: Should be applied to the string being tested, not the
|
431
|
+
# browser object.
|
432
|
+
def menu_available?(page_name)
|
433
|
+
self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).fire_event("onmouseover")
|
434
|
+
if self.link(:class=>/lhnavigation_page_title_value/, :text=>page_name).parent.div(:class=>"lhnavigation_selected_submenu_image").visible?
|
435
|
+
return true
|
436
|
+
else
|
437
|
+
return false
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
# Private methods...
|
442
|
+
private
|
443
|
+
|
444
|
+
def data_sakai_ref
|
445
|
+
hash = {}
|
446
|
+
current_id=""
|
447
|
+
self.div(:id=>"lhnavigation_container").lis.each do |li|
|
448
|
+
hash.store(li.text, li.html[/(?<=data-sakai-ref=").+-id\d+/])
|
449
|
+
end
|
450
|
+
hash.delete_if { |key, value| key == "" }
|
451
|
+
hash.each do |key, value|
|
452
|
+
next if self.div(:id=>value).exist? == false
|
453
|
+
next if self.div(:id=>value).visible? == false
|
454
|
+
if self.div(:id=>value).visible?
|
455
|
+
current_id = value
|
456
|
+
end
|
457
|
+
end
|
458
|
+
return current_id
|
459
|
+
end
|
460
|
+
|
461
|
+
end
|
462
|
+
|
463
|
+
# The left menu when on any of the "Explore" pages.
|
464
|
+
module LeftMenuBarSearch
|
465
|
+
|
466
|
+
include PageObject
|
467
|
+
|
468
|
+
# Page Object Definitions...
|
469
|
+
navigating_link(:all_types, "All types", "ExploreAll")
|
470
|
+
navigating_link(:content, "Content", "ExploreContent")
|
471
|
+
navigating_link(:people, "People", "ExplorePeople")
|
472
|
+
navigating_link(:groups, "Groups", "ExploreGroups")
|
473
|
+
navigating_link(:courses, "Courses", "ExploreCourses")
|
474
|
+
navigating_link(:research_projects, "Research projects", "ExploreResearch")
|
475
|
+
|
476
|
+
end
|
477
|
+
|
478
|
+
# The Left Menu Bar when in the context of the "You" pages
|
479
|
+
module LeftMenuBarYou
|
480
|
+
|
481
|
+
include PageObject
|
482
|
+
|
483
|
+
# Page Object Definitions
|
484
|
+
navigating_link(:basic_information, "Basic Information", "MyProfileBasicInfo")
|
485
|
+
navigating_link(:about_me, "About Me", "MyProfileAboutMe")
|
486
|
+
navigating_link(:online, "Online", "MyProfileOnline")
|
487
|
+
navigating_link(:contact_information, "Contact Information", "MyProfileContactInfo")
|
488
|
+
alias contact_info contact_information
|
489
|
+
navigating_link(:publications, "Publications", "MyProfilePublications")
|
490
|
+
|
491
|
+
permissions_menu(:about_me_permissions, "About Me")
|
492
|
+
permissions_menu(:online_permissions, "Online")
|
493
|
+
permissions_menu(:contact_information_permissions, "Contact Information")
|
494
|
+
permissions_menu(:publications_permissions, "Publications")
|
495
|
+
|
496
|
+
div(:profile_pic_arrow, :class=>"s3d-dropdown-menu-arrow entity_profile_picture_down_arrow")
|
497
|
+
|
498
|
+
link(:inbox_link, :text=>"Inbox")
|
499
|
+
link(:invitations_link, :text=>"Invitations")
|
500
|
+
link(:sent_link, :text=>"Sent")
|
501
|
+
link(:trash_link, :text=>"Trash")
|
502
|
+
|
503
|
+
# Custom Methods
|
504
|
+
|
505
|
+
# Clicks the Inbox link in the left-hand menu. Waits for the new page to
|
506
|
+
# load.
|
507
|
+
def inbox
|
508
|
+
self.inbox_link
|
509
|
+
sleep 1
|
510
|
+
self.wait_for_ajax
|
511
|
+
end
|
512
|
+
|
513
|
+
# Clicks the Invitations link in the left-hand menu. Waits for the new page to
|
514
|
+
# load.
|
515
|
+
def invitations
|
516
|
+
self.invitations_link
|
517
|
+
sleep 1
|
518
|
+
self.wait_for_ajax
|
519
|
+
end
|
520
|
+
|
521
|
+
# Clicks the Sent link in the left-hand menu. Waits for the new page to
|
522
|
+
# load.
|
523
|
+
def sent
|
524
|
+
self.sent_link
|
525
|
+
sleep 1
|
526
|
+
self.wait_for_ajax
|
527
|
+
end
|
528
|
+
|
529
|
+
# Clicks the Trash link in the left-hand menu. Waits for the new page to
|
530
|
+
# load.
|
531
|
+
def trash
|
532
|
+
self.trash_link
|
533
|
+
sleep 1
|
534
|
+
self.wait_for_ajax
|
535
|
+
end
|
536
|
+
|
537
|
+
# The div for the "Lock icon" next to the My messages menu
|
538
|
+
def my_messages_lock_icon
|
539
|
+
self.div(:text=>"My Messages").div(:class=>"lhnavigation_private")
|
540
|
+
end
|
541
|
+
|
542
|
+
# Expands/Collapses the My Messages Tree
|
543
|
+
def show_hide_my_messages_tree
|
544
|
+
self.div(:id=>"lhnavigation_container").link(:text=>"My Messages").click
|
545
|
+
end
|
546
|
+
|
547
|
+
# Opens the Pop Up dialog for changing the Avatar image for the
|
548
|
+
# current page.
|
549
|
+
def change_picture
|
550
|
+
profile_pic_arrow_element.fire_event("onclick")
|
551
|
+
self.link(:id=>"changepic_container_trigger").click
|
552
|
+
self.class.class_eval { include ChangePicturePopUp }
|
553
|
+
end
|
554
|
+
|
555
|
+
# Returns the number displayed in the left menu for the total
|
556
|
+
# unread messages. If there is no number displayed there, this
|
557
|
+
# method will return a zero. Note that the number returned is
|
558
|
+
# an Integer and not a String.
|
559
|
+
def unread_message_count
|
560
|
+
count_div = self.div(:text=>/My Messages/, :class=>"lhnavigation_item_content").div(:class=>"lhnavigation_levelcount")
|
561
|
+
if count_div.present?
|
562
|
+
count_div.text.to_i
|
563
|
+
else
|
564
|
+
0
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
# Returns the number displayed in the left menu for the Inbox's
|
569
|
+
# unread messages. If there is no number displayed there, this
|
570
|
+
# method will return a zero. Note that the number returned is
|
571
|
+
# an Integer and not a String.
|
572
|
+
def unread_inbox_count
|
573
|
+
count_div = self.div(:text=>/Inbox/, :class=>"lhnavigation_subnav_item_content").div(:class=>"lhnavigation_sublevelcount")
|
574
|
+
if count_div.present?
|
575
|
+
count_div.text.to_i
|
576
|
+
else
|
577
|
+
0
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
581
|
+
# Returns the number displayed in the left menu for the Invitation's
|
582
|
+
# unread messages. If there is no number displayed there, this
|
583
|
+
# method will return a zero. Note that the number returned is
|
584
|
+
# an Integer and not a String.
|
585
|
+
def unread_invitations_count
|
586
|
+
count_div = self.div(:text=>/Invitations/, :class=>"lhnavigation_subnav_item_content").div(:class=>"lhnavigation_sublevelcount")
|
587
|
+
if count_div.present?
|
588
|
+
count_div.text.to_i
|
589
|
+
else
|
590
|
+
0
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
def my_library_count
|
595
|
+
count_div = name_link("My library").parent.div(:class=>"lhnavigation_levelcount")
|
596
|
+
count_div.present? ? count_div.text.to_i : 0
|
597
|
+
end
|
598
|
+
|
599
|
+
def my_contacts_count
|
600
|
+
count_div = self.div()
|
601
|
+
if count_div.present?
|
602
|
+
count_div.text.to_i
|
603
|
+
else
|
604
|
+
0
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
end
|
609
|
+
|
610
|
+
# The left menu bar when creating Groups, Courses, or Research
|
611
|
+
module LeftMenuBarCreateWorlds
|
612
|
+
|
613
|
+
include PageObject
|
614
|
+
|
615
|
+
# Page Object Definitions
|
616
|
+
navigating_link(:group, "Group", "CreateGroups")
|
617
|
+
navigating_link(:course, "Course", "MyProfileCategories")
|
618
|
+
navigating_link(:research, "Research", "MyProfileAboutMe")
|
619
|
+
|
620
|
+
end
|
621
|
+
|
622
|
+
#
|
623
|
+
module PageRevisionsBar
|
624
|
+
|
625
|
+
include PageObject
|
626
|
+
|
627
|
+
end
|
628
|
+
|
629
|
+
# The Search field that will appear above some list pages
|
630
|
+
module SearchBar
|
631
|
+
|
632
|
+
include PageObject
|
633
|
+
|
634
|
+
# Custom Methods...
|
635
|
+
|
636
|
+
# Enters the specified text string in the search field.
|
637
|
+
# Includes a trailing line feed character so that the search
|
638
|
+
# will occur immediately, meaning you don't have to include a
|
639
|
+
# line in the script for clicking on the search button.
|
640
|
+
def search_for=(text)
|
641
|
+
self.text_field(:id=>"search_text").set("#{text}\n")
|
642
|
+
self.wait_for_ajax
|
643
|
+
end
|
644
|
+
alias search= search_for=
|
645
|
+
alias search search_for=
|
646
|
+
alias search_for search_for=
|
647
|
+
alias find search_for=
|
648
|
+
alias find= search_for=
|
649
|
+
|
650
|
+
end
|
651
|
+
|
652
|
+
# Methods for the 3 buttons that appear above all Document-type "Areas" in
|
653
|
+
# Groups/Courses.
|
654
|
+
module DocButtons
|
655
|
+
|
656
|
+
include PageObject
|
657
|
+
|
658
|
+
# Page Objects
|
659
|
+
button(:edit_page_button, :id=>"sakaidocs_editpage")
|
660
|
+
button(:add_page_button, :id=>"sakaidocs_addpage_top")
|
661
|
+
button(:page_revisions_button, :id=>"sakaidocs_revisions")
|
662
|
+
|
663
|
+
# Custom Methods...
|
664
|
+
|
665
|
+
# Clicks the Edit Page button.
|
666
|
+
def edit_page
|
667
|
+
self.back_to_top
|
668
|
+
edit_page_button
|
669
|
+
self.wait_for_ajax
|
670
|
+
self.class.class_eval { include DocumentWidget }
|
671
|
+
end
|
672
|
+
|
673
|
+
# Clicks the Add Page button, then enters the text string
|
674
|
+
# into the page title field, followed by a line feed.
|
675
|
+
def add_page(text)
|
676
|
+
self.back_to_top
|
677
|
+
add_page_button
|
678
|
+
self.wait_for_ajax
|
679
|
+
self.send_keys text + "\n"
|
680
|
+
end
|
681
|
+
|
682
|
+
# Clicks the Page Revisions button.
|
683
|
+
def page_revisions
|
684
|
+
self.back_to_top
|
685
|
+
page_revisions_button
|
686
|
+
self.wait_for_ajax
|
687
|
+
|
688
|
+
end
|
689
|
+
|
690
|
+
# Private methods...
|
691
|
+
private
|
692
|
+
|
693
|
+
# The generic method for editing widget settings. DO NOT USE!
|
694
|
+
def widget_settings
|
695
|
+
# jQuery
|
696
|
+
click_settings=%|$("#context_settings").trigger("mousedown");|
|
697
|
+
|
698
|
+
# watir-webdriver
|
699
|
+
edit_page
|
700
|
+
open_widget_menu
|
701
|
+
self.execute_script(click_settings)
|
702
|
+
self.wait_for_ajax
|
703
|
+
end
|
704
|
+
|
705
|
+
# The generic method for removing widgets. DO NOT USE!
|
706
|
+
def remove_widget
|
707
|
+
# JQuery
|
708
|
+
jq_remove = %|$("#context_remove").trigger("mousedown");|
|
709
|
+
|
710
|
+
# watir-webdriver
|
711
|
+
self.edit_page
|
712
|
+
self.open_widget_menu
|
713
|
+
self.execute_script(jq_remove)
|
714
|
+
self.wait_for_ajax
|
715
|
+
end
|
716
|
+
|
717
|
+
# The generic method for editing widget wrappings. DO NOT USE!
|
718
|
+
def widget_wrapping
|
719
|
+
|
720
|
+
#jQuery
|
721
|
+
jq_wrapping = %|$("#context_appearance_trigger").trigger("mousedown");|
|
722
|
+
|
723
|
+
#watir-webdriver
|
724
|
+
edit_page
|
725
|
+
open_widget_menu
|
726
|
+
self.execute_script(jq_wrapping)
|
727
|
+
self.wait_for_ajax
|
728
|
+
self.class.class_eval { include AppearancePopUp }
|
729
|
+
end
|
730
|
+
|
731
|
+
# The generic method for opening the widget menu. DO NOT USE!
|
732
|
+
def open_widget_menu(number=0)
|
733
|
+
# jQuery commands
|
734
|
+
click_widget=%|tinyMCE.get("elm1").selection.select(tinyMCE.get("elm1").dom.select('.widget_inline')[#{number}]);|
|
735
|
+
node_change=%|tinyMCE.get("elm1").nodeChanged();|
|
736
|
+
|
737
|
+
# watir-webdriver
|
738
|
+
self.wait_for_ajax
|
739
|
+
self.execute_script(click_widget)
|
740
|
+
self.wait_for_ajax
|
741
|
+
self.execute_script(node_change)
|
742
|
+
self.wait_for_ajax
|
743
|
+
end
|
744
|
+
|
745
|
+
end
|