Module: ListContent

Includes:
PageObject
Included in:
ExploreAll, ExploreContent, Library, MyLibrary
Defined in:
lib/sakai-oae-test-api/widgets.rb

Overview

Methods related to lists of Content-type objects

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

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

Instance Method Details

#add_to_library(name) ⇒ Object

Adds the specified (listed) content to the library.



253
254
255
256
257
# File 'lib/sakai-oae-test-api/widgets.rb', line 253

def add_to_library(name)
  name_li(name).button(:title=>/^Save /).click
  self.wait_until { self.div(:id=>"savecontent_widget").visible? }
  self.class.class_eval { include SaveContentPopUp }
end

#comments_count(name) ⇒ Object



309
310
311
# File 'lib/sakai-oae-test-api/widgets.rb', line 309

def comments_count(name)
  used_in_text(name)[/\d+(?=.comment)/].to_i
end

#content_description(name) ⇒ Object



294
295
296
# File 'lib/sakai-oae-test-api/widgets.rb', line 294

def content_description(name)
  name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)description/).text
end

#content_owner(name) ⇒ Object

Returns the item’s owner name (as a text string).



274
275
276
# File 'lib/sakai-oae-test-api/widgets.rb', line 274

def content_owner(name)
  name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)by/).link.text
end

#content_tags(name) ⇒ Object

Returns an Array object containing the list of tags/categories listed for the specified content item.



280
281
282
283
284
285
286
# File 'lib/sakai-oae-test-api/widgets.rb', line 280

def (name)
  array = []
  name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)tags/).lis.each do |li|
    array << li.span(:class=>"s3d-search-result-tag").text
  end
  return array
end

#content_type(name) ⇒ Object

Returns the mimetype text next to the Content name–the text that describes what the system thinks the content is.



290
291
292
# File 'lib/sakai-oae-test-api/widgets.rb', line 290

def content_type(name)
  name_li(name).span(:class=>/(mylibrary_item_|searchcontent_result_)mimetype/).text
end

#delete(name) ⇒ Object Also known as: remove_item



259
260
261
262
263
# File 'lib/sakai-oae-test-api/widgets.rb', line 259

def delete(name)
  name_li(name).button(:title=>"Remove").click
  self.div(:id=>"deletecontent_dialog").wait_until_present
  self.class.class_eval { include DeleteContentPopUp }
end

#search_by_tag(tag) ⇒ Object



298
299
300
301
302
303
# File 'lib/sakai-oae-test-api/widgets.rb', line 298

def search_by_tag(tag)
  name_link(tag).click
  sleep 3
  self.wait_for_ajax
  ExploreAll.new @browser
end

#share(name) ⇒ Object

Clicks to share the specified item. Waits for the page to refresh to bring up the Share Pop Up dialog.



246
247
248
249
250
# File 'lib/sakai-oae-test-api/widgets.rb', line 246

def share(name)
  name_li(name).button(:title=>"Share content").click
  self.wait_until { self.text.include? "Or, share it on a webservice:" }
  self.class.class_eval { include ShareWithPopUp }
end

#thumbnail(name) ⇒ Object

Returns the src text for the specified item’s Thumbnail image.



240
241
242
# File 'lib/sakai-oae-test-api/widgets.rb', line 240

def thumbnail(name)
  name_li(name).link(:title=>"View this item").image.src
end

#used_in_count(name) ⇒ Object



305
306
307
# File 'lib/sakai-oae-test-api/widgets.rb', line 305

def used_in_count(name)
  used_in_text(name)[/(?<=in.)\d+/].to_i
end

#view_owner_of(name) ⇒ Object

Clicks to view the owner information of the specified item.



267
268
269
270
271
# File 'lib/sakai-oae-test-api/widgets.rb', line 267

def view_owner_of(name)
  name_li(name).link(:class=>/s3d-regular-light-links (mylibrary_item_|searchcontent_result_)username/).click
  self.div(:id=>"entity_name").wait_until_present
  ViewPerson.new @browser
end