sakai-cle-test-api 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/lib/sakai-cle-test-api.rb +7 -2
  2. data/lib/sakai-cle-test-api/add_files.rb +198 -0
  3. data/lib/sakai-cle-test-api/admin_page_elements.rb +7 -3
  4. data/lib/sakai-cle-test-api/announcements.rb +274 -7
  5. data/lib/sakai-cle-test-api/assessments.rb +930 -27
  6. data/lib/sakai-cle-test-api/assignments.rb +769 -13
  7. data/lib/sakai-cle-test-api/basic_lti.rb +5 -1
  8. data/lib/sakai-cle-test-api/blogs.rb +54 -2
  9. data/lib/sakai-cle-test-api/calendar.rb +423 -8
  10. data/lib/sakai-cle-test-api/chat_room.rb +0 -0
  11. data/lib/sakai-cle-test-api/common_page_elements.rb +69 -172
  12. data/lib/sakai-cle-test-api/core-ext.rb +90 -0
  13. data/lib/sakai-cle-test-api/data_objects/announcement.rb +38 -0
  14. data/lib/sakai-cle-test-api/data_objects/assessment.rb +32 -0
  15. data/lib/sakai-cle-test-api/data_objects/assignment.rb +62 -0
  16. data/lib/sakai-cle-test-api/data_objects/event.rb +86 -0
  17. data/lib/sakai-cle-test-api/data_objects/lesson.rb +137 -0
  18. data/lib/sakai-cle-test-api/data_objects/resource.rb +174 -0
  19. data/lib/sakai-cle-test-api/data_objects/site.rb +213 -0
  20. data/lib/sakai-cle-test-api/data_objects/syllabus.rb +7 -0
  21. data/lib/sakai-cle-test-api/data_objects/topic.rb +0 -0
  22. data/lib/sakai-cle-test-api/data_objects/web_content_tool.rb +52 -0
  23. data/lib/sakai-cle-test-api/data_objects/wiki.rb +7 -0
  24. data/lib/sakai-cle-test-api/drop_box.rb +21 -0
  25. data/lib/sakai-cle-test-api/email_archive.rb +15 -1
  26. data/lib/sakai-cle-test-api/forums.rb +282 -8
  27. data/lib/sakai-cle-test-api/gem_ext.rb +45 -0
  28. data/lib/sakai-cle-test-api/gradebook.rb +19 -1
  29. data/lib/sakai-cle-test-api/gradebook2.rb +15 -1
  30. data/lib/sakai-cle-test-api/lessons.rb +440 -0
  31. data/lib/sakai-cle-test-api/messages.rb +551 -15
  32. data/lib/sakai-cle-test-api/news.rb +3 -1
  33. data/lib/sakai-cle-test-api/polls.rb +65 -3
  34. data/lib/sakai-cle-test-api/profile.rb +36 -2
  35. data/lib/sakai-cle-test-api/profile2.rb +315 -6
  36. data/lib/sakai-cle-test-api/resources.rb +138 -0
  37. data/lib/sakai-cle-test-api/rich_text.rb +13 -0
  38. data/lib/sakai-cle-test-api/sections.rb +198 -8
  39. data/lib/sakai-cle-test-api/site_page_elements.rb +4 -441
  40. data/lib/sakai-cle-test-api/syllabus.rb +149 -7
  41. data/lib/sakai-cle-test-api/tools_menu.rb +3 -20
  42. data/lib/sakai-cle-test-api/utilities.rb +260 -0
  43. data/sakai-cle-test-api.gemspec +2 -3
  44. metadata +21 -19
