class OLE_QA::Framework::OLELS::Patron_Lookup
The Patron
lookup page in the OLE Library System.
Public Class Methods
new(ole_session)
click to toggle source
Calls superclass method
OLE_QA::Framework::Page::new
# File lib/olels/pages/patron_lookup.rb, line 18 def initialize(ole_session) url = ole_session.url + 'portal.do?channelTitle=Patron&channelUrl=' url += ole_session.url + 'ole-kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.ole.deliver.bo.OlePatronDocument&returnLocation=' url += ole_session.url + 'portal.do&hideReturnLink=true&showMaintenanceLinks=true' super(ole_session, url) end
Public Instance Methods
set_elements()
click to toggle source
Calls superclass method
OLE_QA::Framework::OLELS::Lookup#set_elements
# File lib/olels/pages/patron_lookup.rb, line 26 def set_elements super element(:patron_id_field) {b.text_field(:id => "olePatronId_control")} element(:barcode_field) {b.text_field(:id => "barcode_control")} element(:first_name_field) {b.text_field(:id => "firstName_control")} element(:last_name_field) {b.text_field(:id => "lastName_control")} element(:borrower_type_selector) {b.select_list(:id => "borrowerType_control")} element(:email_address_field) {b.text_field(:id => "emailAddress_control")} # Search Controls # TODO Move these elements to OLE_QA::Framework::OLELS::Lookup (common) when they become universal. element(:active_yes_button) {b.radio(:id => 'activeIndicator_control_0')} element(:active_no_button) {b.radio(:id => 'activeIndicator_control_1')} element(:active_both_button) {b.radio(:id => 'activeIndicator_control_2')} element(:search_button) {b.button(:text => "Search")} element(:clear_button) {b.button(:text => "Clear Values")} element(:cancel_button) {b.button(:text => "Cancel")} end
set_functions()
click to toggle source
Calls superclass method
OLE_QA::Framework::Page#set_functions
# File lib/olels/pages/patron_lookup.rb, line 44 def set_functions super # Return the span containing the given text, if it appears in the search results. function(:text_in_results) {|which| b.span(:xpath => "//td/div/span[contains(text(),'#{which}')]")} # Return whether the given text exists in the search results. function(:text_in_results?) {|which| b.span(:xpath => "//td/div/span[contains(text(),'#{which}')]").present? } # Function used for edit_by_text, copy_by_text, and delete_by_text. function(:edit_by_text) {|which| b.a(:xpath => link_by_text('edit',which)) } # Return the copy link for a given text string in the search results. function(:copy_by_text) {|which| b.a(:xpath => link_by_text('copy',which)) } # Return the delete link for a given text string in the search results. function(:delete_by_text) {|which| b.a(:xpath => link_by_text('delete',which)) } # Return the 'return value' link for a line containing the given text in the search results. function(:return_by_text) {|which| b.a(:xpath => "//tr[td/div/span[contains(text(),'#{which}')]]/td/div/fieldset/div/div/a[contains(text(),'return value')]")} end
Private Instance Methods
link_by_text(link,text)
click to toggle source
Return
the XPath to find a link with the given text on a line containing a search result with the given text. @param [String] link The text of the link to be returned. (‘edit’,‘copy’, or ‘delete’) @param [String] text The text to locate in the search results. (e.g., a patron’s first name, barcode, ID, etc.)
# File lib/olels/pages/patron_lookup.rb, line 63 def link_by_text(link,text) "//tr/td[div/span[contains(text(),'#{text}')]]/preceding-sibling::td/div/fieldset/div/div/a[contains(text(),'#{link}')]" end