Class: Profile2

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

#birthday(day, month, year) ⇒ Object



113
114
115
116
117
118
119
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 113

def birthday(day, month, year)
  frm.text_field(:name=>"birthdayContainer:birthday").click
  frm.select(:class=>"ui-datepicker-new-year").wait_until_present
  frm.select(:class=>"ui-datepicker-new-year").select(year.to_i)
  frm.select(:class=>"ui-datepicker-new-month").select(month)
  frm.link(:text=>day.to_s).click
end

#change_pictureObject



86
87
88
89
90
91
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 86

def change_picture
  frm.div(:id=>"myPhoto").fire_event("onmouseover")
  frm.div(:id=>"myPhoto").link(:class=>"edit-image-button").click
  sleep 0.5
  Profile2.new @browser
end

#connection_requestsObject

Returns the number (as a string) displayed next to the “Connections” link in the menu. If there are no connections then returns zero as a string object.



129
130
131
132
133
134
135
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 129

def connection_requests
  begin
    frm.link(:class=>/icon connections/).span(:class=>"new-items-count").text
  rescue
    return "0"
  end
end

#edit_basic_infoObject



44
45
46
47
48
49
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 44

def edit_basic_info
  frm.div(:id=>"mainPanel").span(:text=>"Basic Information").fire_event("onmouseover")
  frm.div(:id=>"mainPanel").link(:href=>/myInfo:editButton/).click
  sleep 0.5
  Profile2.new @browser
end

#edit_contact_infoObject



51
52
53
54
55
56
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 51

def edit_contact_info
  frm.div(:id=>"mainPanel").span(:text=>"Contact Information").fire_event("onmouseover")
  frm.div(:id=>"mainPanel").link(:href=>/myContact:editButton/).click
  sleep 0.5
  Profile2.new @browser
end

#edit_personal_infoObject



79
80
81
82
83
84
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 79

def edit_personal_info
  frm.div(:id=>"mainPanel").span(:text=>"Personal Information").fire_event("onmouseover")
  frm.div(:id=>"mainPanel").link(:href=>/myInterests:editButton/).click
  sleep 0.5
  Profile2.new @browser
end

#edit_social_networkingObject



72
73
74
75
76
77
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 72

def edit_social_networking
  frm.div(:id=>"mainPanel").span(:text=>"Social Networking").fire_event("onmouseover")
  frm.div(:id=>"mainPanel").link(:href=>/mySocialNetworking:editButton/).click
  sleep 0.5
  Profile2.new @browser
end

#edit_staff_infoObject



58
59
60
61
62
63
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 58

def edit_staff_info
  frm.div(:id=>"mainPanel").span(:text=>"Staff Information").fire_event("onmouseover")
  frm.div(:id=>"mainPanel").link(:href=>/myStaff:editButton/).click
  sleep 0.5
  Profile2.new @browser
end

#edit_student_infoObject



65
66
67
68
69
70
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 65

def edit_student_info
  frm.div(:id=>"mainPanel").span(:text=>"Student Information").fire_event("onmouseover")
  frm.div(:id=>"mainPanel").link(:href=>/myStudent:editButton/).click
  sleep 0.5
  Profile2.new @browser
end

#image_file=(filename) ⇒ Object

Enters the specified filename in the file field.

Note that the file should be inside the data/sakai-cle-test-api folder. The file or folder name used for the filename variable should not include a preceding slash (“/”) character.



98
99
100
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 98

def image_file=(filename)
  frm.file_field(:name=>"picture").set(File.expand_path(File.dirname(__FILE__)) + "/../../data/sakai-cle-test-api/" + filename)
end

#personal_summary=(text) ⇒ Object



108
109
110
111
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 108

def personal_summary=(text)
  frm.frame(:id=>"id1a_ifr").send_keys([:command, 'a'], :backspace)
  frm.frame(:id=>"id1a_ifr").send_keys(text)
end

#save_changesObject



121
122
123
124
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 121

def save_changes
  frm.button(:value=>"Save changes").click
  Profile2.new @browser
end

#uploadObject



102
103
104
105
106
# File 'lib/sakai-cle-test-api/page_objects/profile2.rb', line 102

def upload
  frm.button(:value=>"Upload").click
  sleep 0.5
  Profile2.new @browser
end