Class: OLE_QA::Framework::OLELS::Describe_Workbench

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

Overview

The OLE Library System Describe Workbench Screen

Instance Attribute Summary

Attributes inherited from Page

#lines, #url

Attributes inherited from Common_Object

#elements, #functions, #ole

Instance Method Summary collapse

Methods inherited from Page

#lookup, #lookup_url, #open, #wait_for_element, #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) ⇒ Describe_Workbench

Set URL



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

def initialize(ole_session)
  url = ole_session.url + 'portal.do?channelTitle=Describe Workbench&channelUrl='
  url += ole_session.url + 'ole-kr-krad/describeworkbenchcontroller?viewId=DescribeWorkBenchView&methodToCall=start'
  super(ole_session, url)
end

Instance Method Details

#set_elementsObject

Set OLELS Describe Workbench page elements.



26
27
28
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
# File 'lib/olels/pages/describe_workbench.rb', line 26

def set_elements
  super
  # Search Control Elements
  element(:search_button)                   {b.button(:id => "search_button")}
  element(:clear_button)                    {b.button(:id => "clear_button")}
  element(:doc_type_bib)                    {b.radio(:id => 'SearchPanel-docType-Section_control_0')}
  element(:doc_type_holdings)               {b.radio(:id => 'SearchPanel-docType-Section_control_1')}
  element(:doc_type_item)                   {b.radio(:id => 'SearchPanel-docType-Section_control_2')}
  element(:doc_type_e_holdings)             {b.radio(:id => 'SearchPanel-docType-Section_control_3')}
  element(:link_to_order_button)            {b.button(:id => 'submit_button')}
  element(:export_to_xml_button)            {b.button(:id => 'export_button1')}
  element(:close_button)                    {b.button(:id => 'cancel_button')}
  # Search Fields
  element(:search_field_1)                  {b.text_field(:id => "searchText_id_line0_control")}
  element(:search_which_selector_1)         {b.select_list(:id => "operator_id_line0_control")}
  element(:search_field_selector_1)         {b.select_list(:id => "docField_id_line0_control")}
  element(:search_scope_1_and)              {b.radio(:id => 'searchScope_id_line0_control_0')}
  element(:search_scope_1_or)               {b.radio(:id => 'searchScope_id_line0_control_1')}
  element(:search_scope_1_not)              {b.radio(:id => 'searchScope_id_line0_control_2')}
  element(:search_field_2)                  {b.text_field(:id => 'searchText_id_line1_control')}
  element(:search_which_selector_2)         {b.select_list(:id => 'operator_id_line1_control')}
  element(:search_field_selector_2)         {b.select_list(:id => 'docField_id_line1_control')}
  element(:search_scope_2_and)              {b.radio(:id => 'searchScope_id_line1_control_0')}
  element(:search_scope_2_or)               {b.radio(:id => 'searchScope_id_line1_control_1')}
  element(:search_scope_2_not)              {b.radio(:id => 'searchScope_id_line1_control_2')}
  # Search Results Elements
  element(:next_link)                       {b.a(:text => 'Next')}
  element(:previous_link)                   {b.a(:text => 'Previous')}
end

#set_functionsObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/olels/pages/describe_workbench.rb', line 61

def set_functions
  super
  # Check whether the given text exists within the search results table.
  # - Returns true or false based on whether the given string was found.
  function(:result_present?)                {|str| b.td(:xpath => "//table/tbody/tr/td[div/*[contains(text(),\"#{str}\")]]").present?}
  # Return the checkbox for the results line containing the given text.
  # Usage:
  #   workbench.select_by_text("Foo").set(true|false)
  # - Searches both link text (for Local ID element) and regular text in span (for all other fields).
  # - Returns nil if element not found.
  function(:select_by_text)                 {|str| element = b.checkbox(:xpath => "//table/tbody/tr[td[div/*[contains(text(),\"#{str}\")]]]/td[1]/div/input[@type='checkbox']") ; if element.present? then element else nil end}
  # Return the 'view' link for the results line containing the given text.
  # Usage:
  #   workbench.view_by_text.click
  # - Searches both link text (for Local ID element) and regular text in span (for all other fields).
  # - Returns nil if element not found.
  function(:view_by_text)                   {|str| element = b.a(:xpath => "//table/tbody/tr[td[div/*[contains(text(),\"#{str}\")]]]/td/div/fieldset/div/div/a[contains(text(),'View')]") ; if element.present? then element else nil end}
  # Return the 'view' link for the results line containing the given text.
  # Usage:
  #   workbench.view_by_text.click
  # - Searches both link text (for Local ID element) and regular text in span (for all other fields).
  # - Returns nil if element not found.
  function(:edit_by_text)                   {|str| element = b.a(:xpath => "//table/tbody/tr[td[div/*[contains(text(),\"#{str}\")]]]/td/div/fieldset/div/div/a[contains(text(),'Edit')]") ; if element.present? then element else nil end}
  # Return the 'overlay' link for the results line containing the given text.
  # Usage:
  #   workbench.overlay_by_text.click
  # - Searches both link text (for Local ID element) and regular text in span (for all other fields).
  # - Returns nil if element not found.
  function(:overlay_by_text)                {|str| element = b.a(:xpath => "//table/tbody/tr[td[div/*[contains(text(),\"#{str}\")]]]/td/div/fieldset/div/div/a[contains(text(),'OverLay')]") ; if element.present? then element else nil end}
  # Return the 'create instance' link for the results line containing the given text.
  # Usage:
  #   workbench.create_instance_by_text.click
  # - Searches both link text (for Local ID element) and regular text in span (for all other fields).
  # - Returns nil if element not found.
  function(:create_instance_by_text)        {|str| element = b.a(:xpath => "//table/tbody/tr[td[div/*[contains(text(),\"#{str}\")]]]/td/div/fieldset/div/div/a[contains(text(),'Create Instance')]") ; if element.present? then element else nil end}
end

#wait_for_elementsObject



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

def wait_for_elements
  super
  @wait_on << :search_button
end