sakai-cle-test-api 0.0.9 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sakai-cle-test-api.rb +2 -7
- data/lib/sakai-cle-test-api/admin_page_elements.rb +2 -6
- data/lib/sakai-cle-test-api/announcements.rb +7 -274
- data/lib/sakai-cle-test-api/assessments.rb +27 -930
- data/lib/sakai-cle-test-api/assignments.rb +13 -769
- data/lib/sakai-cle-test-api/basic_lti.rb +1 -5
- data/lib/sakai-cle-test-api/blogs.rb +2 -54
- data/lib/sakai-cle-test-api/calendar.rb +8 -423
- data/lib/sakai-cle-test-api/common_page_elements.rb +172 -69
- data/lib/sakai-cle-test-api/drop_box.rb +0 -21
- data/lib/sakai-cle-test-api/email_archive.rb +1 -15
- data/lib/sakai-cle-test-api/forums.rb +8 -282
- data/lib/sakai-cle-test-api/gradebook.rb +1 -19
- data/lib/sakai-cle-test-api/gradebook2.rb +1 -15
- data/lib/sakai-cle-test-api/messages.rb +15 -551
- data/lib/sakai-cle-test-api/news.rb +1 -3
- data/lib/sakai-cle-test-api/polls.rb +3 -65
- data/lib/sakai-cle-test-api/profile.rb +2 -36
- data/lib/sakai-cle-test-api/profile2.rb +6 -315
- data/lib/sakai-cle-test-api/sections.rb +8 -198
- data/lib/sakai-cle-test-api/site_page_elements.rb +441 -4
- data/lib/sakai-cle-test-api/syllabus.rb +7 -149
- data/lib/sakai-cle-test-api/tools_menu.rb +20 -3
- data/lib/sakai-cle-test-api/utilities.rb +0 -260
- data/sakai-cle-test-api.gemspec +3 -2
- metadata +19 -21
- data/lib/sakai-cle-test-api/add_files.rb +0 -198
- data/lib/sakai-cle-test-api/chat_room.rb +0 -0
- data/lib/sakai-cle-test-api/core-ext.rb +0 -90
- data/lib/sakai-cle-test-api/data_objects/announcement.rb +0 -38
- data/lib/sakai-cle-test-api/data_objects/assessment.rb +0 -32
- data/lib/sakai-cle-test-api/data_objects/assignment.rb +0 -62
- data/lib/sakai-cle-test-api/data_objects/event.rb +0 -86
- data/lib/sakai-cle-test-api/data_objects/lesson.rb +0 -137
- data/lib/sakai-cle-test-api/data_objects/resource.rb +0 -174
- data/lib/sakai-cle-test-api/data_objects/site.rb +0 -213
- data/lib/sakai-cle-test-api/data_objects/syllabus.rb +0 -7
- data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
- data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +0 -52
- data/lib/sakai-cle-test-api/data_objects/wiki.rb +0 -7
- data/lib/sakai-cle-test-api/gem_ext.rb +0 -45
- data/lib/sakai-cle-test-api/lessons.rb +0 -440
- data/lib/sakai-cle-test-api/resources.rb +0 -138
- data/lib/sakai-cle-test-api/rich_text.rb +0 -13
@@ -143,12 +143,11 @@ class EditEvaluationAssignment
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def check_group(title)
|
146
|
-
frm.table(:class=>"listHier lines nolines").wait_until_present
|
147
146
|
frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(title)}/).checkbox(:name=>"selectedGroupIDs").set
|
148
147
|
end
|
149
148
|
|
150
149
|
in_frame(:class=>"portletMainIframe") do |frame|
|
151
|
-
|
150
|
+
|
152
151
|
end
|
153
152
|
end
|
154
153
|
|
@@ -227,6 +226,11 @@ class Home
|
|
227
226
|
button(:update_announcements, :name=>"eventSubmit_doUpdate", :frame=>frame)
|
228
227
|
end
|
229
228
|
|
229
|
+
# The Home class should be instantiated whenever the user
|
230
|
+
# context is a given Site or the Administration Workspace.
|
231
|
+
# In that context, the frame index is 1.
|
232
|
+
$frame_index=1
|
233
|
+
|
230
234
|
# Gets the text of the displayed announcements, for
|
231
235
|
# test case verification
|
232
236
|
def announcements_list
|
@@ -298,7 +302,135 @@ class MyWorkspace
|
|
298
302
|
|
299
303
|
end
|
300
304
|
|
305
|
+
#================
|
306
|
+
# Resources Pages
|
307
|
+
#================
|
308
|
+
|
309
|
+
# New class template. For quick class creation...
|
310
|
+
class ResourcesUploadFiles
|
311
|
+
|
312
|
+
include ToolsMenu
|
313
|
+
|
314
|
+
@@filex=0
|
315
|
+
|
316
|
+
# Enters the specified folder/filename value into
|
317
|
+
# the file field on the page. Note that files are
|
318
|
+
# assumed to be in the relative path ../../data/sakai-cle-test-api
|
319
|
+
# The method will throw an error if the specified file
|
320
|
+
# is not found.
|
321
|
+
#
|
322
|
+
# This method is designed to be able to use
|
323
|
+
# multiple times, but it assumes
|
324
|
+
# that the add_another_file method is used
|
325
|
+
# before it, every time except before the first time.
|
326
|
+
def file_to_upload(file_name, file_path="")
|
327
|
+
frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
|
328
|
+
@@filex+=1
|
329
|
+
end
|
330
|
+
|
331
|
+
# Clicks the Upload Files Now button, resets the
|
332
|
+
# @@filex class variable back to zero, and instantiates
|
333
|
+
# the Resources page class.
|
334
|
+
def upload_files_now
|
335
|
+
frm.button(:value=>"Upload Files Now").click
|
336
|
+
@@filex=0
|
337
|
+
Resources.new(@browser)
|
338
|
+
end
|
339
|
+
|
340
|
+
# Clicks the Add Another File link.
|
341
|
+
def add_another_file
|
342
|
+
frm.link(:text=>"Add Another File").click
|
343
|
+
end
|
344
|
+
|
345
|
+
end
|
346
|
+
|
347
|
+
class EditFileDetails
|
348
|
+
|
349
|
+
include ToolsMenu
|
350
|
+
|
351
|
+
# Clicks the Update button, then instantiates
|
352
|
+
# the Resources page class.
|
353
|
+
def update
|
354
|
+
frm.button(:value=>"Update").click
|
355
|
+
Resources.new(@browser)
|
356
|
+
end
|
357
|
+
|
358
|
+
# Enters the specified string into the title field.
|
359
|
+
def title=(title)
|
360
|
+
frm.text_field(:id=>"displayName_0").set(title)
|
361
|
+
end
|
362
|
+
|
363
|
+
# Enters the specified string into the description field.
|
364
|
+
def description=(description)
|
365
|
+
frm.text_field(:id=>"description_0").set(description)
|
366
|
+
end
|
367
|
+
|
368
|
+
# Sets the radio button for publically viewable.
|
369
|
+
def select_publicly_viewable
|
370
|
+
frm.radio(:id=>"access_mode_public_0").set
|
371
|
+
end
|
372
|
+
|
373
|
+
# Checks the checkbox for showing only on the specifed
|
374
|
+
# condition.
|
375
|
+
def check_show_only_if_condition
|
376
|
+
frm.checkbox(:id=>"cbCondition_0")
|
377
|
+
end
|
378
|
+
|
379
|
+
# Selects the specified Gradebook item value in the
|
380
|
+
# select list.
|
381
|
+
def gradebook_item=(item)
|
382
|
+
frm.select(:id=>"selectResource_0").select(item)
|
383
|
+
end
|
384
|
+
|
385
|
+
# Selects the specified value in the item condition
|
386
|
+
# field.
|
387
|
+
def item_condition=(condition)
|
388
|
+
frm.select(:id=>"selectCondition_0").select(condition)
|
389
|
+
end
|
390
|
+
|
391
|
+
# Sets the Grade field to the specified value.
|
392
|
+
def assignment_grade=(grade)
|
393
|
+
frm.text_field(:id=>"assignment_grade_0").set(grade)
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
class CreateFolders #FIXME - Need to add functions for adding multiple folders
|
398
|
+
|
399
|
+
include ToolsMenu
|
400
|
+
|
401
|
+
# Clicks the Create Folders Now button, then
|
402
|
+
# instantiates the Resources page class.
|
403
|
+
def create_folders_now
|
404
|
+
frm.button(:value=>"Create Folders Now").click
|
405
|
+
Resources.new(@browser)
|
406
|
+
end
|
407
|
+
|
408
|
+
# Enters the specified string in the Folder Name
|
409
|
+
# text field.
|
410
|
+
def folder_name=(name)
|
411
|
+
frm.text_field(:id=>"content_0").set(name)
|
412
|
+
end
|
413
|
+
|
414
|
+
end
|
415
|
+
|
416
|
+
# Resources page for a given Site, in the Course Tools menu
|
417
|
+
class Resources < AddFiles
|
301
418
|
|
419
|
+
include ToolsMenu
|
420
|
+
|
421
|
+
def initialize(browser)
|
422
|
+
@browser = browser
|
423
|
+
|
424
|
+
@@classes = {
|
425
|
+
:this=> "Resources",
|
426
|
+
:parent => "Resources",
|
427
|
+
:file_details => "EditFileDetails",
|
428
|
+
:create_folders => "CreateFolders",
|
429
|
+
:upload_files => "ResourcesUploadFiles"
|
430
|
+
}
|
431
|
+
end
|
432
|
+
|
433
|
+
end
|
302
434
|
|
303
435
|
#================
|
304
436
|
# Administrative Search Pages
|
@@ -382,11 +514,7 @@ class SiteSetup
|
|
382
514
|
|
383
515
|
include PageObject
|
384
516
|
include ToolsMenu
|
385
|
-
|
386
|
-
def search_field
|
387
|
-
frm.text_field(:id, "search")
|
388
|
-
end
|
389
|
-
|
517
|
+
|
390
518
|
# Clicks the "New" link on the Site Setup page.
|
391
519
|
# instantiates the SiteType class.
|
392
520
|
def new
|
@@ -399,7 +527,7 @@ class SiteSetup
|
|
399
527
|
# Then clicks the Edit button and instantiates
|
400
528
|
# The SiteSetupEdit class.
|
401
529
|
def edit(site_name)
|
402
|
-
|
530
|
+
frm.text_field(:id, "search").value=Regexp.escape(site_name)
|
403
531
|
frm.button(:value=>"Search").click
|
404
532
|
frm.div(:class=>"portletBody").checkbox(:name=>"selectedMembers").set
|
405
533
|
frm.div(:class=>"portletBody").link(:text, "Edit").click
|
@@ -410,7 +538,7 @@ class SiteSetup
|
|
410
538
|
# field, clicks the Search button, then reinstantiates
|
411
539
|
# the Class due to the page refresh.
|
412
540
|
def search(site_name)
|
413
|
-
|
541
|
+
frm.text_field(:id, "search").set site_name
|
414
542
|
frm.button(:value, "Search").click
|
415
543
|
SiteSetup.new(@browser)
|
416
544
|
end
|
@@ -419,7 +547,7 @@ class SiteSetup
|
|
419
547
|
# checks the site, clicks the delete button,
|
420
548
|
# and instantiates the DeleteSite class.
|
421
549
|
def delete(site_name)
|
422
|
-
|
550
|
+
frm.text_field(:id, "Search").value=site_name
|
423
551
|
frm.button(:value=>"Search").click
|
424
552
|
frm.checkbox(:name=>"selectedMembers").set
|
425
553
|
frm.div(:class=>"portletBody").link(:text, "Delete").click
|
@@ -475,17 +603,11 @@ class SiteEditor
|
|
475
603
|
frm.button(:value=>"Update Participants").click
|
476
604
|
SiteEditor.new(@browser)
|
477
605
|
end
|
478
|
-
|
479
|
-
def return_button
|
480
|
-
frm.button(:name=>"back")
|
481
|
-
end
|
482
|
-
|
483
|
-
def return_to_sites_list
|
484
|
-
return_button.click
|
485
|
-
end
|
486
|
-
|
606
|
+
|
487
607
|
in_frame(:class=>"portletMainIframe") do |frame|
|
488
608
|
button(:previous, :name=>"previous", :frame=>frame)
|
609
|
+
button(:return_to_sites_list, :name=>"", :frame=>frame)
|
610
|
+
button(:next, :name=>"", :frame=>frame)
|
489
611
|
link(:printable_version, :text=>"Printable Version", :frame=>frame)
|
490
612
|
select_list(:select_page_size, :name=>"selectPageSize", :frame=>frame)
|
491
613
|
button(:next, :name=>"eventSubmit_doList_next", :frame=>frame)
|
@@ -694,8 +816,20 @@ class EditSiteTools
|
|
694
816
|
include PageObject
|
695
817
|
include ToolsMenu
|
696
818
|
|
697
|
-
# Clicks the Continue button
|
698
|
-
|
819
|
+
# Clicks the Continue button, then instantiates
|
820
|
+
# the appropriate class for the page that apears.
|
821
|
+
def continue
|
822
|
+
frm.button(:value=>"Continue").click
|
823
|
+
# Logic for determining the new page class...
|
824
|
+
if frm.div(:class=>"portletBody").text =~ /^Add Multiple Tool/
|
825
|
+
AddMultipleTools.new(@browser)
|
826
|
+
elsif frm.div(:class=>"portletBody").text =~ /^Confirming site tools edits for/
|
827
|
+
ConfirmSiteToolsEdits.new(@browser)
|
828
|
+
else
|
829
|
+
puts "Something is wrong"
|
830
|
+
puts frm.div(:class=>"portletBody").text
|
831
|
+
end
|
832
|
+
end
|
699
833
|
|
700
834
|
in_frame(:class=>"portletMainIframe") do |frame|
|
701
835
|
# This is a comprehensive list of all checkboxes and
|
@@ -760,46 +894,16 @@ class EditSiteTools
|
|
760
894
|
|
761
895
|
end
|
762
896
|
|
763
|
-
class ReUseMaterial
|
764
|
-
|
765
|
-
include PageObject
|
766
|
-
include ToolsMenu
|
767
|
-
|
768
|
-
thing(:announcements_checkbox) { |b| b.frm.checkbox(name: "sakai.announcements") }
|
769
|
-
thing(:calendar_checkbox) { |b| b.frm.checkbox(name: "sakai.schedule") }
|
770
|
-
thing(:discussion_forums_checkbox) { |b| b.frm.checkbox(name: "sakai.jforum.tool") }
|
771
|
-
thing(:forums_checkbox) { |b| b.frm.checkbox(name: "sakai.forums") }
|
772
|
-
thing(:chat_room_checkbox) { |b| b.frm.checkbox(name: "sakai.chat") }
|
773
|
-
thing(:polls_checkbox) { |b| b.frm.checkbox(name: "sakai.poll") }
|
774
|
-
thing(:syllabus_checkbox) { |b| b.frm.checkbox(name: "sakai.syllabus") }
|
775
|
-
thing(:lessons_checkbox) { |b| b.frm.checkbox(name: "sakai.melete") }
|
776
|
-
thing(:resources_checkbox) { |b| b.frm.checkbox(name: "sakai.resources") }
|
777
|
-
thing(:assignments_checkbox) { |b| b.frm.checkbox(name: "sakai.assignment.grades") }
|
778
|
-
thing(:tests_and_quizzes_checkbox) { |b| b.frm.checkbox(name: "sakai.samigo") }
|
779
|
-
thing(:gradebook_checkbox) { |b| b.frm.checkbox(name: "sakai.gradebook.tool") }
|
780
|
-
thing(:gradebook2_checkbox) { |b| b.frm.checkbox(name: "sakai.gradebook.gwt.rpc") }
|
781
|
-
thing(:wiki_checkbox) { |b| b.frm.checkbox(name: "sakai.rwiki") }
|
782
|
-
thing(:news_checkbox) { |b| b.frm.checkbox(name: "sakai.news") }
|
783
|
-
thing(:web_content_checkbox) { |b| b.frm.checkbox(name: "sakai.iframe") }
|
784
|
-
thing(:site_statistics_checkbox) { |b| b.frm.checkbox(name: "sakai.sitestats") }
|
785
|
-
action(:continue) { |b| b.frm.button(name: "eventSubmit_doContinue").click }
|
786
|
-
|
787
|
-
end
|
788
|
-
|
789
897
|
# Confirmation page when editing site tools in Site Setup
|
790
898
|
class ConfirmSiteToolsEdits
|
791
899
|
|
792
900
|
include PageObject
|
793
901
|
include ToolsMenu
|
794
|
-
|
795
|
-
def finish_button
|
796
|
-
frm.button(:value=>"Finish")
|
797
|
-
end
|
798
|
-
|
902
|
+
|
799
903
|
# Clicks the Finish button, then instantiates
|
800
904
|
# the SiteSetupEdit class.
|
801
905
|
def finish
|
802
|
-
|
906
|
+
frm.button(:value=>"Finish").click
|
803
907
|
SiteEditor.new(@browser)
|
804
908
|
end
|
805
909
|
|
@@ -889,8 +993,20 @@ class AddMultipleTools
|
|
889
993
|
include PageObject
|
890
994
|
include ToolsMenu
|
891
995
|
|
892
|
-
# Clicks the Continue button
|
893
|
-
|
996
|
+
# Clicks the Continue button, then instantiates
|
997
|
+
# the appropriate Class, based on the page that
|
998
|
+
# appears.
|
999
|
+
def continue
|
1000
|
+
frm.button(:value=>"Continue").click
|
1001
|
+
# Logic to determine the new page class
|
1002
|
+
if frm.div(:class=>"portletBody").text =~ /Course Site Access/
|
1003
|
+
SiteAccess.new(@browser)
|
1004
|
+
elsif frm.div(:class=>"portletBody").text =~ /^Confirming site tools edits/
|
1005
|
+
ConfirmSiteToolsEdits.new(@browser)
|
1006
|
+
else
|
1007
|
+
puts "There's another path to define"
|
1008
|
+
end
|
1009
|
+
end
|
894
1010
|
|
895
1011
|
in_frame(:class=>"portletMainIframe") do |frame|
|
896
1012
|
# Note that the text field definitions included here
|
@@ -1026,20 +1142,7 @@ class CourseSiteInfo
|
|
1026
1142
|
|
1027
1143
|
include PageObject
|
1028
1144
|
include ToolsMenu
|
1029
|
-
|
1030
|
-
|
1031
|
-
def editor
|
1032
|
-
frm.frame(:id=>"description___Frame")
|
1033
|
-
end
|
1034
|
-
|
1035
|
-
def description=(text)
|
1036
|
-
editor.td(:id, "xEditingArea").frame(:index=>0).send_keys text
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
def source=(text)
|
1040
|
-
editor.td(:id, "xEditingArea").text_field(:class=>"SourceField").set text
|
1041
|
-
end
|
1042
|
-
|
1145
|
+
|
1043
1146
|
# Clicks the Continue button, then
|
1044
1147
|
# instantiates the EditSiteTools Class.
|
1045
1148
|
def continue
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#================
|
2
|
-
# Drop Box pages
|
3
|
-
#================
|
4
|
-
|
5
|
-
#
|
6
|
-
class DropBox < AddFiles
|
7
|
-
|
8
|
-
include ToolsMenu
|
9
|
-
|
10
|
-
def initialize(browser)
|
11
|
-
@browser = browser
|
12
|
-
|
13
|
-
@@classes = {
|
14
|
-
:this => "DropBox",
|
15
|
-
:parent => "DropBox",
|
16
|
-
:second => "",
|
17
|
-
:third => ""
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
@@ -1,21 +1,7 @@
|
|
1
1
|
#
|
2
2
|
class EmailArchive
|
3
3
|
include ToolsMenu
|
4
|
-
include
|
5
|
-
def options
|
6
|
-
frm.link(:text=>"Options").click
|
7
|
-
EmailArchiveOptions.new(@browser)
|
8
|
-
end
|
9
|
-
|
10
|
-
# Returns an array containing the
|
11
|
-
def email_list
|
12
|
-
end
|
13
|
-
|
14
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
15
|
-
text_field(:search_field, :id=>"search", :frame=>frame)
|
16
|
-
button(:search_button, :value=>"Search", :frame=>frame)
|
17
|
-
|
18
|
-
end
|
4
|
+
include EmailArchiveMethods
|
19
5
|
end
|
20
6
|
|
21
7
|
class EmailArchiveOptions
|
@@ -1,313 +1,39 @@
|
|
1
1
|
class Forums
|
2
2
|
include ToolsMenu
|
3
|
-
|
4
|
-
# the title of a Forum on the page, it returns
|
5
|
-
# True if the specified forum row has "DRAFT" in it.
|
6
|
-
def draft?(title)
|
7
|
-
frm.table(:id=>"msgForum:forums").row(:text=>/#{Regexp.escape(title)}/).span(:text=>"DRAFT").exist?
|
8
|
-
end
|
9
|
-
|
10
|
-
def new_forum
|
11
|
-
frm.link(:text=>"New Forum").click
|
12
|
-
EditForum.new(@browser)
|
13
|
-
end
|
14
|
-
|
15
|
-
def new_topic_for_forum(name)
|
16
|
-
index = forum_titles.index(name)
|
17
|
-
frm.link(:text=>"New Topic", :index=>index).click
|
18
|
-
AddEditTopic.new(@browser)
|
19
|
-
end
|
20
|
-
|
21
|
-
def organize
|
22
|
-
frm.link(:text=>"Organize").click
|
23
|
-
OrganizeForums.new(@browser)
|
24
|
-
end
|
25
|
-
|
26
|
-
def template_settings
|
27
|
-
frm.link(:text=>"Template Settings").click
|
28
|
-
ForumTemplateSettings.new(@browser)
|
29
|
-
end
|
30
|
-
|
31
|
-
def forums_table
|
32
|
-
frm.div(:class=>"portletBody").table(:id=>"msgForum:forums")
|
33
|
-
end
|
34
|
-
|
35
|
-
def forum_titles
|
36
|
-
titles = []
|
37
|
-
title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name=="title" && link.id=="" }
|
38
|
-
title_links.each { |link| titles << link.text }
|
39
|
-
return titles
|
40
|
-
end
|
41
|
-
|
42
|
-
def topic_titles
|
43
|
-
titles = []
|
44
|
-
title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name == "title" && link.id != "" }
|
45
|
-
title_links.each { |link| titles << link.text }
|
46
|
-
return titles
|
47
|
-
end
|
48
|
-
|
49
|
-
def forum_settings(name)
|
50
|
-
index = forum_titles.index(name)
|
51
|
-
frm.link(:text=>"Forum Settings", :index=>index).click
|
52
|
-
EditForum.new(@browser)
|
53
|
-
end
|
54
|
-
|
55
|
-
def topic_settings(name)
|
56
|
-
index = topic_titles.index(name)
|
57
|
-
frm.link(:text=>"Topic Settings", :index=>index).click
|
58
|
-
AddEditTopic.new(@browser)
|
59
|
-
end
|
60
|
-
|
61
|
-
def delete_forum(name)
|
62
|
-
index = forum_titles.index(name)
|
63
|
-
frm.link(:id=>/msgForum:forums:\d+:delete/,:text=>"Delete", :index=>index).click
|
64
|
-
EditForum.new(@browser)
|
65
|
-
end
|
66
|
-
|
67
|
-
def delete_topic(name)
|
68
|
-
index = topic_titles.index(name)
|
69
|
-
frm.link(:id=>/topics:\d+:delete_confirm/, :text=>"Delete", :index=>index).click
|
70
|
-
AddEditTopic.new(@browser)
|
71
|
-
end
|
72
|
-
|
73
|
-
def open_forum(forum_title)
|
74
|
-
frm.link(:text=>forum_title).click
|
75
|
-
# New Class def goes here.
|
76
|
-
end
|
77
|
-
|
78
|
-
def open_topic(topic_title)
|
79
|
-
frm.link(:text=>topic_title).click
|
80
|
-
TopicPage.new(@browser)
|
81
|
-
end
|
3
|
+
include ForumsMethods
|
82
4
|
end
|
83
5
|
|
84
6
|
class TopicPage
|
85
7
|
include ToolsMenu
|
86
|
-
|
87
|
-
frm.link(:text=>"Post New Thread").click
|
88
|
-
ComposeForumMessage.new(@browser)
|
89
|
-
end
|
90
|
-
|
91
|
-
def thread_titles
|
92
|
-
titles = []
|
93
|
-
message_table = frm.table(:id=>"msgForum:messagesInHierDataTable")
|
94
|
-
1.upto(message_table.rows.size-1) do |x|
|
95
|
-
titles << message_table[x][1].span(:class=>"firstChild").link(:index=>0).text
|
96
|
-
end
|
97
|
-
return titles
|
98
|
-
end
|
99
|
-
|
100
|
-
def open_message(message_title)
|
101
|
-
frm.div(:class=>"portletBody").link(:text=>message_title).click
|
102
|
-
ViewForumThread.new(@browser)
|
103
|
-
end
|
104
|
-
|
105
|
-
def display_entire_message
|
106
|
-
frm.link(:text=>"Display Entire Message").click
|
107
|
-
TopicPage.new(@browser)
|
108
|
-
end
|
8
|
+
include TopicPageMethods
|
109
9
|
end
|
110
10
|
|
111
11
|
class ViewForumThread
|
112
12
|
include ToolsMenu
|
113
|
-
|
114
|
-
frm.link(:text=>"Reply to Thread").click
|
115
|
-
ComposeForumMessage.new(@browser)
|
116
|
-
end
|
117
|
-
|
118
|
-
def reply_to_message(index)
|
119
|
-
frm.link(:text=>"Reply", :index=>(index.to_i - 1)).click
|
120
|
-
ComposeForumMessage.new(@browser)
|
121
|
-
end
|
13
|
+
include ViewForumThreadMethods
|
122
14
|
end
|
123
15
|
|
124
16
|
class ComposeForumMessage
|
125
17
|
include ToolsMenu
|
126
|
-
include
|
127
|
-
def post_message
|
128
|
-
frm.button(:text=>"Post Message").click
|
129
|
-
# Not sure if we need logic here...
|
130
|
-
TopicPage.new(@browser)
|
131
|
-
end
|
132
|
-
|
133
|
-
def editor
|
134
|
-
frm.frame(:id, "dfCompose:df_compose_body_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
135
|
-
end
|
136
|
-
|
137
|
-
def message=(text)
|
138
|
-
editor.send_keys(text)
|
139
|
-
end
|
140
|
-
|
141
|
-
def reply_text
|
142
|
-
@browser.frame(:index=>1).div(:class=>"singleMessageReply").text
|
143
|
-
end
|
144
|
-
|
145
|
-
def add_attachments
|
146
|
-
#FIXME
|
147
|
-
end
|
148
|
-
|
149
|
-
def cancel
|
150
|
-
frm.button(:value=>"Cancel").click
|
151
|
-
# Logic for picking the correct page class
|
152
|
-
if frm.link(:text=>"Reply to Thread")
|
153
|
-
ViewForumThread.new(@browser)
|
154
|
-
elsif frm.link(:text=>"Post New Thread").click
|
155
|
-
TopicPage.new(@browser)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
160
|
-
text_field(:title, :id=>"dfCompose:df_compose_title", :frame=>frame)
|
161
|
-
|
162
|
-
end
|
18
|
+
include ComposeForumMessageMethods
|
163
19
|
end
|
164
20
|
|
165
21
|
class ForumTemplateSettings
|
166
22
|
include ToolsMenu
|
167
|
-
|
168
|
-
frm.div(:class=>"portletBody").h3(:index=>0).text
|
169
|
-
end
|
170
|
-
|
171
|
-
def save
|
172
|
-
frm.button(:value=>"Save").click
|
173
|
-
Forums.new(@browser)
|
174
|
-
end
|
175
|
-
|
176
|
-
def cancel
|
177
|
-
frm.button(:value=>"Cancel").click
|
178
|
-
Forums.new(@browser)
|
179
|
-
end
|
180
|
-
=begin
|
181
|
-
def site_role=(role)
|
182
|
-
frm.select(:id=>"revise:role").select(role)
|
183
|
-
0.upto(frm.select(:id=>"revise:role").length - 1) do |x|
|
184
|
-
if frm.div(:class=>"portletBody").table(:class=>"permissionPanel jsfFormTable lines nolines", :index=>x).visible?
|
185
|
-
@@table_index = x
|
186
|
-
|
187
|
-
def permission_level=(value)
|
188
|
-
frm.select(:id=>"revise:perm:#{@@table_index}:level").select(value)
|
189
|
-
end
|
190
|
-
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
=end
|
23
|
+
include ForumTemplateSettingsMethods
|
195
24
|
end
|
196
25
|
|
197
26
|
class OrganizeForums
|
198
27
|
include ToolsMenu
|
199
|
-
|
200
|
-
frm.button(:value=>"Save").click
|
201
|
-
Forums.new(@browser)
|
202
|
-
end
|
203
|
-
|
204
|
-
# These are set to so that the user
|
205
|
-
# does not have to start the list at zero...
|
206
|
-
def forum(index)
|
207
|
-
frm.select(:id, "revise:forums:#{index.to_i - 1}:forumIndex")
|
208
|
-
end
|
209
|
-
|
210
|
-
def topic(forumindex, topicindex)
|
211
|
-
frm.select(:id, "revise:forums:#{forumindex.to_i - 1}:topics:#{topicindex.to_i - 1}:topicIndex")
|
212
|
-
end
|
28
|
+
include OrganizeForumsMethods
|
213
29
|
end
|
214
30
|
|
215
31
|
class EditForum
|
216
32
|
include ToolsMenu
|
217
|
-
include
|
218
|
-
def save
|
219
|
-
frm.button(:value=>"Save").click
|
220
|
-
Forums.new(@browser)
|
221
|
-
end
|
222
|
-
|
223
|
-
def save_and_add
|
224
|
-
frm.button(:value=>"Save Settings & Add Topic").click
|
225
|
-
AddEditTopic.new(@browser)
|
226
|
-
end
|
227
|
-
|
228
|
-
def editor
|
229
|
-
frm.div(:class=>"portletBody").frame(:id, "revise:df_compose_description_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
230
|
-
end
|
231
|
-
|
232
|
-
def description=(text)
|
233
|
-
editor.send_keys(text)
|
234
|
-
end
|
235
|
-
|
236
|
-
def add_attachments
|
237
|
-
frm.button(:value=>/attachments/).click
|
238
|
-
ForumsAddAttachments.new(@browser)
|
239
|
-
end
|
240
|
-
|
241
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
242
|
-
text_field(:title, :id=>"revise:forum_title", :frame=>frame)
|
243
|
-
text_area(:short_description, :id=>"revise:forum_shortDescription", :frame=>frame)
|
244
|
-
|
245
|
-
end
|
33
|
+
include EditForumMethods
|
246
34
|
end
|
247
35
|
|
248
36
|
class AddEditTopic
|
249
37
|
include ToolsMenu
|
250
|
-
include
|
251
|
-
|
252
|
-
@@table_index=0
|
253
|
-
|
254
|
-
def editor
|
255
|
-
frm.div(:class=>"portletBody").frame(:id, "revise:topic_description_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
|
256
|
-
end
|
257
|
-
|
258
|
-
def description=(text)
|
259
|
-
editor.send_keys(text)
|
260
|
-
end
|
261
|
-
|
262
|
-
def save
|
263
|
-
frm.button(:value=>"Save").click
|
264
|
-
Forums.new(@browser)
|
265
|
-
end
|
266
|
-
|
267
|
-
def add_attachments
|
268
|
-
frm.button(:value=>/Add.+ttachment/).click
|
269
|
-
ForumsAddAttachments.new(@browser)
|
270
|
-
end
|
271
|
-
|
272
|
-
def roles
|
273
|
-
roles=[]
|
274
|
-
options = frm.select(:id=>"revise:role").options.to_a
|
275
|
-
options.each { |option| roles << option.text }
|
276
|
-
return roles
|
277
|
-
end
|
278
|
-
|
279
|
-
def site_role=(role)
|
280
|
-
frm.select(:id=>"revise:role").select(role)
|
281
|
-
0.upto(frm.select(:id=>"revise:role").length - 1) do |x|
|
282
|
-
if frm.div(:class=>"portletBody").table(:class=>"permissionPanel jsfFormTable lines nolines", :index=>x).visible?
|
283
|
-
@@table_index = x
|
284
|
-
|
285
|
-
def permission_level=(value)
|
286
|
-
frm.select(:id=>"revise:perm:#{@@table_index}:level").select(value)
|
287
|
-
end
|
288
|
-
|
289
|
-
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
294
|
-
text_field(:title, :id=>"revise:topic_title", :frame=>frame)
|
295
|
-
text_area(:short_description, :id=>"revise:topic_shortDescription", :frame=>frame)
|
296
|
-
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
# TODO: Determine where this should go and a better way to organize the code
|
301
|
-
class ForumsAddAttachments < AddFiles
|
302
|
-
|
303
|
-
def initialize(browser)
|
304
|
-
@browser = browser
|
305
|
-
|
306
|
-
@@classes = {
|
307
|
-
:this => "ForumsAddAttachments",
|
308
|
-
:parent => "AddEditTopic",
|
309
|
-
:second => "EditForum"
|
310
|
-
}
|
311
|
-
end
|
312
|
-
|
38
|
+
include AddEditTopicMethods
|
313
39
|
end
|