sakai-cle-test-api 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2045 @@
1
+ # Page classes that are in some way common to both
2
+ # the Site context and the My Workspace context.
3
+ #
4
+ # == Synopsis
5
+ #
6
+ # This script defines the page classes that are
7
+ # common to both page contexts--within a Site or within My Workspace.
8
+ #
9
+ # Author :: Abe Heward (aheward@rsmart.com)
10
+
11
+ #require File.dirname(__FILE__) + '/app_functions.rb'
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 should be inside the data/sakai-cle-test-api folder.
779
+ # The file or folder name used for the filename variable
780
+ # should not include a preceding / character.
781
+ def import_file(filename)
782
+ frm.file_field(:name=>"importFile").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
783
+ end
784
+
785
+ end
786
+
787
+ # The page for reviewing activities and confirming them for import.
788
+ class ImportStepThree
789
+
790
+ include PageObject
791
+ include ToolsMenu
792
+
793
+ def import_events
794
+ frm.button(:value=>"Import Events").click
795
+ Calendar.new(@browser)
796
+ end
797
+
798
+ # Returns an array containing the list of Activity names on the page.
799
+ def events
800
+ list = []
801
+ frm.table(:class=>/listHier lines/).rows.each do |row|
802
+ if row.label(:for=>/eventSelected/).exist?
803
+ list << row.label.text
804
+ end
805
+ end
806
+ names = []
807
+ list.uniq!
808
+ list.each do | item |
809
+ name = item[/(?<=\s).+(?=\s\s\()/]
810
+ names << name
811
+ end
812
+ return names
813
+ end
814
+
815
+ # Returns the date of the specified event
816
+ def event_date(event_name)
817
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)[0].text
818
+ end
819
+
820
+ # Unchecks the checkbox for the specified event
821
+ def uncheck_event(event_name)
822
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(event_name)}/)
823
+ end
824
+
825
+ in_frame(:class=>"portletMainIframe") do |frame|
826
+ radio_button(:import_events_for_site, :id=>"site", :frame=>frame)
827
+ radio_button(:import_events_for_selected_groups, :id=>"groups", :frame=>frame)
828
+ end
829
+ end
830
+
831
+
832
+ #================
833
+ # Evaluation System Pages
834
+ #================
835
+
836
+ # The "Evaluations Dashboard"
837
+ class EvaluationSystem
838
+
839
+ include PageObject
840
+ include ToolsMenu
841
+
842
+ def my_templates
843
+ frm.link(:text=>"My Templates").click
844
+ MyTemplates.new(@browser)
845
+ end
846
+
847
+ def add_template
848
+ frm.link(:text=>"Add Template").click
849
+ AddTemplateTitle.new(@browser)
850
+ end
851
+
852
+ def take_evaluation(evaluation_name)
853
+ frm.div(:class=>"summaryBox").table(:text=>/#{Regexp.escape(evaluation_name)}/).link.click
854
+ TakeEvaluation.new(@browser)
855
+ end
856
+
857
+ def status_of(evaluation_name)
858
+ return frm.div(:class=>"summaryBox").table(:text=>/#{Regexp.escape(evaluation_name)}/)[1][1].text
859
+ end
860
+
861
+ in_frame(:class=>"portletMainIframe") do |frame|
862
+
863
+ end
864
+ end
865
+
866
+ #
867
+ class AddTemplateTitle
868
+
869
+ include PageObject
870
+ include ToolsMenu
871
+
872
+ def save
873
+ frm.button(:value=>"Save").click
874
+ EditTemplate.new(@browser)
875
+ end
876
+
877
+ in_frame(:class=>"portletMainIframe") do |frame|
878
+ text_field(:title, :id=>"title", :frame=>frame)
879
+ text_area(:description, :id=>"description", :frame=>frame)
880
+ end
881
+ end
882
+
883
+ #
884
+ class EditTemplate
885
+
886
+ include PageObject
887
+ include ToolsMenu
888
+
889
+ def item_text=(text)
890
+ frm.frame(:id, "item-text___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
891
+ end
892
+
893
+ def new_evaluation
894
+ frm.link(:text=>"New evaluation").click
895
+ frm.frame(:id, "instructions:1:input___Frame").td(:id, "xEditingArea").wait_until_present
896
+ NewEvaluation.new(@browser)
897
+ end
898
+
899
+ def add
900
+ frm.button(:value=>"Add").click
901
+ frm.frame(:id, "item-text___Frame").td(:id, "xEditingArea").wait_until_present
902
+ end
903
+
904
+ def save_item
905
+ frm.button(:value=>"Save item").click
906
+ frm.link(:text=>"New evaluation").wait_until_present
907
+ EditTemplate.new @browser
908
+ end
909
+
910
+ in_frame(:class=>"portletMainIframe") do |frame|
911
+ select_list(:item, :id=>"add-item-control::add-item-classification-selection", :frame=>frame)
912
+ end
913
+ end
914
+
915
+ #
916
+ class NewEvaluation
917
+
918
+ include PageObject
919
+ include ToolsMenu
920
+
921
+ def continue_to_settings
922
+ frm.button(:value=>"Continue to Settings").click
923
+ EvaluationSettings.new(@browser)
924
+ end
925
+
926
+ def instructions=(text)
927
+ frm.frame(:id, "instructions:1:input___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
928
+ end
929
+
930
+ in_frame(:class=>"portletMainIframe") do |frame|
931
+ text_field(:title, :id=>"title", :frame=>frame)
932
+ end
933
+ end
934
+
935
+ #
936
+ class EvaluationSettings
937
+
938
+ include PageObject
939
+ include ToolsMenu
940
+
941
+ def continue_to_assign_to_courses
942
+ frm.button(:value=>"Continue to Assign to Courses").click
943
+ EditEvaluationAssignment.new(@browser)
944
+ end
945
+
946
+ in_frame(:class=>"portletMainIframe") do |frame|
947
+
948
+ end
949
+ end
950
+
951
+ #
952
+ class EditEvaluationAssignment
953
+
954
+ include PageObject
955
+ include ToolsMenu
956
+
957
+ def save_assigned_groups
958
+ frm.button(:value=>"Save Assigned Groups").click
959
+ ConfirmEvaluation.new(@browser)
960
+ end
961
+
962
+ def check_group(title)
963
+ frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(title)}/).checkbox(:name=>"selectedGroupIDs").set
964
+ end
965
+
966
+ in_frame(:class=>"portletMainIframe") do |frame|
967
+
968
+ end
969
+ end
970
+
971
+ #
972
+ class ConfirmEvaluation
973
+
974
+ include PageObject
975
+ include ToolsMenu
976
+
977
+ def done
978
+ frm.button(:value=>"Done").click
979
+ MyEvaluations.new(@browser)
980
+ end
981
+
982
+ end
983
+
984
+ #
985
+ class MyEvaluations
986
+
987
+ include PageObject
988
+ include ToolsMenu
989
+
990
+ in_frame(:class=>"portletMainIframe") do |frame|
991
+
992
+ end
993
+ end
994
+
995
+ #
996
+ class TakeEvaluation
997
+
998
+ include PageObject
999
+ include ToolsMenu
1000
+
1001
+ def submit_evaluation
1002
+ frm.button(:value=>"Submit Evaluation").click
1003
+ EvaluationSystem.new(@browser)
1004
+ end
1005
+
1006
+ in_frame(:class=>"portletMainIframe") do |frame|
1007
+
1008
+ end
1009
+ end
1010
+
1011
+
1012
+ #================
1013
+ # Overview-type Pages
1014
+ #================
1015
+
1016
+ # Topmost page for a Site in Sakai
1017
+ class Home
1018
+
1019
+ include PageObject
1020
+ include ToolsMenu
1021
+
1022
+ # Because the links below are contained within iframes
1023
+ # we need the in_frame method in place so that the
1024
+ # links can be properly parsed in the PageObject
1025
+ # methods for them.
1026
+ # Note that the iframes are being identified by their
1027
+ # index values on the page. This is a very brittle
1028
+ # method for identifying them, but for now it's our
1029
+ # only option because both the <id> and <name>
1030
+ # tags are unique for every site.
1031
+ in_frame(:index=>1) do |frame|
1032
+ # Site Information Display, Options button
1033
+ link(:site_info_display_options, :text=>"Options", :frame=>frame)
1034
+
1035
+ end
1036
+
1037
+ in_frame(:index=>2) do |frame|
1038
+ # Recent Announcements Options button
1039
+ link(:recent_announcements_options, :text=>"Options", :frame=>frame)
1040
+ # Link for New In Forms
1041
+ link(:new_in_forums, :text=>"New Messages", :frame=>frame)
1042
+ text_field(:number_of_announcements, :id=>"itemsEntryField", :frame=>frame)
1043
+ button(:update_announcements, :name=>"eventSubmit_doUpdate", :frame=>frame)
1044
+ end
1045
+
1046
+ # The Home class should be instantiated whenever the user
1047
+ # context is a given Site or the Administration Workspace.
1048
+ # In that context, the frame index is 1.
1049
+ $frame_index=1
1050
+
1051
+ # Gets the text of the displayed announcements, for
1052
+ # test case verification
1053
+ def announcements_list
1054
+ list = []
1055
+ links = @browser.frame(:index=>2).links
1056
+ links.each { |link| list << link.text }
1057
+ list.delete_if { |item| item=="Options" } # Deletes the Options link if it's there.
1058
+ return list
1059
+ end
1060
+
1061
+ end
1062
+
1063
+ # The Page that appears when you are not in a particular Site
1064
+ # Note that this page differs depending on what user is logged in.
1065
+ # The definitions below include all potential objects. We may
1066
+ # have to split this class out into user-specific classes.
1067
+ class MyWorkspace
1068
+
1069
+ include PageObject
1070
+ include ToolsMenu
1071
+
1072
+ # Because the links below are contained within iframes
1073
+ # we need the in_frame method in place so that the
1074
+ # links can be properly parsed in the PageObject
1075
+ # methods for them.
1076
+ # Note that the iframes are being identified by their
1077
+ # index values on the page. This is a very brittle
1078
+ # method for identifying them, but for now it's our
1079
+ # only option because both the <id> and <name>
1080
+ # tags are unique for every site.
1081
+ in_frame(:class=>"portletMainIframe") do |frame|
1082
+ # Calendar Options button
1083
+ link(:calendar_options, :text=>"Options", :frame=>frame)
1084
+ end
1085
+
1086
+ in_frame(:index=>1) do |frame|
1087
+ # My Workspace Information Options
1088
+ link(:my_workspace_information_options, :text=>"Options", :frame=>frame)
1089
+ # Message of the Day, Options button
1090
+ link(:message_of_the_day_options, :text=>"Options", :frame=>frame)
1091
+
1092
+ end
1093
+
1094
+ in_frame(:index=>0) do |frame|
1095
+ select_list(:select_page_size, :id=>"selectPageSize", :frame=>frame)
1096
+ button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
1097
+ button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
1098
+ button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
1099
+ button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
1100
+ end
1101
+
1102
+ # Returns an array of strings of the Calendar Events listed below
1103
+ # the Calendar
1104
+ def calendar_events
1105
+ events = []
1106
+ table = @browser.frame(:class=>"portletMainIframe", :index=>2).table(:id=>"calendarForm:datalist_event_list")
1107
+ table.wait_until_present
1108
+ table.rows.each do |row|
1109
+ events << row.link.text
1110
+ end
1111
+ return events
1112
+ end
1113
+
1114
+ # The MyWorkspace class should ONLY be instantiated when
1115
+ # the user context is NOT a given site or Administration Workspace.
1116
+ # Otherwise the frame index will not be 0, and page objects
1117
+ # will not be found by Webdriver.
1118
+ $frame_index=0
1119
+
1120
+ end
1121
+
1122
+ #================
1123
+ # Resources Pages
1124
+ #================
1125
+
1126
+ # New class template. For quick class creation...
1127
+ class ResourcesUploadFiles
1128
+
1129
+ include ToolsMenu
1130
+
1131
+ @@filex=0
1132
+
1133
+ # Enters the specified folder/filename value into
1134
+ # the file field on the page. Note that files are
1135
+ # assumed to be in the relative path ../../data/sakai-cle-test-api
1136
+ # The method will throw an error if the specified file
1137
+ # is not found.
1138
+ #
1139
+ # This method is designed to be able to use
1140
+ # multiple times, but it assumes
1141
+ # that the add_another_file method is used
1142
+ # before it, every time except before the first time.
1143
+ def file_to_upload=(file_name)
1144
+ frm.file_field(:id, "content_#{@@filex}").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + file_name)
1145
+ @@filex+=1
1146
+ end
1147
+
1148
+ # Clicks the Upload Files Now button, resets the
1149
+ # @@filex class variable back to zero, and instantiates
1150
+ # the Resources page class.
1151
+ def upload_files_now
1152
+ frm.button(:value=>"Upload Files Now").click
1153
+ @@filex=0
1154
+ Resources.new(@browser)
1155
+ end
1156
+
1157
+ # Clicks the Add Another File link.
1158
+ def add_another_file
1159
+ frm.link(:text=>"Add Another File").click
1160
+ end
1161
+
1162
+ end
1163
+
1164
+ class EditFileDetails
1165
+
1166
+ include ToolsMenu
1167
+
1168
+ # Clicks the Update button, then instantiates
1169
+ # the Resources page class.
1170
+ def update
1171
+ frm.button(:value=>"Update").click
1172
+ Resources.new(@browser)
1173
+ end
1174
+
1175
+ # Enters the specified string into the title field.
1176
+ def title=(title)
1177
+ frm.text_field(:id=>"displayName_0").set(title)
1178
+ end
1179
+
1180
+ # Enters the specified string into the description field.
1181
+ def description=(description)
1182
+ frm.text_field(:id=>"description_0").set(description)
1183
+ end
1184
+
1185
+ # Sets the radio button for publically viewable.
1186
+ def select_publicly_viewable
1187
+ frm.radio(:id=>"access_mode_public_0").set
1188
+ end
1189
+
1190
+ # Checks the checkbox for showing only on the specifed
1191
+ # condition.
1192
+ def check_show_only_if_condition
1193
+ frm.checkbox(:id=>"cbCondition_0")
1194
+ end
1195
+
1196
+ # Selects the specified Gradebook item value in the
1197
+ # select list.
1198
+ def gradebook_item=(item)
1199
+ frm.select(:id=>"selectResource_0").select(item)
1200
+ end
1201
+
1202
+ # Selects the specified value in the item condition
1203
+ # field.
1204
+ def item_condition=(condition)
1205
+ frm.select(:id=>"selectCondition_0").select(condition)
1206
+ end
1207
+
1208
+ # Sets the Grade field to the specified value.
1209
+ def assignment_grade=(grade)
1210
+ frm.text_field(:id=>"assignment_grade_0").set(grade)
1211
+ end
1212
+ end
1213
+
1214
+ class CreateFolders #FIXME - Need to add functions for adding multiple folders
1215
+
1216
+ include ToolsMenu
1217
+
1218
+ # Clicks the Create Folders Now button, then
1219
+ # instantiates the Resources page class.
1220
+ def create_folders_now
1221
+ frm.button(:value=>"Create Folders Now").click
1222
+ Resources.new(@browser)
1223
+ end
1224
+
1225
+ # Enters the specified string in the Folder Name
1226
+ # text field.
1227
+ def folder_name=(name)
1228
+ frm.text_field(:id=>"content_0").set(name)
1229
+ end
1230
+
1231
+ end
1232
+
1233
+ # Resources page for a given Site, in the Course Tools menu
1234
+ class Resources < AttachPageTools
1235
+
1236
+ include ToolsMenu
1237
+
1238
+ def initialize(browser)
1239
+ @browser = browser
1240
+
1241
+ @@classes = {
1242
+ :this=> "Resources",
1243
+ :parent => "Resources",
1244
+ :file_details => "EditFileDetails",
1245
+ :create_folders => "CreateFolders",
1246
+ :upload_files => "ResourcesUploadFiles"
1247
+ }
1248
+ end
1249
+
1250
+ end
1251
+
1252
+ #================
1253
+ # Administrative Search Pages
1254
+ #================
1255
+
1256
+ # The Search page in the Administration Workspace - "icon-sakai-search"
1257
+ class Search
1258
+
1259
+ include PageObject
1260
+ include ToolsMenu
1261
+
1262
+ in_frame(:index=>0) do |frame|
1263
+ link(:admin, :text=>"Admin", :frame=>frame)
1264
+ text_field(:search_field, :id=>"search", :frame=>frame)
1265
+ button(:search_button, :name=>"sb", :frame=>frame)
1266
+ radio_button(:this_site, :id=>"searchSite", :frame=>frame)
1267
+ radio_button(:all_my_sites, :id=>"searchMine", :frame=>frame)
1268
+
1269
+ end
1270
+
1271
+ end
1272
+
1273
+ # The Search Admin page within the Search page in the Admin workspace
1274
+ class SearchAdmin
1275
+
1276
+ include PageObject
1277
+ include ToolsMenu
1278
+
1279
+ in_frame(:index=>0) do |frame|
1280
+ link(:search, :text=>"Search", :frame=>frame)
1281
+ link(:rebuild_site_index, :text=>"Rebuild Site Index", :frame=>frame)
1282
+ link(:refresh_site_index, :text=>"Refresh Site Index", :frame=>frame)
1283
+ link(:rebuild_whole_index, :text=>"Rebuild Whole Index", :frame=>frame)
1284
+ link(:refresh_whole_index, :text=>"Refresh Whole Index", :frame=>frame)
1285
+ link(:remove_lock, :text=>"Remove Lock", :frame=>frame)
1286
+ link(:reload_index, :text=>"Reload Index", :frame=>frame)
1287
+ link(:enable_diagnostics, :text=>"Enable Diagnostics", :frame=>frame)
1288
+ link(:disable_diagnostics, :text=>"Disable Diagnostics", :frame=>frame)
1289
+ end
1290
+
1291
+ end
1292
+
1293
+ #================
1294
+ # Site Setup/Site Editor Pages
1295
+ #================
1296
+
1297
+ # This module contains the methods referring to the menu items
1298
+ # across the top of all the Site Editor pages.
1299
+ module SiteEditorMenu
1300
+
1301
+ # Clicks the Edit Tools link, then
1302
+ # instantiates the EditSiteTools class.
1303
+ def edit_tools
1304
+ frm.link(:text=>"Edit Tools").click
1305
+ EditSiteTools.new(@browser)
1306
+ end
1307
+
1308
+ # Clicks the Manage Groups link and
1309
+ # instantiates the Groups Class.
1310
+ def manage_groups
1311
+ frm.link(:text=>"Manage Groups").click
1312
+ Groups.new(@browser)
1313
+ end
1314
+
1315
+ # Clicks the Duplicate Site link and instantiates
1316
+ # the DuplicateSite class.
1317
+ def duplicate_site
1318
+ frm.link(:text=>"Duplicate Site").click
1319
+ DuplicateSite.new(@browser)
1320
+ end
1321
+
1322
+ def add_participants
1323
+ frm.link(:text=>"Add Participants").click
1324
+ SiteSetupAddParticipants.new @browser
1325
+ end
1326
+
1327
+ end
1328
+
1329
+ # The Site Setup page - a.k.a., link class=>"icon-sakai-sitesetup"
1330
+ class SiteSetup
1331
+
1332
+ include PageObject
1333
+ include ToolsMenu
1334
+
1335
+ # Clicks the "New" link on the Site Setup page.
1336
+ # instantiates the SiteType class.
1337
+ def new
1338
+ frm.div(:class=>"portletBody").link(:text=>"New").click
1339
+ SiteType.new(@browser)
1340
+ end
1341
+
1342
+ # Searches for the specified site, then
1343
+ # selects the specified Site's checkbox.
1344
+ # Then clicks the Edit button and instantiates
1345
+ # The SiteSetupEdit class.
1346
+ def edit(site_name)
1347
+ frm.text_field(:id, "search").value=Regexp.escape(site_name)
1348
+ frm.button(:value=>"Search").click
1349
+ frm.div(:class=>"portletBody").checkbox(:name=>"selectedMembers").set
1350
+ frm.div(:class=>"portletBody").link(:text, "Edit").click
1351
+ SiteEditor.new(@browser)
1352
+ end
1353
+
1354
+ # Enters the specified site name string in the search
1355
+ # field, clicks the Search button, then reinstantiates
1356
+ # the Class due to the page refresh.
1357
+ def search(site_name)
1358
+ frm.text_field(:id, "search").set site_name
1359
+ frm.button(:value, "Search").click
1360
+ SiteSetup.new(@browser)
1361
+ end
1362
+
1363
+ # Searches for the specified site, then
1364
+ # checks the site, clicks the delete button,
1365
+ # and instantiates the DeleteSite class.
1366
+ def delete(site_name)
1367
+ frm.text_field(:id, "Search").value=site_name
1368
+ frm.button(:value=>"Search").click
1369
+ frm.checkbox(:name=>"selectedMembers").set
1370
+ frm.div(:class=>"portletBody").link(:text, "Delete").click
1371
+ DeleteSite.new(@browser)
1372
+ end
1373
+
1374
+ # Returns an Array object containing strings of
1375
+ # all Site titles displayed on the web page.
1376
+ def site_titles
1377
+ titles = []
1378
+ sites_table = frm.table(:id=>"siteList")
1379
+ 1.upto(sites_table.rows.size-1) do |x|
1380
+ titles << sites_table[x][1].text
1381
+ end
1382
+ return titles
1383
+ end
1384
+
1385
+ in_frame(:class=>"portletMainIframe") do |frame| #FIXME!
1386
+ select_list(:view, :id=>"view", :frame=>frame)
1387
+ button(:clear_search, :value=>"Clear Search", :frame=>frame)
1388
+ select_list(:select_page_size, :id=>"selectPageSize", :frame=>frame)
1389
+ link(:sort_by_title, :text=>"Worksite Title", :frame=>frame)
1390
+ link(:sort_by_type, :text=>"Type", :frame=>frame)
1391
+ link(:sort_by_creator, :text=>"Creator", :frame=>frame)
1392
+ link(:sort_by_status, :text=>"Status", :frame=>frame)
1393
+ link(:sort_by_creation_date, :text=>"Creation Date", :frame=>frame)
1394
+ end
1395
+
1396
+ end
1397
+
1398
+ # The topmost "Site Editor" page,
1399
+ # found in SITE MANAGEMENT
1400
+ # or else Site Setup after you have
1401
+ # selected to Edit a particular site.
1402
+ class SiteEditor
1403
+
1404
+ include PageObject
1405
+ include ToolsMenu
1406
+ include SiteEditorMenu
1407
+
1408
+ # Sets the specified role for the specified participant.
1409
+ #
1410
+ # Because the participant is selected using a regular expression,
1411
+ # the "participant" string can be anything that will suffice as a
1412
+ # unique match--i.e., last name, first name, or user id, or any combination,
1413
+ # as long as it will match a part of the string that appears in the
1414
+ # desired row.
1415
+ def set_role(participant, role)
1416
+ frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(participant)}/).select(:id=>/role/).select(role)
1417
+ end
1418
+
1419
+ def update_participants
1420
+ frm.button(:value=>"Update Participants").click
1421
+ SiteEditor.new(@browser)
1422
+ end
1423
+
1424
+ in_frame(:class=>"portletMainIframe") do |frame|
1425
+ button(:previous, :name=>"previous", :frame=>frame)
1426
+ button(:return_to_sites_list, :name=>"", :frame=>frame)
1427
+ button(:next, :name=>"", :frame=>frame)
1428
+ link(:printable_version, :text=>"Printable Version", :frame=>frame)
1429
+ select_list(:select_page_size, :name=>"selectPageSize", :frame=>frame)
1430
+ button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
1431
+ button(:last, :name=>"eventSubmit_doList_last", :frame=>frame)
1432
+ button(:previous, :name=>"eventSubmit_doList_prev", :frame=>frame)
1433
+ button(:first, :name=>"eventSubmit_doList_first", :frame=>frame)
1434
+ end
1435
+
1436
+ end
1437
+
1438
+ # Groups page inside the Site Editor
1439
+ class Groups
1440
+
1441
+ include PageObject
1442
+ include ToolsMenu
1443
+ include SiteEditorMenu
1444
+
1445
+ # Clicks the Create New Group link and
1446
+ # instantiates the CreateNewGroup Class.
1447
+ def create_new_group
1448
+ create_new_group_link_element.wait_until_present
1449
+ create_new_group_link
1450
+ CreateNewGroup.new(@browser)
1451
+ end
1452
+
1453
+ in_frame(:class=>"portletMainIframe") do |frame|
1454
+ link(:create_new_group_link, :text=>"Create New Group", :frame=>frame)
1455
+ link(:auto_groups, :text=>"Auto Groups", :frame=>frame)
1456
+ button(:remove_checked, :id=>"delete-groups", :frame=>frame)
1457
+ button(:cancel, :id=>"cancel", :frame=>frame)
1458
+ end
1459
+ end
1460
+
1461
+ # The Create New Group page inside the Site Editor
1462
+ class CreateNewGroup
1463
+
1464
+ include PageObject
1465
+ include ToolsMenu
1466
+
1467
+ # Clicks the Add button and instantiates the Groups Class.
1468
+ def add
1469
+ frm.button(:id=>"save").click
1470
+ Groups.new(@browser)
1471
+ end
1472
+
1473
+ in_frame(:class=>"portletMainIframe") do |frame|
1474
+ text_field(:title, :id=>"group_title", :frame=>frame)
1475
+ text_field(:description, :id=>"group_description", :frame=>frame)
1476
+ select_list(:site_member_list, :name=>"siteMembers-selection", :frame=>frame)
1477
+ select_list(:group_member_list, :name=>"groupMembers-selection", :frame=>frame)
1478
+ button(:right, :name=>"right", :index=>0, :frame=>frame)
1479
+ button(:left, :name=>"left", :index=>0, :frame=>frame)
1480
+ button(:all_right, :name=>"right", :index=>1, :frame=>frame)
1481
+ button(:all_left, :name=>"left",:index=>1, :frame=>frame)
1482
+ button(:cancel, :id=>"cancel", :frame=>frame)
1483
+ end
1484
+ end
1485
+
1486
+ # The first page of the Duplicate Site pages in the Site Editor.
1487
+ class DuplicateSite
1488
+
1489
+ include PageObject
1490
+ include ToolsMenu
1491
+
1492
+ def duplicate
1493
+ frm.button(:value=>"Duplicate").click
1494
+ frm.span(:class=>"submitnotif").wait_while_present(300)
1495
+ SiteEditor.new(@browser)
1496
+ end
1497
+
1498
+ # Returns the site name in the header, for verification.
1499
+ def site_name
1500
+ frm.div(:class=>"portletBody").h3.span(:class=>"highlight").text
1501
+ end
1502
+
1503
+ in_frame(:class=>"portletMainIframe") do |frame|
1504
+ text_field(:site_title, :id=>"title", :frame=>frame)
1505
+ select_list(:academic_term, :id=>"selectTerm", :frame=>frame)
1506
+ end
1507
+ end
1508
+
1509
+
1510
+ # Page for Adding Participants to a Site in Site Setup
1511
+ class SiteSetupAddParticipants
1512
+
1513
+ include PageObject
1514
+ include ToolsMenu
1515
+
1516
+ def continue
1517
+ frm.button(:value=>"Continue").click
1518
+ SiteSetupChooseRole.new @browser
1519
+ end
1520
+
1521
+ in_frame(:class=>"portletMainIframe") do |frame|
1522
+ text_area(:official_participants, :id=>"content::officialAccountParticipant", :frame=>frame)
1523
+ text_area(:non_official_participants, :id=>"content::nonOfficialAccountParticipant", :frame=>frame)
1524
+ radio_button(:assign_all_to_same_role, :id=>"content::role-row:0:role-select", :frame=>frame)
1525
+ radio_button(:assign_each_individually, :id=>"content::role-row:1:role-select", :frame=>frame)
1526
+ radio_button(:active_status, :id=>"content::status-row:0:status-select", :frame=>frame)
1527
+ radio_button(:inactive_status, :id=>"content::status-row:1:status-select", :frame=>frame)
1528
+ button(:cancel, :id=>"content::cancel", :frame=>frame)
1529
+
1530
+ end
1531
+
1532
+ end
1533
+
1534
+ # Page for selecting Participant roles individually
1535
+ class SiteSetupChooseRolesIndiv
1536
+
1537
+ include PageObject
1538
+ include ToolsMenu
1539
+
1540
+ def continue
1541
+ frm.button(:value=>"Continue").click
1542
+ #SiteSetupParticipantEmail.new(@browser)
1543
+ end
1544
+
1545
+ in_frame(:class=>"portletMainIframe") do |frame|
1546
+ button(:back, :name=>"command link parameters&Submitting%20control=content%3A%3Aback&Fast%20track%20action=siteAddParticipantHandler.processDifferentRoleBack", :frame=>frame)
1547
+ button(:cancel, :name=>"command link parameters&Submitting%20control=content%3A%3Acancel&Fast%20track%20action=siteAddParticipantHandler.processCancel", :frame=>frame)
1548
+ select_list(:user_role, :id=>"content::user-row:0:role-select-selection", :frame=>frame)
1549
+ end
1550
+
1551
+ end
1552
+
1553
+ # Page for selecting the same role for All. This class is used for
1554
+ # both Course and Portfolio sites.
1555
+ class SiteSetupChooseRole
1556
+
1557
+ include PageObject
1558
+ include ToolsMenu
1559
+
1560
+ def continue
1561
+ frm.button(:value=>"Continue").click
1562
+ SiteSetupParticipantEmail.new(@browser)
1563
+ end
1564
+
1565
+ in_frame(:class=>"portletMainIframe") do |frame|
1566
+ button(:back, :name=>"command link parameters&Submitting%20control=content%3A%3Aback&Fast%20track%20action=siteAddParticipantHandler.processSameRoleBack", :frame=>frame)
1567
+ button(:cancel, :name=>"command link parameters&Submitting%20control=content%3A%3Acancel&Fast%20track%20action=siteAddParticipantHandler.processCancel", :frame=>frame)
1568
+ radio_button(:guest, :value=>"Guest", :frame=>frame)
1569
+ radio_button(:instructor, :value=>"Instructor", :frame=>frame)
1570
+ radio_button(:student, :value=>"Student", :frame=>frame)
1571
+ radio_button(:evaluator, :value=>"Evaluator", :frame=>frame)
1572
+ radio_button(:organizer, :value=>"Organizer", :frame=>frame)
1573
+ radio_button(:participant, :value=>"Participant", :frame=>frame)
1574
+ radio_button(:reviewer, :value=>"Reviewer", :frame=>frame)
1575
+ radio_button(:teaching_assistant, :id=>"content::role-row:3:role-select", :frame=>frame)
1576
+ end
1577
+
1578
+ end
1579
+
1580
+ # Page for specifying whether to send an email
1581
+ # notification to the newly added Site participants
1582
+ class SiteSetupParticipantEmail
1583
+
1584
+ include PageObject
1585
+ include ToolsMenu
1586
+
1587
+ def continue
1588
+ frm.button(:value=>"Continue").click
1589
+ SiteSetupParticipantConfirmation.new(@browser)
1590
+ end
1591
+
1592
+ in_frame(:class=>"portletMainIframe") do |frame|
1593
+ button(:back, :name=>"command link parameters&Submitting%20control=content%3A%3Acontinue&Fast%20track%20action=siteAddParticipantHandler.processEmailNotiBack", :frame=>frame)
1594
+ button(:cancel, :name=>"command link parameters&Submitting%20control=content%3A%3Acontinue&Fast%20track%20action=siteAddParticipantHandler.processEmailNotiCancel", :frame=>frame)
1595
+ radio_button(:send_now, :id=>"content::noti-row:0:noti-select", :frame=>frame)
1596
+ radio_button(:dont_send, :id=>"content::noti-row:1:noti-select", :frame=>frame)
1597
+
1598
+ end
1599
+
1600
+ end
1601
+
1602
+ # The confirmation page showing site participants and their set roles
1603
+ class SiteSetupParticipantConfirmation
1604
+
1605
+ include PageObject
1606
+ include ToolsMenu
1607
+
1608
+ def finish
1609
+ frm.button(:value=>"Finish").click
1610
+ SiteEditor.new(@browser)
1611
+ end
1612
+
1613
+ # Returns the value of the id field for the specified name.
1614
+ def id(name)
1615
+ frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(name)}/)[1].text
1616
+ end
1617
+
1618
+ # Returns the value of the Role field for the specified name.
1619
+ def role(name)
1620
+ frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(name)}/)[2].text
1621
+ end
1622
+
1623
+ in_frame(:class=>"portletMainIframe") do |frame|
1624
+ button(:back, :name=>"command link parameters&Submitting%20control=content%3A%3Aback&Fast%20track%20action=siteAddParticipantHandler.processConfirmBack", :frame=>frame)
1625
+ button(:cancel, :name=>"command link parameters&Submitting%20control=content%3A%3Aback&Fast%20track%20action=siteAddParticipantHandler.processConfirmCancel", :frame=>frame)
1626
+ end
1627
+ end
1628
+
1629
+ # The Edit Tools page (click on "Edit Tools" when editing a site
1630
+ # in Site Setup in the Admin Workspace)
1631
+ class EditSiteTools
1632
+
1633
+ include PageObject
1634
+ include ToolsMenu
1635
+
1636
+ # Clicks the Continue button, then instantiates
1637
+ # the appropriate class for the page that apears.
1638
+ def continue
1639
+ frm.button(:value=>"Continue").click
1640
+ # Logic for determining the new page class...
1641
+ if frm.div(:class=>"portletBody").text =~ /^Add Multiple Tool/
1642
+ AddMultipleTools.new(@browser)
1643
+ elsif frm.div(:class=>"portletBody").text =~ /^Confirming site tools edits for/
1644
+ ConfirmSiteToolsEdits.new(@browser)
1645
+ else
1646
+ puts "Something is wrong"
1647
+ puts frm.div(:class=>"portletBody").text
1648
+ end
1649
+ end
1650
+
1651
+ in_frame(:class=>"portletMainIframe") do |frame|
1652
+ # This is a comprehensive list of all checkboxes and
1653
+ # radio buttons for this page,
1654
+ # though not all will appear at one time.
1655
+ # The list will depend on the type of site being
1656
+ # created/edited.
1657
+ checkbox(:all_tools, :id=>"all", :frame=>frame)
1658
+ checkbox(:home, :id=>"home", :frame=>frame)
1659
+ checkbox(:announcements, :id=>"sakai.announcements", :frame=>frame)
1660
+ checkbox(:assignments, :id=>"sakai.assignment.grades", :frame=>frame)
1661
+ checkbox(:basic_lti, :id=>"sakai.basiclti", :frame=>frame)
1662
+ checkbox(:calendar, :id=>"sakai.schedule", :frame=>frame)
1663
+ checkbox(:email_archive, :id=>"sakai.mailbox", :frame=>frame)
1664
+ checkbox(:evaluations, :id=>"osp.evaluation", :frame=>frame)
1665
+ checkbox(:forms, :id=>"sakai.metaobj", :frame=>frame)
1666
+ checkbox(:glossary, :id=>"osp.glossary", :frame=>frame)
1667
+ checkbox(:matrices, :id=>"osp.matrix", :frame=>frame)
1668
+ checkbox(:news, :id=>"sakai.news", :frame=>frame)
1669
+ checkbox(:portfolio_layouts, :id=>"osp.presLayout", :frame=>frame)
1670
+ checkbox(:portfolio_showcase, :id=>"sakai.rsn.osp.iframe", :frame=>frame)
1671
+ checkbox(:portfolio_templates, :id=>"osp.presTemplate", :frame=>frame)
1672
+ checkbox(:portfolios, :id=>"osp.presentation", :frame=>frame)
1673
+ checkbox(:resources, :id=>"sakai.resources", :frame=>frame)
1674
+ checkbox(:roster, :id=>"sakai.site.roster", :frame=>frame)
1675
+ checkbox(:search, :id=>"sakai.search", :frame=>frame)
1676
+ checkbox(:styles, :id=>"osp.style", :frame=>frame)
1677
+ checkbox(:web_content, :id=>"sakai.iframe", :frame=>frame)
1678
+ checkbox(:wizards, :id=>"osp.wizard", :frame=>frame)
1679
+ checkbox(:blogger, :id=>"blogger", :frame=>frame)
1680
+ checkbox(:blogs, :id=>"sakai.blogwow", :frame=>frame)
1681
+ checkbox(:chat_room, :id=>"sakai.chat", :frame=>frame)
1682
+ checkbox(:discussion_forums, :id=>"sakai.jforum.tool", :frame=>frame)
1683
+ checkbox(:drop_box, :id=>"sakai.dropbox", :frame=>frame)
1684
+ checkbox(:email, :id=>"sakai.mailtool", :frame=>frame)
1685
+ checkbox(:forums, :id=>"sakai.forums", :frame=>frame)
1686
+ checkbox(:certification, :id=>"com.rsmart.certification", :frame=>frame)
1687
+ checkbox(:feedback, :id=>"sakai.postem", :frame=>frame)
1688
+ checkbox(:gradebook, :id=>"sakai.gradebook.tool", :frame=>frame)
1689
+ checkbox(:gradebook2, :id=>"sakai.gradebook.gwt.rpc", :frame=>frame)
1690
+ checkbox(:lesson_builder, :id=>"sakai.lessonbuildertool", :frame=>frame)
1691
+ checkbox(:lessons, :id=>"sakai.melete", :frame=>frame)
1692
+ checkbox(:live_virtual_classroom, :id=>"rsmart.virtual_classroom.tool", :frame=>frame)
1693
+ checkbox(:media_gallery, :id=>"sakai.kaltura", :frame=>frame)
1694
+ checkbox(:messages, :id=>"sakai.messages", :frame=>frame)
1695
+ checkbox(:news, :id=>"sakai.news", :frame=>frame)
1696
+ checkbox(:opensyllabus, :id=>"sakai.opensyllabus.tool", :frame=>frame)
1697
+ checkbox(:podcasts, :id=>"sakai.podcasts", :frame=>frame)
1698
+ checkbox(:polls, :id=>"sakai.poll", :frame=>frame)
1699
+ checkbox(:sections, :id=>"sakai.sections", :frame=>frame)
1700
+ checkbox(:site_editor, :id=>"sakai.siteinfo", :frame=>frame)
1701
+ checkbox(:site_statistics, :id=>"sakai.sitestats", :frame=>frame)
1702
+ checkbox(:syllabus, :id=>"sakai.syllabus", :frame=>frame)
1703
+ checkbox(:tests_and_quizzes_cb, :id=>"sakai.samigo", :frame=>frame)
1704
+ checkbox(:wiki, :id=>"sakai.rwiki", :frame=>frame)
1705
+ radio_button(:no_thanks, :id=>"import_no", :frame=>frame)
1706
+ radio_button(:yes, :id=>"import_yes", :frame=>frame)
1707
+ select_list(:import_sites, :id=>"importSites", :frame=>frame)
1708
+ button(:back, :name=>"Back", :frame=>frame)
1709
+ button(:cancel, :name=>"Cancel", :frame=>frame)
1710
+ end
1711
+
1712
+ end
1713
+
1714
+ # Confirmation page when editing site tools in Site Setup
1715
+ class ConfirmSiteToolsEdits
1716
+
1717
+ include PageObject
1718
+ include ToolsMenu
1719
+
1720
+ # Clicks the Finish button, then instantiates
1721
+ # the SiteSetupEdit class.
1722
+ def finish
1723
+ frm.button(:value=>"Finish").click
1724
+ SiteEditor.new(@browser)
1725
+ end
1726
+
1727
+ end
1728
+
1729
+
1730
+ # The Delete Confirmation Page for deleting a Site
1731
+ class DeleteSite
1732
+
1733
+ include PageObject
1734
+ include ToolsMenu
1735
+
1736
+ # Clicks the Remove button, then instantiates
1737
+ # the SiteSetup class.
1738
+ def remove
1739
+ frm.button(:value=>"Remove").click
1740
+ SiteSetup.new(@browser)
1741
+ end
1742
+
1743
+ # Clicks the Cancel button, then instantiates
1744
+ # the SiteSetup class.
1745
+ def cancel
1746
+ frm.button(:value=>"Cancel").click
1747
+ SiteSetup.new(@browser)
1748
+ end
1749
+
1750
+ end
1751
+ #The Site Type page that appears when creating a new site
1752
+ class SiteType
1753
+
1754
+ include PageObject
1755
+ include ToolsMenu
1756
+
1757
+ # The page's Continue button. Button gets
1758
+ # clicked and then the appropriate class
1759
+ # gets instantiated, based on the page that
1760
+ # appears.
1761
+ def continue #FIXME
1762
+ if frm.button(:id, "submitBuildOwn").enabled?
1763
+ frm.button(:id, "submitBuildOwn").click
1764
+ elsif frm.button(:id, "submitFromTemplateCourse").enabled?
1765
+ frm.button(:id, "submitFromTemplateCourse").click
1766
+ elsif frm.button(:id, "submitFromTemplate").enabled?
1767
+ frm.button(:id, "submitFromTemplate").click
1768
+ =begin
1769
+ elsif frm.button(:value=>"Continue", :index=>$frame_index).enabled?
1770
+ frm.button(:value=>"Continue", :index=>$frame_index).fire_event("onclick")
1771
+ elsif frm.button(:value=>"Continue", :index=>$frame_index).enabled?
1772
+ frm.button(:value=>"Continue", :index=>$frame_index).fire_event("onclick")
1773
+ elsif frm.button(:value=>"Continue", :index=>2).enabled?
1774
+ frm.button(:value=>"Continue", :index=>2).fire_event("onclick")
1775
+ else
1776
+ frm.button(:value=>"Continue", :index=>2).fire_event("onclick")
1777
+ =end
1778
+ end
1779
+
1780
+ if frm.div(:class=>"portletBody").h3.text=="Course/Section Information"
1781
+ CourseSectionInfo.new(@browser)
1782
+ elsif frm.div(:class=>"portletBody").h3.text=="Project Site Information"
1783
+ ProjectSiteInfo.new(@browser)
1784
+ elsif frm.div(:class=>"portletBody").h3.text=="Portfolio Site Information"
1785
+ PortfolioSiteInfo.new(@browser)
1786
+ else
1787
+ puts "Something is wrong on Saturn 3"
1788
+ end
1789
+ end
1790
+
1791
+ in_frame(:class=>"portletMainIframe") do |frame|
1792
+ radio_button(:course_site, :id=>"course", :frame=>frame)
1793
+ radio_button(:project_site, :id=>"project", :frame=>frame)
1794
+ radio_button(:portfolio_site, :id=>"portfolio", :frame=>frame)
1795
+ radio_button(:create_site_from_template, :id=>"copy", :frame=>frame)
1796
+ select_list(:academic_term, :id=>"selectTerm", :frame=>frame)
1797
+ select_list(:select_template, :id=>"templateSiteId", :frame=>frame)
1798
+ select_list(:select_term, :id=>"selectTermTemplate", :frame=>frame)
1799
+ button(:cancel, :id=>"cancelCreate", :frame=>frame)
1800
+ checkbox(:copy_users, :id=>"copyUsers", :frame=>frame)
1801
+ checkbox(:copy_content, :id=>"copyContent", :frame=>frame)
1802
+ end
1803
+
1804
+ end
1805
+
1806
+ # The Add Multiple Tool Instances page that appears during Site creation
1807
+ # after the Course Site Tools page
1808
+ class AddMultipleTools
1809
+
1810
+ include PageObject
1811
+ include ToolsMenu
1812
+
1813
+ # Clicks the Continue button, then instantiates
1814
+ # the appropriate Class, based on the page that
1815
+ # appears.
1816
+ def continue
1817
+ frm.button(:value=>"Continue").click
1818
+ # Logic to determine the new page class
1819
+ if frm.div(:class=>"portletBody").text =~ /Course Site Access/
1820
+ SiteAccess.new(@browser)
1821
+ elsif frm.div(:class=>"portletBody").text =~ /^Confirming site tools edits/
1822
+ ConfirmSiteToolsEdits.new(@browser)
1823
+ else
1824
+ puts "There's another path to define"
1825
+ end
1826
+ end
1827
+
1828
+ in_frame(:class=>"portletMainIframe") do |frame|
1829
+ # Note that the text field definitions included here
1830
+ # for the Tools definitions are ONLY for the first
1831
+ # instances of each. Since the UI allows for
1832
+ # an arbitrary number, if you are writing tests
1833
+ # that add more then you're going to have to explicitly
1834
+ # reference them or define them in the test case script
1835
+ # itself--for now, anyway.
1836
+ text_field(:site_email_address, :id=>"emailId", :frame=>frame)
1837
+ text_field(:basic_lti_title, :id=>"title_sakai.basiclti", :frame=>frame)
1838
+ select_list(:more_basic_lti_tools, :id=>"num_sakai.basiclti", :frame=>frame)
1839
+ text_field(:lesson_builder_title, :id=>"title_sakai.lessonbuildertool", :frame=>frame)
1840
+ select_list(:more_lesson_builder_tools, :id=>"num_sakai.lessonbuildertool", :frame=>frame)
1841
+ text_field(:news_title, :id=>"title_sakai.news", :frame=>frame)
1842
+ text_field(:news_url_channel, :name=>"channel-url_sakai.news", :frame=>frame)
1843
+ select_list(:more_news_tools, :id=>"num_sakai.news", :frame=>frame)
1844
+ text_field(:web_content_title, :id=>"title_sakai.iframe", :frame=>frame)
1845
+ text_field(:web_content_source, :id=>"source_sakai.iframe", :frame=>frame)
1846
+ select_list(:more_web_content_tools, :id=>"num_sakai.iframe", :frame=>frame)
1847
+ button(:back, :name=>"Back", :frame=>frame)
1848
+ button(:cancel, :name=>"Cancel", :frame=>frame)
1849
+
1850
+ end
1851
+
1852
+ end
1853
+
1854
+ # The Course/Section Information page that appears when creating a new Site
1855
+ class CourseSectionInfo
1856
+
1857
+ include PageObject
1858
+ include ToolsMenu
1859
+
1860
+ # Clicks the Continue button, then instantiates
1861
+ # the CourseSiteInfo Class.
1862
+ def continue
1863
+ frm.button(:value=>"Continue").click
1864
+ CourseSiteInfo.new(@browser)
1865
+ end
1866
+
1867
+ # Clicks the Done button (or the
1868
+ # "Done - go to Site" button if it
1869
+ # happens to be there), then instantiates
1870
+ # the SiteSetup Class.
1871
+ def done
1872
+ frm.button(:value=>/Done/).click
1873
+ SiteSetup.new(@browser)
1874
+ end
1875
+
1876
+ in_frame(:class=>"portletMainIframe") do |frame|
1877
+ # Note that ONLY THE FIRST instances of the
1878
+ # subject, course, and section fields
1879
+ # are included in the page elements definitions here,
1880
+ # because their identifiers are dependent on how
1881
+ # many instances exist on the page.
1882
+ # This means that if you need to access the second
1883
+ # or subsequent of these elements, you'll need to
1884
+ # explicitly identify/define them in the test case
1885
+ # itself.
1886
+ text_field(:subject, :name=>/Subject:/, :frame=>frame)
1887
+ text_field(:course, :name=>/Course:/, :frame=>frame)
1888
+ text_field(:section, :name=>/Section:/, :frame=>frame)
1889
+ text_field(:authorizers_username, :id=>"uniqname", :frame=>frame)
1890
+ text_field(:special_instructions, :id=>"additional", :frame=>frame)
1891
+ select_list(:add_more_rosters, :id=>"number", :frame=>frame)
1892
+ button(:back, :name=>"Back", :frame=>frame)
1893
+ button(:cancel, :name=>"Cancel", :frame=>frame)
1894
+ end
1895
+
1896
+ end
1897
+
1898
+ # The Site Access Page that appears during Site creation
1899
+ # immediately following the Add Multiple Tools Options page.
1900
+ class SiteAccess
1901
+
1902
+ include PageObject
1903
+ include ToolsMenu
1904
+
1905
+ # The page element that displays the joiner role
1906
+ # select list. Use this method to validate whether the
1907
+ # select list is visible or not.
1908
+ #
1909
+ # Example: page.joiner_role_div.visible?
1910
+ def joiner_role_div
1911
+ frm.div(:id=>"joinerrole")
1912
+ end
1913
+
1914
+ # Clicks the Continue button, then
1915
+ # instantiates the ConfirmCourseSiteSetup class.
1916
+ def continue
1917
+ frm.button(:value=>"Continue").click
1918
+ ConfirmSiteSetup.new(@browser)
1919
+ end
1920
+
1921
+ in_frame(:class=>"portletMainIframe") do |frame|
1922
+ radio_button(:publish_site, :id=>"publish", :frame=>frame)
1923
+ radio_button(:leave_as_draft, :id=>"unpublish", :frame=>frame)
1924
+ radio_button(:limited, :id=>"unjoinable", :frame=>frame)
1925
+ radio_button(:allow, :id=>"joinable", :frame=>frame)
1926
+ button(:back, :name=>"eventSubmit_doBack", :frame=>frame)
1927
+ button(:cancel, :name=>"eventSubmit_doCancel_create", :frame=>frame)
1928
+ select_list(:joiner_role, :id=>"joinerRole", :frame=>frame)
1929
+ end
1930
+
1931
+ end
1932
+
1933
+ # The Confirmation page at the end of a Course Site Setup
1934
+ class ConfirmSiteSetup
1935
+
1936
+ include PageObject
1937
+ include ToolsMenu
1938
+
1939
+ # Clicks the Request Site button, then
1940
+ # instantiates the SiteSetup Class.
1941
+ def request_site
1942
+ frm.button(:value=>"Request Site").click
1943
+ SiteSetup.new(@browser)
1944
+ end
1945
+
1946
+ # For portfolio sites...
1947
+ # Clicks the "Create Site" button and
1948
+ # instantiates the SiteSetup class.
1949
+ def create_site
1950
+ frm.button(:value=>"Create Site").click
1951
+ SiteSetup.new(@browser)
1952
+ end
1953
+
1954
+ end
1955
+
1956
+ # The Course Site Information page that appears when creating a new Site
1957
+ # immediately after the Course/Section Information page
1958
+ class CourseSiteInfo
1959
+
1960
+ include PageObject
1961
+ include ToolsMenu
1962
+
1963
+ # Clicks the Continue button, then
1964
+ # instantiates the EditSiteTools Class.
1965
+ def continue
1966
+ frm.button(:value=>"Continue").click
1967
+ EditSiteTools.new(@browser)
1968
+ end
1969
+
1970
+ # Gets the text contained in the alert box
1971
+ # on the web page.
1972
+ def alert_box_text
1973
+ frm.div(:class=>"portletBody").div(:class=>"alertMessage").text
1974
+ end
1975
+
1976
+ in_frame(:class=>"portletMainIframe") do |frame|
1977
+ text_field(:short_description, :id=>"short_description", :frame=>frame)
1978
+ text_field(:special_instructions, :id=>"additional", :frame=>frame)
1979
+ text_field(:site_contact_name, :id=>"siteContactName", :frame=>frame)
1980
+ text_field(:site_contact_email, :id=>"siteContactEmail", :frame=>frame)
1981
+ button(:back, :name=>"Back", :frame=>frame)
1982
+ button(:cancel, :name=>"Cancel", :frame=>frame)
1983
+ end
1984
+
1985
+ end
1986
+
1987
+ #
1988
+ class PortfolioSiteInfo
1989
+
1990
+ include PageObject
1991
+ include ToolsMenu
1992
+
1993
+ def description=(text)
1994
+ frm.frame(:id, "description___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
1995
+ end
1996
+
1997
+ def continue
1998
+ frm.button(:value=>"Continue").click
1999
+ PortfolioSiteTools.new(@browser)
2000
+ end
2001
+
2002
+ in_frame(:class=>"portletMainIframe") do |frame|
2003
+ text_field(:title, :id=>"title", :frame=>frame)
2004
+ text_field(:url_alias, :id=>"alias_0", :frame=>frame)
2005
+ text_area(:short_description, :id=>"short_description", :frame=>frame)
2006
+ text_field(:icon_url, :id=>"iconUrl", :frame=>frame)
2007
+ text_field(:site_contact_name, :id=>"siteContactName", :frame=>frame)
2008
+ text_field(:site_contact_email, :id=>"siteContactEmail", :frame=>frame)
2009
+ end
2010
+ end
2011
+
2012
+ #
2013
+ class PortfolioSiteTools
2014
+
2015
+ include PageObject
2016
+ include ToolsMenu
2017
+
2018
+ def continue
2019
+ frm.button(:value=>"Continue").click
2020
+ PortfolioConfigureToolOptions.new(@browser)
2021
+ end
2022
+
2023
+ in_frame(:class=>"portletMainIframe") do |frame|
2024
+ checkbox(:all_tools, :id=>"all", :frame=>frame)
2025
+
2026
+ end
2027
+ end
2028
+
2029
+ #
2030
+ class PortfolioConfigureToolOptions
2031
+
2032
+ include PageObject
2033
+ include ToolsMenu
2034
+
2035
+ def continue
2036
+ frm.button(:value=>"Continue").click
2037
+ SiteAccess.new(@browser)
2038
+ end
2039
+
2040
+ in_frame(:class=>"portletMainIframe") do |frame|
2041
+ text_field(:email, :id=>"emailId", :frame=>frame)
2042
+ end
2043
+ end
2044
+
2045
+