Class: TakeAssessmentList

Inherits:
Object
  • Object
show all
Includes:
PageObject
Defined in:
lib/sakai-oae-test-api/cle_frame_classes.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 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

#available_assessmentsObject

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



968
969
970
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 968

def available_assessments
  # define this later
end

#feedback(test_name) ⇒ Object

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



1003
1004
1005
1006
1007
1008
1009
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 1003

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.



975
976
977
978
979
980
981
982
983
984
985
986
987
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 975

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.



992
993
994
995
996
997
998
999
# File 'lib/sakai-oae-test-api/cle_frame_classes.rb', line 992

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