Module: AssessmentsListMethods

Includes:
PageObject
Defined in:
lib/kuali-sakai-common-lib/assessments.rb

Overview

The Course Tools “Tests and Quizzes” page for a given site. (Instructor view)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page_elements(identifier) ⇒ Object

Encapsulates all the PageObject code into a module method that can be called from the necessary class.



118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 118

def self.page_elements(identifier)
  in_frame(identifier) do |frame|
    link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
    text_field(:title, :id=>"authorIndexForm:title", :frame=>frame)
    radio_button(:create_using_builder) { |page| page.radio_button_element(:name=>"authorIndexForm:_id29", index=>0, :frame=>frame) }
    radio_button(:create_using_text) { |page| page.radio_button_element(:name=>"authorIndexForm:_id29", :index=>$frame_index, :frame=>frame) }
    select_list(:select_assessment_type, :id=>"authorIndexForm:assessmentTemplate", :frame=>frame)
    button(:import, :id=>"authorIndexForm:import", :frame=>frame)
    #(:, :=>"", :frame=>frame)
    #(:, :=>"", :frame=>frame)

  end
end

Instance Method Details

#createObject

This method reads the type of assessment selected for creation, then clicks the Create button and instantiates the proper class.

If the assessment is going to be made in the builder, then EditAssessment is called. If from Markup text…



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 54

def create
  builder_or_text = frm.radio(:value=>"1", :name=>"authorIndexForm:_id29").set?

  frm.button(:value=>"Create").click

  if builder_or_text == true
    EditAssessment.new(@browser)
  else
    # Need to add Markup page class, then add the reference here.
  end

end

#inactive_assessment_titlesObject

Returns an Array of the inactive Assessment titles displayed in the list.



98
99
100
101
102
103
104
105
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 98

def inactive_assessment_titles
  titles =[]
  inactive_table = frm.div(:class=>"tier2", :index=>2).table(:id=>"authorIndexForm:inactivePublishedAssessments")
  1.upto(inactive_table.rows.size-1) do |x|
    titles << inactive_table[x][1].span(:id=>/inactivePublishedAssessmentTitle/).text
  end
  return titles
end

#pending_assessment_titlesObject

Collects the titles of the Assessments listed as “Pending” then returns them as an Array.



76
77
78
79
80
81
82
83
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 76

def pending_assessment_titles
  titles =[]
  pending_table = frm.table(:id=>"authorIndexForm:coreAssessments")
  1.upto(pending_table.rows.size-1) do |x|
    titles << pending_table[x][1].span(:id=>/assessmentTitle/).text
  end
  return titles
end

#published_assessment_titlesObject

Collects the titles of the Assessments listed as “Published” then returns them as an Array.



87
88
89
90
91
92
93
94
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 87

def published_assessment_titles
  titles =[]
  published_table = frm.div(:class=>"tier2", :index=>2).table(:class=>"listHier", :index=>0)
  1.upto(published_table.rows.size-1) do |x|
    titles << published_table[x][1].span(:id=>/publishedAssessmentTitle/).text
  end
  return titles
end

#question_poolsObject

Clicks the Question Pools link, then instantiates the QuestionPoolsList class.



69
70
71
72
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 69

def question_pools
  frm.link(:text=>"Question Pools").click
  QuestionPoolsList.new(@browser)
end

#score_test(test_title) ⇒ Object

Opens the selected test for scoring then instantiates the AssessmentTotalScores class.

Parameters:

  • test_title (String)

    the title of the test to be clicked.



110
111
112
113
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 110

def score_test(test_title)
  frm.tbody(:id=>"authorIndexForm:_id88:tbody_element").row(:text=>/#{Regexp.escape(test_title)}/).link(:id=>/authorIndexToScore/).click
  AssessmentTotalScores.new(@browser)
end