Module: ListWidget

Includes:
PageObject
Included in:
ExploreAll, ExploreContent, ExploreCourses, ExploreGroups, ExplorePeople, ExploreResearch, Library, MyContacts, MyLibrary, MyMemberships
Defined in:
lib/sakai-oae-test-api/widgets.rb

Overview

Contains methods common to all Results lists

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

#last_updated(name) ⇒ Object Also known as: last_changed

Gets the text describing when the specified item was last changed.



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/sakai-oae-test-api/widgets.rb', line 192

def last_updated(name)
  # Get the target class...
  klass = case
            when name_li(name).div(:class=>"searchgroups_result_usedin").present?
              "searchgroups_result_usedin"
            when name_li(name).div(:class=>"searchcontent_result_by").present?
              "searchcontent_result_by"
            when name_li(name).div(:class=>"mymemberships_item_usedin").present?
              "mymemberships_item_usedin"
            when name_li(name).div(:class=>"mylibrary_item_by").present?
              "mylibrary_item_by"
            else
              puts "Didn't find any expected DIVs. Please investigate and add missing class value"
              puts
              puts name_li(name).html
          end
  # Grab the text now that we know the class of the div...
  div_text = name_li(name).div(:class=>klass).text
  case(klass)
    when "mylibrary_item_by"
      return div_text[/(?<=\|.).+/]
    when "searchgroups_result_usedin"
      return div_text[/^.+(?=.\|)/]
    when "mymemberships_item_usedin"
      return div_text[/^.+(?=.\|)/]
    when "searchcontent_result_by"
      return div_text[/(?<=\|.).+/]
  end

end

#results_listObject Also known as: courses, course_list, groups_list, groups, projects, documents, documents_list, content_list, results, people_list, contacts, memberships

Returns an array containing the text of the links (for Groups, Courses, etc.) listed



167
168
169
170
171
172
173
174
175
176
177
# File 'lib/sakai-oae-test-api/widgets.rb', line 167

def results_list
  list = []
  begin
    self.spans(:class=>"s3d-search-result-name").each do |element|
      list << element.text
    end
  rescue
    list = []
  end
  list
end