Module: AddEditSectionsMethods

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

Overview

Methods in this class currently do not support adding multiple instances of sections simultaneously. That will be added at some future time. The same goes for adding days with different meeting times. This will hopefully be supported in the future.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page_elements(identifier) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/kuali-sakai-common-lib/sections.rb', line 157

def self.page_elements(identifier)
  in_frame(identifier) do |frame|
    select_list(:category, :id=>/SectionsForm:category/, :frame=>frame)
    text_field(:name, :id=>/SectionsForm:sectionTable:0:titleInput/, :frame=>frame)
    checkbox(:monday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:monday/, :frame=>frame)
    checkbox(:tuesday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:tuesday/, :frame=>frame)
    checkbox(:wednesday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:wednesday/, :frame=>frame)
    checkbox(:thursday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:thursday/, :frame=>frame)
    checkbox(:friday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:friday/, :frame=>frame)
    checkbox(:saturday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:saturday/, :frame=>frame)
    checkbox(:sunday, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:sunday/, :frame=>frame)
    text_field(:start_time, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:startTime/, :frame=>frame)
    text_field(:end_time, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:endTime/, :frame=>frame)
    text_field(:location, :id=>/SectionsForm:sectionTable:0:meetingsTable:0:location/, :frame=>frame)
    radio_button(:startAM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:startTimeAm/, :index=>0, :frame=>frame) }
    radio_button(:startPM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:startTimeAm/, :index=>1, :frame=>frame) }
    radio_button(:endAM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:endTimeAm/, :index=>0, :frame=>frame) }
    radio_button(:endPM) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:meetingsTable:0:endTimeAm/, :index=>1, :frame=>frame) }
    radio_button(:unlimited_students) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:limit/, :index=>0, :frame=>frame) }
    radio_button(:limited_students) { |page| page.radio_button_element(:name=>/SectionsForm:sectionTable:0:limit/, :index=>1, :frame=>frame) }
    text_field(:max_students, :id=>/SectionsForm:sectionTable:0:maxEnrollmentInput/, :frame=>frame)
  end
end

Instance Method Details

#add_sectionsObject

Clicks the Add Sections button then instantiates the Sections Class, unless there’s an Alert message, in which case it will reinstantiate the class.



121
122
123
124
125
126
127
128
# File 'lib/kuali-sakai-common-lib/sections.rb', line 121

def add_sections
  frm.button(:value=>"Add Sections").click
  if frm.div(:class=>"validation").exist?
    AddEditSections.new(@browser)
  else
    Sections.new(@browser)
  end
end

#alert_textObject



130
131
132
# File 'lib/kuali-sakai-common-lib/sections.rb', line 130

def alert_text
  frm.div(:class=>"validation").text
end

#check_days(array) ⇒ Object

This method takes an array object containing strings of the days of the week and then clicks the appropriate checkboxes, based on those strings.



147
148
149
150
151
152
153
154
155
# File 'lib/kuali-sakai-common-lib/sections.rb', line 147

def check_days(array)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:monday/).set if array.include?(/mon/i)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:tuesday/).set if array.include?(/tue/i)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:wednesday/).set if array.include?(/wed/i)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:thursday/).set if array.include?(/thu/i)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:friday/).set if array.include?(/fri/i)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:saturday/).set if array.include?(/sat/i)
  frm.checkbox(:id=>/SectionsForm:sectionTable:0:meetingsTable:0:sunday/).set if array.include?(/sun/i)
end

#updateObject

The Update button is only available when editing an existing Sections record.



135
136
137
138
139
140
141
142
# File 'lib/kuali-sakai-common-lib/sections.rb', line 135

def update
  frm.button(:value=>"Update").click
  if frm.div(:class=>"validation").exist?
    AddEditSections.new(@browser)
  else
    Sections.new(@browser)
  end
end