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
data/lib/sakai-cle-test-api.rb
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
require 'cgi'
|
2
|
-
require '
|
3
|
-
require 'page-object'
|
4
|
-
require 'sakai-cle-test-api/gem_ext'
|
5
|
-
require 'sakai-cle-test-api/core-ext'
|
6
|
-
require 'sakai-cle-test-api/utilities'
|
7
|
-
require 'sakai-cle-test-api/rich_text'
|
2
|
+
require 'kuali-sakai-common-lib'
|
8
3
|
require 'sakai-cle-test-api/utilities'
|
9
4
|
require 'sakai-cle-test-api/tools_menu'
|
10
5
|
require 'sakai-cle-test-api/admin_page_elements'
|
11
6
|
Dir["#{File.dirname(__FILE__)}/sakai-cle-test-api/*.rb"].each {|f| require f }
|
12
|
-
Dir["#{File.dirname(__FILE__)}/sakai-cle-test-api/data_objects/*.rb"].each {|f| require f }
|
13
7
|
|
14
8
|
# Initialize this class at the start of your test cases to
|
15
9
|
# open the specified test browser at the specified Sakai welcome page URL.
|
@@ -27,6 +21,7 @@ class SakaiCLE
|
|
27
21
|
@browser = Watir::Browser.new web_browser
|
28
22
|
@browser.window.resize_to(1400,900)
|
29
23
|
@browser.goto url
|
24
|
+
$frame_index = 0 # TODO - Need to remove this and all dependent code.
|
30
25
|
end
|
31
26
|
|
32
27
|
# Returns the class containing the welcome page's page elements.
|
@@ -744,12 +744,7 @@ class EditUser
|
|
744
744
|
|
745
745
|
include PageObject
|
746
746
|
include ToolsMenu
|
747
|
-
|
748
|
-
def update_details
|
749
|
-
frm.button(:name=>"eventSubmit_doSave").click
|
750
|
-
sleep 1
|
751
|
-
end
|
752
|
-
|
747
|
+
|
753
748
|
in_frame(:class=>"portletMainIframe") do |frame|
|
754
749
|
link(:remove_user, :text=>"Remove User", :frame=>frame)
|
755
750
|
text_field(:first_name, :id=>"first-name", :frame=>frame)
|
@@ -757,6 +752,7 @@ class EditUser
|
|
757
752
|
text_field(:email, :id=>"email", :frame=>frame)
|
758
753
|
text_field(:create_new_password, :id=>"pw", :frame=>frame)
|
759
754
|
text_field(:verify_new_password, :id=>"pw0", :frame=>frame)
|
755
|
+
button(:update_details, :name=>"eventSubmit_doSave", :frame=>frame)
|
760
756
|
button(:cancel_changes, :name=>"eventSubmit_doCancel", :frame=>frame)
|
761
757
|
end
|
762
758
|
|
@@ -1,294 +1,27 @@
|
|
1
1
|
# The Announcements list page for a Site.
|
2
2
|
class Announcements
|
3
3
|
include ToolsMenu
|
4
|
-
|
5
|
-
# Clicks the add button, instantiates the AddEditAnnouncements class.
|
6
|
-
def add
|
7
|
-
frm.div(:class=>"portletBody").link(:title=>"Add").click
|
8
|
-
frm.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).wait_until_present(60)
|
9
|
-
AddEditAnnouncements.new(@browser)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Edits the specified announcement in the list.
|
13
|
-
# @param subject [String] the text of the announcement listing link.
|
14
|
-
def edit(subject)
|
15
|
-
frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).link(:text=>"Edit").click
|
16
|
-
AddEditAnnouncements.new(@browser)
|
17
|
-
end
|
18
|
-
|
19
|
-
# Returns an array of the subject strings of the announcements
|
20
|
-
# listed on the page.
|
21
|
-
def subjects
|
22
|
-
links = frm.table(:class=>"listHier").links.find_all { |link| link.title=~/View announcement/ }
|
23
|
-
subjects = []
|
24
|
-
links.each { |link| subjects << link.text }
|
25
|
-
return subjects
|
26
|
-
end
|
27
|
-
|
28
|
-
def href(subject)
|
29
|
-
frm.link(:text=>subject).href
|
30
|
-
end
|
31
|
-
|
32
|
-
# Returns true or false depending on whether the specified announcement has an attachment.
|
33
|
-
# @param subject [String] the text of the announcement listing link.
|
34
|
-
def has_attachment?(subject)
|
35
|
-
if frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).exist?
|
36
|
-
return frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/).image(:alt=>"attachment").exist?
|
37
|
-
else
|
38
|
-
puts "Can't find your target row. Your test is faulty."
|
39
|
-
return false
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns the text of the "For" column for
|
44
|
-
# the specified announcement.
|
45
|
-
# @param subject [String] the text of the announcement listing link.
|
46
|
-
def for_column(subject)
|
47
|
-
frm.table(:class=>"listHier").row(:text=>/#{Regexp.escape(subject)}/)[4].text
|
48
|
-
end
|
49
|
-
|
50
|
-
# Clicks the specified announcement link and instantiates the PreviewAnnouncements class.
|
51
|
-
# @param subject [String] the text of the announcement listing link.
|
52
|
-
def preview_announcement(subject)
|
53
|
-
frm.link(:text=>subject).click
|
54
|
-
PreviewAnnouncements.new(@browser)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Selects the specified list item from the View selection list.
|
58
|
-
# @param list_item [String] the text of the option in the selection list.
|
59
|
-
def view=(list_item)
|
60
|
-
frm.select(:id=>"view").set(list_item)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Clicks the Merge link and instantiates the AnnouncementsMerge class.
|
64
|
-
def merge
|
65
|
-
frm.link(:text=>"Merge").click
|
66
|
-
AnnouncementsMerge.new(@browser)
|
67
|
-
end
|
68
|
-
|
4
|
+
include AnnouncementsMethods
|
69
5
|
end
|
70
6
|
|
71
7
|
# Show Announcements from Another Site. On this page you select what announcements
|
72
8
|
# you want to merge into the current Site.
|
73
9
|
class AnnouncementsMerge
|
74
10
|
include ToolsMenu
|
75
|
-
|
76
|
-
# Checks the checkbox for the specified site name
|
77
|
-
# @param site_name [String] the name of the relevant site displayed in the table
|
78
|
-
def check(site_name)
|
79
|
-
frm.table(:class=>"listHier lines nolines").row(:text=>/#{Regexp.escape(site_name)}/).checkbox(:id=>/site/).set
|
80
|
-
end
|
81
|
-
|
82
|
-
# Clicks the Save button and returns the Announcements class.
|
83
|
-
def save
|
84
|
-
frm.button(:value=>"Save").click
|
85
|
-
Announcements.new(@browser)
|
86
|
-
end
|
87
|
-
|
11
|
+
include AnnouncementsMergeMethods
|
88
12
|
end
|
89
13
|
|
90
14
|
# This Class does double-duty. It's for the Preview page when editing an
|
91
15
|
# Announcement, plus for when you just click an Announcement to view it.
|
92
16
|
class PreviewAnnouncements
|
93
17
|
include ToolsMenu
|
94
|
-
|
95
|
-
# Clicks the Return to list button and returns the Announcements class.
|
96
|
-
def return_to_list
|
97
|
-
frm.button(:value=>"Return to List").click
|
98
|
-
Announcements.new(@browser)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Clicks the Save changes button and returns the Announcements class.
|
102
|
-
def save_changes
|
103
|
-
frm.button(:value=>"Save Changes").click
|
104
|
-
Announcements.new(@browser)
|
105
|
-
end
|
106
|
-
|
107
|
-
# Clicks the Edit button and returns the AddEditAnnouncements class.
|
108
|
-
def edit
|
109
|
-
frm.button(:value=>"Edit").click
|
110
|
-
AddEditAnnouncements.new(@browser)
|
111
|
-
end
|
112
|
-
|
18
|
+
include PreviewAnnouncementsMethods
|
113
19
|
end
|
114
20
|
|
115
21
|
# The page where an announcement is created or edited.
|
116
22
|
class AddEditAnnouncements
|
117
23
|
include ToolsMenu
|
118
|
-
|
119
|
-
# Clicks the Add Announcement button and then determines whether to return
|
120
|
-
# AddEditAnnouncements or Announcements class.
|
121
|
-
def add_announcement
|
122
|
-
frm.button(:value=>"Add Announcement").click
|
123
|
-
if frm.div(:class=>"portletBody").h3.text=~/Add Announcement/
|
124
|
-
AddEditAnnouncements.new(@browser)
|
125
|
-
else
|
126
|
-
Announcements.new(@browser)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# Clicks the Save changes button and returns the Announcements class.
|
131
|
-
def save_changes
|
132
|
-
frm.button(:value=>"Save Changes").click
|
133
|
-
Announcements.new(@browser)
|
134
|
-
end
|
135
|
-
|
136
|
-
# Clicks the Preview button and returns the PreviewAnnouncements class.
|
137
|
-
def preview
|
138
|
-
frm.button(:value=>"Preview").click
|
139
|
-
PreviewAnnouncements.new(@browser)
|
140
|
-
end
|
141
|
-
|
142
|
-
# Sends the specified text block to the rich text editor
|
143
|
-
# @param text [String] the text that you want to add to the editor.
|
144
|
-
def body=(text)
|
145
|
-
frm.frame(:id, "body___Frame").td(:id, "xEditingArea").frame(:index=>0).send_keys(text)
|
146
|
-
end
|
147
|
-
|
148
|
-
# Clicks the Add attachments button and returns the Announcments Attach class.
|
149
|
-
def add_attachments
|
150
|
-
frm.button(:value=>"Add Attachments").click
|
151
|
-
AnnouncementsAttach.new(@browser)
|
152
|
-
end
|
153
|
-
|
154
|
-
# Clicks the checkbox for the specified group name
|
155
|
-
# when you've set the announcement access to display
|
156
|
-
# to groups.
|
157
|
-
# @param group_name [String] the name of the group in the table that you intend to select.
|
158
|
-
def check_group(group_name)
|
159
|
-
frm.table(:id=>"groupTable").row(:text=>/#{Regexp.escape(group_name)}/).checkbox(:name=>"selectedGroups").set
|
160
|
-
end
|
161
|
-
|
162
|
-
# Sets the Announcement Title field to the specified
|
163
|
-
# string value.
|
164
|
-
# @param string [String] the text you want to put in the title field.
|
165
|
-
def title=(string)
|
166
|
-
frm.text_field(:id=>"subject").set(string)
|
167
|
-
end
|
168
|
-
|
169
|
-
# Clicks the radio button for "Only members of this site can see this announcement"
|
170
|
-
def select_site_members
|
171
|
-
frm.radio(:id=>"site").set
|
172
|
-
end
|
173
|
-
|
174
|
-
# Clicks the radio button for "This announcement is publicly viewable"
|
175
|
-
def select_publicly_viewable
|
176
|
-
frm.radio(:id=>"pubview").set
|
177
|
-
end
|
178
|
-
|
179
|
-
# Clicks the radio button for "Displays this announcement to selected groups only."
|
180
|
-
def select_groups
|
181
|
-
frm.radio(:id=>"groups").set
|
182
|
-
end
|
183
|
-
|
184
|
-
# Clicks the radio button for "Show - (Post and display this announcement immediately)"
|
185
|
-
def select_show
|
186
|
-
frm.radio(:id=>"hidden_false").set
|
187
|
-
end
|
188
|
-
|
189
|
-
# Clicks the radio button for "Hide - (Draft mode - Do not display this announcement at this time)"
|
190
|
-
def select_hide
|
191
|
-
frm.radio(:id=>"hidden_true").set
|
192
|
-
end
|
193
|
-
|
194
|
-
# Clicks the radio button for "Specify Dates - (Choose when this announcement will be displayed)"
|
195
|
-
def select_specify_dates
|
196
|
-
frm.radio(:id=>"hidden_specify").set
|
197
|
-
end
|
198
|
-
|
199
|
-
# Checks the checkbox for "Beginning"
|
200
|
-
def check_beginning
|
201
|
-
frm.checkbox(:id=>"use_start_date").set
|
202
|
-
end
|
203
|
-
|
204
|
-
# Checks the checkbox for "Ending"
|
205
|
-
def check_ending
|
206
|
-
frm.checkbox(:id=>"use_end_date").set
|
207
|
-
end
|
208
|
-
|
209
|
-
# Checks the checkbox for selecting all Groups
|
210
|
-
def check_all
|
211
|
-
frm.checkbox(:id=>"selectall").set
|
212
|
-
end
|
213
|
-
|
214
|
-
# Sets the Beginning Month selection to the
|
215
|
-
# specified string.
|
216
|
-
def beginning_month=(string)
|
217
|
-
frm.select(:id=>"release_month").select(string)
|
218
|
-
end
|
219
|
-
|
220
|
-
# Sets the Beginning Day selection to the
|
221
|
-
# specified string.
|
222
|
-
def beginning_day=(string)
|
223
|
-
frm.select(:id=>"release_day").select(string)
|
224
|
-
end
|
225
|
-
|
226
|
-
# Sets the Beginning Year selection to the
|
227
|
-
# specified string.
|
228
|
-
def beginning_year=(string)
|
229
|
-
frm.select(:id=>"release_year").select(string)
|
230
|
-
end
|
231
|
-
|
232
|
-
# Sets the Beginning Hour selection to the
|
233
|
-
# specified string
|
234
|
-
def beginning_hour=(string)
|
235
|
-
frm.select(:id=>"release_hour").select(string)
|
236
|
-
end
|
237
|
-
|
238
|
-
# Sets the Beginning Minute selection to the
|
239
|
-
# specified string
|
240
|
-
def beginning_minute=(string)
|
241
|
-
frm.select(:id=>"release_minute").select(string)
|
242
|
-
end
|
243
|
-
|
244
|
-
# Sets the AM or PM value to the specified string.
|
245
|
-
# Obviously the string should be either "AM" or "PM".
|
246
|
-
def beginning_meridian=(string)
|
247
|
-
frm.select(:id=>"release_ampm").select(string)
|
248
|
-
end
|
249
|
-
|
250
|
-
# Sets the Ending Month selection to the specified
|
251
|
-
# string.
|
252
|
-
def ending_month=(string)
|
253
|
-
frm.select(:id=>"retract_month").select(string)
|
254
|
-
end
|
255
|
-
|
256
|
-
# Sets the Ending Day selection to the specified
|
257
|
-
# string.
|
258
|
-
def ending_day=(string)
|
259
|
-
frm.select(:id=>"retract_day").select(string)
|
260
|
-
end
|
261
|
-
|
262
|
-
# Sets the Ending Year selection to the specified
|
263
|
-
# string.
|
264
|
-
def ending_year=(string)
|
265
|
-
frm.select(:id=>"retract_year").select(string)
|
266
|
-
end
|
267
|
-
|
268
|
-
# Sets the Ending Hour selection to the specified
|
269
|
-
# string.
|
270
|
-
def ending_hour=(string)
|
271
|
-
frm.select(:id=>"retract_hour").select(string)
|
272
|
-
end
|
273
|
-
|
274
|
-
# Sets the Ending Minute selection to the specified
|
275
|
-
# string.
|
276
|
-
def ending_minute=(string)
|
277
|
-
frm.select(:id=>"retract_minute").select(string)
|
278
|
-
end
|
279
|
-
|
280
|
-
# Sets the Ending AM/PM selection to the specified
|
281
|
-
# value.
|
282
|
-
def ending_meridian=(string)
|
283
|
-
frm.select(:id=>"retract_ampm").select(string)
|
284
|
-
end
|
285
|
-
|
286
|
-
# Gets the text of the alert message when it appears on
|
287
|
-
# the page
|
288
|
-
def alert_message
|
289
|
-
frm.div(:class=>"alertMessage").text
|
290
|
-
end
|
291
|
-
|
24
|
+
include AddEditAnnouncementsMethods
|
292
25
|
end
|
293
26
|
|
294
27
|
# The page for attaching files and links to Announcements.
|
@@ -310,17 +43,17 @@ end
|
|
310
43
|
# Page for merging announcements from other sites
|
311
44
|
class AnnouncementsMerge
|
312
45
|
include ToolsMenu
|
313
|
-
|
46
|
+
include AnnouncementsMergeMethods
|
314
47
|
end
|
315
48
|
|
316
49
|
# Page for setting up options for announcements
|
317
50
|
class AnnouncementsOptions
|
318
51
|
include ToolsMenu
|
319
|
-
|
52
|
+
include AnnouncementsOptionsMethods
|
320
53
|
end
|
321
54
|
|
322
55
|
# Page containing permissions options for announcements
|
323
56
|
class AnnouncementsPermissions
|
324
57
|
include ToolsMenu
|
325
|
-
|
58
|
+
include AnnouncementsPermissionsMethods
|
326
59
|
end
|
@@ -3,125 +3,12 @@
|
|
3
3
|
# Assessments pages - "Samigo", a.k.a., "Tests & Quizzes"
|
4
4
|
#================
|
5
5
|
|
6
|
-
# This is a module containing methods that are
|
7
|
-
# common to all the question pages inside the
|
8
|
-
# Assessment section of a Site.
|
9
|
-
module QuestionHelpers
|
10
|
-
include PageObject
|
11
|
-
# Saves the question by clicking the Save button, then makes the determination
|
12
|
-
# whether to instantiate the EditAssessment class, or the EditQuestionPool class.
|
13
|
-
def save
|
14
|
-
|
15
|
-
quiz = frm.div(:class=>"portletBody").div(:index=>0).text
|
16
|
-
pool = frm.div(:class=>"portletBody").div(:index=>1).text
|
17
|
-
|
18
|
-
frm.button(:value=>"Save").click
|
19
|
-
|
20
|
-
if quiz =~ /^Assessments/
|
21
|
-
EditAssessment.new(@browser)
|
22
|
-
elsif pool =~ /^Question Pools/
|
23
|
-
EditQuestionPool.new(@browser)
|
24
|
-
else
|
25
|
-
puts "Unexpected text: "
|
26
|
-
p pool
|
27
|
-
p quiz
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
33
|
-
link(:assessments, :text=>"Assessments", :frame=>frame)
|
34
|
-
link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
|
35
|
-
link(:question_pools, :text=>"Question Pools", :frame=>frame)
|
36
|
-
link(:questions, :text=>/Questions:/, :frame=>frame)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
6
|
# The Course Tools "Tests and Quizzes" page for a given site.
|
42
7
|
# (Instructor view)
|
43
8
|
class AssessmentsList
|
44
9
|
include PageObject
|
45
10
|
include ToolsMenu
|
46
|
-
|
47
|
-
# This method reads the type of assessment selected for creation,
|
48
|
-
# then clicks the Create button and instantiates the proper class.
|
49
|
-
#
|
50
|
-
# If the assessment is going to be made in the builder, then
|
51
|
-
# EditAssessment is called. If from Markup text...
|
52
|
-
def create
|
53
|
-
builder_or_text = frm.radio(:value=>"1", :name=>"authorIndexForm:_id29").set?
|
54
|
-
|
55
|
-
frm.button(:value=>"Create").click
|
56
|
-
|
57
|
-
if builder_or_text == true
|
58
|
-
EditAssessment.new(@browser)
|
59
|
-
else
|
60
|
-
# Need to add Markup page class, then add the reference here.
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
# Clicks the Question Pools link, then instantiates
|
66
|
-
# the QuestionPoolsList class.
|
67
|
-
def question_pools
|
68
|
-
frm.link(:text=>"Question Pools").click
|
69
|
-
QuestionPoolsList.new(@browser)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Collects the titles of the Assessments listed as "Pending"
|
73
|
-
# then returns them as an Array.
|
74
|
-
def pending_assessment_titles
|
75
|
-
titles =[]
|
76
|
-
pending_table = frm.table(:id=>"authorIndexForm:coreAssessments")
|
77
|
-
1.upto(pending_table.rows.size-1) do |x|
|
78
|
-
titles << pending_table[x][1].span(:id=>/assessmentTitle/).text
|
79
|
-
end
|
80
|
-
return titles
|
81
|
-
end
|
82
|
-
|
83
|
-
# Collects the titles of the Assessments listed as "Published"
|
84
|
-
# then returns them as an Array.
|
85
|
-
def published_assessment_titles
|
86
|
-
titles =[]
|
87
|
-
published_table = frm.div(:class=>"tier2", :index=>2).table(:class=>"listHier", :index=>0)
|
88
|
-
1.upto(published_table.rows.size-1) do |x|
|
89
|
-
titles << published_table[x][1].span(:id=>/publishedAssessmentTitle/).text
|
90
|
-
end
|
91
|
-
return titles
|
92
|
-
end
|
93
|
-
|
94
|
-
# Returns an Array of the inactive Assessment titles displayed
|
95
|
-
# in the list.
|
96
|
-
def inactive_assessment_titles
|
97
|
-
titles =[]
|
98
|
-
inactive_table = frm.div(:class=>"tier2", :index=>2).table(:id=>"authorIndexForm:inactivePublishedAssessments")
|
99
|
-
1.upto(inactive_table.rows.size-1) do |x|
|
100
|
-
titles << inactive_table[x][1].span(:id=>/inactivePublishedAssessmentTitle/).text
|
101
|
-
end
|
102
|
-
return titles
|
103
|
-
end
|
104
|
-
|
105
|
-
# Opens the selected test for scoring
|
106
|
-
# then instantiates the AssessmentTotalScores class.
|
107
|
-
# @param test_title [String] the title of the test to be clicked.
|
108
|
-
def score_test(test_title)
|
109
|
-
frm.tbody(:id=>"authorIndexForm:_id88:tbody_element").row(:text=>/#{Regexp.escape(test_title)}/).link(:id=>/authorIndexToScore/).click
|
110
|
-
AssessmentTotalScores.new(@browser)
|
111
|
-
end
|
112
|
-
|
113
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
114
|
-
link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
|
115
|
-
text_field(:title, :id=>"authorIndexForm:title", :frame=>frame)
|
116
|
-
radio_button(:create_using_builder) { |page| page.radio_button_element(:name=>"authorIndexForm:_id29", index=>0, :frame=>frame) }
|
117
|
-
radio_button(:create_using_text) { |page| page.radio_button_element(:name=>"authorIndexForm:_id29", :index=>$frame_index, :frame=>frame) }
|
118
|
-
select_list(:select_assessment_type, :id=>"authorIndexForm:assessmentTemplate", :frame=>frame)
|
119
|
-
button(:import, :id=>"authorIndexForm:import", :frame=>frame)
|
120
|
-
#(:, :=>"", :frame=>frame)
|
121
|
-
#(:, :=>"", :frame=>frame)
|
122
|
-
|
123
|
-
end
|
124
|
-
|
11
|
+
include AssessmentsListMethods
|
125
12
|
end
|
126
13
|
|
127
14
|
# Page that appears when previewing an assessment.
|
@@ -129,201 +16,21 @@ end
|
|
129
16
|
class PreviewOverview
|
130
17
|
include PageObject
|
131
18
|
include ToolsMenu
|
132
|
-
|
133
|
-
# Scrapes the value of the due date from the page. Returns it as a string.
|
134
|
-
def due_date
|
135
|
-
frm.div(:class=>"tier2").table(:index=>0)[0][0].text
|
136
|
-
end
|
137
|
-
|
138
|
-
# Scrapes the value of the time limit from the page. Returns it as a string.
|
139
|
-
def time_limit
|
140
|
-
frm.div(:class=>"tier2").table(:index=>0)[3][0].text
|
141
|
-
end
|
142
|
-
|
143
|
-
# Scrapes the submission limit from the page. Returns it as a string.
|
144
|
-
def submission_limit
|
145
|
-
frm.div(:class=>"tier2").table(:index=>0)[6][0].text
|
146
|
-
end
|
147
|
-
|
148
|
-
# Scrapes the Feedback policy from the page. Returns it as a string.
|
149
|
-
def feedback
|
150
|
-
frm.div(:class=>"tier2").table(:index=>0)[9][0].text
|
151
|
-
end
|
152
|
-
|
153
|
-
# Clicks the Done button, then instantiates
|
154
|
-
# the EditAssessment class.
|
155
|
-
def done
|
156
|
-
frm.button(:name=>"takeAssessmentForm:_id5").click
|
157
|
-
EditAssessment.new(@browser)
|
158
|
-
end
|
159
|
-
|
160
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
161
|
-
button(:begin_assessment, :id=>"takeAssessmentForm:beginAssessment3", :frame=>frame)
|
162
|
-
|
163
|
-
end
|
164
|
-
|
19
|
+
include PreviewOverviewMethods
|
165
20
|
end
|
166
21
|
|
167
22
|
# The Settings page for a particular Assessment
|
168
23
|
class AssessmentSettings
|
169
24
|
include PageObject
|
170
25
|
include ToolsMenu
|
171
|
-
|
172
|
-
# Scrapes the Assessment Type from the page and returns it as a string.
|
173
|
-
def assessment_type_title
|
174
|
-
frm.div(:class=>"tier2").table(:index=>0)[0][1].text
|
175
|
-
end
|
176
|
-
|
177
|
-
# Scrapes the Assessment Author information from the page and returns it as a string.
|
178
|
-
def assessment_type_author
|
179
|
-
frm.div(:class=>"tier2").table(:index=>0)[1][1].text
|
180
|
-
end
|
181
|
-
|
182
|
-
# Scrapes the Assessment Type Description from the page and returns it as a string.
|
183
|
-
def assessment_type_description
|
184
|
-
frm.div(:class=>"tier2").table(:index=>0)[2][1].text
|
185
|
-
end
|
186
|
-
|
187
|
-
# Clicks the Save Settings and Publish button
|
188
|
-
# then instantiates the PublishAssessment class.
|
189
|
-
def save_and_publish
|
190
|
-
frm.button(:value=>"Save Settings and Publish").click
|
191
|
-
PublishAssessment.new(@browser)
|
192
|
-
end
|
193
|
-
|
194
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
195
|
-
link(:open, :text=>"Open", :frame=>frame)
|
196
|
-
link(:close, :text=>"Close", :frame=>frame)
|
197
|
-
text_field(:title, :id=>"assessmentSettingsAction:intro:assessment_title", :frame=>frame)
|
198
|
-
text_field(:authors, :id=>"assessmentSettingsAction:intro:assessment_author", :frame=>frame)
|
199
|
-
text_area(:description, :id=>"assessmentSettingsAction:intro:_id44_textinput", :frame=>frame)
|
200
|
-
button(:add_attachments_to_intro, :name=>"assessmentSettingsAction:intro:_id90", :frame=>frame)
|
201
|
-
text_field(:available_date, :id=>"assessmentSettingsAction:startDate", :frame=>frame)
|
202
|
-
text_field(:due_date, :id=>"assessmentSettingsAction:endDate", :frame=>frame)
|
203
|
-
text_field(:retract_date, :id=>"assessmentSettingsAction:retractDate", :frame=>frame)
|
204
|
-
radio_button(:released_to_anonymous) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:_id117", :index=>$frame_index, :frame=>frame) }
|
205
|
-
radio_button(:released_to_site) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:_id117", :index=>$frame_index, :frame=>frame) }
|
206
|
-
text_area(:specified_ips, :name=>"assessmentSettingsAction:_id132", :frame=>frame)
|
207
|
-
text_field(:secondary_id, :id=>"assessmentSettingsAction:username", :frame=>frame)
|
208
|
-
text_field(:secondary_pw, :id=>"assessmentSettingsAction:password", :frame=>frame)
|
209
|
-
checkbox(:timed_assessment, :id=>"assessmentSettingsAction:selTimeAssess", :frame=>frame)
|
210
|
-
select_list(:limit_hour, :id=>"assessmentSettingsAction:timedHours", :frame=>frame)
|
211
|
-
select_list(:limit_mins, :id=>"assessmentSettingsAction:timedMinutes", :frame=>frame)
|
212
|
-
radio_button(:linear_access) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:itemNavigation", :index=>$frame_index, :frame=>frame) }
|
213
|
-
radio_button(:random_access) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:itemNavigation", :index=>$frame_index, :frame=>frame) }
|
214
|
-
radio_button(:question_per_page) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:assessmentFormat", :index=>$frame_index, :frame=>frame) }
|
215
|
-
radio_button(:part_per_page) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:assessmentFormat", :index=>$frame_index, :frame=>frame) }
|
216
|
-
radio_button(:assessment_per_page) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:assessmentFormat", :index=>2, :frame=>frame) }
|
217
|
-
radio_button(:continuous_numbering) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:itemNumbering", :index=>$frame_index, :frame=>frame) }
|
218
|
-
radio_button(:restart_per_part) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:itemNumbering", :index=>$frame_index, :frame=>frame) }
|
219
|
-
checkbox(:add_mark_for_review, :id=>"assessmentSettingsAction:markForReview1", :frame=>frame)
|
220
|
-
radio_button(:unlimited_submissions) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:unlimitedSubmissions", :index=>$frame_index, :frame=>frame) }
|
221
|
-
radio_button(:only_x_submissions) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:unlimitedSubmissions", :index=>$frame_index, :frame=>frame) }
|
222
|
-
text_field(:allowed_submissions, :id=>"assessmentSettingsAction:submissions_Allowed", :frame=>frame)
|
223
|
-
radio_button(:late_submissions_not_accepted) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:lateHandling", :index=>$frame_index, :frame=>frame) }
|
224
|
-
radio_button(:late_submissions_accepted) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:lateHandling", :index=>$frame_index, :frame=>frame) }
|
225
|
-
text_area(:submission_message, :id=>"assessmentSettingsAction:_id245_textinput", :frame=>frame)
|
226
|
-
text_field(:final_page_url, :id=>"assessmentSettingsAction:finalPageUrl", :frame=>frame)
|
227
|
-
radio_button(:question_level_feedback) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackAuthoring", :index=>$frame_index, :frame=>frame) }
|
228
|
-
radio_button(:selection_level_feedback) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackAuthoring", :index=>$frame_index, :frame=>frame) }
|
229
|
-
radio_button(:both_feedback_levels) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackAuthoring", :index=>2, :frame=>frame) }
|
230
|
-
radio_button(:immediate_feedback) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackDelivery", :index=>$frame_index, :frame=>frame) }
|
231
|
-
radio_button(:feedback_on_submission) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackDelivery", :index=>$frame_index, :frame=>frame) }
|
232
|
-
radio_button(:no_feedback) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackDelivery", :index=>2, :frame=>frame) }
|
233
|
-
radio_button(:feedback_on_date) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackDelivery", :index=>3, :frame=>frame) }
|
234
|
-
text_field(:feedback_date, :id=>"assessmentSettingsAction:feedbackDate", :frame=>frame)
|
235
|
-
radio_button(:only_release_scores) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackComponentOption", :index=>$frame_index, :frame=>frame) }
|
236
|
-
radio_button(:release_questions_and) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:feedbackComponentOption", :index=>$frame_index, :frame=>frame) }
|
237
|
-
checkbox(:release_student_response, :id=>"assessmentSettingsAction:feedbackCheckbox1", :frame=>frame)
|
238
|
-
checkbox(:release_correct_response, :id=>"assessmentSettingsAction:feedbackCheckbox3", :frame=>frame)
|
239
|
-
checkbox(:release_students_assessment_scores, :id=>"assessmentSettingsAction:feedbackCheckbox5", :frame=>frame)
|
240
|
-
checkbox(:release_students_question_and_part_scores, :id=>"assessmentSettingsAction:feedbackCheckbox7", :frame=>frame)
|
241
|
-
checkbox(:release_question_level_feedback, :id=>"assessmentSettingsAction:feedbackCheckbox2", :frame=>frame)
|
242
|
-
checkbox(:release_selection_level_feedback, :id=>"assessmentSettingsAction:feedbackCheckbox4", :frame=>frame)
|
243
|
-
checkbox(:release_graders_comments, :id=>"assessmentSettingsAction:feedbackCheckbox6", :frame=>frame)
|
244
|
-
checkbox(:release_statistics, :id=>"assessmentSettingsAction:feedbackCheckbox8", :frame=>frame)
|
245
|
-
radio_button(:student_ids_seen) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:anonymousGrading1", :index=>$frame_index, :frame=>frame) }
|
246
|
-
radio_button(:anonymous_grading) { |page| page.radio_button_element( :name=>"assessmentSettingsAction:anonymousGrading1", :index=>$frame_index, :frame=>frame) }
|
247
|
-
#radio_button(:no_gradebook_options) { |page| page.radio_button_element( :name=>"", :index=>$frame_index, :frame=>frame) }
|
248
|
-
#radio_button(:grades_sent_to_gradebook) { |page| page.radio_button_element( :name=>"", :index=>$frame_index, :frame=>frame) }
|
249
|
-
#radio_button(:record_highest_score) { |page| page.radio_button_element( :name=>"", :index=>$frame_index, :frame=>frame) }
|
250
|
-
#radio_button(:record_last_score) { |page| page.radio_button_element( :name=>"", :index=>$frame_index, :frame=>frame) }
|
251
|
-
#radio_button(:background_color) { |page| page.radio_button_element( :name=>"", :index=>$frame_index, :frame=>frame) }
|
252
|
-
#text_field(:color_value, :id=>"", :frame=>frame)
|
253
|
-
#radio_button(:background_image) { |page| page.radio_button_element( :name=>"", :index=>$frame_index, :frame=>frame) }
|
254
|
-
#text_field(:image_name, :=>"", :frame=>frame)
|
255
|
-
#text_field(:keywords, :=>"", :frame=>frame)
|
256
|
-
#text_field(:objectives, :=>"", :frame=>frame)
|
257
|
-
#text_field(:rubrics, :=>"", :frame=>frame)
|
258
|
-
#checkbox(:record_metadata_for_questions, :=>"", :frame=>frame)
|
259
|
-
button(:save, :name=>"assessmentSettingsAction:_id383", :frame=>frame)
|
260
|
-
button(:cancel, :name=>"assessmentSettingsAction:_id385", :frame=>frame)
|
261
|
-
|
262
|
-
end
|
263
|
-
|
26
|
+
include AssessmentSettingsMethods
|
264
27
|
end
|
265
28
|
|
266
29
|
# Instructor's view of Students' assessment scores
|
267
30
|
class AssessmentTotalScores
|
268
31
|
include PageObject
|
269
32
|
include ToolsMenu
|
270
|
-
|
271
|
-
# Gets the user ids listed in the
|
272
|
-
# scores table, returns them as an Array
|
273
|
-
# object.
|
274
|
-
#
|
275
|
-
# Note that this method is only appropriate when student
|
276
|
-
# identities are not being obscured on this page. If student
|
277
|
-
# submissions are set to be anonymous then this method will fail
|
278
|
-
# to return any ids.
|
279
|
-
def student_ids
|
280
|
-
ids = []
|
281
|
-
scores_table = frm.table(:id=>"editTotalResults:totalScoreTable").to_a
|
282
|
-
scores_table.delete_at(0)
|
283
|
-
scores_table.each { |row| ids << row[1] }
|
284
|
-
return ids
|
285
|
-
end
|
286
|
-
|
287
|
-
# Adds a comment to the specified student's comment box.
|
288
|
-
#
|
289
|
-
# Note that this method assumes that the student identities are not being
|
290
|
-
# obscured on this page. If they are, then this method will not work for
|
291
|
-
# selecting the appropriate comment box.
|
292
|
-
# @param student_id [String] the target student id
|
293
|
-
# @param comment [String] the text of the comment being made to the student
|
294
|
-
def comment_for_student(student_id, comment)
|
295
|
-
index_val = student_ids.index(student_id)
|
296
|
-
frm.text_field(:name=>"editTotalResults:totalScoreTable:#{index_val}:_id345").value=comment
|
297
|
-
end
|
298
|
-
|
299
|
-
# Clicks the Submit Date link in the table header to sort/reverse sort the list.
|
300
|
-
def sort_by_submit_date
|
301
|
-
frm.link(:text=>"Submit Date").click
|
302
|
-
end
|
303
|
-
|
304
|
-
# Enters the specified string into the topmost box listed on the page.
|
305
|
-
#
|
306
|
-
# This method is especially useful when the student identities are obscured, since
|
307
|
-
# in that situation you can't target a specific student's comment box, obviously.
|
308
|
-
# @param comment [String] the text to be entered into the Comment box
|
309
|
-
def comment_in_first_box=(comment)
|
310
|
-
frm.text_field(:name=>"editTotalResults:totalScoreTable:0:_id345").value=comment
|
311
|
-
end
|
312
|
-
|
313
|
-
# Clicks the Update button, then instantiates
|
314
|
-
# the AssessmentTotalScores class.
|
315
|
-
def update
|
316
|
-
frm.button(:value=>"Update").click
|
317
|
-
AssessmentTotalScores.new(@browser)
|
318
|
-
end
|
319
|
-
|
320
|
-
# Clicks the Assessments link on the page
|
321
|
-
# then instantiates the AssessmentsList class.
|
322
|
-
def assessments
|
323
|
-
frm.link(:text=>"Assessments").click
|
324
|
-
AssessmentsList.new(@browser)
|
325
|
-
end
|
326
|
-
|
33
|
+
include AssessmentTotalScoresMethods
|
327
34
|
end
|
328
35
|
|
329
36
|
# The page that appears when you're creating a new quiz
|
@@ -331,176 +38,14 @@ end
|
|
331
38
|
class EditAssessment
|
332
39
|
include PageObject
|
333
40
|
include ToolsMenu
|
334
|
-
|
335
|
-
# Allows insertion of a question at a specified
|
336
|
-
# point in the Assessment. Must include the
|
337
|
-
# part number, the question number, and the type of
|
338
|
-
# question. Question Type must match the Type
|
339
|
-
# value in the drop down.
|
340
|
-
#
|
341
|
-
# The method will instantiate the page class
|
342
|
-
# based on the selected question type.
|
343
|
-
def insert_question_after(part_num, question_num, qtype)
|
344
|
-
if question_num.to_i == 0
|
345
|
-
frm.select(:id=>"assesssmentForm:parts:#{part_num.to_i - 1}:changeQType").select(qtype)
|
346
|
-
else
|
347
|
-
frm.select(:id=>"assesssmentForm:parts:#{part_num.to_i - 1}:parts:#{question_num.to_i - 1}:changeQType").select(qtype)
|
348
|
-
end
|
349
|
-
|
350
|
-
page = case(qtype)
|
351
|
-
when "Multiple Choice" then MultipleChoice.new(@browser)
|
352
|
-
when "True False" then TrueFalse.new(@browser)
|
353
|
-
when "Survey" then Survey.new(@browser)
|
354
|
-
when "Short Answer/Essay" then ShortAnswer.new(@browser)
|
355
|
-
when "Fill in the Blank" then FillInBlank.new(@browser)
|
356
|
-
when "Numeric Response" then NumericResponse.new(@browser)
|
357
|
-
when "Matching" then Matching.new(@browser)
|
358
|
-
when "Audio Recording" then AudioRecording.new(@browser)
|
359
|
-
when "File Upload" then FileUpload.new(@browser)
|
360
|
-
else puts "#{qtype} is not a valid question type"
|
361
|
-
end
|
362
|
-
|
363
|
-
return page
|
364
|
-
|
365
|
-
end
|
366
|
-
|
367
|
-
# Allows removal of question by part number and question number.
|
368
|
-
# @param part_num [String] the Part number containing the question you want to remove
|
369
|
-
# @param question_num [String] the number of the question you want to remove
|
370
|
-
def remove_question(part_num, question_num)
|
371
|
-
frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:deleteitem").click
|
372
|
-
end
|
373
|
-
|
374
|
-
# Allows editing of a question by specifying its part number
|
375
|
-
# and question number.
|
376
|
-
# @param part_num [String] the Part number containing the question you want
|
377
|
-
# @param question_num [String] the number of the question you want
|
378
|
-
def edit_question(part_num, question_num)
|
379
|
-
frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:modify").click
|
380
|
-
end
|
381
|
-
|
382
|
-
# Allows copying an Assessment part to a Pool.
|
383
|
-
# @param part_num [String] the part number of the assessment you want
|
384
|
-
def copy_part_to_pool(part_num)
|
385
|
-
frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:copyToPool").click
|
386
|
-
end
|
387
|
-
|
388
|
-
# Allows removing a specified
|
389
|
-
# Assessment part number.
|
390
|
-
# @param part_num [String] the part number of the assessment you want
|
391
|
-
def remove_part(part_num)
|
392
|
-
frm.link(:xpath, "//a[contains(@onclick, 'assesssmentForm:parts:#{part_num.to_i-1}:copyToPool')]").click
|
393
|
-
end
|
394
|
-
|
395
|
-
# Clicks the Add Part button, then
|
396
|
-
# instantiates the AddEditAssessmentPart page class.
|
397
|
-
def add_part
|
398
|
-
frm.link(:text=>"Add Part").click
|
399
|
-
AddEditAssessmentPart.new(@browser)
|
400
|
-
end
|
401
|
-
|
402
|
-
# Selects the desired question type from the
|
403
|
-
# drop down list, then instantiates the appropriate
|
404
|
-
# page class.
|
405
|
-
# @param qtype [String] the text of the item you want to select from the list
|
406
|
-
def select_question_type(qtype)
|
407
|
-
frm.select(:id=>"assesssmentForm:changeQType").select(qtype)
|
408
|
-
|
409
|
-
page = case(qtype)
|
410
|
-
when "Multiple Choice" then MultipleChoice.new(@browser)
|
411
|
-
when "True False" then TrueFalse.new(@browser)
|
412
|
-
when "Survey" then Survey.new(@browser)
|
413
|
-
when "Short Answer/Essay" then ShortAnswer.new(@browser)
|
414
|
-
when "Fill in the Blank" then FillInBlank.new(@browser)
|
415
|
-
when "Numeric Response" then NumericResponse.new(@browser)
|
416
|
-
when "Matching" then Matching.new(@browser)
|
417
|
-
when "Audio Recording" then AudioRecording.new(@browser)
|
418
|
-
when "File Upload" then FileUpload.new(@browser)
|
419
|
-
else puts "#{qtype} is not a valid question type"
|
420
|
-
end
|
421
|
-
|
422
|
-
return page
|
423
|
-
|
424
|
-
end
|
425
|
-
|
426
|
-
# Clicks the Preview button,
|
427
|
-
# then instantiates the PreviewOverview page class.
|
428
|
-
def preview
|
429
|
-
frm.link(:text=>"Preview").click
|
430
|
-
PreviewOverview.new(@browser)
|
431
|
-
end
|
432
|
-
|
433
|
-
# Clicks the Settings link, then
|
434
|
-
# instantiates the AssessmentSettings page class.
|
435
|
-
def settings
|
436
|
-
frm.link(:text=>"Settings").click
|
437
|
-
AssessmentSettings.new(@browser)
|
438
|
-
end
|
439
|
-
|
440
|
-
# Clicks the Publish button, then
|
441
|
-
# instantiates the PublishAssessment page class.
|
442
|
-
def publish
|
443
|
-
frm.link(:text=>"Publish").click
|
444
|
-
PublishAssessment.new(@browser)
|
445
|
-
end
|
446
|
-
|
447
|
-
# Clicks the Question Pools button, then
|
448
|
-
# instantiates the QuestionPoolsList page class.
|
449
|
-
def question_pools
|
450
|
-
frm.link(:text=>"Question Pools").click
|
451
|
-
QuestionPoolsList.new(@browser)
|
452
|
-
end
|
453
|
-
|
454
|
-
# Allows retrieval of a specified question's
|
455
|
-
# text, by part and question number.
|
456
|
-
# @param part_num [String] the Part number containing the question you want
|
457
|
-
# @param question_num [String] the number of the question you want
|
458
|
-
def get_question_text(part_number, question_number)
|
459
|
-
frm.table(:id=>"assesssmentForm:parts:#{part_number.to_i-1}:parts").div(:class=>"tier3", :index=>question_number.to_i-1).text
|
460
|
-
end
|
461
|
-
|
462
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
463
|
-
link(:assessments, :text=>"Assessments", :frame=>frame)
|
464
|
-
link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
|
465
|
-
link(:print, :text=>"Print", :frame=>frame)
|
466
|
-
button(:update_points, :id=>"assesssmentForm:pointsUpdate", :frame=>frame)
|
467
|
-
|
468
|
-
end
|
469
|
-
|
41
|
+
include EditAssessmentMethods
|
470
42
|
end
|
471
43
|
|
472
44
|
# This is the page for adding and editing a part of an assessment
|
473
45
|
class AddEditAssessmentPart
|
474
46
|
include PageObject
|
475
47
|
include ToolsMenu
|
476
|
-
|
477
|
-
# Clicks the Save button, then instantiates
|
478
|
-
# the EditAssessment page class.
|
479
|
-
def save
|
480
|
-
frm.button(:name=>"modifyPartForm:_id89").click
|
481
|
-
EditAssessment.new(@browser)
|
482
|
-
end
|
483
|
-
|
484
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
485
|
-
text_field(:title, :id=>"modifyPartForm:title", :frame=>frame)
|
486
|
-
text_area(:information, :id=>"modifyPartForm:_id10_textinput", :frame=>frame)
|
487
|
-
button(:add_attachments, :name=>"modifyPartForm:_id54", :frame=>frame)
|
488
|
-
radio_button(:questions_one_by_one) { |page| page.radio_button_element(:index=>0, :name=>"modifyPartForm:_id60", :frame=>frame)}
|
489
|
-
radio_button(:random_draw) { |page| page.radio_button_element(:index=>1, :name=>"modifyPartForm:_id60", :frame=>frame) }
|
490
|
-
select_list(:pool_name, :id=>"modifyPartForm:assignToPool", :frame=>frame)
|
491
|
-
text_field(:number_of_questions, :id=>"modifyPartForm:numSelected", :frame=>frame)
|
492
|
-
text_field(:point_value_of_questions, :id=>"modifyPartForm:numPointsRandom", :frame=>frame)
|
493
|
-
text_field(:negative_point_value, :id=>"modifyPartForm:numDiscountRandom", :frame=>frame)
|
494
|
-
radio_button(:randomized_each_time) { |page| page.radio_button_element(:index=>0, :name=>"modifyPartForm:randomizationType", :frame=>frame) }
|
495
|
-
radio_button(:randomized_once) { |page| page.radio_button_element(:index=>1, :name=>"modifyPartForm:randomizationType", :frame=>frame) }
|
496
|
-
radio_button(:order_as_listed) { |page| page.radio_button_element(:index=>0, :name=>"modifyPartForm:_id81", :frame=>frame) }
|
497
|
-
radio_button(:random_within_part) { |page| page.radio_button_element(:index=>1, :name=>"modifyPartForm:_id81", :frame=>frame) }
|
498
|
-
text_field(:objective, :id=>"modifyPartForm:obj", :frame=>frame)
|
499
|
-
text_field(:keyword, :id=>"modifyPartForm:keyword", :frame=>frame)
|
500
|
-
text_field(:rubric, :id=>"modifyPartForm:rubric", :frame=>frame)
|
501
|
-
button(:cancel, :name=>"modifyPartForm:_id90", :frame=>frame)
|
502
|
-
end
|
503
|
-
|
48
|
+
include AddEditAssessmentPartMethods
|
504
49
|
end
|
505
50
|
|
506
51
|
# The review page once you've selected to Save and Publish
|
@@ -508,229 +53,63 @@ end
|
|
508
53
|
class PublishAssessment
|
509
54
|
include PageObject
|
510
55
|
include ToolsMenu
|
511
|
-
|
512
|
-
# Clicks the Publish button, then
|
513
|
-
# instantiates the AssessmentsList page class.
|
514
|
-
def publish
|
515
|
-
frm.button(:value=>"Publish").click
|
516
|
-
AssessmentsList.new(@browser)
|
517
|
-
end
|
518
|
-
|
519
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
520
|
-
button(:cancel, :value=>"Cancel", :frame=>frame)
|
521
|
-
button(:edit, :name=>"publishAssessmentForm:_id23", :frame=>frame)
|
522
|
-
select_list(:notification, :id=>"publishAssessmentForm:number", :frame=>frame)
|
523
|
-
|
524
|
-
end
|
525
|
-
|
56
|
+
include PublishAssessmentMethods
|
526
57
|
end
|
527
58
|
|
528
59
|
# The page for setting up a multiple choice question
|
529
60
|
class MultipleChoice
|
530
61
|
include PageObject
|
531
62
|
include ToolsMenu
|
532
|
-
include
|
533
|
-
|
534
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
535
|
-
button(:cancel, :value=>"Cancel", :frame=>frame)
|
536
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
537
|
-
link(:whats_this, :text=>"(What's This?)", :frame=>frame)
|
538
|
-
radio_button(:single_correct) { |page| page.radio_button_element(:name=>"itemForm:chooseAnswerTypeForMC", :index=>0, :frame=>frame) }
|
539
|
-
radio_button(:enable_negative_marking) { |page| page.radio_button_element(:name=>"itemForm:partialCreadit_NegativeMarking", :index=>0, :frame=>frame) }
|
540
|
-
|
541
|
-
# Element present when negative marking selected:
|
542
|
-
text_field(:negative_point_value, :id=>"itemForm:answerdsc", :frame=>frame)
|
543
|
-
|
544
|
-
radio_button(:enable_partial_credit) { |page| page.radio_button_element(:name=>"itemForm:partialCreadit_NegativeMarking", :index=>1, :frame=>frame) }
|
545
|
-
link(:reset_to_default, :text=>"Reset to Default Grading Logic", :frame=>frame)
|
546
|
-
radio_button(:multi_single) {|page| page.radio_button_element(:name=>"itemForm:chooseAnswerTypeForMC", :index=>1, :frame=>frame) }
|
547
|
-
radio_button(:multi_multi) {|page| page.radio_button_element(:name=>"itemForm:chooseAnswerTypeForMC", :index=>2, :frame=>frame) }
|
548
|
-
text_area(:question_text, :id=>"itemForm:_id82_textinput", :frame=>frame)
|
549
|
-
button(:add_attachments, :name=>"itemForm:_id126", :frame=>frame)
|
550
|
-
|
551
|
-
text_area(:answer_a, :id=>"itemForm:mcchoices:0:_id140_textinput", :frame=>frame)
|
552
|
-
link(:remove_a, :id=>"itemForm:mcchoices:0:removelinkSingle", :frame=>frame)
|
553
|
-
text_area(:answer_b, :id=>"itemForm:mcchoices:1:_id140_textinput", :frame=>frame)
|
554
|
-
link(:remove_b, :id=>"itemForm:mcchoices:1:removelinkSingle", :frame=>frame)
|
555
|
-
text_area(:answer_c, :id=>"itemForm:mcchoices:2:_id140_textinput", :frame=>frame)
|
556
|
-
link(:remove_c, :id=>"itemForm:mcchoices:2:removelinkSingle", :frame=>frame)
|
557
|
-
text_area(:answer_d, :id=>"itemForm:mcchoices:3:_id140_textinput", :frame=>frame)
|
558
|
-
link(:remove_d, :id=>"itemForm:mcchoices:3:removelinkSingle", :frame=>frame)
|
559
|
-
|
560
|
-
# Radio buttons that appear when "single correct" is selected
|
561
|
-
radio_button(:a_correct, :name=>"itemForm:mcchoices:0:mcradiobtn", :frame=>frame)
|
562
|
-
radio_button(:b_correct, :name=>"itemForm:mcchoices:1:mcradiobtn", :frame=>frame)
|
563
|
-
radio_button(:c_correct, :name=>"itemForm:mcchoices:2:mcradiobtn", :frame=>frame)
|
564
|
-
radio_button(:d_correct, :name=>"itemForm:mcchoices:3:mcradiobtn", :frame=>frame)
|
565
|
-
|
566
|
-
# % Value fields that appear when "single correct" and "partial credit" selected
|
567
|
-
text_field(:a_value, :id=>"itemForm:mcchoices:0:partialCredit", :frame=>frame)
|
568
|
-
text_field(:b_value, :id=>"itemForm:mcchoices:1:partialCredit", :frame=>frame)
|
569
|
-
text_field(:c_value, :id=>"itemForm:mcchoices:2:partialCredit", :frame=>frame)
|
570
|
-
text_field(:d_value, :id=>"itemForm:mcchoices:3:partialCredit", :frame=>frame)
|
571
|
-
|
572
|
-
link(:reset_score_values, :text=>"Reset Score Values", :frame=>frame)
|
573
|
-
|
574
|
-
# Checkboxes that appear when "multiple correct" is selected
|
575
|
-
checkbox(:a_correct, :name=>"itemForm:mcchoices:0:mccheckboxes", :frame=>frame)
|
576
|
-
checkbox(:b_correct, :name=>"itemForm:mcchoices:1:mccheckboxes", :frame=>frame)
|
577
|
-
checkbox(:c_correct, :name=>"itemForm:mcchoices:2:mccheckboxes", :frame=>frame)
|
578
|
-
checkbox(:d_correct, :name=>"itemForm:mcchoices:3:mccheckboxes", :frame=>frame)
|
579
|
-
|
580
|
-
select_list(:insert_additional_answers, :id=>"itemForm:insertAdditionalAnswerSelectMenu", :frame=>frame)
|
581
|
-
radio_button(:randomize_answers_yes) {|page| page.radio_button_element(:index=>0, :name=>"itemForm:_id162", :frame=>frame) }
|
582
|
-
radio_button(:randomize_answers_no) {|page| page.radio_button_element(:index=>1, :name=>"itemForm:_id162", :frame=>frame) }
|
583
|
-
radio_button(:require_rationale_yes) {|page| page.radio_button_element(:index=>0, :name=>"itemForm:_id166", :frame=>frame) }
|
584
|
-
radio_button(:require_rationale_no) {|page| page.radio_button_element(:index=>1, :name=>"itemForm:_id166", :frame=>frame) }
|
585
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
586
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
587
|
-
|
588
|
-
end
|
589
|
-
|
63
|
+
include MultipleChoiceMethods
|
590
64
|
end
|
591
65
|
|
592
66
|
# The page for setting up a Survey question
|
593
67
|
class Survey
|
594
68
|
include PageObject
|
595
69
|
include ToolsMenu
|
596
|
-
include
|
597
|
-
|
598
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
599
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
600
|
-
text_area(:question_text, :id=>"itemForm:_id69_textinput", :frame=>frame)
|
601
|
-
button(:add_attachments, :id=>"itemForm:_id113", :frame=>frame)
|
602
|
-
radio_button(:yes_no) { |page| page.radio_button_element(:index=>0, :name=>"itemForm:selectscale", :frame=>frame) }
|
603
|
-
radio_button(:disagree_agree) {|page| page.radio_button_element(:index=>1, :name=>"itemForm:selectscale", :frame=>frame) }
|
604
|
-
radio_button(:disagree_undecided) {|page| page.radio_button_element(:index=>2, :name=>"itemForm:selectscale", :frame=>frame) }
|
605
|
-
radio_button(:below_above) {|page| page.radio_button_element(:index=>3, :name=>"itemForm:selectscale", :frame=>frame)}
|
606
|
-
radio_button(:strongly_agree) {|page| page.radio_button_element(:index=>4, :name=>"itemForm:selectscale", :frame=>frame)}
|
607
|
-
radio_button(:unacceptable_excellent) {|page| page.radio_button_element(:index=>5, :name=>"itemForm:selectscale", :frame=>frame)}
|
608
|
-
radio_button(:one_to_five) {|page| page.radio_button_element(:index=>6, :name=>"itemForm:selectscale", :frame=>frame)}
|
609
|
-
radio_button(:one_to_ten) {|page| page.radio_button_element(:index=>7, :name=>"itemForm:selectscale", :frame=>frame)}
|
610
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
611
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
612
|
-
end
|
613
|
-
|
70
|
+
include SurveyMethods
|
614
71
|
end
|
615
72
|
|
616
73
|
# The page for setting up a Short Answer/Essay question
|
617
74
|
class ShortAnswer
|
618
75
|
include PageObject
|
619
76
|
include ToolsMenu
|
620
|
-
include
|
621
|
-
|
622
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
623
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
624
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
625
|
-
text_area(:question_text, :id=>"itemForm:_id69_textinput", :frame=>frame)
|
626
|
-
button(:add_attachments, :id=>"itemForm:_id113", :frame=>frame)
|
627
|
-
text_area(:model_short_answer, :id=>"itemForm:_id129_textinput", :frame=>frame)
|
628
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
629
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
630
|
-
end
|
631
|
-
|
77
|
+
include ShortAnswerMethods
|
632
78
|
end
|
633
79
|
|
634
80
|
# The page for setting up a Fill-in-the-blank question
|
635
81
|
class FillInBlank
|
636
82
|
include PageObject
|
637
83
|
include ToolsMenu
|
638
|
-
include
|
639
|
-
|
640
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
641
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
642
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
643
|
-
text_area(:question_text, :id=>"itemForm:_id75_textinput", :frame=>frame)
|
644
|
-
checkbox(:case_sensitive, :name=>"itemForm:_id76", :frame=>frame)
|
645
|
-
checkbox(:mutually_exclusive, :name=>"itemForm:_id78", :frame=>frame)
|
646
|
-
button(:add_attachments, :id=>"itemForm:_id126", :frame=>frame)
|
647
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
648
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
649
|
-
|
650
|
-
end
|
651
|
-
|
84
|
+
include FillInBlankMethods
|
652
85
|
end
|
653
86
|
|
654
87
|
# The page for setting up a numeric response question
|
655
88
|
class NumericResponse
|
656
89
|
include PageObject
|
657
90
|
include ToolsMenu
|
658
|
-
include
|
659
|
-
|
660
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
661
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
662
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
663
|
-
text_area(:question_text, :id=>"itemForm:_id73_textinput", :frame=>frame)
|
664
|
-
button(:add_attachments, :id=>"itemForm:_id117", :frame=>frame)
|
665
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
666
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
667
|
-
|
668
|
-
end
|
669
|
-
|
91
|
+
include NumericResponseMethods
|
670
92
|
end
|
671
93
|
|
672
94
|
# The page for setting up a matching question
|
673
95
|
class Matching
|
674
96
|
include PageObject
|
675
97
|
include ToolsMenu
|
676
|
-
include
|
677
|
-
|
678
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
679
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
680
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
681
|
-
text_area(:question_text, :id=>"itemForm:_id78_textinput", :frame=>frame)
|
682
|
-
button(:add_attachments, :id=>"itemForm:_id122", :frame=>frame)
|
683
|
-
text_area(:choice, :id=>"itemForm:_id147_textinput", :frame=>frame)
|
684
|
-
text_area(:match, :id=>"itemForm:_id151_textinput", :frame=>frame)
|
685
|
-
button(:save_pairing, :name=>"itemForm:_id164", :frame=>frame)
|
686
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
687
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
688
|
-
|
689
|
-
end
|
690
|
-
|
98
|
+
include MatchingMethods
|
691
99
|
end
|
692
100
|
|
693
101
|
# The page for setting up a True/False question
|
694
102
|
class TrueFalse
|
695
103
|
include PageObject
|
696
104
|
include ToolsMenu
|
697
|
-
include
|
698
|
-
|
699
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
700
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
701
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
702
|
-
text_area(:question_text, :id=>"itemForm:_id77_textinput", :frame=>frame)
|
703
|
-
button(:add_attachments, :id=>"itemForm:_id121", :frame=>frame)
|
704
|
-
text_field(:negative_point_value, :id=>"itemForm:answerdsc", :frame=>frame)
|
705
|
-
radio_button(:answer_true) {|page| page.radio_button_element(:index=>0, :name=>"itemForm:TF", :frame=>frame)}
|
706
|
-
radio_button(:answer_false) {|page| page.radio_button_element(:index=>1, :name=>"itemForm:TF", :frame=>frame)}
|
707
|
-
radio_button(:required_rationale_yes) {|page| page.radio_button_element(:index=>0, :name=>"itemForm:rational", :frame=>frame)}
|
708
|
-
radio_button(:required_rationale_no) {|page| page.radio_button_element(:index=>1, :name=>"itemForm:rational", :frame=>frame)}
|
709
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
710
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
711
|
-
|
712
|
-
end
|
713
|
-
|
105
|
+
include TrueFalseMethods
|
714
106
|
end
|
715
107
|
|
716
108
|
# The page for setting up a question that requires an audio response
|
717
109
|
class AudioRecording
|
718
110
|
include PageObject
|
719
111
|
include ToolsMenu
|
720
|
-
include
|
721
|
-
|
722
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
723
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
724
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
725
|
-
text_area(:question_text, :id=>"itemForm:_id69_textinput", :frame=>frame)
|
726
|
-
button(:add_attachments, :id=>"itemForm:_id113", :frame=>frame)
|
727
|
-
text_field(:time_allowed, :id=>"itemForm:timeallowed", :frame=>frame)
|
728
|
-
select_list(:number_of_attempts, :id=>"itemForm:noattempts", :frame=>frame)
|
729
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
730
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
731
|
-
|
732
|
-
end
|
733
|
-
|
112
|
+
include AudioRecordingMethods
|
734
113
|
end
|
735
114
|
|
736
115
|
# The page for setting up a question that requires
|
@@ -738,140 +117,35 @@ end
|
|
738
117
|
class FileUpload
|
739
118
|
include PageObject
|
740
119
|
include ToolsMenu
|
741
|
-
include
|
742
|
-
|
743
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
744
|
-
button(:cancel, :id=>"itemForm:_id63", :frame=>frame)
|
745
|
-
text_field(:answer_point_value, :id=>"itemForm:answerptr", :frame=>frame)
|
746
|
-
text_area(:question_text, :id=>"itemForm:_id69_textinput", :frame=>frame)
|
747
|
-
button(:add_attachments, :id=>"itemForm:_id113", :frame=>frame)
|
748
|
-
select_list(:assign_to_part, :id=>"itemForm:assignToPart", :frame=>frame)
|
749
|
-
select_list(:assign_to_pool, :id=>"itemForm:assignToPool", :frame=>frame)
|
750
|
-
|
751
|
-
end
|
752
|
-
|
120
|
+
include FileUploadMethods
|
753
121
|
end
|
754
122
|
|
755
123
|
# The page that appears when you are editing a type of assessment
|
756
124
|
class EditAssessmentType
|
757
125
|
include PageObject
|
758
126
|
include ToolsMenu
|
759
|
-
|
127
|
+
include EditAssessmentTypeMethods
|
760
128
|
end
|
761
129
|
|
762
130
|
# The Page that appears when adding a new question pool
|
763
131
|
class AddQuestionPool
|
764
132
|
include PageObject
|
765
133
|
include ToolsMenu
|
766
|
-
|
767
|
-
# instantiates the QuestionPoolsList page class.
|
768
|
-
def save
|
769
|
-
#10.times {frm.button(:id=>"questionpool:submit").flash}
|
770
|
-
frm.button(:id=>"questionpool:submit").click
|
771
|
-
#sleep 180
|
772
|
-
#frm.button(:value=>"Create").wait_until_present(120)
|
773
|
-
QuestionPoolsList.new(@browser)
|
774
|
-
end
|
775
|
-
|
776
|
-
def cancel
|
777
|
-
frm.button(:value=>"Cancel").click
|
778
|
-
QuestionPoolsList.new @browser
|
779
|
-
end
|
780
|
-
|
781
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
782
|
-
text_field(:pool_name, :id=>"questionpool:namefield", :frame=>frame)
|
783
|
-
text_field(:department_group, :id=>"questionpool:orgfield", :frame=>frame)
|
784
|
-
text_area(:description, :id=>"questionpool:descfield", :frame=>frame)
|
785
|
-
text_field(:objectives, :id=>"questionpool:objfield", :frame=>frame)
|
786
|
-
text_field(:keywords, :id=>"questionpool:keyfield", :frame=>frame)
|
787
|
-
|
788
|
-
end
|
134
|
+
include AddQuestionPoolMethods
|
789
135
|
end
|
790
136
|
|
791
137
|
# The Page that appears when editing an existing question pool
|
792
138
|
class EditQuestionPool
|
793
139
|
include PageObject
|
794
140
|
include ToolsMenu
|
795
|
-
|
796
|
-
# instantiates the SelectQuestionType class.
|
797
|
-
def add_question
|
798
|
-
frm.link(:id=>"editform:addQlink").click
|
799
|
-
SelectQuestionType.new(@browser)
|
800
|
-
end
|
801
|
-
|
802
|
-
# Clicks the Question Pools link, then
|
803
|
-
# instantiates the QuestionPoolsList class.
|
804
|
-
def question_pools
|
805
|
-
frm.link(:text=>"Question Pools").click
|
806
|
-
QuestionPoolsList.new(@browser)
|
807
|
-
end
|
808
|
-
|
809
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
810
|
-
text_field(:pool_name, :id=>"editform:namefield", :frame=>frame)
|
811
|
-
text_field(:department_group, :id=>"editform:orgfield", :frame=>frame)
|
812
|
-
text_area(:description, :id=>"editform:descfield", :frame=>frame)
|
813
|
-
text_field(:objectives, :id=>"editform:objfield", :frame=>frame)
|
814
|
-
text_field(:keywords, :id=>"editform:keyfield", :frame=>frame)
|
815
|
-
button(:update, :id=>"editform:Update", :frame=>frame)
|
816
|
-
button(:save, :id=>"questionpool:submit", :frame=>frame)
|
817
|
-
button(:cancel, :id=>"questionpool:_id11", :frame=>frame)
|
818
|
-
|
819
|
-
end
|
141
|
+
include EditQuestionPoolMethods
|
820
142
|
end
|
821
143
|
|
822
144
|
# The page with the list of existing Question Pools
|
823
145
|
class QuestionPoolsList
|
824
146
|
include PageObject
|
825
147
|
include ToolsMenu
|
826
|
-
|
827
|
-
# the EditQuestionPool page class.
|
828
|
-
# @param name [String] the name of the pool you want to edit
|
829
|
-
def edit_pool(name)
|
830
|
-
frm.span(:text=>name).fire_event("onclick")
|
831
|
-
EditQuestionPool.new(@browser)
|
832
|
-
end
|
833
|
-
|
834
|
-
# Clicks the Add New Pool link, then
|
835
|
-
# instantiates the AddQuestionPool page class.
|
836
|
-
def add_new_pool
|
837
|
-
#puts "clicking add new pool..."
|
838
|
-
#10.times {frm.link(:text=>"Add New Pool").flash}
|
839
|
-
frm.link(:text=>"Add New Pool").click
|
840
|
-
#puts "clicked..."
|
841
|
-
#frm.text_field(:id=>"questionpool:namefield").wait_until_present(200)
|
842
|
-
AddQuestionPool.new(@browser)
|
843
|
-
end
|
844
|
-
|
845
|
-
# Returns an array containing strings of the pool names listed
|
846
|
-
# on the page.
|
847
|
-
def pool_names
|
848
|
-
names= []
|
849
|
-
frm.table(:id=>"questionpool:TreeTable").rows.each do | row |
|
850
|
-
if row.span(:id=>/questionpool.+poolnametext/).exist?
|
851
|
-
names << row.span(:id=>/questionpool.+poolnametext/).text
|
852
|
-
end
|
853
|
-
end
|
854
|
-
return names
|
855
|
-
end
|
856
|
-
|
857
|
-
# Clicks "Import" and then instantiates the
|
858
|
-
# PoolImport page class.
|
859
|
-
def import
|
860
|
-
frm.link(:text=>"Import").click
|
861
|
-
PoolImport.new(@browser)
|
862
|
-
end
|
863
|
-
|
864
|
-
# Clicks the Assessments link and then
|
865
|
-
# instantiates the AssessmentsList page class.
|
866
|
-
def assessments
|
867
|
-
frm.link(:text=>"Assessments").click
|
868
|
-
AssessmentsList.new(@browser)
|
869
|
-
end
|
870
|
-
|
871
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
872
|
-
link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
|
873
|
-
|
874
|
-
end
|
148
|
+
include QuestionPoolsListMethods
|
875
149
|
end
|
876
150
|
|
877
151
|
# The page that appears when you click to import
|
@@ -879,57 +153,14 @@ end
|
|
879
153
|
class PoolImport
|
880
154
|
include PageObject
|
881
155
|
include ToolsMenu
|
882
|
-
|
883
|
-
# file field. Including the file path separately is optional.
|
884
|
-
# @param file_name [String] the name of the file you want to choose. Can include path info, if desired.
|
885
|
-
# @param file_path [String] Optional. This is the path information for the file location.
|
886
|
-
def choose_file(file_name, file_path="")
|
887
|
-
frm.file_field(:name=>"importPoolForm:_id6.upload").set(file_path + file_name)
|
888
|
-
end
|
889
|
-
|
890
|
-
# Clicks the Import button, then
|
891
|
-
# instantiates the QuestionPoolsList
|
892
|
-
# page class.
|
893
|
-
def import
|
894
|
-
frm.button(:value=>"Import").click
|
895
|
-
QuestionPoolsList.new(@browser)
|
896
|
-
end
|
897
|
-
|
156
|
+
include PoolImportMethods
|
898
157
|
end
|
899
158
|
|
900
159
|
# This page appears when adding a question to a pool
|
901
160
|
class SelectQuestionType
|
902
161
|
include PageObject
|
903
162
|
include ToolsMenu
|
904
|
-
|
905
|
-
# drop-down list, then instantiates the appropriate
|
906
|
-
# page class, based on the question type selected.
|
907
|
-
# @param qtype [String] the text of the question type you want to select from the drop down list.
|
908
|
-
def select_question_type(qtype)
|
909
|
-
frm.select(:id=>"_id1:selType").select(qtype)
|
910
|
-
frm.button(:value=>"Save").click
|
911
|
-
|
912
|
-
page = case(qtype)
|
913
|
-
when "Multiple Choice" then MultipleChoice.new(@browser)
|
914
|
-
when "True False" then TrueFalse.new(@browser)
|
915
|
-
when "Survey" then Survey.new(@browser)
|
916
|
-
when "Short Answer/Essay" then ShortAnswer.new(@browser)
|
917
|
-
when "Fill in the Blank" then FillInBlank.new(@browser)
|
918
|
-
when "Numeric Response" then NumericResponse.new(@browser)
|
919
|
-
when "Matching" then Matching.new(@browser)
|
920
|
-
when "Audio Recording" then AudioRecording.new(@browser)
|
921
|
-
when "File Upload" then FileUpload.new(@browser)
|
922
|
-
else puts "nothing selected"
|
923
|
-
end
|
924
|
-
|
925
|
-
return page
|
926
|
-
|
927
|
-
end
|
928
|
-
|
929
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
930
|
-
button(:cancel, :value=>"Cancel", :frame=>frame)
|
931
|
-
|
932
|
-
end
|
163
|
+
include SelectQuestionTypeMethods
|
933
164
|
end
|
934
165
|
|
935
166
|
# Page of Assessments accessible to a student user
|
@@ -939,159 +170,25 @@ end
|
|
939
170
|
class TakeAssessmentList
|
940
171
|
include PageObject
|
941
172
|
include ToolsMenu
|
942
|
-
|
943
|
-
def available_assessments
|
944
|
-
# define this later
|
945
|
-
end
|
946
|
-
|
947
|
-
# Method to get the titles of assessments that
|
948
|
-
# the student user has submitted. The titles are
|
949
|
-
# returned in an Array object.
|
950
|
-
def submitted_assessments
|
951
|
-
table_array = @browser.frame(:index=>1).table(:id=>"selectIndexForm:reviewTable").to_a
|
952
|
-
table_array.delete_at(0)
|
953
|
-
titles = []
|
954
|
-
table_array.each { |row|
|
955
|
-
unless row[0] == ""
|
956
|
-
titles << row[0]
|
957
|
-
end
|
958
|
-
}
|
959
|
-
|
960
|
-
return titles
|
961
|
-
|
962
|
-
end
|
963
|
-
|
964
|
-
# Clicks the specified assessment
|
965
|
-
# then instantiates the BeginAssessment
|
966
|
-
# page class.
|
967
|
-
# @param name [String] the name of the assessment you want to take
|
968
|
-
def take_assessment(name)
|
969
|
-
begin
|
970
|
-
frm.link(:text=>name).click
|
971
|
-
rescue Watir::Exception::UnknownObjectException
|
972
|
-
frm.link(:text=>CGI::escapeHTML(name)).click
|
973
|
-
end
|
974
|
-
BeginAssessment.new(@browser)
|
975
|
-
end
|
976
|
-
|
977
|
-
# TODO This method is in need of improvement to make it more generalized for finding the correct test.
|
978
|
-
#
|
979
|
-
def feedback(test_name)
|
980
|
-
test_table = frm.table(:id=>"selectIndexForm:reviewTable").to_a
|
981
|
-
test_table.delete_if { |row| row[3] != "Immediate" }
|
982
|
-
index_value = test_table.index { |row| row[0] == test_name }
|
983
|
-
frm.link(:text=>"Feedback", :index=>index_value).click
|
984
|
-
# Need to add a call to a New class here, when it's written
|
985
|
-
end
|
986
|
-
|
173
|
+
include TakeAssessmentListMethods
|
987
174
|
end
|
988
175
|
|
989
176
|
# The student view of the overview page of an Assessment
|
990
177
|
class BeginAssessment
|
991
178
|
include PageObject
|
992
179
|
include ToolsMenu
|
993
|
-
|
994
|
-
def begin_assessment
|
995
|
-
frm.button(:value=>"Begin Assessment").click
|
996
|
-
end
|
997
|
-
|
998
|
-
# Clicks the Cancel button and instantiates the X Class.
|
999
|
-
def cancel
|
1000
|
-
# Define this later
|
1001
|
-
end
|
1002
|
-
|
1003
|
-
# Selects the specified radio button answer
|
1004
|
-
def multiple_choice_answer(letter)
|
1005
|
-
index = case(letter.upcase)
|
1006
|
-
when "A" then "0"
|
1007
|
-
when "B" then "1"
|
1008
|
-
when "C" then "2"
|
1009
|
-
when "D" then "3"
|
1010
|
-
when "E" then "4"
|
1011
|
-
end
|
1012
|
-
frm.radio(:name=>/takeAssessmentForm.+:deliverMultipleChoice.+:_id.+:#{index}/).click
|
1013
|
-
end
|
1014
|
-
|
1015
|
-
# Enters the answer into the specified blank number (1-based).
|
1016
|
-
# @param answer [String]
|
1017
|
-
def fill_in_blank_answer(answer, blank_number)
|
1018
|
-
index = blank_number.to_i-1
|
1019
|
-
frm.text_field(:name=>/deliverFillInTheBlank:_id.+:#{index}/).value=answer
|
1020
|
-
end
|
1021
|
-
|
1022
|
-
# Clicks either the True or the False radio button, as specified.
|
1023
|
-
def true_false_answer(answer)
|
1024
|
-
answer.upcase=~/t/i ? index = 0 : index = 1
|
1025
|
-
frm.radio(:name=>/deliverTrueFalse/, :index=>index).set
|
1026
|
-
end
|
1027
|
-
|
1028
|
-
# Enters the specified string into the Rationale text box.
|
1029
|
-
def true_false_rationale(text)
|
1030
|
-
frm.text_field(:name=>/:deliverTrueFalse:rationale/).value=text
|
1031
|
-
end
|
1032
|
-
|
1033
|
-
# Enters the specified text into the "Short Answer" field.
|
1034
|
-
def short_answer(answer)
|
1035
|
-
frm.text_field(:name=>/deliverShortAnswer/).value=answer
|
1036
|
-
end
|
1037
|
-
|
1038
|
-
# Selects the specified matching value, at the spot specified by the number (1-based counting).
|
1039
|
-
def match_answer(answer, number)
|
1040
|
-
index = number.to_i-1
|
1041
|
-
frm.select(:name=>/deliverMatching/, :index=>index).select(answer)
|
1042
|
-
end
|
1043
|
-
|
1044
|
-
# Enters the specified file name in the file field. You can include the path to the file
|
1045
|
-
# as an optional second parameter.
|
1046
|
-
def file_answer(file_name, file_path="")
|
1047
|
-
frm.file_field(:name=>/deliverFileUpload/).set(file_path + file_name)
|
1048
|
-
frm.button(:value=>"Upload").click
|
1049
|
-
end
|
1050
|
-
|
1051
|
-
# Clicks the Next button and instantiates the BeginAssessment Class.
|
1052
|
-
def next
|
1053
|
-
frm.button(:value=>"Next").click
|
1054
|
-
BeginAssessment.new(@browser)
|
1055
|
-
end
|
1056
|
-
|
1057
|
-
# Clicks the Submit for Grading button and instantiates the ConfirmSubmission Class.
|
1058
|
-
def submit_for_grading
|
1059
|
-
frm.button(:value=>"Submit for Grading").click
|
1060
|
-
ConfirmSubmission.new(@browser)
|
1061
|
-
end
|
180
|
+
include BeginAssessmentMethods
|
1062
181
|
end
|
1063
182
|
|
1064
183
|
# The confirmation page that appears when submitting an Assessment.
|
1065
184
|
# The last step before actually submitting the the Assessment.
|
1066
185
|
class ConfirmSubmission
|
1067
186
|
include ToolsMenu
|
1068
|
-
include
|
1069
|
-
# Clicks the Submit for Grading button and instantiates
|
1070
|
-
# the SubmissionSummary Class.
|
1071
|
-
def submit_for_grading
|
1072
|
-
frm.button(:value=>"Submit for Grading").click
|
1073
|
-
SubmissionSummary.new(@browser)
|
1074
|
-
end
|
1075
|
-
|
1076
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
1077
|
-
span(:validation, :class=>"validation", :frame=>frame)
|
1078
|
-
|
1079
|
-
end
|
187
|
+
include ConfirmSubmissionMethods
|
1080
188
|
end
|
1081
189
|
|
1082
190
|
# The summary page that appears when an Assessment has been submitted.
|
1083
191
|
class SubmissionSummary
|
1084
192
|
include ToolsMenu
|
1085
|
-
include
|
1086
|
-
|
1087
|
-
# the TakeAssessmentList Class.
|
1088
|
-
def continue
|
1089
|
-
frm.button(:value=>"Continue").click
|
1090
|
-
TakeAssessmentList.new(@browser)
|
1091
|
-
end
|
1092
|
-
|
1093
|
-
in_frame(:class=>"portletMainIframe") do |frame|
|
1094
|
-
div(:summary_info, :class=>"tier1", :frame=>frame)
|
1095
|
-
|
1096
|
-
end
|
1097
|
-
end
|
193
|
+
include SubmissionSummaryMethods
|
194
|
+
end
|