Class: MyProfilePublications

Inherits:
Object
  • Object
show all
Includes:
GlobalMethods, HeaderFooterBar, LeftMenuBarYou, PageObject
Defined in:
lib/sakai-oae-test-api/page_classes.rb

Overview

Publications

Instance Method Summary collapse

Methods included from LeftMenuBarYou

#change_picture, #inbox, #invitations, #my_contacts_count, #my_library_count, #my_messages_lock_icon, #sent, #show_hide_my_messages_tree, #trash, #unread_inbox_count, #unread_invitations_count, #unread_message_count

Methods included from PageObject

#method_missing, #name_li, #name_link

Methods included from HeaderFooterBar

#acknowledgements, #add_collection, #add_content, #browse_footer, #browse_footer_link, #change_language, #change_location, #click_link, #explore_footer, #explore_footer_link, #login, #messages_container, #my_account, #sign_out, #sign_up, #toggle_collector, #user_agreement

Methods included from GlobalMethods

#close_notification, #menu_item, #open_page, #view_person

Dynamic Method Handling

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

Instance Method Details

#fill_out_form(hash) ⇒ Object

Takes a hash object and uses it to fill in all the publication fields. The key values that the has must contain are as follows: :main_title, :main_author, :co_authors, :publisher, :place, :volume_title, :volume_info, :year, :number, :series, :url. Any missing or misspelled key values will be ignored.



1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/sakai-oae-test-api/page_classes.rb', line 1148

def fill_out_form(hash)
  self.main_title=hash[:main_title]
  self.main_author=hash[:main_author]
  self.co_authors=hash[:co_authors]
  self.publisher=hash[:publisher]
  self.place_of_publication=hash[:place]
  self.volume_title=hash[:volume_title]
  self.volume_information=hash[:volume_info]
  self.year=hash[:year]
  self.number=hash[:number]
  self.series_title=hash[:series]
  self.url=hash[:url]
end

#publication_titlesObject Also known as: titles

Returns an array containing all of the titles of the publications that exist on the page.



1172
1173
1174
1175
1176
# File 'lib/sakai-oae-test-api/page_classes.rb', line 1172

def publication_titles
  array = []
  self.div(:id=>"displayprofilesection_sections_publications").text_fields(:id=>/maintitle_/).each { |field| array << field.value }
  return array
end

#publications_dataObject Also known as: publication_data, publications_list

Returns an array of hashes. Each hash in the array refers to one of the listed publications.

Each hash’s key=>value pairs are determined by the field title and field values for the publications.

Example: “Main title:”=>“War and Peace”,“Main author:”=>“Tolstoy”, etc.…



1185
1186
1187
1188
1189
1190
1191
1192
1193
# File 'lib/sakai-oae-test-api/page_classes.rb', line 1185

def publications_data
  list = []
  self.div(:id=>"displayprofilesection_sections_publications").divs(:class=>"displayprofilesection_multiple_section").each do |div|
    hash = {}
    div.divs(:class=>"displayprofilesection_field").each { |subdiv| hash.store(subdiv.label(:class=>"s3d-input-label").text, subdiv.text_field.value) }
    list << hash
  end
  return list
end

#remove_this_publication(main_title) ⇒ Object

Clicks the “Remove this publication” link for the publication specified (by the Main title of the record in question).



1164
1165
1166
1167
1168
# File 'lib/sakai-oae-test-api/page_classes.rb', line 1164

def remove_this_publication(main_title)
  target_div_id = self.text_field(:value=>main_title).parent.parent.parent.id
  self.div(:id=>target_div_id).button(:id=>/displayprofilesection_remove_link_/).click
  self.wait_for_ajax
end

#updateObject

Clicks the “Update” button and waits for any Ajax calls to complete.



1136
1137
1138
1139
# File 'lib/sakai-oae-test-api/page_classes.rb', line 1136

def update
  self.form(:id=>"displayprofilesection_form_publications").button(:text=>"Update").click
  self.wait_for_ajax(2)
end