@@ -0,0 +1,138 @@
1
+ #================
2
+ # Resources Pages
3
+ #================
4
+
5
+ # Resources page for a given Site, in the Course Tools menu
6
+ class Resources < AddFiles
7
+
8
+ include PageObject
9
+ include ToolsMenu
10
+
11
+ end
12
+
13
+ # New class template. For quick class creation...
14
+ class ResourcesUploadFiles
15
+
16
+ include PageObject
17
+ include ToolsMenu
18
+
19
+ @@filex=0 # TODO: This is almost certainly not going to work right.
20
+
21
+ # Enters the specified folder/filename value into
22
+ # the file field on the page. Note that files are
23
+ # assumed to be in the relative path ../../data/sakai-cle-test-api
24
+ # The method will throw an error if the specified file
25
+ # is not found.
26
+ #
27
+ # This method is designed to be able to use
28
+ # multiple times, but it assumes
29
+ # that the add_another_file method is used
30
+ # before it, every time except before the first time.
31
+ def file_to_upload(file_name, file_path="")
32
+ frm.file_field(:id, "content_#{@@filex}").set(file_path + file_name)
33
+ @@filex+=1
34
+ end
35
+
36
+ # Clicks the Upload Files Now button, resets the
37
+ # @@filex class variable back to zero, and instantiates
38
+ # the Resources page class.
39
+ def upload_files_now
40
+ frm.button(:value=>"Upload Files Now").click
41
+ @@filex=0
42
+ Resources.new(@browser)
43
+ end
44
+
45
+ # Clicks the Add Another File link.
46
+ def add_another_file
47
+ frm.link(:text=>"Add Another File").click
48
+ end
49
+
50
+ end
51
+
52
+ class EditFileDetails
53
+
54
+ include PageObject
55
+ include ToolsMenu
56
+
57
+ # Clicks the Update button, then instantiates
58
+ # the Resources page class.
59
+ def update
60
+ frm.button(:value=>"Update").click
61
+ Resources.new(@browser)
62
+ end
63
+
64
+ # Enters the specified string into the title field.
65
+ def title=(title)
66
+ frm.text_field(:id=>"displayName_0").set(title)
67
+ end
68
+
69
+ # Enters the specified string into the description field.
70
+ def description=(description)
71
+ frm.text_field(:id=>"description_0").set(description)
72
+ end
73
+
74
+ # Sets the radio button for publically viewable.
75
+ def select_publicly_viewable
76
+ frm.radio(:id=>"access_mode_public_0").set
77
+ end
78
+
79
+ # Checks the checkbox for showing only on the specifed
80
+ # condition.
81
+ def check_show_only_if_condition
82
+ frm.checkbox(:id=>"cbCondition_0")
83
+ end
84
+
85
+ # Selects the specified Gradebook item value in the
86
+ # select list.
87
+ def gradebook_item=(item)
88
+ frm.select(:id=>"selectResource_0").select(item)
89
+ end
90
+
91
+ # Selects the specified value in the item condition
92
+ # field.
93
+ def item_condition=(condition)
94
+ frm.select(:id=>"selectCondition_0").select(condition)
95
+ end
96
+
97
+ # Sets the Grade field to the specified value.
98
+ def assignment_grade=(grade)
99
+ frm.text_field(:id=>"assignment_grade_0").set(grade)
100
+ end
101
+ end
102
+
103
+ class CreateFolders
104
+
105
+ include PageObject
106
+ include ToolsMenu
107
+
108
+ thing(:folder_name) { |b| b.frm.text_field(:id=>"content_0") }
109
+ action(:create_folders_now) { |b| b.frm.button(:value=>"Create Folders Now").click }
110
+
111
+ end
112
+
113
+ class CreateHTMLPageContent
114
+
115
+ include PageObject
116
+ include ToolsMenu
117
+ include FCKEditor
118
+
119
+ thing(:editor) { |b| b.frm.frame(:id=>"content___Frame") }
120
+ action(:continue) { |b| b.frm.button(id: "saveChanges").click }
121
+
122
+ def source=(text)
123
+ editor.td(:id, "xEditingArea").text_field(:class=>"SourceField").set text
124
+ end
125
+
126
+ end
127
+
128
+ class CreateHTMLPageProperties
129
+
130
+ include PageObject
131
+ include ToolsMenu
132
+
133
+ thing(:name) { |b| b.frm.text_field(id: "displayName_0") }
134
+ thing(:description) { |b| b.frm.text_field(id: "description_0") }
135
+
136
+ action(:finish) { |b| b.frm.button(id: "finish_button").click }
137
+
138
+ end
@@ -0,0 +1,13 @@
1
+ module FCKEditor
2
+
3
+ # This has to be defined this way because there several pages
4
+ # that have multiple rich text editors.
5
+ def source(editor)
6
+ editor.div(:title=>/Source/).click
7
+ end
8
+
9
+ def select_all(editor)
10
+ editor.div(:title=>"Select All").click
11
+ end
12
+
13
+ end
@@ -1,9 +1,110 @@
1
+
2
+ module SectionsMenu
3
+ include PageObject
4
+ # Clicks the Add Sections button/link and instantiates
5
+ # the AddEditSections Class.
6
+ def add_sections
7
+ frm.link(:text=>"Add Sections").click
8
+ AddEditSections.new(@browser)
9
+ end
10
+
11
+ def overview
12
+ frm.link(:text=>"Overview").click
13
+ Sections.new(@browser)
14
+ end
15
+
16
+ def student_memberships
17
+ frm.link(:text=>"Student Memberships").click
18
+ StudentMemberships.new(@browser)
19
+ end
20
+
21
+ def options
22
+ frm.link(:text=>"Options").click
23
+ SectionsOptions.new(@browser)
24
+ end
25
+
26
+ end
27
+
1
28
  # Topmost page for Sections in Site Management
