kuali-sakai-common-lib 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/kuali-sakai-common-lib.gemspec +4 -5
  2. data/lib/kuali-sakai-common-lib.rb +3 -2
  3. data/lib/kuali-sakai-common-lib/add_files.rb +260 -0
  4. data/lib/kuali-sakai-common-lib/announcements.rb +301 -0
  5. data/lib/kuali-sakai-common-lib/assessments.rb +1183 -0
  6. data/lib/kuali-sakai-common-lib/assignments.rb +861 -0
  7. data/lib/kuali-sakai-common-lib/basic_lti.rb +13 -0
  8. data/lib/kuali-sakai-common-lib/blogs.rb +23 -0
  9. data/lib/kuali-sakai-common-lib/calendar.rb +466 -0
  10. data/lib/kuali-sakai-common-lib/calendar_summary.rb +0 -0
  11. data/lib/kuali-sakai-common-lib/chat_room.rb +0 -0
  12. data/lib/{core-ext.rb → kuali-sakai-common-lib/core-ext.rb} +0 -0
  13. data/lib/kuali-sakai-common-lib/drop_box.rb +0 -0
  14. data/lib/kuali-sakai-common-lib/email_archive.rb +28 -0
  15. data/lib/kuali-sakai-common-lib/forums.rb +326 -0
  16. data/lib/kuali-sakai-common-lib/gem_ext.rb +36 -0
  17. data/lib/kuali-sakai-common-lib/gradebook.rb +23 -0
  18. data/lib/kuali-sakai-common-lib/gradebook2.rb +24 -0
  19. data/lib/kuali-sakai-common-lib/messages.rb +639 -0
  20. data/lib/kuali-sakai-common-lib/news.rb +8 -0
  21. data/lib/kuali-sakai-common-lib/polls.rb +77 -0
  22. data/lib/kuali-sakai-common-lib/post_em.rb +0 -0
  23. data/lib/kuali-sakai-common-lib/profile.rb +46 -0
  24. data/lib/kuali-sakai-common-lib/profile2.rb +360 -0
  25. data/lib/kuali-sakai-common-lib/resources_roster.rb +0 -0
  26. data/lib/kuali-sakai-common-lib/rwiki.rb +0 -0
  27. data/lib/kuali-sakai-common-lib/sections.rb +237 -0
  28. data/lib/kuali-sakai-common-lib/single_user.rb +0 -0
  29. data/lib/kuali-sakai-common-lib/site_statistics.rb +0 -0
  30. data/lib/kuali-sakai-common-lib/syllabus.rb +182 -0
  31. data/lib/{utilities.rb → kuali-sakai-common-lib/utilities.rb} +13 -2
  32. metadata +51 -8
