Module: Profile2SearchMethods

Includes:
PageObject
Defined in:
lib/kuali-sakai-common-lib/profile2.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page_elements(identifier) ⇒ Object



250
251
252
253
254
255
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 250

def self.page_elements(identifier)
  in_frame(identifier) do |frame|
    text_field(:persons_name_or_email, :name=>"searchName", :frame=>frame)
    text_field(:common_interest, :name=>"searchInterest", :frame=>frame)
  end
end

Instance Method Details

#add_as_connection(name) ⇒ Object



219
220
221
222
223
224
225
226
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 219

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



245
246
247
248
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 245

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.



235
236
237
238
239
240
241
242
243
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 235

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



213
214
215
216
217
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 213

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



207
208
209
210
211
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 207

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



228
229
230
231
# File 'lib/kuali-sakai-common-lib/profile2.rb', line 228

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