2
29
  class Sections
3
30
  include PageObject
4
31
  include ToolsMenu
5
32
  include SectionsMenu
6
- include SectionsMethods
33
+ # Clicks the Edit link for the specified section.
34
+ # Then instantiates the AddEditSections class.
35
+ def edit(title)
36
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/).link(:text=>/Edit/).click
37
+ AddEditSections.new(@browser)
38
+ end
39
+
40
+ def assign_tas(title)
41
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/).link(:text=>/Assign TAs/).click
42
+ AssignTeachingAssistants.new(@browser)
43
+ end
44
+
45
+ def assign_students(title)
46
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/).link(:text=>/Assign Students/).click
47
+ AssignStudents.new(@browser)
48
+ end
49
+
50
+ def check(title)
51
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/).checkbox(:name=>/remove/).set
52
+ end
53
+
54
+ def section_names
55
+ names = []
56
+ frm.table(:class=>/listHier/).rows.each do |row|
57
+ if row.td(:class=>"leftIndent").exist?
58
+ names << row.td(:class=>"leftIndent").div(:index=>0).text
59
+ end
60
+ end
61
+ return names
62
+ end
63
+
64
+ def remove_sections
65
+ frm.button(:value=>"Remove Sections").click
66
+ Sections.new(@browser)
67
+ end
68
+
69
+ # Returns the text of the Teach Assistant cell for the specified
70
+ # Section.
71
+ def tas_for(title)
72
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/)[1].text
73
+ end
74
+
75
+ #
76
+ def days_for(title)
77
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/)[2].text
78
+ end
79
+
80
+ #
81
+ def time_for(title)
82
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/)[3].text
83
+ end
84
+
85
+ #
86
+ def location_for(title)
87
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/)[4].text
88
+ end
89
+
90
+ #
91
+ def current_size_for(title)
92
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/)[5].text
93
+ end
94
+
95
+ #
96
+ def availability_for(title)
97
+ frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(title)}/)[6].text
98
+ end
99
+
100
+ def alert_text
101
+ frm.div(:class=>"validation").text
102
+ end
103
+
104
+ def success_text
105
+ frm.div(:class=>"success").text
106
+ end
107
+
7
108
  end
8
109
 
9
110
  # Methods in this class currently do not support
@@ -13,13 +114,70 @@ end
13
114
  # be supported in the future.
14
115
  class AddEditSections
15
116
 
16
- identifier = {:class=>"portletMainIframe"}
17
-
18
117
  include PageObject
19
118
  include ToolsMenu
20
119
  include SectionsMenu
