Class: OLE_QA::Framework::OLELS::Location_Level_Lookup

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

Overview

The location level 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_Level_Lookup

Returns a new instance of Location_Level_Lookup.



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

def initialize(ole_session)
  url = ole_session.url + 'portal.do?channelTitle=Location Level&channelUrl='
  url += ole_session.url + 'ole-kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.ole.describe.bo.OleLocationLevel&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
# File 'lib/olels/pages/location_level_lookup.rb', line 25

def set_elements
  super
  element(:level_id_icon)                                       {b.input(:title => 'Direct Inquiry')}
  element(:level_code_field)                                    {b.text_field(:name => 'lookupCriteria[levelCode]')}
  element(:level_name_field)                                    {b.text_field(:name => 'lookupCriteria[levelName]')}
  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



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/olels/pages/location_level_lookup.rb', line 35

def set_functions
  super
  # Return the span element containing the given text, if it exists in the search results.
  function(:text_in_results)                                   {|which| b.span(:xpath => "//td/div/span[contains(text(),'#{which}')]")}
  # Query whether the given text value exists in the search results.
  function(:text_in_results?)                                   {|which| text_in_results(which).present?}
  # Return the 'edit' link for a search results line containing a given value.
  function(:edit_by_text)                                       {|which| b.a(:xpath => "//tr[td/div/span[contains(text(),'#{which}')]]/td[1]/div/fieldset/div/div/a[contains(text(),'edit')]")}
  # Return the 'Level ID' link for a search results line containing a given value.
  function(:id_by_text)                                         {|which| b.a(:xpath => "//tr[td/div/span[contains(text(),'#{which}')]]/td[2]/div/span/a")}
  # Return the 'Parent Level ID' link for a search results line containing a given value.
  function(:parent_id_by_text)                                  {|which| b.a(:xpath => "//tr[td/div/span[contains(text(),'#{which}')]]/td[5]/div/span/a")}
end

#wait_for_elementsObject



49
50
51
52
53
# File 'lib/olels/pages/location_level_lookup.rb', line 49

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