Class: OLE_QA::Framework::OLELS::Item_Lookup

Inherits:
Page show all
Defined in:
lib/olels/pages/item_lookup.rb

Overview

The Item 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 Page

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

Methods included from Helpers

#browser, #load_yml, #set_element, #set_function

Constructor Details

#initialize(ole_session) ⇒ Item_Lookup

Returns a new instance of Item_Lookup.



18
19
20
21
22
23
24
# File 'lib/olels/pages/item_lookup.rb', line 18

def initialize(ole_session)
  # Direct linking for a new request is not possible, so the URL is for Request_Lookup.
  url = ole_session.url + 'portal.do?channelTitle=Request&channelUrl='
  url += ole_session.url + 'ole-kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.ole.deliver.bo.OleDeliverRequestBo&returnLocation='
  url += ole_session.url + 'portal.do&hideReturnLink=true&showMaintenanceLinks=true'
  super(ole_session,url)
end

Instance Method Details

#set_elementsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/olels/pages/item_lookup.rb', line 26

def set_elements
  super
  element(:title)                         {b.span(:class => 'uif-headerText-span')}
  element(:title_field)                   {b.div(:data_label => 'Title').text_field(:class => 'uif-textControl')}
  element(:author_field)                  {b.div(:data_label => 'Author').text_field(:class => 'uif-textControl')}
  element(:publisher_field)               {b.div(:data_label => 'Publisher').text_field(:class => 'uif-textControl')}
  element(:barcode_field)                 {b.div(:data_label => 'Item Barcode').text_field(:class => 'uif-textControl')}
  element(:call_number_field)             {b.div(:data_label => 'Call Number').text_field(:class => 'uif-textControl')}
  element(:item_type_selector)            {b.div(:data_label => 'Item Type').select_list(:class => 'fixed-size-200-select')}
  element(:search_button)                 {b.button(:text => /[Ss]earch/)}
  element(:clear_button)                  {b.button(:text => /[Cc]lear [Vv]alues/)}
  element(:close_button)                  {b.button(:text => /[Cc]lose/)}
  element(:error_message)                 {b.li(:class => 'uif-errorMessageItem')}
end

#set_functionsObject



41
42
43
44
45
46
47
48
# File 'lib/olels/pages/item_lookup.rb', line 41

def set_functions
  super
  # Determine if the given text exists in the search results.
  function(:text_in_results)              {|which| b.span(:class => 'uif-readOnlyContent',:text => /#{which}/)}
  function(:text_in_results?)             {|which| text_in_results(which).present?}
  # Find the 'return value' link for a row containing the given text.
  function(:return_by_text)               {|which| text_in_results(which).parent.parent.parent.td(:index => 0).div(:index => 0).fieldset(:index => 0).div(:index => 0).div(:index => 1).a(:text => /return value/)}
end

#wait_for_elementsObject



50
51
52
53
54
# File 'lib/olels/pages/item_lookup.rb', line 50

def wait_for_elements
  super
  @wait_on << :title_field << :barcode_field
  @wait_on << :search_button
end