21
- include AddEditSectionsMethods
22
- #include AddEditSectionsMethods
120
+ # Clicks the Add Sections button then instantiates the Sections Class,
121
+ # unless there's an Alert message, in which case it will reinstantiate
122
+ # the class.
123
+ def add_sections
124
+ frm.button(:value=>"Add Sections").click
125
+ if frm.div(:class=>"validation").exist?
126
+ AddEditSections.new(@browser)
127
+ else
128
+ Sections.new(@browser)
129
+ end
130
+ end
131
+
132
+ def alert_text
133
+ frm.div(:class=>"validation").text
134
+ end
135
+
136
+ # The Update button is only available when editing an existing Sections record.
137
+ def update
138
+ frm.button(:value=>"Update").click
139
+ if frm.div(:class=>"validation").exist?
140
+ AddEditSections.new(@browser)
141
+ else
142
+ Sections.new(@browser)
143
+ end
144
+ end
145
+
146
+ # This method takes an array object containing strings of the
147
+ # days of the week and then clicks the appropriate checkboxes, based
148
+ # on those strings.
149
+ def check_days(array)
150
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:monday/).set if array.include?(/mon/i)
151
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:tuesday/).set if array.include?(/tue/i)
152
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:wednesday/).set if array.include?(/wed/i)
153
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:thursday/).set if array.include?(/thu/i)
154
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:friday/).set if array.include?(/fri/i)
155
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:saturday/).set if array.include?(/sat/i)
156
+ frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:sunday/).set if array.include?(/sun/i)
157
+ end
158
+
159
+ in_frame(:class=>"portletMainIframe") do |frame|
160
+ select_list(:category, :id=>/SectionsForm:category/, :frame=>frame)
161
+ text_field(:name, :id=>/SectionsForm:sectionTable:0:titleInput/, :frame=>frame)
162
+ checkbox(:monday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:monday/, :frame=>frame)
163
+ checkbox(:tuesday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:tuesday/, :frame=>frame)
164
+ checkbox(:wednesday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:wednesday/, :frame=>frame)
165
+ checkbox(:thursday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:thursday/, :frame=>frame)
166
+ checkbox(:friday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:friday/, :frame=>frame)
167
+ checkbox(:saturday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:saturday/, :frame=>frame)
168
+ checkbox(:sunday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:sunday/, :frame=>frame)
169
+ text_field(:start_time, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:startTime/, :frame=>frame)
170
+ text_field(:end_time, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:endTime/, :frame=>frame)
171
+ text_field(:location, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:location/, :frame=>frame)
172
+ radio_button(:startAM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:startTimeAm/, :index=>0, :frame=>frame) }
173
+ radio_button(:startPM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:startTimeAm/, :index=>1, :frame=>frame) }
174
+ radio_button(:endAM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:endTimeAm/, :index=>0, :frame=>frame) }
175
+ radio_button(:endPM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:endTimeAm/, :index=>1, :frame=>frame) }
176
+ radio_button(:unlimited_students) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:limit/, :index=>0, :frame=>frame) }
177
+ radio_button(:limited_students) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:limit/, :index=>1, :frame=>frame) }
178
+ text_field(:max_students, :id=>/SectionsForm:sectionTable:0:maxEnrollmentInput/, :frame=>frame)
179
+ end
180
+
23
181
  end
24
182
 
25
183
  #
@@ -27,7 +185,19 @@ class AssignTeachingAssistants
27
185
  include PageObject
28
186
  include ToolsMenu
29
187
  include SectionsMenu
30
- include AssignTeachingAssistantsMethods
188
+ def assign_TAs
189
+ frm.button(:value=>"Assign TAs").click
190
+ Sections.new(@browser)
191
+ end
192
+
193
+ in_frame(:class=>"portletMainIframe") do |frame|
194
+ select_list(:available_tas, :id=>"memberForm:availableUsers", :frame=>frame)
195
+ select_list(:assigned_tas, :id=>"memberForm:selectedUsers", :frame=>frame)
196
+ button(:assign, :value=>">", :frame=>frame)
197
+ button(:unassign, :value=>"<", :frame=>frame)
198
+ button(:assign_all, :value=>">>", :frame=>frame)
199
+ button(:unassign_all, :value=>"<<", :frame=>frame)
200
+ end
31
201
  end
32
202
 
33
203
  #
@@ -35,7 +205,19 @@ class AssignStudents
35
205
  include PageObject
36
206
  include ToolsMenu
37
207
  include SectionsMenu
38
- include AssignStudentsMethods
208
+ def assign_students
209
+ frm.button(:value=>"Assign students").click
210
+ Sections.new(@browser)
211
+ end
212
+
213
+ in_frame(:class=>"portletMainIframe") do |frame|
214
+ select_list(:available_students, :id=>"memberForm:availableUsers", :frame=>frame)
215
+ select_list(:assigned_students, :id=>"memberForm:selectedUsers", :frame=>frame)
216
+ button(:assign, :value=>">", :frame=>frame)
217
+ button(:unassign, :value=>"<", :frame=>frame)
218
+ button(:assign_all, :value=>">>", :frame=>frame)
219
+ button(:unassign_all, :value=>"<<", :frame=>frame)
220
+ end
39
221
  end
