Class: BeginAssessment

Inherits:
AssessmentsBase show all
Defined in:
lib/sakai-cle-test-api/page_objects/assessments.rb

Overview

The student view of the overview page of an Assessment

Instance Method Summary collapse

Methods inherited from AssessmentsBase

menu_bar_elements, pool_page_elements, question_page_elements

Methods inherited from BasePage

basic_page_elements, frame_element

Methods inherited from PageMaker

element, expected_element, expected_title, #initialize, #method_missing, page_url

Constructor Details

This class inherits a constructor from PageMaker

Dynamic Method Handling

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

Instance Method Details

#begin_assessmentObject

Clicks the Begin Assessment button.



776
777
778
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 776

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

#cancelObject

Clicks the Cancel button and instantiates the X Class.



781
782
783
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 781

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.



829
830
831
832
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 829

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)


800
801
802
803
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 800

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



822
823
824
825
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 822

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



786
787
788
789
790
791
792
793
794
795
796
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 786

def multiple_choice_answer(letter)
  # TODO: Convert this to a hash instead of case statement
  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.



835
836
837
838
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 835

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

#short_answer(answer) ⇒ Object

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



817
818
819
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 817

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.



841
842
843
844
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 841

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.



806
807
808
809
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 806

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.



812
813
814
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 812

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