Module: BeginAssessmentMethods

Includes:
PageObject
Defined in:
lib/kuali-sakai-common-lib/assessments.rb

Overview

The student view of the overview page of an Assessment

Instance Method Summary collapse

Instance Method Details

#begin_assessmentObject

Clicks the Begin Assessment button.



963
964
965
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 963

def begin_assessment
  frm.button(:value=>"Begin Assessment").click
end

#cancelObject

Clicks the Cancel button and instantiates the X Class.



968
969
970
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 968

def cancel
  # Define this later
end

#file_answer(file_name, file_path = "") ⇒ Object

Enters the specified file name in the file field. You can include the path to the file as an optional second parameter.



1015
1016
1017
1018
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1015

def file_answer(file_name, file_path="")
  frm.file_field(:name=>/deliverFileUpload/).set(file_path + file_name)
  frm.button(:value=>"Upload").click
end

#fill_in_blank_answer(answer, blank_number) ⇒ Object

Enters the answer into the specified blank number (1-based).

Parameters:

  • answer (String)


986
987
988
989
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 986

def fill_in_blank_answer(answer, blank_number)
  index = blank_number.to_i-1
  frm.text_field(:name=>/deliverFillInTheBlank:_id.+:#{index}/).value=answer
end

#match_answer(answer, number) ⇒ Object

Selects the specified matching value, at the spot specified by the number (1-based counting).



1008
1009
1010
1011
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1008

def match_answer(answer, number)
  index = number.to_i-1
  frm.select(:name=>/deliverMatching/, :index=>index).select(answer)
end

#multiple_choice_answer(letter) ⇒ Object

Selects the specified radio button answer



973
974
975
976
977
978
979
980
981
982
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 973

def multiple_choice_answer(letter)
  index = case(letter.upcase)
            when "A" then "0"
            when "B" then "1"
            when "C" then "2"
            when "D" then "3"
            when "E" then "4"
          end
  frm.radio(:name=>/takeAssessmentForm.+:deliverMultipleChoice.+:_id.+:#{index}/).click
end

#nextObject

Clicks the Next button and instantiates the BeginAssessment Class.



1021
1022
1023
1024
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1021

def next
  frm.button(:value=>"Next").click
  BeginAssessment.new(@browser)
end

#short_answer(answer) ⇒ Object

Enters the specified text into the “Short Answer” field.



1003
1004
1005
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1003

def short_answer(answer)
  frm.text_field(:name=>/deliverShortAnswer/).value=answer
end

#submit_for_gradingObject

Clicks the Submit for Grading button and instantiates the ConfirmSubmission Class.



1027
1028
1029
1030
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1027

def submit_for_grading
  frm.button(:value=>"Submit for Grading").click
  ConfirmSubmission.new(@browser)
end

#true_false_answer(answer) ⇒ Object

Clicks either the True or the False radio button, as specified.



992
993
994
995
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 992

def true_false_answer(answer)
  answer.upcase=~/t/i ? index = 0 : index = 1
  frm.radio(:name=>/deliverTrueFalse/, :index=>index).set
end

#true_false_rationale(text) ⇒ Object

Enters the specified string into the Rationale text box.



998
999
1000
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 998

def true_false_rationale(text)
  frm.text_field(:name=>/:deliverTrueFalse:rationale/).value=text
end