Class: Lessons

Inherits:
LessonsBase show all
Defined in:
lib/sakai-cle-test-api/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

Methods inherited from PageMaker

element, expected_element, expected_title, #initialize, #method_missing, page_url

Constructor Details

This class inherits a constructor from PageMaker

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageMaker

Instance Method Details

#check_lesson(name) ⇒ Object



64
65
66
# File 'lib/sakai-cle-test-api/page_objects/lessons.rb', line 64

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

#check_section(name) ⇒ Object



68
69
70
# File 'lib/sakai-cle-test-api/page_objects/lessons.rb', line 68

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

#href(name) ⇒ Object



60
61
62
# File 'lib/sakai-cle-test-api/page_objects/lessons.rb', line 60

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

#lessons_listObject

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



73
74
75
76
77
78
79
80
81
# File 'lib/sakai-cle-test-api/page_objects/lessons.rb', line 73

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

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/sakai-cle-test-api/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.



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/sakai-cle-test-api/page_objects/lessons.rb', line 85

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