Class: BeginAssessment

Inherits:
Object
  • Object
show all
Includes:
PageObject
Defined in:
lib/sakai-oae-test-api/cle_frame_classes.rb

Overview

The student view of the overview page of an Assessment

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject

Instance Method Details

#begin_assessmentObject

Clicks the Begin Assessment button.



1019
1020
1021
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1019

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

#cancelObject

Clicks the Cancel button and instantiates the X Class.



1024
1025
1026
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1024

def cancel
  # Define this later
end

#file_answer(file_name) ⇒ Object

Enters the specified file name (and subdirectory below the expected target Sakai-CLE path) in the file field.



1069
1070
1071
1072
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1069

def file_answer(file_name)
  frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + 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).



1041
1042
1043
1044
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1041

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



1063
1064
1065
1066
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1063

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



1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1029

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.



1075
1076
1077
1078
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1075

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

#short_answer(answer) ⇒ Object

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



1058
1059
1060
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1058

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.



1081
1082
1083
1084
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1081

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.



1047
1048
1049
1050
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1047

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.



1053
1054
1055
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1053

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