Class: TakeAssessmentList

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

Overview

Page of Assessments accessible to a student user

It may be that we want to deprecate this class and simply use the AssessmentsList class alone.

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

#available_assessmentsObject

Returns an array containing the assessment names that appear on the page.



726
727
728
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 726

def available_assessments
  # define this later
end

#feedback(test_name) ⇒ Object

TODO This method is in need of improvement to make it more generalized for finding the correct test.



762
763
764
765
766
767
768
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 762

def feedback(test_name)
  test_table = frm.table(:id=>"selectIndexForm:reviewTable").to_a
  test_table.delete_if { |row| row[3] != "Immediate" }
  index_value = test_table.index { |row| row[0] == test_name }
  frm.link(:text=>"Feedback", :index=>index_value).click
  # Need to add a call to a New class here, when it's written
end

#submitted_assessmentsObject

Method to get the titles of assessments that the student user has submitted. The titles are returned in an Array object.



733
734
735
736
737
738
739
740
741
742
743
744
745
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 733

def 
  table_array = @browser.frame(:index=>1).table(:id=>"selectIndexForm:reviewTable").to_a
  table_array.delete_at(0)
  titles = []
  table_array.each { |row|
    unless row[0] == ""
      titles << row[0]
    end
  }

  return titles

end

#take_assessment(name) ⇒ Object

Clicks the specified assessment then instantiates the BeginAssessment page class.

Parameters:

  • name (String)

    the name of the assessment you want to take



751
752
753
754
755
756
757
758
# File 'lib/sakai-cle-test-api/page_objects/assessments.rb', line 751

def take_assessment(name)
  begin
    frm.link(:text=>name).click
  rescue Watir::Exception::UnknownObjectException
    frm.link(:text=>CGI::escapeHTML(name)).click
  end
  BeginAssessment.new(@browser)
end