Class: StudentAssessmentsList

Inherits:
AssessmentsBase show all
Defined in:
lib/sambal-cle/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, button, damballa, frame_element, link

Instance Method Details

#available_assessmentsObject

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



111
112
113
114
115
116
117
# File 'lib/sambal-cle/page_objects/assessments.rb', line 111

def available_assessments
  list = []
  table = available_assessments_table.to_a
  table.delete_at(0)
  table.each { |row| list<<row[0].gsub(/\s+$/, "") unless row[0]=="" }
  list
end

#feedback(test_name) ⇒ Object

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



148
149
150
151
152
153
# File 'lib/sambal-cle/page_objects/assessments.rb', line 148

def feedback(test_name)
  test_table = .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
end

#submitted_assessmentsObject

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



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/sambal-cle/page_objects/assessments.rb', line 122

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

Parameters:

  • name (String)

    the name of the assessment you want to take



138
139
140
141
142
143
144
# File 'lib/sambal-cle/page_objects/assessments.rb', line 138

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