Class: OLE_QA::Framework::OLELS::Patron

Inherits:
E_Doc show all
Defined in:
lib/olels/pages/patron.rb

Overview

Note:

Use of this page may require a special login. The default user, ole-khuntley, does not have sufficient permissions to create a new patron record (as of 1.0.0-M2-r13397, 07/31/2013).

A single patron record in the OLE Library System.

Instance Attribute Summary

Attributes inherited from Page

#lines, #url

Attributes inherited from Common_Object

#elements, #functions, #ole

Instance Method Summary collapse

Methods inherited from E_Doc

#wait_for_elements

Methods inherited from Page

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

Methods included from Page_Helpers

#set_line

Methods included from Helpers

#browser, #load_yml, #set_element, #set_function

Constructor Details

#initialize(ole_session) ⇒ Patron

The page object will open a new patron record by default.



22
23
24
25
26
# File 'lib/olels/pages/patron.rb', line 22

def initialize(ole_session)
  url = ole_session.url + 'ole-kr-krad/patronMaintenance?viewTypeName=MAINTENANCE&returnLocation='
  url += ole_session.url + 'portal.do&methodToCall=start&dataObjectClassName=org.kuali.ole.deliver.bo.OlePatronDocument'
  super(ole_session, url)
end

Instance Method Details

#set_elementsObject

Define screen elements for patron record screen.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/olels/pages/patron.rb', line 29

def set_elements
  super
  element(:patron_id)                                     {b.a(:xpath => "//th[span/label[contains(text(),'Patron Id:')]]/following-sibling::td[1]/div/span/a")}
  element(:barcode_field)                                 {b.text_field(:id => 'barcode_control')}
  element(:borrower_type_selector)                        {b.select_list(:id => 'borrowerType_control')}
  element(:source_selector)                               {b.select_list(:id => 'sourceType_control')}
  element(:patron_image_field)                            {b.input(:id => 'attachment_Files_control').to_subtype}
  element(:upload_image_button)                           {b.button(:id => 'uploadButton_patron')}
  element(:statistical_category_selector)                 {b.select_list(:id => 'statisticalCategory_control')}
  element(:activation_date_field)                         {b.text_field(:id => 'activationDate_control')}
  element(:expiration_date_field)                         {b.text_field(:id => 'expirationDate_control')}
  element(:active_checkbox)                               {b.checkbox(:id => 'activeIndicator_control')}
  element(:name_type)                                     {b.span(:id => /nameType.*control/)}
  element(:title_selector)                                {b.select_list(:id => /namePrefix.*control/)}
  element(:first_name_field)                              {b.text_field(:id => /firstName.*control/)}
  element(:middle_name_field)                             {b.text_field(:id => /middleName.*control/)}
  element(:last_name_field)                               {b.text_field(:id => /lastName.*control/)}
  element(:suffix_selector)                               {b.select_list(:id => /nameSuffix.*control/)}
  element(:affiliation_toggle)                            {b.a(:id => 'OlePatronDocument-Affiliation_toggle')}
  element(:library_policies_toggle)                       {b.a(:id => 'OlePatronDocument-LibraryPoliciesSection_toggle')}
  element(:loaned_records_toggle)                         {b.a(:id => 'OlePatronDocument-PatronLoanedRecords_toggle')}
  element(:requested_records_toggle)                      {b.a(:id => 'OlePatronDocument-PatronRequestedRecords_toggle')}
  element(:temp_circ_history_toggle)                      {b.a(:id => 'OlePatronDocument-TemporaryCirculationHistoryRecords_toggle')}
  element(:note_toggle)                                   {b.a(:id => 'OlePatronDocument-NotesSection_toggle')}
  element(:proxy_patron_toggle)                           {b.a(:id => 'OlePatronDocument-ProxySection_toggle')}
  element(:proxy_for_toggle)                              {b.a(:id => 'OlePatronDocument-ProxyForSection_toggle')}
  element(:local_id_toggle)                               {b.a(:id => 'OlePatronDocument-PatronLocalIdSection_toggle')}
  element(:lost_barcode_toggle)                           {b.a(:id => 'OlePatronDocument-InvalidOrLostBarcodeSection_toggle')}
  # TODO Check on OLE-4523 for the establishment of the element ID in the ad_hoc_toggle link.
  element(:ad_hoc_toggle)                                 {b.a(:id => 'OlePatronDocument-AdHocRecipientsSection_toggle')}
  # TODO Check on OLE-4526 for the establishment of the element ID in the route_log_toggle link.
  element(:route_log_toggle)                              {b.a(:id => 'OlePatronDocument-RouteLogSection_toggle')}
  element(:contacts_toggle)                               {b.a(:id => 'OlePatronDocument-ContactsSection_toggle')}
  element(:overview_toggle)                               {b.a(:id => 'OlePatronDocument-OverviewSection_toggle')}
  element(:name_toggle)                                   {b.a(:id => 'OlePatronDocument-Name_toggle')}
  element(:address_toggle)                                {b.a(:id => 'OlePatronDocument-Address_toggle')}
  element(:phone_toggle)                                  {b.a(:id => 'OlePatronDocument-Phone_toggle')}
  element(:email_toggle)                                  {b.a(:id => 'OlePatronDocument-Email_toggle')}
end

#set_functionsObject

Define commonly used functions for patron record screen.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/olels/pages/patron.rb', line 70

def set_functions
  super
  # If the .patron_image_field has already been set once, IDs of related elements change.
  # Use this method to update element IDs on the page object.  It will return true if the IDs have been updated, false if the default IDs are still being used.
  function(:redefine_patron_image_elements)               do
                                                            if b.input(:id => 'attachment_File_edit_control').present?
                                                              set_element(:patron_image_field, true)  {b.input(:id => 'attachment_File_edit_control').to_subtype}
                                                              set_element(:upload_image_button,true)  {b.button(:id => 'uploadButton_edit')}
                                                              true
                                                            else
                                                              set_element(:patron_image_field, true)  {b.input(:id => 'attachment_Files_control').to_subtype}
                                                              set_element(:upload_image_button, true) {b.button(:id => 'uploadButton_patron')}
                                                              false
                                                            end
                                                          end
end

#set_linesObject



87
88
89
90
91
# File 'lib/olels/pages/patron.rb', line 87

def set_lines
  set_line(:address_line, OLE_QA::Framework::OLELS::Patron_Address_Line)
  set_line(:phone_line, OLE_QA::Framework::OLELS::Patron_Phone_Line)
  set_line(:email_line, OLE_QA::Framework::OLELS::Patron_Email_Line)
end