Module: EditAssessmentMethods
- Includes:
- PageObject
- Defined in:
- lib/kuali-sakai-common-lib/assessments.rb
Overview
The page that appears when you’re creating a new quiz or editing an existing one
Instance Method Summary collapse
-
#add_part ⇒ Object
Clicks the Add Part button, then instantiates the AddEditAssessmentPart page class.
-
#copy_part_to_pool(part_num) ⇒ Object
Allows copying an Assessment part to a Pool.
-
#edit_question(part_num, question_num) ⇒ Object
Allows editing of a question by specifying its part number and question number.
-
#get_question_text(part_number, question_number) ⇒ Object
Allows retrieval of a specified question’s text, by part and question number.
-
#insert_question_after(part_num, question_num, qtype) ⇒ Object
Allows insertion of a question at a specified point in the Assessment.
-
#preview ⇒ Object
Clicks the Preview button, then instantiates the PreviewOverview page class.
-
#publish ⇒ Object
Clicks the Publish button, then instantiates the PublishAssessment page class.
-
#question_pools ⇒ Object
Clicks the Question Pools button, then instantiates the QuestionPoolsList page class.
-
#remove_part(part_num) ⇒ Object
Allows removing a specified Assessment part number.
-
#remove_question(part_num, question_num) ⇒ Object
Allows removal of question by part number and question number.
-
#select_question_type(qtype) ⇒ Object
Selects the desired question type from the drop down list, then instantiates the appropriate page class.
-
#settings ⇒ Object
Clicks the Settings link, then instantiates the AssessmentSettings page class.
Instance Method Details
#add_part ⇒ Object
Clicks the Add Part button, then instantiates the AddEditAssessmentPart page class.
386 387 388 389 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 386 def add_part frm.link(:text=>"Add Part").click AddEditAssessmentPart.new(@browser) end |
#copy_part_to_pool(part_num) ⇒ Object
Allows copying an Assessment part to a Pool.
373 374 375 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 373 def copy_part_to_pool(part_num) frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:copyToPool").click end |
#edit_question(part_num, question_num) ⇒ Object
Allows editing of a question by specifying its part number and question number.
367 368 369 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 367 def edit_question(part_num, question_num) frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:modify").click end |
#get_question_text(part_number, question_number) ⇒ Object
Allows retrieval of a specified question’s text, by part and question number.
447 448 449 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 447 def get_question_text(part_number, question_number) frm.table(:id=>"assesssmentForm:parts:#{part_number.to_i-1}:parts").div(:class=>"tier3", :index=>question_number.to_i-1).text end |
#insert_question_after(part_num, question_num, qtype) ⇒ Object
Allows insertion of a question at a specified point in the Assessment. Must include the part number, the question number, and the type of question. Question Type must match the Type value in the drop down.
The method will instantiate the page class based on the selected question type.
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 332 def insert_question_after(part_num, question_num, qtype) if question_num.to_i == 0 frm.select(:id=>"assesssmentForm:parts:#{part_num.to_i - 1}:changeQType").select(qtype) else frm.select(:id=>"assesssmentForm:parts:#{part_num.to_i - 1}:parts:#{question_num.to_i - 1}:changeQType").select(qtype) end page = case(qtype) when "Multiple Choice" then MultipleChoice.new(@browser) when "True False" then TrueFalse.new(@browser) when "Survey" then Survey.new(@browser) when "Short Answer/Essay" then ShortAnswer.new(@browser) when "Fill in the Blank" then FillInBlank.new(@browser) when "Numeric Response" then NumericResponse.new(@browser) when "Matching" then Matching.new(@browser) when "Audio Recording" then AudioRecording.new(@browser) when "File Upload" then FileUpload.new(@browser) else puts "#{qtype} is not a valid question type" end return page end |
#preview ⇒ Object
Clicks the Preview button, then instantiates the PreviewOverview page class.
417 418 419 420 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 417 def preview frm.link(:text=>"Preview").click PreviewOverview.new(@browser) end |
#publish ⇒ Object
Clicks the Publish button, then instantiates the PublishAssessment page class.
431 432 433 434 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 431 def publish frm.link(:text=>"Publish").click PublishAssessment.new(@browser) end |
#question_pools ⇒ Object
Clicks the Question Pools button, then instantiates the QuestionPoolsList page class.
438 439 440 441 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 438 def question_pools frm.link(:text=>"Question Pools").click QuestionPoolsList.new(@browser) end |
#remove_part(part_num) ⇒ Object
Allows removing a specified Assessment part number.
380 381 382 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 380 def remove_part(part_num) frm.link(:xpath, "//a[contains(@onclick, 'assesssmentForm:parts:#{part_num.to_i-1}:copyToPool')]").click end |
#remove_question(part_num, question_num) ⇒ Object
Allows removal of question by part number and question number.
359 360 361 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 359 def remove_question(part_num, question_num) frm.link(:id=>"assesssmentForm:parts:#{part_num.to_i-1}:parts:#{question_num.to_i-1}:deleteitem").click end |
#select_question_type(qtype) ⇒ Object
Selects the desired question type from the drop down list, then instantiates the appropriate page class.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 395 def select_question_type(qtype) frm.select(:id=>"assesssmentForm:changeQType").select(qtype) page = case(qtype) when "Multiple Choice" then MultipleChoice.new(@browser) when "True False" then TrueFalse.new(@browser) when "Survey" then Survey.new(@browser) when "Short Answer/Essay" then ShortAnswer.new(@browser) when "Fill in the Blank" then FillInBlank.new(@browser) when "Numeric Response" then NumericResponse.new(@browser) when "Matching" then Matching.new(@browser) when "Audio Recording" then AudioRecording.new(@browser) when "File Upload" then FileUpload.new(@browser) else puts "#{qtype} is not a valid question type" end return page end |
#settings ⇒ Object
Clicks the Settings link, then instantiates the AssessmentSettings page class.
424 425 426 427 |
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 424 def settings frm.link(:text=>"Settings").click AssessmentSettings.new(@browser) end |