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.



1077
1078
1079
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1077

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

#cancelObject

Clicks the Cancel button and instantiates the X Class.



1082
1083
1084
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1082

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.



1129
1130
1131
1132
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1129

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)


1100
1101
1102
1103
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1100

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).



1122
1123
1124
1125
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1122

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



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1087

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.



1135
1136
1137
1138
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1135

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

#short_answer(answer) ⇒ Object

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



1117
1118
1119
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1117

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.



1141
1142
1143
1144
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1141

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.



1106
1107
1108
1109
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1106

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.



1112
1113
1114
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 1112

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