sakai-cle-test-api 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README.md +2 -5
  2. data/lib/sakai-cle-test-api.rb +4 -8
  3. data/lib/sakai-cle-test-api/admin_page_elements.rb +1 -433
  4. data/lib/sakai-cle-test-api/announcements.rb +59 -0
  5. data/lib/sakai-cle-test-api/assessments.rb +194 -0
  6. data/lib/sakai-cle-test-api/assignments.rb +113 -0
  7. data/lib/sakai-cle-test-api/basic_lti.rb +5 -0
  8. data/lib/sakai-cle-test-api/blogs.rb +5 -0
  9. data/lib/sakai-cle-test-api/calendar.rb +65 -0
  10. data/lib/sakai-cle-test-api/calendar_summary.rb +0 -0
  11. data/lib/sakai-cle-test-api/common_page_elements.rb +1 -817
  12. data/lib/sakai-cle-test-api/drop_box.rb +0 -0
  13. data/lib/sakai-cle-test-api/email_archive.rb +10 -0
  14. data/lib/sakai-cle-test-api/forums.rb +39 -0
  15. data/lib/sakai-cle-test-api/gradebook.rb +10 -0
  16. data/lib/sakai-cle-test-api/gradebook2.rb +6 -0
  17. data/lib/sakai-cle-test-api/messages.rb +119 -0
  18. data/lib/sakai-cle-test-api/news.rb +9 -0
  19. data/lib/sakai-cle-test-api/polls.rb +24 -0
  20. data/lib/sakai-cle-test-api/post_em.rb +0 -0
  21. data/lib/sakai-cle-test-api/profile.rb +17 -0
  22. data/lib/sakai-cle-test-api/profile2.rb +43 -0
  23. data/lib/sakai-cle-test-api/resources_roster.rb +0 -0
  24. data/lib/sakai-cle-test-api/rwiki.rb +0 -0
  25. data/lib/sakai-cle-test-api/sections.rb +43 -0
  26. data/lib/sakai-cle-test-api/single_user.rb +0 -0
  27. data/lib/sakai-cle-test-api/site_page_elements.rb +1236 -5017
  28. data/lib/sakai-cle-test-api/site_statistics.rb +0 -0
  29. data/lib/sakai-cle-test-api/syllabus.rb +77 -0
  30. data/lib/sakai-cle-test-api/tools_menu.rb +415 -0
  31. data/sakai-cle-test-api.gemspec +2 -2
  32. metadata +30 -6
  33. data/lib/sakai-cle-test-api/app_functions.rb +0 -753
@@ -10,822 +10,6 @@
10
10
 
11
11
  #require File.dirname(__FILE__) + '/app_functions.rb'
12
12
 
