Class: ContentSectionObject
- Inherits:
-
Object
- Object
- ContentSectionObject
- Includes:
- PageHelper, Utilities, Workflows
- Defined in:
- lib/sakai-cle-test-api/data_objects/lesson.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#copyright_status ⇒ Object
Returns the value of attribute copyright_status.
-
#editor_content ⇒ Object
Returns the value of attribute editor_content.
-
#file_description ⇒ Object
Returns the value of attribute file_description.
-
#file_folder ⇒ Object
Returns the value of attribute file_folder.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#href ⇒ Object
Returns the value of attribute href.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#modality ⇒ Object
Returns the value of attribute modality.
-
#module ⇒ Object
Returns the value of attribute module.
-
#site ⇒ Object
Returns the value of attribute site.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
-
#url_description ⇒ Object
Returns the value of attribute url_description.
-
#url_title ⇒ Object
Returns the value of attribute url_title.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ ContentSectionObject
constructor
A new instance of ContentSectionObject.
Methods included from Workflows
menu_link, #open_my_site_by_name
Methods included from Utilities
#current_hour, #current_month, #current_year, #get_filename, #in_15_minutes, #last_hour, #last_month, #last_year, #make, #make_date, #next_hour, #next_month, #next_year, #on_page, #random_alphanums, #random_alphanums_plus, #random_email, #random_high_ascii, #random_letters, #random_multiline, #random_nicelink, #random_string, #random_xss_string, #tomorrow, #yesterday
Methods included from PageHelper
#make, #on, #visit, #wait_until
Constructor Details
#initialize(browser, opts = {}) ⇒ ContentSectionObject
Returns a new instance of ContentSectionObject.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 63 def initialize(browser, opts={}) @browser = browser defaults = { :title=>random_alphanums, :copyright_status=>"Public Domain", :modality=>[:check_textual] } = defaults.merge(opts) @site=[:site] @module=[:module] @title=[:title] @instructions=[:instructions] @modality=[:modality] @content_type=[:content_type] @copyright_status=[:copyright_status] @editor_content=[:editor_content] @file_name=[:file_name] @file_path=[:file_path] @file_description=[:file_description] @file_folder=[:file_folder] @url=[:url] @url_title=[:url_title] @url_description=[:url_description] raise "Your modality variable must be an Array containing one or more keys\nthat match the checkbox methods, like this:\n[:uncheck_textual, :check_visual, :check_auditory]" unless @modality.class==Array raise "You must specify a Site for your Section" if @site==nil raise "You must specify a Module for your Section" if @module==nil end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def content_type @content_type end |
#copyright_status ⇒ Object
Returns the value of attribute copyright_status.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def copyright_status @copyright_status end |
#editor_content ⇒ Object
Returns the value of attribute editor_content.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def editor_content @editor_content end |
#file_description ⇒ Object
Returns the value of attribute file_description.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def file_description @file_description end |
#file_folder ⇒ Object
Returns the value of attribute file_folder.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def file_folder @file_folder end |
#file_name ⇒ Object
Returns the value of attribute file_name.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def file_name @file_name end |
#file_path ⇒ Object
Returns the value of attribute file_path.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def file_path @file_path end |
#href ⇒ Object
Returns the value of attribute href.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def href @href end |
#instructions ⇒ Object
Returns the value of attribute instructions.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def instructions @instructions end |
#modality ⇒ Object
Returns the value of attribute modality.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def modality @modality end |
#module ⇒ Object
Returns the value of attribute module.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def module @module end |
#site ⇒ Object
Returns the value of attribute site.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def site @site end |
#title ⇒ Object Also known as: name
Returns the value of attribute title.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def url @url end |
#url_description ⇒ Object
Returns the value of attribute url_description.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def url_description @url_description end |
#url_title ⇒ Object
Returns the value of attribute url_title.
59 60 61 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 59 def url_title @url_title end |
Instance Method Details
#create ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 95 def create open_my_site_by_name @site unless @browser.title=~/#{@site}/ lessons unless @browser.title=~/Lessons$/ reset on_page Lessons do |page| page.open_lesson @module end on_page AddEditModule do |page| page.add_content_sections end on_page AddEditContentSection do |page| page.title.set @title page.instructions.set @instructions @modality.each do |content| page.send(content) end page.content_type.select @content_type unless @content_type==nil end on AddEditContentSection do |page| # Note we are reinstantiating the class here because of # an issue with Selenium Webdriver throwing a # WeakReference error, given the partial page reload. case @content_type when "Compose content with editor" page.enter_source_text page.content_editor, @editor_content when "Upload or link to a file" page.select_a_file on_page LessonAddAttachment do |add| add.upload_local_file @file_name, @file_path add.continue end page.file_description.set @file_description when "Link to new or existing URL resource on server" page.select_url on_page SelectingContent do |select| select.new_url.set @url select.url_title.set @url_title select.continue end page.url_description.set @url_description when "Upload or link to a file in Resources" page.select_or_upload_file on_page ResourcesBase do |add| add.open_folder @file_folder unless @file_folder == nil add.select_file @file_name add.continue end else raise "You have a typo in what you've specified for your Section's content type.\nIt must be one of the options contained in the dropdown." end page.copyright_status.select @copyright_status page.add end on ConfirmSectionAdd do |confirm| confirm.finish end on Lessons do |list| @href = list.href @title end end |
#edit(opts = {}) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 156 def edit opts={} open_my_site_by_name @site unless @browser.title=~/#{@site}/ lessons unless @browser.title=~/Lessons$/ reset on Lessons do |list| list.check_section @title list.edit end on AddEditContentSection do |edit| edit.title.set opts[:title] unless opts[:title]==nil edit.instructions.set opts[:instructions] unless opts[:instructions]==nil if opts[:modality].class==Array opts[:modality].each do |item| edit.send(item) end end # TODO: Add code here for updating attached resources edit.enter_source_text(edit.content_editor, opts[:editor_content]) unless opts[:editor_content]==nil # TODO: Add code here for updating remaining variables edit.finish end @title=opts[:title] unless opts[:title]==nil @instructions=opts[:instructions] unless opts[:instructions]==nil @modality=opts[:modality] unless opts[:modality]==nil end |