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

#url

Attributes inherited from Common_Object

#elements, #functions, #ole

Instance Method Summary collapse

Methods inherited from E_Doc

#create_line, #remove_line, #wait_for_elements

Methods inherited from Page

#open, #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

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



22
23
24
25
26
27
28
29
30
31
# 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)

  # Set up initial contact info lines, one of each.
  add_address_line(1)
  add_phone_line(1)
  add_email_line(1)
end

Instance Method Details

#create_address_line(which = 1) ⇒ Object Also known as: add_address_line



92
93
94
# File 'lib/olels/pages/patron.rb', line 92

def create_address_line(which = 1)
  create_line("address_line_#{which}","Patron_Address_Line", which)
end

#create_email_line(which = 1) ⇒ Object Also known as: add_email_line



102
103
104
# File 'lib/olels/pages/patron.rb', line 102

def create_email_line(which = 1)
  create_line("email_line_#{which}","Patron_Email_Line", which)
end

#create_phone_line(which = 1) ⇒ Object Also known as: add_phone_line



97
98
99
# File 'lib/olels/pages/patron.rb', line 97

def create_phone_line(which = 1)
  create_line("phone_line_#{which}","Patron_Phone_Line", which)
end

#remove_address_line(which = 1) ⇒ Object Also known as: delete_address_line



107
108
109
# File 'lib/olels/pages/patron.rb', line 107

def remove_address_line(which = 1)
  remove_line("address_line_#{which}")
end

#remove_email_line(which = 1) ⇒ Object Also known as: delete_email_line



117
118
119
# File 'lib/olels/pages/patron.rb', line 117

def remove_email_line(which = 1)
  remove_line("email_line_#{which}")
end

#remove_phone_line(which = 1) ⇒ Object Also known as: delete_phone_line



112
113
114
# File 'lib/olels/pages/patron.rb', line 112

def remove_phone_line(which = 1)
  remove_line("phone_line_#{which}")
end

#set_elementsObject

Define screen elements for patron record screen.



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
68
69
70
71
72
# File 'lib/olels/pages/patron.rb', line 34

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.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/olels/pages/patron.rb', line 75

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