13
- #================
14
- # Announcements Pages
15
- #================
16
-
17
- # The Announcements list page for a Site.
18
- class Announcements
19
-
20
- include ToolsMenu
21
-
22
- def add
23
- frm.div(:class=>"portletBody").link(:title=>"Add").click
24
- frm.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).wait_until_present(60)
25
- AddEditAnnouncements.new(@browser)
26
- end
27
-
28
- def edit(subject)
29
- frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).link(:text=>"Edit").click
30
- AddEditAnnouncements.new(@browser)
31
- end
32
-
33
- # Returns an array of the subject strings of the announcements
34
- # listed on the page.
35
- def subjects
36
- links = frm.table(:class=>"listHier").links.find_all { |link| link.title=~/View announcement/ }
37
- subjects = []
38
- links.each { |link| subjects << link.text }
39
- return subjects
40
- end
41
-
42
- def has_attachment?(subject)
43
- if frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).exist?
44
- return frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).image(:alt=>"attachment").exist?
45
- else
46
- puts "Can't find your target row. Your test is faulty."
47
- return false
48
- end
49
- end
50
-
51
- # Returns the text of the "For" column for
52
- # the specified announcement.
53
- def for_column(subject)
54
- frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/)[4].text
55
- end
56
-
57
- def preview_announcement(subject)
58
- frm.link(:text=>subject).click
59
- PreviewAnnouncements.new(@browser)
60
- end
61
-
62
- def view=(list_item)
63
- frm.select(:id=>"view").set(list_item)
64
- end
65
-
66
- def merge
67
- frm.link(:text=>"Merge").click
68
- AnnouncementsMerge.new(@browser)
69
- end
70
-
71
- end
72
-
73
- # Show Announcements from Another Site. On this page you select what announcements
74
- # you want to merge into the current Site.
75
- class AnnouncementsMerge
76
-
77
- include ToolsMenu
78
-
79
- # Checks the checkbox for the specified site name
80
- def check(site_name)
81
- frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(site_name)}/).checkbox(:id=>/site/).set
82
- end
83
-
84
- def save
85
- frm.button(:value=>"Save").click
86
- Announcements.new(@browser)
87
- end
88
-
89
- end
90
-
91
-
92
- # This Class does double-duty. It's for the Preview page when editing an
93
- # Announcement, plus for when you just click an Announcement to view it.
94
- class PreviewAnnouncements
95
-
96
- include ToolsMenu
97
-
98
- def return_to_list
99
- frm.button(:value=>"Return to List").click
100
- Announcements.new(@browser)
101
- end
102
-
103
- def save_changes
104
- frm.button(:value=>"Save Changes").click
105
- Announcements.new(@browser)
106
- end
107
-
108
- def edit
109
- frm.button(:value=>"Edit").click
110
- AddEditAnnouncements.new(@browser)
111
- end
112
-
113
- end
114
-
115
- # The page where an announcement is created or edited.
116
- class AddEditAnnouncements
117
-
118
- include ToolsMenu
119
-
120
- def add_announcement
121
- frm.button(:value=>"Add Announcement").click
122
- if frm.div(:class=>"portletBody").h3.text=~/Add Announcement/
123
- AddEditAnnouncements.new(@browser)
124
- else
125
- Announcements.new(@browser)
126
- end
127
- end
128
-
129
- def save_changes
130
- frm.button(:value=>"Save Changes").click
131
- Announcements.new(@browser)
132
- end
133
-
134
- def preview
135
- frm.button(:value=>"Preview").click
136
- PreviewAnnouncements.new(@browser)
137
- end
138
-
139
- def body=(text)
140
- frm.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
141
- end
142
-
143
- def add_attachments
144
- frm.button(:value=>"Add Attachments").click
145
- AnnouncementsAttach.new(@browser)
146
- end
147
-
148
- # Clicks the checkbox for the specified group name
149
- # when you've set the announcement access to display
150
- # to groups.
151
- def check_group(group_name)
152
- frm.table(:id=>"groupTable").row(:text=>/#{Regexp.escape(group_name)}/).checkbox(:name=>"selectedGroups").set
153
- end
154
-
155
- # Sets the Announcement Title field to the specified
156
- # string value.
157
- def title=(string)
158
- frm.text_field(:id=>"subject").set(string)
159
- end
160
-
161
- # Clicks the radio button for "Only members of this site can see this announcement"
162
- def select_site_members
163
- frm.radio(:id=>"site").set
164
- end
165
-
166
- # Clicks the radio button for "This announcement is publicly viewable"
167
- def select_publicly_viewable
168
- frm.radio(:id=>"pubview").set
169
- end
170
-
171
- # Clicks the radio button for "Displays this announcement to selected groups only."
172
- def select_groups
173
- frm.radio(:id=>"groups").set
174
- end
175
-
176
- # Clicks the radio button for "Show - (Post and display this announcement immediately)"
177
- def select_show
178
- frm.radio(:id=>"hidden_false").set
179
- end
180
-
181
- # Clicks the radio button for "Hide - (Draft mode - Do not display this announcement at this time)"
182
- def select_hide
183
- frm.radio(:id=>"hidden_true").set
184
- end
185
-
186
- # Clicks the radio button for "Specify Dates - (Choose when this announcement will be displayed)"
187
- def select_specify_dates
188
- frm.radio(:id=>"hidden_specify").set
189
- end
190
-
191
- # Checks the checkbox for "Beginning"
192
- def check_beginning
193
- frm.checkbox(:id=>"use_start_date").set
194
- end
195
-
196
- # Checks the checkbox for "Ending"
197
- def check_ending
198
- frm.checkbox(:id=>"use_end_date").set
199
- end
200
-
201
- # Checks the checkbox for selecting all Groups
202
- def check_all
203
- frm.checkbox(:id=>"selectall").set
204
- end
205
-
206
- # Sets the Beginning Month selection to the
207
- # specified string.
208
- def beginning_month=(string)
209
- frm.select(:id=>"release_month").select(string)
210
- end
211
-
212
- # Sets the Beginning Day selection to the
213
- # specified string.
214
- def beginning_day=(string)
215
- frm.select(:id=>"release_day").select(string)
216
- end
217
-
218
- # Sets the Beginning Year selection to the
219
- # specified string.
220
- def beginning_year=(string)
221
- frm.select(:id=>"release_year").select(string)
222
- end
223
-
224
- # Sets the Beginning Hour selection to the
225
- # specified string
226
- def beginning_hour=(string)
227
- frm.select(:id=>"release_hour").select(string)
228
- end
229
-
230
- # Sets the Beginning Minute selection to the
231
- # specified string
232
- def beginning_minute=(string)
233
- frm.select(:id=>"release_minute").select(string)
234
- end
235
-
236
- # Sets the AM or PM value to the specified string.
237
- # Obviously the string should be either "AM" or "PM".
238
- def beginning_meridian=(string)
239
- frm.select(:id=>"release_ampm").select(string)
240
- end
241
-
242
- # Sets the Ending Month selection to the specified
243
- # string.
244
- def ending_month=(string)
245
- frm.select(:id=>"retract_month").select(string)
246
- end
247
-
248
- # Sets the Ending Day selection to the specified
249
- # string.
250
- def ending_day=(string)
251
- frm.select(:id=>"retract_day").select(string)
252
- end
253
-
254
- # Sets the Ending Year selection to the specified
255
- # string.
256
- def ending_year=(string)
257
- frm.select(:id=>"retract_year").select(string)
258
- end
259
-
260
- # Sets the Ending Hour selection to the specified
261
- # string.
262
- def ending_hour=(string)
263
- frm.select(:id=>"retract_hour").select(string)
264
- end
265
-
266
- # Sets the Ending Minute selection to the specified
267
- # string.
268
- def ending_minute=(string)
269
- frm.select(:id=>"retract_minute").select(string)
270
- end
271
-
272
- # Sets the Ending AM/PM selection to the specified
273
- # value.
274
- def ending_meridian=(string)
275
- frm.select(:id=>"retract_ampm").select(string)
276
- end
277
-
278
- # Gets the text of the alert message when it appears on
279
- # the page
280
- def alert_message
281
- frm.div(:class=>"alertMessage").text
282
- end
283
-
284
- end
285
-
286
- # The page for attaching files and links to Announcements.
287
- class AnnouncementsAttach < AttachPageTools
288
-
289
- include ToolsMenu
290
-
291
- def initialize(browser)
292
- @browser = browser
293
-
294
- @@classes= {
295
- :this => "AnnouncementsAttach",
296
- :parent => "AddEditAnnouncements"
297
- }
298
- end
299
-
300
- end
301
-
302
- # Page for merging announcements from other sites
303
- class AnnouncementsMerge
304
-
305
- include ToolsMenu
306
-
307
-
308
- end
309
-
310
- # Page for setting up options for announcements
311
- class AnnouncementsOptions
312
-
313
- include ToolsMenu
314
-
315
- end
316
-
317
- # Page containing permissions options for announcements
318
- class AnnouncementsPermissions
319
-
320
- include ToolsMenu
321
-
322
- end
323
-
324
-
325
- #================
326
- # Calendar Pages
327
- #================
328
-
329
- module CalendarTools
330
-
331
- #
332
- def add_event
333
- frm.link(:text=>"Add").click
334
- frm.frame(:id, "description___Frame").td(:id, "xEditingArea").frame(:index=>0).wait_until_present
335
- AddEditEvent.new(@browser)
336
- end
337
-
338
- #
339
- def fields
340
- frm.link(:text=>"Fields").click
341
- AddEditFields.new(@browser)
342
- end
343
-
344
- #
345
- def import
346
- frm.link(:text=>"Import").click
347
- ImportStepOne.new(@browser)
348
- end
349
-
350
- end
351
-
352
- # Top page of the Calendar
353
- # For now it includes all views, though that probably
354
- # means it will have to be re-instantiated every time
355
- # a new view is selected.
356
- class Calendar
357
-
358
- include PageObject
359
- include ToolsMenu
360
- include CalendarTools
361
-
362
- # Selects the specified item in the View select list,
363
- # then reinstantiates the Class.
364
- def select_view(item)
365
- frm.select(:id=>"view").select(item)
366
- Calendar.new(@browser)
367
- end
368
-
369
- # Selects the specified item in the View select list.
370
- # This is the same method as the select_view method, except
371
- # that it does not reinstantiate the class. Use this if you're
372
- # not concerned about throwing obsolete element errors when
373
- # the page updates.
374
- def view=(item)
375
- frm.select(:id=>"view").select(item)
376
- end
377
-
378
- # Selects the specified item in the Show select list.
379
- def show=(item)
380
- frm.select(:id=>"timeFilterOption").select(item)
381
- end
382
-
383
- # Returns the text of the Calendar's header.
384
- def header
385
- frm.div(:class=>"portletBody").h3.text
386
- end
387
-
388
- # This is the alert box object. If you want to
389
- # get the text contents of the alert box, use
390
- # alert_box.text. That will get you a string object
391
- # that is the text contents.
392
- def alert_box
393
- frm.div(:class=>"alertMessage")
394
- end
395
-
396
- # Clicks the link to the specified event, then
397
- # instantiates the EventDetail class.
398
- def open_event(title)
399
- truncated = title[0..5]
400
- frm.link(:text=>/#{Regexp.escape(truncated)}/).click
401
- EventDetail.new(@browser)
402
- end
403
-
404
- # Returns the href value of the target link
405
- # use for validation when you are testing whether the link
406
- # will appear again on another screen, since often times
407
- # validation by title text alone will not work.
408
- def event_href(title)
409
- truncated = title[0..5]
410
- return frm.link(:text=>/#{Regexp.escape(truncated)}/).href
411
- end
412
-
413
- def show_events=(item)
414
- frm.select(:id=>"timeFilterOption").select(item)
415
- end
416
-
417
- # Selects the specified value in the start month select list.
418
- def start_month=(item)
419
- frm.select(:id=>"customStartMonth").select(item)
420
- end
421
-
422
- # Selects the specified value in the start day select list.
423
- def start_day=(item)
424
- frm.select(:id=>"customStartDay").select(item)
425
- end
426
-
427
- # Selects the specified value in the start year select list.
428
- def start_year=(item)
429
- frm.select(:id=>"customStartYear").select(item)
430
- end
431
-
432
- # Selects the specified value in the end month select list.
433
- def end_month=(item)
434
- frm.select(:id=>"customEndMonth").select(item)
435
- end
436
-
437
- # Selects the specified value in the End Day select list.
438
- def end_day=(item)
439
- frm.select(:id=>"customEndDay").select(item)
440
- end
441
-
442
- # Selects the specified value in the End Year select list.
443
- def end_year=(item)
444
- frm.select(:id=>"customEndYear").select(item)
445
- end
446
-
447
- # Clicks the Filter Events button, then re-instantiates
448
- # the Calendar class to avoid the possibility of an
449
- # ObsoleteElement error.
450
- def filter_events
451
- frm.button(:name=>"eventSubmit_doCustomdate").click
452
- Calendar.new(@browser)
453
- end
454
-
455
- # Clicks the Go to Today button, then reinstantiates
456
- # the Calendar class.
457
- def go_to_today
458
- frm.button(:value=>"Go to Today").click
459
- Calendar.new(@browser)
460
- end
461
-
462
- # Returns an array of the titles of the displayed events.
463
- def event_list
464
- events_list
465
- end
466
-
467
- # Returns an array for the listed events.
468
- # This array contains more than simply strings of the event titles, because
469
- # often the titles are truncated to fit on the screen. In addition, getting the "title"
470
- # tag of the link is often problematic because titles can contain double-quotes, which
471
- # will mess up the HTML of the anchor tag (there is probably an XSS vulnerability to
472
- # exploit, there. This should be extensively tested.).
473
- #
474
- # Because of these issues, the array contains the title tag, the anchor text, and
475
- # the entire href string for every event listed on the page. Having all three items
476
- # available should ensure that verification steps don't give false results--especially
477
- # when you are doing a negative test (checking that an event is NOT present).
478
- def events_list
479
- list = []
480
- if frm.table(:class=>"calendar").exist?
481
- events_table = frm.table(:class=>"calendar")
482
- else
483
- events_table = frm.table(:class=>"listHier lines nolines")
484
- end
485
- events_table.links.each do |link|
486
- list << link.title
487
- list << link.text
488
- list << link.href
489
- list << link.html[/(?<="location=").+doDescription/]
490
- end
491
- list.compact!
492
- list.uniq!
493
- return list
494
- end
495
-
496
- # Clicks the "Previous X" button, where X might be Day, Week, or Month,
497
- # then reinstantiates the Calendar class to ensure against any obsolete element
498
- # errors.
499
- def previous
500
- frm.button(:name=>"eventSubmit_doPrev").click
501
- Calendar.new(@browser)
502
- end
503
-
504
- # Clicks the "Next X" button, where X might be Day, Week, or Month,
505
- # then reinstantiates the Calendar class to ensure against any obsolete element
506
- # errors.
507
- def next
508
- frm.button(:name=>"eventSubmit_doNext").click
509
- Calendar.new(@browser)
510
- end
511
-
512
- # Clicks the "Today" button and reinstantiates the class.
513
- def today
514
- frm.button(:value=>"Today").click
515
- Calendar.new(@browser)
516
- end
517
-
518
- def earlier
519
- frm().link(:text=>"Earlier").click
520
- Calendar.new(@browser)
521
- end
522
-
523
- def later
524
- frm().link(:text=>"Later").click
525
- Calendar.new(@browser)
526
- end
527
-
528
- # Clicks the "Set as Default View" button
529
- def set_as_default_view
530
- frm.link(:text=>"Set as Default View").click
531
- end
532
-
533
- end
534
-
535
- # The page that appears when you click on an event in the Calendar
536
- class EventDetail
537
-
538
- include PageObject
539
- include ToolsMenu
540
- include CalendarTools
541
-
542
- # Clicks the Go to Today button, then instantiates
543
- # the Calendar class.
544
- def go_to_today
545
- frm.button(:value=>"Go to Today").click
546
- Calendar.new(@browser)
547
- end
548
-
549
- def back_to_calendar
550
- frm.button(:value=>"Back to Calendar").click
551
- Calendar.new(@browser)
552
- end
553
-
554
- def last_event
555
- frm().button(:value=>"< Last Event").click
556
- EventDetail.new(@browser)
557
- end
558
-
559
- def next_event
560
- frm().button(:value=>"Next Event >").click
561
- EventDetail.new(@browser)
562
- end
563
-
564
- def event_title
565
- frm.div(:class=>"portletBody").h3.text
566
- end
567
-
568
- def edit
569
- frm.button(:value=>"Edit").click
570
- AddEditEvent.new(@browser)
571
- end
572
-
573
- def remove_event
574
- frm.button(:value=>"Remove event").click
575
- DeleteConfirm.new(@browser)
576
- end
577
-
578
- # Returns a hash object containing the contents of the event details
579
- # table on the page, with each of the header column items as a Key
580
- # and the associated data column as the corresponding Value.
581
- def details
582
- details = {}
583
- frm.table(:class=>"itemSummary").rows.each do |row|
584
- details.store(row.th.text, row.td.text)
585
- end
586
- return details
587
- end
588
-
589
- end
590
-
591
- #
592
- class AddEditEvent
593
-
594
- include PageObject
595
- include ToolsMenu
596
-
597
- #
598
- def save_event
599
- frm.button(:value=>"Save Event").click
600
- Calendar.new(@browser)
601
- end
602
- #
603
- def message=(text)
604
- frm.frame(:id, "description___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
605
- end
606
-
607
- # The FCKEditor object. Use this method to set up a "wait_until_present"
608
- # step, since sometimes it takes a long time for this object to load.
609
- def message_editor
610
- frm.frame(:id, "description___Frame").td(:id, "xEditingArea").frame(:index=>0)
611
- end
612
-
613
- def frequency
614
- frm.button(:name=>"eventSubmit_doEditfrequency").click
615
- EventFrequency.new(@browser)
616
- end
617
-
618
- def add_attachments
619
- frm.button(:value=>"Add Attachments").click
620
- EventAttach.new(@browser)
621
- end
622
-
623
- def add_remove_attachments
624
- frm.button(:value=>"Add/remove attachments").click
625
- EventAttach.new(@browser)
626
- end
627
-
628
- # Returns true if the page has a link with the
629
- # specified file name. Use for test case asserts.
630
- def attachment?(file_name)
631
- frm.link(:text=>file_name).exist?
632
- end
633
-
634
- # Use this method to enter text into custom fields
635
- # on the page. The "field" variable is the name of the
636
- # field, while the "text" is the string you want to put into
637
- # it.
638
- def custom_field_text(field, text)
639
- frm.text_field(:name=>field).set(text)
640
- end
641
-
642
- in_frame(:class=>"portletMainIframe") do |frame|
643
- text_field(:title, :id=>"activitytitle", :frame=>frame)
644
- select_list(:month, :id=>"month", :frame=>frame)
645
- select_list(:day, :id=>"day", :frame=>frame)
646
- select_list(:year, :id=>"yearSelect", :frame=>frame)
647
- select_list(:start_hour, :id=>"startHour", :frame=>frame)
648
- select_list(:start_minute, :id=>"startMinute", :frame=>frame)
649
- select_list(:start_meridian, :id=>"startAmpm", :frame=>frame)
650
- select_list(:hours, :id=>"duHour", :frame=>frame)
651
- select_list(:minutes, :id=>"duMinute", :frame=>frame)
652
- select_list(:end_hour, :id=>"endHour", :frame=>frame)
653
- select_list(:end_minute, :id=>"endMinute", :frame=>frame)
654
- select_list(:end_meridian, :id=>"endAmpm", :frame=>frame)
655
- radio_button(:display_to_site, :id=>"site", :frame=>frame)
656
- select_list(:event_type, :id=>"eventType", :frame=>frame)
657
- text_area(:location, :name=>"location", :frame=>frame)
658
- end
659
- end
660
-
661
- #
662
- class EventAttach < AttachPageTools
663
-
664
- include ToolsMenu
665
-
666
- def initialize(browser)
667
- @browser = browser
668
-
669
- @@classes = {
670
- :this=>"EventAttach",
671
- :parent=>"AddEditEvent"
672
- }
673
- end
674
-
675
- end
676
-
677
- # The page that appears when the Frequency button is clicked on the Add/Edit
678
- # Event page.
679
- class EventFrequency
680
-
681
- include PageObject
682
- include ToolsMenu
683
-
684
- def save_frequency
685
- frm.button(:value=>"Save Frequency").click
686
- AddEditEvent.new(@browser)
687
- end
688
-
689
- def cancel
690
- frm.button(:value=>"Cancel").click
691
- AddEditEvent.new(@browser)
692
- end
693
-
694
- in_frame(:class=>"portletMainIframe") do |frame|
695
- select_list(:event_frequency, :id=>"frequencySelect", :frame=>frame)
696
- select_list(:interval, :id=>"interval", :frame=>frame)
697
- select_list(:ends_after, :name=>"count", :frame=>frame)
698
- select_list(:ends_month, :id=>"endMonth", :frame=>frame)
699
- select_list(:ends_day, :id=>"endDay", :frame=>frame)
700
- select_list(:ends_year, :id=>"endYear", :frame=>frame)
701
- radio_button(:after, :id=>"count", :frame=>frame)
702
- radio_button(:on, :id=>"till", :frame=>frame)
703
- radio_button(:never, :id=>"never", :frame=>frame)
704
- end
705
- end
706
-
707
- #
708
- class AddEditFields
709
-
710
- include PageObject
711
- include ToolsMenu
712
-
713
- # Clicks the Save Field Changes buton and instantiates
714
- # The Calendar or EventDetail class--unless the Alert Message box appears,
715
- # in which case it re-instantiates the class.
716
- def save_field_changes
717
- frm.button(:value=>"Save Field Changes").click
718
- if frm.div(:class=>"alertMessage").exist?
719
- AddEditFields.new(@browser)
720
- elsif frm.button(:value=>"Back to Calendar").exist?
721
- EventDetail.new(@browser)
722
- else
723
- Calendar.new(@browser)
724
- end
725
- end
726
-
727
- # Returns a string of the contents of the Alert box.
728
- def alert_box
729
- frm.div(:class=>"alertMessage").text
730
- end
731
-
732
- def create_field
733
- frm.button(:value=>"Create Field").click
734
- AddEditFields.new(@browser)
735
- end
736
-
737
- # Checks the checkbox for the specified field
738
- def check_remove(field_name)
739
- frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(field_name)}/).checkbox.set
740
- end
741
-
742
- in_frame(:class=>"portletMainIframe") do |frame|
743
- text_field(:field_name, :id=>"textfield", :frame=>frame)
744
- end
745
- end
746
-
747
- #
748
- class ImportStepOne
749
-
750
- include PageObject
751
- include ToolsMenu
752
-
753
- def continue
754
- frm.button(:value=>"Continue").click
755
- ImportStepTwo.new(@browser)
756
- end
757
-
758
- in_frame(:class=>"portletMainIframe") do |frame|
759
- radio_button(:microsoft_outlook, :id=>"importType_Outlook", :frame=>frame)
760
- radio_button(:meeting_maker, :id=>"importType_MeetingMaker", :frame=>frame)
761
- radio_button(:generic_calendar_import, :id=>"importType_Generic", :frame=>frame)
762
- end
763
- end
764
-
765
- #
766
- class ImportStepTwo
767
-
768
- include PageObject
769
- include ToolsMenu
770
-
771
- def continue
772
- frm.button(:value=>"Continue").click
773
- ImportStepThree.new(@browser)
774
- end
775
-
776
- # Enters the specified filename in the file field.
777
- #
778
- # Note that the file path is an optional second parameter, if you do not want to
779
- # include the full path in the filename.
780
- def import_file(filename, filepath="")
781
- frm.file_field(:name=>"importFile").set(filepath + filename)
782
- end
783
-
784
- end
785
-
786
- # The page for reviewing activities and confirming them for import.
787
- class ImportStepThree
788
-
789
- include PageObject
790
- include ToolsMenu
791
-
792
- def import_events
793
- frm.button(:value=>"Import Events").click
794
- Calendar.new(@browser)
795
- end
796
-
797
- # Returns an array containing the list of Activity names on the page.
798
- def events
799
- list = []
800
- frm.table(:class=>/listHier lines/).rows.each do |row|
801
- if row.label(:for=>/eventSelected/).exist?
802
- list << row.label.text
803
- end
804
- end
805
- names = []
806
- list.uniq!
807
- list.each do | item |
808
- name = item[/(?<=\s).+(?=\s\s\()/]
809
- names << name
810
- end
811
- return names
812
- end
813
-
814
- # Returns the date of the specified event
815
- def event_date(event_name)
816
- frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)[0].text
817
- end
818
-
819
- # Unchecks the checkbox for the specified event
820
- def uncheck_event(event_name)
821
- frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)
822
- end
823
-
824
- in_frame(:class=>"portletMainIframe") do |frame|
825
- radio_button(:import_events_for_site, :id=>"site", :frame=>frame)
826
- radio_button(:import_events_for_selected_groups, :id=>"groups", :frame=>frame)
827
- end
828
- end
829
13
 
830
14
 
831
15
  #================
@@ -1230,7 +414,7 @@ class CreateFolders #FIXME - Need to add functions for adding multiple folders
1230
414
  end
1231
415
 
1232
416
  # Resources page for a given Site, in the Course Tools menu
1233
- class Resources < AttachPageTools
417
+ class Resources < AddFiles
1234
418
 
1235
419
  include ToolsMenu
1236
420