Class: Profile2Search

Inherits:
BasePage show all
Includes:
Profile2Nav
Defined in:
lib/sakai-cle-test-api/page_objects/profile2.rb

Instance Method Summary collapse

Methods included from Profile2Nav

#connections, #messages, #my_profile, #pictures, #preferences, #privacy, #search_for_connections

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

#add_as_connection(name) ⇒ Object



209
210
211
212
213
214
215
216
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 209

def add_as_connection(name)
  frm.div(:class=>"search-result", :text=>/#{Regexp.escape(name)}/).link(:class=>"icon connection-add").click
  frm.div(:class=>"modalWindowButtons").wait_until_present
  frm.div(:class=>"modalWindowButtons").button(:value=>"Add connection").click
  frm.div(:class=>"modalWindowButtons").wait_while_present
  sleep 0.5
  Profile2Search.new @browser
end

#clear_resultsObject



235
236
237
238
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 235

def clear_results
  frm.button(:value=>"Clear results").click
  Profile2Search.new(@browser)
end

#resultsObject

Returns an array containing strings of the names of the users returned in the search.



225
226
227
228
229
230
231
232
233
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 225

def results
  results = []
  frm.div(:class=>"portletBody").spans.each do |span|
    if span.class_name == "search-result-info-name"
      results << span.text
    end
  end
  return results
end

#search_by_common_interestObject



203
204
205
206
207
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 203

def search_by_common_interest
  frm.button(:value=>"Search by common interest").click
  sleep 0.5
  Profile2Search.new(@browser)
end

#search_by_name_or_emailObject



197
198
199
200
201
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 197

def search_by_name_or_email
  frm.button(:value=>"Search by name or email").click
  sleep 0.5
  Profile2Search.new(@browser)
end

#view(name) ⇒ Object



218
219
220
221
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 218

def view(name)
  frm.link(:text=>name).click
  Profile2View.new(@browser)
end