sakai-cle-test-api 0.0.9 → 0.0.75

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