Class: OLE_QA::Framework::DocStore::Results

Inherits:
Page show all
Defined in:
lib/docstore/common/results.rb

Overview

Note:

Elements in the search results will be vastly different depending on the type of search performed. If it matters, then be sure to use the subclass for the type of search results you are expecting.

The base page object for a given set of DocStore search results.

Direct Known Subclasses

Marc_Results

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, #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) ⇒ Results

Returns a new instance of Results.



21
22
23
24
# File 'lib/docstore/common/results.rb', line 21

def initialize(ole_session)
  url = ole_session.docstore_url + 'discovery.do'
  super(ole_session, url)
end

Instance Method Details

#set_elementsObject



26
27
28
29
30
31
32
33
34
# File 'lib/docstore/common/results.rb', line 26

def set_elements
  super
  element(:revise_search_button)                      {b.button(:id => 'Back')}
  element(:new_search_button)                         {b.button(:name => 'newSearch')}
  element(:page_field)                                {b.text_field(:id => 'pageSpinner')}
  element(:go_to_page_button)                         {b.button(:id => 'gotoPage')}
  element(:page_list)                                 {b.div(:id => 'pageList').b}
  element(:no_results)                                {b.div(:id => 'demo2').b(:text => /^([Nn]o).*(results)/)}
end

#set_functionsObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/docstore/common/results.rb', line 41

def set_functions
  super
  # Title bar for a given record, ordered by appearance on the screen (1-based).
  # @note Not reliable as a source of textual information!  If there is any highlighting
  #   on this element, the text will be broken up by a <span></span> wherever the
  #   highlighting is applied.
  function(:title_bar)                                { |which| which -= 1 ; b.h3(:class => 'expand', :index => "#{which}").a(:title => 'Expand/Collapse')}
  # Check if results are present and return true or false.
  function(:any_results?)                             { no_results.present? ? false : true}
  # Check if there is more than one page of results listed and return true or false.
  function(:multiple_pages?)                          { page_field.present? }
end

#wait_for_elementsObject



36
37
38
39
# File 'lib/docstore/common/results.rb', line 36

def wait_for_elements
  super
  @wait_on << :revise_search_button
end