Class: Lessons

Inherits:
LessonsBase show all
Defined in:
lib/sambal-cle/page_objects/lessons.rb

Overview

The Lessons page in a site (“icon-sakai-melete”)

Note that this class is inclusive of both the Instructor/Admin and the Student views of this page many methods will error out if used when in the Student view.

Instance Method Summary collapse

Methods inherited from LessonsBase

menu_elements

Methods inherited from BasePage

basic_page_elements, frame_element

Instance Method Details

#check_lesson(name) ⇒ Object



65
66
67
# File 'lib/sambal-cle/page_objects/lessons.rb', line 65

def check_lesson(name)
  frm.tr(text: /#{Regexp.escape(name)}/).td(class: "ModCheckClass").checkbox.set
end

#check_section(name) ⇒ Object



69
70
71
# File 'lib/sambal-cle/page_objects/lessons.rb', line 69

def check_section(name)
  frm.td(class: "SectionClass", text: /#{Regexp.escape(name)}/).checkbox.set
end

#href(name) ⇒ Object



61
62
63
# File 'lib/sambal-cle/page_objects/lessons.rb', line 61

def href(name)
  frm.link(:text=>name).href
end

#lessons_listObject

Returns an array of the Module titles displayed on the page.



74
75
76
77
78
79
80
81
82
# File 'lib/sambal-cle/page_objects/lessons.rb', line 74

def lessons_list
  list = []
  lessons_table.links.each do |link|
    if link.id=~/lis.+module.+form:table:.+:(edit|view)Mod/
      list << link.text
    end
  end
  return list
end

#open_lesson(name) ⇒ Object Also known as: open_section

Clicks on the link that matches the supplied name value, next is the AddEditLesson, or ViewLesson class, depending on which page loads.

Will error out if there is no matching link in the list.



56
57
58
# File 'lib/sambal-cle/page_objects/lessons.rb', line 56

def open_lesson(name)
  frm.link(:text=>name).click
end

#sections_list(module_name) ⇒ Object

Returns and array containing the list of section titles for the specified module.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/sambal-cle/page_objects/lessons.rb', line 86

def sections_list(module_name)
  list = []
  if lessons_table.row(:text=>/#{Regexp.escape(module_name)}/).table(:id=>/tablesec/).exist?
    lessons_table.row(:text=>/#{Regexp.escape(module_name)}/).table(:id=>/tablesec/).links.each do |link|
      if link.id=~/Sec/
        list << link.text
      end
    end
  end
  return list
end