40
222
 
41
223
  # The Options page for Sections.
@@ -43,5 +225,13 @@ class SectionsOptions
43
225
  include PageObject
44
226
  include ToolsMenu
45
227
  include SectionsMenu
46
- include AssignStudentsMethods
228
+ def update
229
+ frm().button(:value=>"Update").click
230
+ Sections.new(@browser)
231
+ end
232
+
233
+ in_frame(:class=>"portletMainIframe") do |frame|
234
+ checkbox(:students_can_sign_up, :id=>"optionsForm:selfRegister", :frame=>frame)
235
+ checkbox(:students_can_switch, :id=>"optionsForm:selfSwitch", :frame=>frame)
236
+ end
47
237
  end
@@ -724,27 +724,7 @@ class Information
724
724
  end
725
725
 
726
726
 
727
- #================
728
- # Drop Box pages
729
- #================
730
727
 
731
- #
732
- class DropBox < AddFiles
733
-
734
- include ToolsMenu
735
-
736
- def initialize(browser)
737
- @browser = browser
738
-
739
- @@classes = {
740
- :this => "DropBox",
741
- :parent => "DropBox",
742
- :second => "",
743
- :third => ""
744
- }
745
- end
746
-
747
- end
748
728
 
749
729
 
750
730
 
@@ -1079,426 +1059,6 @@ end
1079
1059
 
1080
1060
 
1081
1061
 