@@ -0,0 +1,861 @@
1
+ #
2
+ module AssignmentsListMethods
3
+ include PageObject
4
+ # Returns an array of the displayed assignment titles.
5
+ # Use for verification of test steps.
6
+ def assignments_titles
7
+ titles = []
8
+ a_table = frm.table(:class=>"listHier lines nolines")
9
+ 1.upto(a_table.rows.size-1) do |x|
10
+ titles << a_table[x][1].h4(:index=>0).text
11
+ end
12
+ return titles
13
+ end
14
+ alias assignment_titles assignments_titles
15
+ alias assignment_list assignments_titles
16
+ alias assignments_list assignments_titles
17
+
18
+ # Clicks the Add link, then instantiates
19
+ # the AssignmentAdd page class.
20
+ def add
21
+ frm.link(:text=>"Add").click
22
+ AssignmentAdd.new(@browser)
23
+ end
24
+
25
+ # Clicks the Edit link for the assignment with the specified
26
+ # id, then instantiates the AssignmentAdd page class.
27
+ def edit_assignment_id(id)
28
+ frm.link(:href=>/#{Regexp.escape(id)}/).click
29
+ AssignmentAdd.new(@browser)
30
+ end
31
+
32
+ # Clicks the Edit link for the Assignment specified.
33
+ # Then it instantiates the AssignmentAdd page class.
34
+ def edit_assignment(assignment_name)
35
+ index = assignments_titles.index(assignment_name)
36
+ frm.link(:text=>"Edit", :index=>index).click
37
+ AssignmentAdd.new(@browser)
38
+ end
39
+
40
+ # Checks the appropriate checkbox, based on the specified assignment_name
41
+ # Then clicks the Update button and confirms the deletion request.
42
+ # It then reinstantiates the AssignmentsList class because of the page
43
+ # update.
44
+ def delete_assignment(assignment_name)
45
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(assignment_name)}/).checkbox(:name=>"selectedAssignments").set
46
+ frm.button(:value=>"Update").click
47
+ frm.button(:value=>"Delete").click
48
+ AssignmentsList.new(@browser)
49
+ end
50
+
51
+ # Clicks on the Duplicate link for the Assignment specified.
52
+ # Then instantiates the AssignmentsList page class.
53
+ def duplicate_assignment(assignment_name)
54
+ index = assignments_titles.index(assignment_name)
55
+ frm.link(:text=>"Duplicate", :index=>index).click
56
+ AssignmentsList.new(@browser)
57
+ end
58
+
59
+ # Gets the assignment id from the href of the specified
60
+ # Assignment link.
61
+ def get_assignment_id(assignment_name)
62
+ frm.link(:text=>/#{Regexp.escape(assignment_name)}/).href =~ /(?<=\/a\/\S{36}\/).+(?=&pan)/
63
+ return $~.to_s
64
+ end
65
+
66
+ # Clicks the Permissions button, then
67
+ # instantiates the AssignmentsPermissions page class.
68
+ def permissions
69
+ frm.link(:text=>"Permissions").click
70
+ AssignmentsPermissions.new(@browser)
71
+ end
72
+
73
+ # Checks the checkbox for the specified Assignment,
74
+ # using the assignment id as the identifier.
75
+ def check_assignment(id) #FIXME to use name instead of id.
76
+ frm.checkbox(:value, /#{id}/).set
77
+ end
78
+
79
+ # Clicks the Reorder button, then instantiates
80
+ # the AssignmentsReorder page class.
81
+ def reorder
82
+ frm().link(:text=>"Reorder").click
83
+ AssignmentsReorder.new(@browser)
84
+ end
85
+
86
+ # Opens the specified assignment for viewing
87
+ #
88
+ # Instantiates the student view or instructor/admin
89
+ # view based on the landing page attributes
90
+ def open_assignment(assignment_name)
91
+ frm.link(:text=>assignment_name).click
92
+ if frm.div(:class=>"portletBody").p(:class=>"instruction").exist? && frm.div(:class=>"portletBody").p(:class=>"instruction").text == "Add attachment(s), then choose the appropriate button at the bottom."
93
+ AssignmentStudent.new(@browser)
94
+ elsif frm.div(:class=>"portletBody").h3.text=="Assignment - In progress"
95
+ AssignmentStudent.new(@browser)
96
+ elsif frm.div(:class=>"portletBody").h3.text=="Viewing assignment..." || frm.div(:class=>"portletBody").h3.text.include?("Submitted") || frm.button(:value=>"Back to list").exist?
97
+ AssignmentsPreview.new(@browser)
98
+ else
99
+ frm.frame(:id, "Assignment.view_submission_text___Frame").td(:id, "xEditingArea").wait_until_present
100
+ AssignmentStudent.new(@browser)
101
+ end
102
+ end
103
+
104
+ # Gets the contents of the status column
105
+ # for the specified assignment
106
+ def status_of(assignment_name)
107
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(assignment_name)}/).td(:headers=>"status").text
108
+ end
109
+
110
+ # Clicks the View Submissions link for the specified
111
+ # Assignment, then instantiates the AssignmentSubmissionList
112
+ # page class.
113
+ def view_submissions_for(assignment_name)
114
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(assignment_name)}/).link(:text=>"View Submissions").click
115
+ AssignmentSubmissionList.new(@browser)
116
+ end
117
+
118
+ # Clicks the Grade link for the specified Assignment,
119
+ # then instantiates the AssignmentSubmissionList page class.
120
+ def grade(assignment_name)
121
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(assignment_name)}/).link(:text=>"Grade").click
122
+ AssignmentSubmissionList.new(@browser)
123
+ end
124
+
125
+ def self.page_elements(identifier)
126
+ in_frame(identifier) do |frame|
127
+ link(:grade_report, :text=>"Grade Report", :frame=>frame)
128
+ link(:student_view, :text=>"Student View", :frame=>frame)
129
+ link(:options, :text=>"Options", :frame=>frame)
130
+ link(:sort_assignment_title, :text=>"Assignment title", :frame=>frame)
131
+ link(:sort_status, :text=>"Status", :frame=>frame)
132
+ link(:sort_open, :text=>"Open", :frame=>frame)
133
+ link(:sort_due, :text=>"Due", :frame=>frame)
134
+ link(:sort_in, :text=>"In", :frame=>frame)
135
+ link(:sort_new, :text=>"New", :frame=>frame)
136
+ link(:sort_scale, :text=>"Scale", :frame=>frame)
137
+ select_list(:view, :id=>"view", :frame=>frame)
138
+ select_list(:select_page_size, :id=>"selectPageSize", :frame=>frame)
139
+ button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
140
+ button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
141
+ button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
142
+ button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
143
+ button(:update, :name=>"eventSubmit_doDelete_confirm_assignment", :frame=>frame)
144
+ end
145
+ end
146
+
147
+ end
148
+
149
+ # The page where you create a new assignment
150
+ module AssignmentAddMethods
151
+ include PageObject
152
+ # Clicks the Post button, then
153
+ # instantiates the AssignmentsList page class.
154
+ def post
155
+ frm.button(:value=>"Post").click
156
+ AssignmentsList.new(@browser)
157
+ end
158
+
159
+ # Clicks the Cancel button, then
160
+ # instantiates the AssignmentsList page class.
161
+ def cancel
162
+ frm.button(:value=>"Cancel", :index=>-1).click
163
+ AssignmentsList.new(@browser)
164
+ end
165
+
166
+ # Clicks the Save Draft button, then
167
+ # instantiates the AssignmentsList page class.
168
+ def save_draft
169
+ frm.button(:name=>"save").click
170
+ AssignmentsList.new(@browser)
171
+ end
172
+
173
+ # Grabs the text contained in the alert box when
174
+ # it is present on the page (will throw an error if
175
+ # called when the box is not present).
176
+ def alert_text
177
+ frm.div(:class=>"portletBody").div(:class=>"alertMessage").text
178
+ end
179
+
180
+ # Sends the specified text to the text box in the FCKEditor
181
+ # on the page.
182
+ def instructions=(instructions)
183
+ frm.frame(:id, "new_assignment_instructions___Frame").td(:id, "xEditingArea").frame(:index=>0).wait_until_present
184
+ frm.frame(:id, "new_assignment_instructions___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(instructions)
185
+ end
186
+
187
+ # Clicks the Preview button, then instantiates
188
+ # the AssignmentsPreview page class.
189
+ def preview
190
+ frm.button(:value=>"Preview").click
191
+ AssignmentsPreview.new(@browser)
192
+ end
193
+
194
+ # This is the warning message that appears when you
195
+ # select to add an assignment to the gradebook.
196
+ def gradebook_warning
197
+ frm.div(:class, "portletBody").span(:id, "gradebookListWarnAssoc")
198
+ end
199
+
200
+ # Clicks the Add Attachments button, then
201
+ # instantiates the AssignmentAttachments page class.
202
+ def add_attachments
203
+ frm.button(:value=>"Add Attachments").click
204
+ AssignmentAttachments.new(@browser)
205
+ end
206
+
207
+ def self.page_elements(identifier)
208
+ in_frame(identifier) do |frame|
209
+ hidden_field(:assignment_id, :name=>"assignmentId", :frame=>frame)
210
+ link(:assignment_list, :text=>"Assignment List", :frame=>frame)
211
+ link(:grade_report, :text=>"Grade Report", :frame=>frame)
212
+ link(:student_view, :text=>"Student View", :frame=>frame)
213
+ link(:permissions, :text=>"Permissions", :frame=>frame)
214
+ link(:options, :text=>"Options", :frame=>frame)
215
+ text_field(:title, :id=>"new_assignment_title", :frame=>frame)
216
+ select_list(:open_month, :id=>"new_assignment_openmonth", :frame=>frame)
217
+ select_list(:open_day, :id=>"new_assignment_openday", :frame=>frame)
218
+ select_list(:open_year, :id=>"new_assignment_openyear", :frame=>frame)
219
+ select_list(:open_hour, :id=>"new_assignment_openhour", :frame=>frame)
220
+ select_list(:open_minute, :id=>"new_assignment_openmin", :frame=>frame)
221
+ select_list(:open_meridian, :id=>"new_assignment_openampm", :frame=>frame)
222
+ select_list(:due_month, :id=>"new_assignment_duemonth", :frame=>frame)
223
+ select_list(:due_day, :id=>"new_assignment_dueday", :frame=>frame)
224
+ select_list(:due_year, :id=>"new_assignment_dueyear", :frame=>frame)
225
+ select_list(:due_hour, :id=>"new_assignment_duehour", :frame=>frame)
226
+ select_list(:due_minute, :id=>"new_assignment_duemin", :frame=>frame)
227
+ select_list(:due_meridian, :id=>"new_assignment_dueampm", :frame=>frame)
228
+ select_list(:accept_month, :id=>"new_assignment_closemonth", :frame=>frame)
229
+ select_list(:accept_day, :id=>"new_assignment_closeday", :frame=>frame)
230
+ select_list(:accept_year, :id=>"new_assignment_closeyear", :frame=>frame)
231
+ select_list(:accept_hour, :id=>"new_assignment_closehour", :frame=>frame)
232
+ select_list(:accept_minute, :id=>"new_assignment_closemin", :frame=>frame)
233
+ select_list(:accept_meridian, :id=>"new_assignment_closeampm", :frame=>frame)
234
+ select_list(:student_submissions, :id=>"subType", :frame=>frame)
235
+ select_list(:grade_scale, :id=>"new_assignment_grade_type", :frame=>frame)
236
+ checkbox(:allow_resubmission, :id=>"allowResToggle", :frame=>frame)
237
+ select_list(:num_resubmissions, :id=>"allowResubmitNumber", :frame=>frame)
238
+ select_list(:resub_until_month, :id=>"allow_resubmit_closeMonth", :frame=>frame)
239
+ select_list(:resub_until_day, :id=>"allow_resubmit_closeDay", :frame=>frame)
240
+ select_list(:resub_until_year, :id=>"allow_resubmit_closeYear", :frame=>frame)
241
+ select_list(:resub_until_hour, :id=>"allow_resubmit_closeHour", :frame=>frame)
242
+ select_list(:resub_until_minute, :id=>"allow_resubmit_closeMin", :frame=>frame)
243
+ select_list(:resub_until_meridian, :id=>"allow_resubmit_closeAMPM", :frame=>frame)
244
+ text_field(:max_points, :name=>"new_assignment_grade_points", :frame=>frame)
245
+ checkbox(:add_due_date, :id=>"new_assignment_check_add_due_date", :frame=>frame)
246
+ checkbox(:add_open_announcement, :id=>"new_assignment_check_auto_announce", :frame=>frame)
247
+ checkbox(:add_honor_pledge, :id=>"new_assignment_check_add_honor_pledge", :frame=>frame)
248
+
249
+ checkbox(:use_turnitin, :id=>"new_assignment_use_review_service", :frame=>frame)
250
+ checkbox(:allow_students_to_view_report, :id=>"new_assignment_allow_student_view", :frame=>frame)
251
+
252
+ radio_button(:do_not_add_to_gradebook, :id=>"no",:name=>"new_assignment_add_to_gradebook", :frame=>frame)
253
+ radio_button(:add_to_gradebook, :id=>"add", :name=>"new_assignment_add_to_gradebook", :frame=>frame)
254
+ radio_button(:do_not_send_notifications, :id=>"notsendnotif", :frame=>frame)
255
+ radio_button(:send_notifications, :id=>"sendnotif", :frame=>frame)
256
+ radio_button(:send_summary_email, :id=>"sendnotifsummary", :frame=>frame)
257
+ radio_button(:do_not_send_grade_notif, :id=>"notsendreleasegradenotif", :frame=>frame)
258
+ radio_button(:send_grade_notif, :id=>"sendreleasegradenotif", :frame=>frame)
259
+ link(:add_model_answer, :id=>"modelanswer_add", :frame=>frame)
260
+ link(:add_private_note, :id=>"note_add", :frame=>frame)
261
+ link(:add_all_purpose_item, :id=>"allPurpose_add", :frame=>frame)
262
+
263
+ text_area(:model_answer, :id=>"modelanswer_text", :frame=>frame)
264
+ button(:model_answer_attach, :name=>"modelAnswerAttach", :frame=>frame)
265
+ select_list(:show_model_answer, :id=>"modelanswer_to", :frame=>frame)
266
+ button(:save_model_answer, :id=>"modelanswer_save", :frame=>frame)
267
+ button(:cancel_model_answer, :id=>"modelanswer_cancel", :frame=>frame)
268
+ text_area(:private_note, :id=>"note_text", :frame=>frame)
269
+ select_list(:share_note_with, :id=>"note_to", :frame=>frame)
270
+ button(:save_note, :id=>"note_save", :frame=>frame)
271
+ button(:cancel_note, :id=>"note_cancel", :frame=>frame)
272
+ text_field(:all_purpose_title, :id=>"allPurpose_title", :frame=>frame)
273
+ text_area(:all_purpose_text, :id=>"allPurpose_text", :frame=>frame)
274
+ button(:add_all_purpose_attachments, :id=>"allPurposeAttach", :frame=>frame)
275
+ radio_button(:show_this_all_purpose_item, :id=>"allPurposeHide1", :frame=>frame)
276
+ radio_button(:hide_this_all_purpose_item, :id=>"allPurposeHide2", :frame=>frame)
277
+ checkbox(:show_from, :id=>"allPurposeShowFrom", :frame=>frame)
278
+ checkbox(:show_until, :id=>"allPurposeShowTo", :frame=>frame)
279
+ select_list(:show_from_month, :id=>"allPurpose_releaseMonth", :frame=>frame)
280
+ select_list(:show_from_day, :id=>"allPurpose_releaseDay", :frame=>frame)
281
+ select_list(:show_from_year, :id=>"allPurpose_releaseYear", :frame=>frame)
282
+ select_list(:show_from_hour, :id=>"allPurpose_releaseHour", :frame=>frame)
283
+ select_list(:show_from_minute, :id=>"allPurpose_releaseMin", :frame=>frame)
284
+ select_list(:show_from_meridian, :id=>"allPurpose_releaseAMPM", :frame=>frame)
285
+ select_list(:show_until_month, :id=>"allPurpose_retractMonth", :frame=>frame)
286
+ select_list(:show_until_day, :id=>"allPurpose_retractDay", :frame=>frame)
287
+ select_list(:show_until_year, :id=>"allPurpose_retractYear", :frame=>frame)
288
+ select_list(:show_until_hour, :id=>"allPurpose_retractHour", :frame=>frame)
289
+ select_list(:show_until_minute, :id=>"allPurpose_retractMin", :frame=>frame)
290
+ select_list(:show_until_meridian, :id=>"allPurpose_retractAMPM", :frame=>frame)
291
+ link(:expand_guest_list, :id=>"expand_1", :frame=>frame)
292
+ link(:collapse_guest_list, :id=>"collapse_1", :frame=>frame)
293
+ link(:expand_TA_list, :id=>"expand_2", :frame=>frame)
294
+ link(:collapse_TA_list, :id=>"collapse_2", :frame=>frame)
295
+ link(:expand_instructor_list, :id=>"expand_3", :frame=>frame)
296
+ link(:collapse_instructor_list, :is=>"collapse_3", :frame=>frame)
297
+
298
+ # Note that only the "All" checkboxes are defined, since other items may or may not be there
299
+ checkbox(:all_guests, :id=>"allPurpose_Guest", :frame=>frame)
300
+ checkbox(:all_TAs, :id=>"allPurpose_Teaching Assistant", :frame=>frame)
301
+ checkbox(:all_instructors, :id=>"allPurpose_Instructor", :frame=>frame)
302
+ end
303
+ end
304
+
305
+ end
306
+
307
+ # The Permissions Page in Assignments
308
+ module AssignmentsPermissionsMethods
309
+ include PageObject
310
+ # Clicks the Save button, then instantiates
311
+ # the AssignmentsList page class.
312
+ def save
313
+ frm.button(:value=>"Save").click
314
+ AssignmentsList.new(@browser)
315
+ end
316
+
317
+ def self.page_elements(identifier)
318
+ in_frame(identifier) do |frame|
319
+ checkbox(:evaluators_share_drafts, :id=>"Evaluatorasn.share.drafts", :frame=>frame)
320
+ checkbox(:organizers_share_drafts, :id=>"Organizerasn.share.drafts", :frame=>frame)
321
+
322
+ checkbox(:guests_all_groups, :id=>"Guestasn.all.groups", :frame=>frame)
323
+ checkbox(:guests_create_assignments, :id=>"Guestasn.new", :frame=>frame)
324
+ checkbox(:guests_submit_to_assigments, :id=>"Guestasn.submit", :frame=>frame)
325
+ checkbox(:guests_delete_assignments, :id=>"Guestasn.delete", :frame=>frame)
326
+ checkbox(:guests_read_assignments, :id=>"Guestasn.read", :frame=>frame)
327
+ checkbox(:guests_revise_assignments, :id=>"Guestasn.revise", :frame=>frame)
328
+ checkbox(:guests_grade_assignments, :id=>"Guestasn.grade", :frame=>frame)
329
+ checkbox(:guests_receive_notifications, :id=>"Guestasn.receive.notifications", :frame=>frame)
330
+ checkbox(:guests_share_drafts, :id=>"Guestasn.share.drafts", :frame=>frame)
331
+ checkbox(:instructors_all_groups, :id=>"Instructorasn.all.groups", :frame=>frame)
332
+ checkbox(:instructors_create_assignments, :id=>"Instructorasn.new", :frame=>frame)
333
+ checkbox(:instructors_submit_to_assigments, :id=>"Instructorasn.submit", :frame=>frame)
334
+ checkbox(:instructors_delete_assignments, :id=>"Instructorasn.delete", :frame=>frame)
335
+ checkbox(:instructors_read_assignments, :id=>"Instructorasn.read", :frame=>frame)
336
+ checkbox(:instructors_revise_assignments, :id=>"Instructorasn.revise", :frame=>frame)
337
+ checkbox(:instructors_grade_assignments, :id=>"Instructorasn.grade", :frame=>frame)
338
+ checkbox(:instructors_receive_notifications, :id=>"Instructorasn.receive.notifications", :frame=>frame)
339
+ checkbox(:instructors_share_drafts, :id=>"Instructorasn.share.drafts", :frame=>frame)
340
+ checkbox(:students_all_groups, :id=>"Studentasn.all.groups", :frame=>frame)
341
+ checkbox(:students_create_assignments, :id=>"Studentasn.new", :frame=>frame)
342
+ checkbox(:students_submit_to_assigments, :id=>"Studentasn.submit", :frame=>frame)
343
+ checkbox(:students_delete_assignments, :id=>"Studentasn.delete", :frame=>frame)
344
+ checkbox(:students_read_assignments, :id=>"Studentasn.read", :frame=>frame)
345
+ checkbox(:students_revise_assignments, :id=>"Studentasn.revise", :frame=>frame)
346
+ checkbox(:students_grade_assignments, :id=>"Studentasn.grade", :frame=>frame)
347
+ checkbox(:students_receive_notifications, :id=>"Studentasn.receive.notifications", :frame=>frame)
348
+ checkbox(:students_share_drafts, :id=>"Studentasn.share.drafts", :frame=>frame)
349
+ checkbox(:tas_all_groups, :id=>"Teaching Assistantasn.all.groups", :frame=>frame)
350
+ checkbox(:tas_create_assignments, :id=>"Teaching Assistantasn.new", :frame=>frame)
351
+ checkbox(:tas_submit_to_assigments, :id=>"Teaching Assistantasn.submit", :frame=>frame)
352
+ checkbox(:tas_delete_assignments, :id=>"Teaching Assistantasn.delete", :frame=>frame)
353
+ checkbox(:tas_read_assignments, :id=>"Teaching Assistantasn.read", :frame=>frame)
354
+ checkbox(:tas_revise_assignments, :id=>"Teaching Assistantasn.revise", :frame=>frame)
355
+ checkbox(:tas_grade_assignments, :id=>"Teaching Assistantasn.grade", :frame=>frame)
356
+ checkbox(:tas_receive_notifications, :id=>"Teaching Assistantasn.receive.notifications", :frame=>frame)
357
+ checkbox(:tas_share_drafts, :id=>"Teaching Assistantasn.share.drafts", :frame=>frame)
358
+ link(:undo_changes, :text=>"Undo changes", :frame=>frame)
359
+ button(:cancel, :id=>"eventSubmit_doCancel", :frame=>frame)
360
+ link(:permission, :text=>"Permission", :frame=>frame)
361
+ link(:guest, :text=>"Guest", :frame=>frame)
362
+ link(:instructor, :text=>"Instructor", :frame=>frame)
363
+ link(:student, :text=>"Student", :frame=>frame)
364
+ link(:teaching_assistant, :text=>"Teaching Assistant", :frame=>frame)
365
+ link(:same_permissions_for_all_groups, :text=>"Same site level permissions for all groups inside the site", :frame=>frame)
366
+ link(:create_new_assignments, :text=>"Create new assignment(s)", :frame=>frame)
367
+ link(:submit_to_assignments, :text=>"Submit to assignment(s)", :frame=>frame)
368
+ link(:delete_assignments, :text=>"Delete assignment(s)", :frame=>frame)
369
+ link(:read_assignments, :text=>"Read Assignment(s)", :frame=>frame)
370
+ link(:revise_assignments, :text=>"Revise assignment(s)", :frame=>frame)
371
+ link(:grade_submissions, :text=>"Grade assignment submission(s)", :frame=>frame)
372
+ link(:receive_email_notifications, :text=>"Receive email notifications", :frame=>frame)
373
+ link(:view_drafts_from_others, :text=>"Able to view draft assignment(s) created by other users", :frame=>frame)
374
+ end
375
+ end
376
+
377
+ end
378
+
379
+ # Page that appears when you click to preview an Assignment
380
+ module AssignmentsPreviewMethods
381
+ include PageObject
382
+ # Returns the text content of the page header
383
+ def header
384
+ frm.div(:class=>"portletBody").h3.text
385
+ end
386
+
387
+ # Returns a hash object containing the contents of the Item Summary table.
388
+ # The hash's Key is the header column and the value is the content column.
389
+ def item_summary
390
+ hash = {}
391
+ frm.table(:class=>"itemSummary").rows.each do |row|
392
+ hash.store(row.th.text, row.td.text)
393
+ end
394
+ return hash
395
+ end
396
+
397
+ # Grabs the Assignment Instructions text.
398
+ def assignment_instructions
399
+ frm.div(:class=>"textPanel").text
400
+ end
401
+
402
+ # Grabs the instructor comments text.
403
+ def instructor_comments
404
+ frm.div(:class=>"portletBody").div(:class=>"textPanel", :index=>2).text
405
+ end
406
+
407
+ #
408
+ def back_to_list
409
+ frm.button(:value=>"Back to list").click
410
+ AssignmentsList.new(@browser)
411
+ end
412
+
413
+ # Clicks the Post button, then instantiates
414
+ # the AssignmentsList page class.
415
+ def post
416
+ frm.button(:name=>"post").click
417
+ AssignmentsList.new(@browser)
418
+ end
419
+
420
+ # Clicks the Cancel button and instantiates the
421
+ # AssignmentsList Class.
422
+ def cancel
423
+ frm.button(:value=>"Cancel").click
424
+ AssignmentsList.new(@browser)
425
+ end
426
+
427
+ def self.page_elements(identifier)
428
+ in_frame(identifier) do |frame|
429
+ hidden_field(:assignment_id, :name=>"assignmentId", :frame=>frame)
430
+ link(:assignment_list, :text=>"Assignment List", :frame=>frame)
431
+ link(:permissions, :text=>"Permissions", :frame=>frame)
432
+ link(:options, :text=>"Options", :frame=>frame)
433
+ link(:hide_assignment, :href=>/doHide_preview_assignment_assignment/, :frame=>frame)
434
+ link(:show_assignment, :href=>/doShow_preview_assignment_assignment/, :frame=>frame)
435
+ link(:hide_student_view, :href=>/doHide_preview_assignment_student_view/, :frame=>frame)
436
+ link(:show_student_view, :href=>/doShow_preview_assignment_student_view/, :frame=>frame)
437
+ button(:edit, :name=>"revise", :frame=>frame)
438
+ button(:save_draft, :name=>"save", :frame=>frame)
439
+ button(:done, :name=>"done", :frame=>frame)
440
+ end
441
+ end
442
+
443
+ end
444
+
445
+ # The reorder page for Assignments
446
+ module AssignmentsReorderMethods
447
+ include PageObject
448
+ # Clicks the Save button, then instantiates
449
+ # the AssignmentsList page class.
450
+ def save
451
+ frm.button(:value=>"Save").click
452
+ AssignmentsList.new(@browser)
453
+ end
454
+
455
+ # Clicks the Cancel button, then instantiates
456
+ # the AssignmentsList Class.
457
+ def cancel
458
+ frm.button(:value=>"Cancel").click
459
+ AssignmentsList.new(@browser)
460
+ end
461
+
462
+ def self.page_elements(identifier)
463
+ in_frame(identifier) do |frame|
464
+ link(:add, :text=>"Add", :frame=>frame)
465
+ link(:assignment_list, :text=>"Assignment List", :frame=>frame)
466
+ link(:grade_report, :text=>"Grade Report", :frame=>frame)
467
+ link(:student_view, :text=>"Student View", :frame=>frame)
468
+ link(:permissions, :text=>"Permissions", :frame=>frame)
469
+ link(:options, :text=>"Options", :frame=>frame)
470
+ link(:sort_by_title, :text=>"Sort by title", :frame=>frame)
471
+ link(:sort_by_open_date, :text=>"Sort by open date", :frame=>frame)
472
+ link(:sort_by_due_date, :text=>"Sort by due date", :frame=>frame)
473
+ link(:undo_last, :text=>"Undo last", :frame=>frame)
474
+ link(:undo_all, :text=>"Undo all", :frame=>frame)
475
+ end
476
+ end
477
+
478
+ end
479
+
480
+ # A Student user's page for editing/submitting/view an assignment.
481
+ module AssignmentStudentMethods
482
+ include PageObject
483
+ # Returns the text content of the page header
484
+ def header
485
+ frm.div(:class=>"portletBody").h3.text
486
+ end
487
+
488
+ # Returns a hash object containing the contents of the Item Summary table.
489
+ # The hash's Key is the header column and the value is the content column.
490
+ def item_summary
491
+ hash = {}
492
+ frm.table(:class=>"itemSummary").rows.each do |row|
493
+ hash.store(row.th.text, row.td.text)
494
+ end
495
+ return hash
496
+ end
497
+
498
+ # Grabs the instructor comments text.
499
+ def instructor_comments
500
+ frm.div(:class=>"portletBody").div(:class=>"textPanel", :index=>2).text
501
+ end
502
+
503
+ # Enters the specified text into the Assignment Text FCKEditor.
504
+ def assignment_text=(text)
505
+ frm.frame(:id, "Assignment.view_submission_text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
506
+ end
507
+
508
+ # Clears out any existing text from the Assignment Text FCKEditor.
509
+ def remove_assignment_text
510
+ frm.frame(:id, "Assignment.view_submission_text___Frame").div(:title=>"Select All").fire_event("onclick")
511
+ frm.frame(:id, "Assignment.view_submission_text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys :backspace
512
+ end
513
+
514
+ # This class variable allows adding an arbitrary number of
515
+ # files to the page, as long as the adding steps alternate between
516
+ # selecting the file and clicking the add more files button
517
+ @@file_number = 0
518
+
519
+ # Enters the specified file name into the file field. Entering the path
520
+ # separately is optional.
521
+ # Once the filename is entered in the field, the
522
+ # @@file_number class variable is increased by one
523
+ # in case any more files need to be added to the upload
524
+ # list.
525
+ def select_file(file_name, file_path="")
526
+ frm.file_field(:id=>"clonableUpload", :name=>"upload#{@@file_number}").set(file_path + file_name)
527
+ @@file_number += 1
528
+ end
529
+
530
+ # Clicks the Submit button, then instantiates
531
+ # the appropriate page class, based on the
532
+ # page that gets loaded.
533
+ def submit
534
+ frm.button(:value=>"Submit").click
535
+ @@file_number=0
536
+ if frm.div(:class=>"portletBody").h3.text=~/Submission Confirmation/
537
+ SubmissionConfirmation.new(@browser)
538
+ elsif frm.button(:value=>"Back to list").exist?
539
+ SubmissionConfirmation.new(@browser)
540
+ else
541
+ AssessmentsList.new(@browser)
542
+ end
543
+ end
544
+
545
+ # Clicks the Resubmit button, then instantiates
546
+ # the appropriate page class, based on the
547
+ # page that gets loaded.
548
+ #
549
+ # Resets @@file_number to zero so that file
550
+ # uploads will work if this page is visited again
551
+ # in the same script.
552
+ def resubmit
553
+ frm.button(:value=>"Resubmit").click
554
+ @@file_number=0
555
+ if frm.link(:text=>"Assignment title").exist?
556
+ puts "list..."
557
+ AssessmentsList.new(@browser)
558
+ else
559
+ SubmissionConfirmation.new(@browser)
560
+ end
561
+ end
562
+
563
+ # Clicks the Preview button, then
564
+ # instantiates the AssignmentStudentPreview page class.
565
+ #
566
+ # Resets @@file_number to zero so that file
567
+ # uploads will work if this page is visited again
568
+ # in the same script.
569
+ def preview
570
+ frm.button(:value=>"Preview").click
571
+ @@file_number=0
572
+ AssignmentStudentPreview.new(@browser)
573
+ end
574
+
575
+ # Clicks the Save Draft button, then
576
+ # instantiates the SubmissionConfirmation
577
+ # page class.
578
+ def save_draft
579
+ frm.button(:value=>"Save Draft").click
580
+ SubmissionConfirmation.new(@browser)
581
+ end
582
+
583
+ # Clicks the link to select more files
584
+ # from the Workspace. Then instantiates
585
+ # the AssignmentAttachments page class.
586
+ def select_more_files_from_workspace
587
+ frm.link(:id=>"attach").click
588
+ AssignmentAttachments.new(@browser)
589
+ end
590
+
591
+ # Clicks the Back to list button, then
592
+ # instantiates the AssignmentList page class.
593
+ def back_to_list
594
+ frm.button(:value=>"Back to list").click
595
+ AssignmentsList.new(@browser)
596
+ end
597
+
598
+ # Clicks the Cancel button and instantiates the
599
+ # AssignmentsList Class.
600
+ def cancel
601
+ frm.button(:value=>"Cancel").click
602
+ AssignmentsList.new(@browser)
603
+ end
604
+
605
+ def self.page_elements(identifier)
606
+ in_frame(identifier) do |frame|
607
+ link(:add_another_file, :id=>"addMoreAttachmentControls", :frame=>frame)
608
+ end
609
+ end
610
+
611
+ end
612
+
613
+ # Page that appears when a Student User clicks to Preview an
614
+ # assignment that is in progress.
615
+ module AssignmentStudentPreviewMethods
616
+ include PageObject
617
+ # Clicks the Submit button, then
618
+ # instantiates the SubmissionConfirmation
619
+ # page class.
620
+ def submit
621
+ frm.button(:value=>"Submit").click
622
+ SubmissionConfirmation.new(@browser)
623
+ end
624
+
625
+ # Clicks the Save Draft button, then
626
+ # instantiates the SubmissionConfirmation
627
+ # page class.
628
+ def save_draft
629
+ frm.button(:value=>"Save Draft").click
630
+ SubmissionConfirmation.new(@browser)
631
+ end
632
+
633
+ # Returns the contents of the submission box.
634
+ def submission_text
635
+ frm.div(:class=>"portletBody").div(:class=>/textPanel/).text
636
+ end
637
+
638
+ # Returns an array of strings. Each element in the
639
+ # array is the name of attached files.
640
+ def attachments
641
+ names = []
642
+ frm.ul(:class=>"attachList indnt1").links.each { |link| names << link.text }
643
+ return names
644
+ end
645
+
646
+ end
647
+
648
+ # The page that appears when a Student user has fully submitted an assignment
649
+ # or saves it as a draft.
650
+ module SubmissionConfirmationMethods
651
+ include PageObject
652
+ # Returns the text of the success message on the page.
653
+ def confirmation_text
654
+ frm.div(:class=>"portletBody").div(:class=>"success").text
655
+ end
656
+
657
+ # Returns the text of the assignment submission.
658
+ def submission_text
659
+ frm.div(:class=>"portletBody").div(:class=>"textPanel indnt2").text
660
+ end
661
+
662
+ # Clicks the Back to list button, then
663
+ # instantiates the AssignmentsList page class.
664
+ def back_to_list
665
+ frm.button(:value=>"Back to list").click
666
+ frm.link(:text=>"Assignment title").wait_until_present
667
+ AssignmentsList.new(@browser)
668
+ end
669
+ end
670
+
671
+ # The page that appears when you click on an assignment's "Grade" or "View Submission" link
672
+ # as an instructor. Shows the list of students and their
673
+ # assignment submission status.
674
+ module AssignmentSubmissionListMethods
675
+ include PageObject
676
+ # Clicks the Assignment List link and instantiates the AssignmentsList Class.
677
+ def assignment_list
678
+ frm.link(:text=>"Assignment List").click
679
+ AssignmentsList.new(@browser)
680
+ end
681
+ # Clicks the Show Resubmission Settings button
682
+ def show_resubmission_settings
683
+ frm.image(:src, "/library/image/sakai/expand.gif?panel=Main").click
684
+ end
685
+
686
+ # Clicks the Show Assignment Details button.
687
+ def show_assignment_details
688
+ frm.image(:src, "/library/image/sakai/expand.gif").click
689
+ end
690
+
691
+ # Gets the Student table text and returns it in an Array object.
692
+ def student_table
693
+ table = frm.table(:class=>"listHier lines nolines").to_a
694
+ end
695
+
696
+ # Clicks the Grade link for the specified student, then
697
+ # instantiates the AssignmentSubmission page class.
698
+ def grade(student_name)
699
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(student_name)}/).link(:text=>"Grade").click
700
+ frm.frame(:id, "grade_submission_feedback_comment___Frame").td(:id, "xEditingArea").frame(:index=>0).wait_until_present
701
+ AssignmentSubmission.new(@browser)
702
+ end
703
+
704
+ # Gets the value of the status field for the specified
705
+ # Student. Note that the student's name needs to be entered
706
+ # so that it's unique for the row, but it does not have
707
+ # to match the entire name/id value--unless there are two
708
+ # students with the same name.
709
+ #
710
+ # Useful for verification purposes.
711
+ def submission_status_of(student_name)
712
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(student_name)}/)[4].text
713
+ end
714
+
715
+ def self.page_elements(identifier)
716
+ in_frame(identifier) do |frame|
717
+ link(:add, :text=>"Add", :frame=>frame)
718
+ link(:grade_report, :text=>"Grade Report", :frame=>frame)
719
+ link(:permissions, :text=>"Permissions", :frame=>frame)
720
+ link(:options, :text=>"Options", :frame=>frame)
721
+ link(:student_view, :text=>"Student View", :frame=>frame)
722
+ link(:reorder, :text=>"Reorder", :frame=>frame)
723
+ text_field(:search_input, :id=>"search", :frame=>frame)
724
+ button(:find, :value=>"Find", :frame=>frame)
725
+ button(:clear, :value=>"Clear", :frame=>frame)
726
+ link(:download_all, :text=>"Download All", :frame=>frame)
727
+ link(:upload_all, :text=>"Upload All", :frame=>frame)
728
+ link(:release_grades, :text=>"Release Grades", :frame=>frame)
729
+ link(:sort_by_student, :text=>"Student", :frame=>frame)
730
+ link(:sort_by_submitted, :text=>"Submitted", :frame=>frame)
731
+ link(:sort_by_status, :text=>"Status", :frame=>frame)
732
+ link(:sort_by_grade, :text=>"Grade", :frame=>frame)
733
+ link(:sort_by_release, :text=>"Release", :frame=>frame)
734
+ select_list(:default_grade, :id=>"defaultGrade_1", :frame=>frame)
735
+ button(:apply, :name=>"apply", :frame=>frame)
736
+ select_list(:num_resubmissions, :id=>"allowResubmitNumber", :frame=>frame)
737
+ select_list(:accept_until_month, :id=>"allow_resubmit_closeMonth", :frame=>frame)
738
+ select_list(:accept_until_day, :id=>"allow_resubmit_closeDay", :frame=>frame)
739
+ select_list(:accept_until_year, :id=>"allow_resubmit_closeYear", :frame=>frame)
740
+ select_list(:accept_until_hour, :id=>"allow_resubmit_closeHour", :frame=>frame)
741
+ select_list(:accept_until_min, :id=>"allow_resubmit_closeMin", :frame=>frame)
742
+ select_list(:accept_until_meridian, :id=>"allow_resubmit_closeAMPM", :frame=>frame)
743
+ button(:update, :id=>"eventSubmit_doSave_resubmission_option", :frame=>frame)
744
+ select_list(:select_page_size, :id=>"selectPageSize", :frame=>frame)
745
+ button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
746
+ button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
747
+ button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
748
+ button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
749
+ button(:update, :name=>"eventSubmit_doDelete_confirm_assignment", :frame=>frame)
750
+ end
751
+ end
752
+
753
+ end
754
+
755
+ # The page that shows a student's submitted assignment to an instructor user.
756
+ module AssignmentSubmissionMethods
757
+ include PageObject
758
+ # Enters the specified text string in the FCKEditor box for the assignment text.
759
+ def assignment_text=(text)
760
+ frm.frame(:id, "grade_submission_feedback_text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
761
+ end
762
+
763
+ # Removes all the contents of the FCKEditor Assignment Text box.
764
+ def remove_assignment_text
765
+ frm.frame(:id, "grade_submission_feedback_text___Frame").div(:title=>"Select All").fire_event("onclick")
766
+ frm.frame(:id, "grade_submission_feedback_text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys :backspace
767
+ end
768
+
769
+ # Enters the specified string into the Instructor Comments FCKEditor box.
770
+ def instructor_comments=(text)
771
+ frm.frame(:id, "grade_submission_feedback_comment___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
772
+ end
773
+
774
+ # Clicks the Add Attachments button, then instantiates the AssignmentAttachments Class.
775
+ def add_attachments
776
+ frm.button(:name=>"attach").click
777
+ AssignmentAttachments.new(@browser)
778
+ end
779
+
780
+ # Clicks the Return to List button, then instantiates the
781
+ # AssignmentSubmissionList Class.
782
+ def return_to_list
783
+ frm.button(:value=>"Return to List").click
784
+ AssignmentSubmissionList.new(@browser)
785
+ end
786
+
787
+ def self.page_elements(identifier)
788
+ in_frame(identifier) do |frame|
789
+ select_list(:select_default_grade, :name=>"grade_submission_grade", :frame=>frame)
790
+ checkbox(:allow_resubmission, :id=>"allowResToggle", :frame=>frame)
791
+ select_list(:num_resubmissions, :id=>"allowResubmitNumberSelect", :frame=>frame)
792
+ select_list(:accept_until_month, :id=>"allow_resubmit_closeMonth", :frame=>frame)
793
+ select_list(:accept_until_day, :id=>"allow_resubmit_closeDay", :frame=>frame)
794
+ select_list(:accept_until_year, :id=>"allow_resubmit_closeYear", :frame=>frame)
795
+ select_list(:accept_until_hour, :id=>"allow_resubmit_closeHour", :frame=>frame)
796
+ select_list(:accept_until_min, :id=>"allow_resubmit_closeMin", :frame=>frame)
797
+ select_list(:accept_until_meridian, :id=>"allow_resubmit_closeAMPM", :frame=>frame)
798
+ button(:save_and_release, :value=>"Save and Release to Student", :frame=>frame)
799
+ button(:save_and_dont_release, :value=>"Save and Don't Release to Student", :frame=>frame)
800
+ end
801
+ end
802
+
803
+ end
804
+
805
+ # The Grade Report page accessed from the Assignments page
806
+ module GradeReportMethods
807
+ include PageObject
808
+ def self.page_elements(identifier)
809
+ in_frame(identifier) do |frame|
810
+ #(:, :=>"", :frame=>frame)
811
+ #(:, :=>"", :frame=>frame)
812
+ #(:, :=>"", :frame=>frame)
813
+ #(:, :=>"", :frame=>frame)
814
+ #(:, :=>"", :frame=>frame)
815
+ end
816
+ end
817
+
818
+ end
819
+
820
+ # The Student View page accessed from the Assignments page
821
+ module StudentViewMethods
822
+ include PageObject
823
+ def self.page_elements(identifier)
824
+ in_frame(identifier) do |frame|
825
+ link(:add, :text=>"Add", :frame=>frame)
826
+ link(:grade_report, :text=>"Grade Report", :frame=>frame)
827
+ link(:assignment_list, :text=>"Assignment List", :frame=>frame)
828
+ link(:permissions, :text=>"Permissions", :frame=>frame)
829
+ link(:options, :text=>"Options", :frame=>frame)
830
+ link(:sort_assignment_title, :text=>"Assignment title", :frame=>frame)
831
+ link(:sort_status, :text=>"Status", :frame=>frame)
832
+ link(:sort_open, :text=>"Open", :frame=>frame)
833
+ link(:sort_due, :text=>"Due", :frame=>frame)
834
+ link(:sort_scale, :text=>"Scale", :frame=>frame)
835
+ select_list(:select_page_size, :name=>"selectPageSize", :frame=>frame)
836
+ button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
837
+ button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
838
+ button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
839
+ button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
840
+ end
841
+ end
842
+
843
+ end
844
+ # TODO - Need to figure out whether this stays here or goes to CLE only.
845
+ =begin
846
+ # Page for attaching files to Assignments
847
+ class AssignmentAttachments < AddFiles
848
+
849
+ def initialize(browser)
850
+ @browser = browser
851
+
852
+ @@classes = {
853
+ :this => "AssignmentAttachments",
854
+ :parent => "AssignmentAdd",
855
+ :second => "AssignmentStudent",
856
+ :third => "AssignmentSubmission"
857
+ }
858
+ end
859
+
860
+ end
861
+ =end