Class: OLE_QA::Framework::OLELS::Location_Lookup

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

Overview

The location lookup screen 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) ⇒ Location_Lookup

Returns a new instance of Location_Lookup.



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

def initialize(ole_session)
  url = ole_session.url + 'portal.do?channelTitle=Location &channelUrl='
  url += ole_session.url + 'ole-kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.ole.describe.bo.OleLocation&returnLocation='
  url += ole_session.url +  'portal.do&hideReturnLink=true&showMaintenanceLinks=true'
  super(ole_session, url)
end

Instance Method Details

#set_elementsObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/olels/pages/location_lookup.rb', line 25

def set_elements
  super
  element(:location_id_field)                                       {b.text_field(:id => 'locationId_control')}
  element(:location_code_field)                                     {b.text_field(:id => 'locationCode_control')}
  element(:location_name_field)                                     {b.text_field(:id => 'locationName_control')}
  element(:location_level_field)                                    {b.text_field(:id => 'levelId_control')}
  element(:location_level_icon)                                     {b.input(:title => 'Search Field')}
  element(:search_button)                                           {b.button(:text => /[Ss]earch/)}
  element(:clear_button)                                            {b.button(:text => /[Cc]lear/)}
  element(:cancel_button)                                           {b.button(:text => /[Cc]ancel/)}
end

#set_functionsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/olels/pages/location_lookup.rb', line 37

def set_functions
  super
  # Return the span element containing the given text, if it is found in the search results.
  function(:text_in_results)                                       {|which| b.span(:xpath => "//td/div/span[contains(text(),'#{which}')]")}
  # A function to query whether a given text value exists in the search results.
  function(:text_in_results?)                                       {|which| b.span(:xpath => "//td/div/span[contains(text(),'#{which}')]").present?}
  # Return the 'edit' link for a search results line containing the given text.
  function(:edit_by_text)                                           {|which| b.a(:xpath => "//td[div/span[contains(text(),'#{which}')]]/preceding-sibling::td/div/fieldset/div/div/a[contains(text(),'edit')]")}
  # Return the 'copy' link for a search results line containing the given text.
  function(:copy_by_text)                                           {|which| b.a(:xpath => "//td[div/span[contains(text(),'#{which}')]]/preceding-sibling::td/div/fieldset/div/div/a[contains(text(),'copy')]")}
  # Return the 'return results' link for a search results line containing the given text.
  # @note Used when the lookup screen is opened from another page, like the create/edit location page.
  function(:return_by_text)                                         {|which| b.a(:xpath => "//td[div/span[contains(text(),'#{which}')]]/preceding-sibling::td/div/fieldset/div/div/a[contains(text(),'return value')]")}
  # Return the ID or Parent ID element from a search results line containing the given text.
  function(:id_by_text)                                             {|which| b.span(:xpath => "//tr[td/div/span[contains(text(),'#{which}')]]/td[2]/div/span")}
  function(:parent_id_by_text)                                      {|which| b.span(:xpath => "//tr[td/div/span[contains(text(),'#{which}')]]/td[5]/div/span")}
end

#wait_for_elementsObject



55
56
57
58
59
# File 'lib/olels/pages/location_lookup.rb', line 55

def wait_for_elements
  super
  @wait_on << :location_id_field
  @wait_on << :search_button
end