1082
- #================
1083
- # Lesson Pages
1084
- #================
1085
-
1086
- # Contains items common to most Lessons pages.
1087
- module LessonsMenu
1088
-
1089
- # Clicks on the Preferences link on the Lessons page,
1090
- # then instantiates the LessonPreferences class.
1091
- def preferences
1092
- frm.link(:text=>"Preferences").click
1093
- LessonPreferences.new(@browser)
1094
- end
1095
-
1096
- def view
1097
- frm.link(:text=>"View").click
1098
- if frm.div(:class=>"meletePortletToolBarMessage").text=="Viewing student side..."
1099
- ViewModuleList.new(@browser)
1100
- else
1101
- #FIXME
1102
- end
1103
- end
1104
-
1105
- def manage
1106
- frm.link(:text=>"Manage").click
1107
- LessonManage.new(@browser)
1108
- end
1109
-
1110
- def author
1111
- #FIXME
1112
- end
1113
-
1114
- end
1115
-
1116
- # The Lessons page in a site ("icon-sakai-melete")
1117
- #
1118
- # Note that this class is inclusive of both the
1119
- # Instructor/Admin and the Student views of this page
1120
- # many methods will error out if used when in the
1121
- # Student view.
1122
- class Lessons
1123
-
1124
- include PageObject
1125
- include ToolsMenu
1126
- include LessonsMenu
1127
-
1128
- # Clicks the Add Module link, then
1129
- # instantiates the AddModule class.
1130
- #
1131
- # Assumes the Add Module link is present
1132
- # and will error out if it is not.
1133
- def add_module
1134
- frm.link(:text=>"Add Module").click
1135
- AddEditModule.new(@browser)
1136
- end
1137
-
1138
- # Clicks on the link that matches the supplied
1139
- # name value, then instantiates the
1140
- # AddEditLesson, or ViewLesson class, depending
1141
- # on which page loads.
1142
- #
1143
- # Will error out if there is no
1144
- # matching link in the list.
1145
- def open_lesson(name)
1146
- frm.link(:text=>name).click
1147
- if frm.div(:class=>"meletePortletToolBarMessage").exist? && frm.div(:class=>"meletePortletToolBarMessage").text=="Editing module..."
1148
- AddEditModule.new(@browser)
1149
- else
1150
- ViewModule.new(@browser)
1151
- end
1152
- end
1153
-
1154
- # Returns an array of the Module titles displayed on the page.
1155
- def lessons_list
1156
- list = []
1157
- frm.table(:id=>/lis.+module.+form:table/).links.each do |link|
1158
- if link.id=~/lis.+module.+form:table:.+:(edit|view)Mod/
1159
- list << link.text
1160
- end
1161
- end
1162
- return list
1163
- end
1164
-
1165
- # Returns and array containing the list of section titles for the
1166
- # specified module.
1167
- def sections_list(module_name)
1168
- list = []
1169
- if frm.table(:id=>/lis.+module.+form:table/).row(:text=>/#{Regexp.escape(module_name)}/).table(:id=>/tablesec/).exist?
1170
- frm.table(:id=>/lis.+module.+form:table/).row(:text=>/#{Regexp.escape(module_name)}/).table(:id=>/tablesec/).links.each do |link|
1171
- if link.id=~/Sec/
1172
- list << link.text
1173
- end
1174
- end
1175
- end
1176
- return list
1177
- end
1178
-
1179
- end
1180
-
1181
- # The student user's view of a Lesson Module or Section.
1182
- class ViewModule
1183
-
1184
- include PageObject
1185
- include ToolsMenu
1186
-
1187
- def sections_list
1188
- list = []
1189
- frm.table(:id=>"viewmoduleStudentform:tablesec").links.each { |link| list << link.text }
1190
- return list
1191
- end
1192
-
1193
- def next
1194
- frm.link(:text=>"Next").click
1195
- ViewModule.new(@browser)
1196
- end
1197
-
1198
- # Returns the text of the Module title row
1199
- def module_title
1200
- frm.span(:id=>/modtitle/).text
1201
- end
1202
-
1203
- # Returns the text of the Section title row
1204
- def section_title
1205
- frm.span(:id=>/form:title/).text
1206
- end
1207
-
1208
- def content_include?(content)
1209
- frm.form(:id=>"viewsectionStudentform").text.include?(content)
1210
- end
1211
-
1212
- end
1213
-
1214
- # This is the Instructor's preview of the Student's view
1215
- # of the list of Lesson Modules.
1216
- class ViewModuleList
1217
-
1218
- include PageObject
1219
- include ToolsMenu
1220
-
1221
- def open_lesson(name)
1222
- frm.link(:text=>name).click
1223
- LessonStudentSide.new(@browser)
1224
- end
1225
-
1226
- def open_section(name)
1227
- frm.link(:text=>name).click
1228
- SectionStudentSide.new(@browser)
1229
- end
1230
-
1231
- end
1232
-
1233
- # The instructor's preview of the student view of the lesson.
1234
- class LessonStudentSide
1235
-
1236
- include PageObject
1237
- include ToolsMenu
1238
- include LessonsMenu
1239
-
1240
- end
1241
-
1242
- # The instructor's preview of the student's view of the section.
1243
- class SectionStudentSide
1244
-
1245
- include PageObject
1246
- include ToolsMenu
1247
- include LessonsMenu
1248
-
1249
- end
1250
-
1251
- # The Managing Options page for Lessons
1252
- class LessonManage
1253
-
1254
- include PageObject
1255
- include ToolsMenu
1256
- include LessonsMenu
1257
-
1258
- def manage_content
1259
- frm.link(:text=>"Manage Content").click
1260
- LessonManageContent.new(@browser)
1261
- end
1262
-
1263
- def sort
1264
- frm.link(:text=>"Sort").click
1265
- LessonManageSort.new(@browser)
1266
- end
1267
-
1268
- # Clicks the Import/Export button and
1269
- # instantiates the LessonImportExport class.
1270
- def import_export
1271
- frm.link(:text=>"Import/Export").click
1272
- LessonImportExport.new(@browser)
1273
- end
1274
-
1275
- end
1276
-
1277
- # The Sorting Modules and Sections page in Lessons
1278
- class LessonManageSort
1279
-
1280
- include PageObject
1281
- include ToolsMenu
1282
-
1283
- def view
1284
- frm.link(:text=>"View").click
1285
- if frm.div(:class=>"meletePortletToolBarMessage").text=="Viewing student side..."
1286
- ViewModuleList.new(@browser)
1287
- else
1288
- #FIXME
1289
- end
1290
- end
1291
-
1292
- in_frame(:index=>1) do |frame|
1293
- link(:sort_modules, :id=>"SortSectionForm:sortmod", :frame=>frame)
1294
- link(:sort_sections, :id=>"SortModuleForm:sortsec", :frame=>frame)
1295
-
1296
- end
1297
- end
1298
-
1299
- # The Import/Export page in Manage Lessons for a Site
1300
- class LessonImportExport
1301
-
1302
- include PageObject
1303
- include ToolsMenu
1304
- include LessonsMenu
1305
-
1306
- # Uploads the file specified - meaning that it enters
1307
- # the target file information, then clicks the import
1308
- # button.
1309
- #
1310
- # The file path is an optional parameter.
1311
- def upload_IMS(file_name, file_path="")
1312
- frm.file_field(:name, "impfile").set(file_path + file_name)
1313
- frm.link(:id=>"importexportform:importModule").click
1314
- frm.table(:id=>"AutoNumber1").div(:text=>"Processing...").wait_while_present
1315
- end
1316
-
1317
- # Returns the text of the alert box.
1318
- def alert_text
1319
- frm.span(:class=>"BlueClass").text
1320
- end
1321
-
1322
- end
1323
-
1324
- # The User preference options page for Lessons.
1325
- #
1326
- # Note that this class is inclusive of Student
1327
- # and Instructor views of the page. Thus,
1328
- # not all methods in the class will work
1329
- # at all times.
1330
- class LessonPreferences
1331
-
1332
- include PageObject
1333
- include ToolsMenu
1334
-
1335
- # Clicks the View button
1336
- # then instantiates the Lessons class.
1337
- def view
1338
- frm.link(:text=>"View").click
1339
- Lessons.new(@browser)
1340
- end
1341
-
1342
- in_frame(:index=>1) do |frame|
1343
- radio_button(:expanded) { |page| page.radio_button_element(:name=>"UserPreferenceForm:_id5", :index=>0, :frame=>frame) }
1344
- radio_button(:collapsed) { |page| page.radio_button_element(:name=>"UserPreferenceForm:_id5", :index=>1, :frame=>frame) }
1345
- link(:set, :id=>"UserPreferenceForm:SetButton", :frame=>frame)
1346
- end
1347
- end
1348
-
1349
- # This Class encompasses methods for both the Add and the Edit pages for Lesson Modules.
1350
- class AddEditModule
1351
-
1352
- include PageObject
1353
- include ToolsMenu
1354
-
1355
- # Clicks the Add button for the Lesson Module
1356
- # then instantiates the ConfirmModule class.
1357
- def add
1358
- frm.link(:id=>/ModuleForm:submitsave/).click
1359
- ConfirmModule.new(@browser)
1360
- end
1361
-
1362
- def add_content_sections
1363
- frm.link(:id=>/ModuleForm:sectionButton/).click
1364
- AddEditSection.new(@browser)
1365
- end
1366
-
1367
- in_frame(:index=>1) do |frame|
1368
- text_field(:title, :id=>/ModuleForm:title/, :frame=>frame)
1369
- text_area(:description, :id=>/ModuleForm:description/, :frame=>frame)
1370
- text_area(:keywords, :id=>/ModuleForm:keywords/, :frame=>frame)
1371
- text_field(:start_date, :id=>/ModuleForm:startDate/, :frame=>frame)
1372
- text_field(:end_date, :id=>/ModuleForm:endDate/, :frame=>frame)
1373
- end
1374
- end
1375
-
1376
- # The confirmation page when you are saving a Lesson Module.
1377
- class ConfirmModule
1378
-
1379
- include PageObject
1380
- include ToolsMenu
1381
-
1382
- # Clicks the Add Content Sections button and
1383
- # instantiates the AddEditSection class.
1384
- def add_content_sections
1385
- frm.link(:id=>/ModuleConfirmForm:sectionButton/).click
1386
- AddEditSection.new(@browser)
1387
- end
1388
-
1389
- # Clicks the Return to Modules button, then
1390
- # instantiates the AddEditModule class.
1391
- def return_to_modules
1392
- frm.link(:id=>"AddModuleConfirmForm:returnModImg").click
1393
- AddEditModule.new(@browser)
1394
- end
1395
-
1396
- end
1397
-
1398
- # Page for adding a section to a Lesson.
1399
- class AddEditSection
1400
-
1401
- include PageObject
1402
- include ToolsMenu
1403
-
1404
- # Clicks the Add button on the page
1405
- # then instantiates the ConfirmSectionAdd class.
1406
- def add
1407
- frm.link(:id=>/SectionForm:submitsave/).click
1408
- ConfirmSectionAdd.new(@browser)
1409
- end
1410
-
1411
- # Pointer to the Edit Text box of the FCKEditor
1412
- # on the page.
1413
- def content_editor
1414
- frm.frame(:id, "AddSectionForm:fckEditorView:otherMeletecontentEditor_inputRichText___Frame").td(:id, "xEditingArea").frame(:index=>0)
1415
- end
1416
-
1417
- def add_content=(text)
1418
- content_editor.send_keys(text)
1419
- end
1420
-
1421
- def clear_content
1422
- frm.frame(:id, "AddSectionForm:fckEditorView:otherMeletecontentEditor_inputRichText___Frame").div(:title=>"Select All").fire_event("onclick")
1423
- content_editor.send_keys :backspace
1424
- end
1425
-
1426
- def select_url
1427
- frm.link(:id=>"AddSectionForm:ContentLinkView:serverViewButton").click
1428
- SelectingContent.new(@browser)
1429
- end
1430
-
1431
- # This method clicks the Select button that appears on the page
1432
- # then calls the LessonAddAttachment class.
1433
- #
1434
- # It assumes that the Content Type selection box has
1435
- # already been updated to "Upload or link to a file in Resources".
1436
- def select_or_upload_file
1437
- frm.link(:id=>"AddSectionForm:ResourceHelperLinkView:serverViewButton").click
1438
- LessonAddAttachment.new(@browser)
1439
- end
1440
-
1441
- in_frame(:index=>1) do |frame|
1442
- text_field(:title, :id=>"AddSectionForm:title", :frame=>frame)
1443
- select_list(:content_type, :id=>"AddSectionForm:contentType", :frame=>frame)
1444
- checkbox(:auditory_content, :id=>"AddSectionForm:contentaudio", :frame=>frame)
1445
- end
1446
- end
1447
-
1448
- # Confirmation page for Adding (or Editing)
1449
- # a Section to a Module in Lessons.
1450
- class ConfirmSectionAdd
1451
-
1452
- include PageObject
1453
- include ToolsMenu
1454
-
1455
- # Clicks the Add Another Section button
1456
- # then instantiates the AddSection class.
1457
- def add_another_section
1458
- frm.link(:id=>/SectionConfirmForm:saveAddAnotherbutton/).click
1459
- AddEditSection.new(@browser)
1460
- end
1461
-
1462
- # Clicks the Finish button
1463
- # then instantiates the Lessons class.
1464
- def finish
1465
- frm.link(:id=>/Form:FinishButton/).click
1466
- Lessons.new(@browser)
1467
- end
1468
-
1469
- end
1470
-
1471
- #
1472
- class SelectingContent
1473
-
1474
- include PageObject
1475
- include ToolsMenu
1476
-
1477
- def continue
1478
- frm.link(:id=>"ServerViewForm:addButton").click
1479
- AddEditSection.new(@browser)
1480
- end
1481
-
1482
- in_frame(:index=>1) do |frame|
1483
- text_field(:new_url, :id=>"ServerViewForm:link", :frame=>frame)
1484
- text_field(:url_title, :id=>"ServerViewForm:link_title", :frame=>frame)
1485
- end
1486
- end
1487
-
1488
- #
1489
- class LessonAddAttachment < AddFiles
1490
-
1491
- include ToolsMenu
1492
-
1493
- def initialize(browser)
1494
- @browser = browser
1495
- @@classes = {
1496
- :this => "LessonAddAttachment",
1497
- :parent => "AddEditSection"
1498
- }
1499
- end
1500
-
1501
- end
1502
1062
 
1503
1063
  #================
1504
1064
  # Matrix Pages for a Portfolio Site
@@ -1684,10 +1244,13 @@ class EditCell
1684
1244
  include PageObject
1685
1245
  include ToolsMenu
1686
1246
 
1247
+ thing(:select_evaluators_link) { |b| b.frm.link(:text=>"Select Evaluators") }
1248
+
1687
1249
  # Clicks the "Select Evaluators" link
1688
1250
  # and instantiates the SelectEvaluators Class.
1689
1251
  def select_evaluators
1690
- frm.link(:text=>"Select Evaluators").click
1252
+ select_evaluators_link.wait_until_present
1253
+ select_evaluators_link.click
1691
1254
  SelectEvaluators.new(@browser)
1692
1255
  end
1693
1256