Module: TakeAssessmentListMethods

Includes:
PageObject
Defined in:
lib/kuali-sakai-common-lib/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

Instance Method Details

#available_assessmentsObject

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



913
914
915
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 913

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.



949
950
951
952
953
954
955
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 949

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.



920
921
922
923
924
925
926
927
928
929
930
931
932
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 920

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



938
939
940
941
942
943
944
945
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 938

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