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

Instance Method Details

#add_partObject

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.

Parameters:

  • part_num (String)

    the part number of the assessment you want



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.

Parameters:

  • part_num (String)

    the Part number containing the question you want

  • question_num (String)

    the number of the question you want



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.

Parameters:

  • part_num (String)

    the Part number containing the question you want

  • question_num (String)

    the number of the question you want



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

#previewObject

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

#publishObject

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_poolsObject

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.

Parameters:

  • part_num (String)

    the part number of the assessment you want



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.

Parameters:

  • part_num (String)

    the Part number containing the question you want to remove

  • question_num (String)

    the number of the question you want to remove



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.

Parameters:

  • qtype (String)

    the text of the item you want to select from the list



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

#settingsObject

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