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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page_elements(identifier) ⇒ Object



471
472
473
474
475
476
477
478
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 471

def self.page_elements(identifier)
  in_frame(identifier) do |frame|
    link(:assessments, :text=>"Assessments", :frame=>frame)
    link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
    link(:print, :text=>"Print", :frame=>frame)
    button(:update_points, :id=>"assesssmentForm:pointsUpdate", :frame=>frame)
  end
end

Instance Method Details

#add_partObject

Clicks the Add Part button, then instantiates the AddEditAssessmentPart page class.



406
407
408
409
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 406

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



393
394
395
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 393

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



387
388
389
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 387

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



467
468
469
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 467

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.



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 352

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.



437
438
439
440
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 437

def preview
  frm.link(:text=>"Preview").click
  PreviewOverview.new(@browser)
end

#publishObject

Clicks the Publish button, then instantiates the PublishAssessment page class.



451
452
453
454
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 451

def publish
  frm.link(:text=>"Publish").click
  PublishAssessment.new(@browser)
end

#question_poolsObject

Clicks the Question Pools button, then instantiates the QuestionPoolsList page class.



458
459
460
461
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 458

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



400
401
402
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 400

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



379
380
381
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 379

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



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 415

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.



444
445
446
447
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 444

def settings
  frm.link(:text=>"Settings").click
  AssessmentSettings.new(@browser)
end