Class: OLE_QA::Framework::OLELS::Patron_Lookup

Inherits:
Lookup show all
Defined in:
lib/olels/pages/patron_lookup.rb

Overview

The Patron lookup page in the OLE Library System.

Instance Attribute Summary

Attributes inherited from Page

#lines, #url, #wait_on

Attributes inherited from Common_Object

#elements, #functions, #ole

Instance Method Summary collapse

Methods inherited from Lookup

#wait_for_elements

Methods inherited from Page

#lookup, #lookup_url, #open, #set_line, #wait_for_element, #wait_for_elements, #wait_for_page_to_load

Methods included from Helpers

#browser, #load_yml, #set_element, #set_function

Constructor Details

#initialize(ole_session) ⇒ Patron_Lookup

Returns a new instance of Patron_Lookup.



18
19
20
21
22
23
# 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

Instance Method Details

#set_elementsObject

Set Patron Lookup elements.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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_functionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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