Class: OLE_QA::Framework::OLEFS::PURAP_Document

Inherits:
E_Doc show all
Defined in:
lib/olefs/common/purap_document.rb

Overview

An OLE Financial System PURchasing/Accounts Payable Document

Instance Attribute Summary

Attributes inherited from Page

#url

Attributes inherited from Common_Object

#elements, #functions, #ole

Instance Method Summary collapse

Methods inherited from E_Doc

#get_error_array, #wait_for_elements

Methods inherited from Page

#open, #set_functions, #wait_for_element, #wait_for_elements, #wait_for_page_to_load

Methods inherited from Common_Object

#set_functions

Methods included from Helpers

#browser, #load_yml, #set_element, #set_function

Constructor Details

#initialize(ole_session, url) ⇒ PURAP_Document

Returns a new instance of PURAP_Document.



18
19
20
21
# File 'lib/olefs/common/purap_document.rb', line 18

def initialize(ole_session, url)
  super(ole_session, url)
  set_lines if defined?(self.set_lines)
end

Instance Method Details

#create_line(instance_name, class_name, which = 0) ⇒ Object Also known as: add_line

Create a Line Object on a PURAP Document page.

Raises:

  • (StandardError)


56
57
58
59
60
61
62
# File 'lib/olefs/common/purap_document.rb', line 56

def create_line(instance_name, class_name, which=0)
  raise StandardError, "Line object already exists.  (#{instance_name})" if self.instance_variables.include?("@#{instance_name}".to_sym)
  new_line_name = instance_name
  make_accessor(:"#{instance_name}")
  klas = OLE_QA::Framework::OLEFS.const_get(:"#{class_name}")
  instance_variable_set(:"@#{new_line_name}", klas.new(@ole, which))
end

#remove_line(instance_name) ⇒ Object Also known as: delete_line

Remove a Line Object from a PURAP Document page.

Raises:

  • (StandardError)


66
67
68
69
70
# File 'lib/olefs/common/purap_document.rb', line 66

def remove_line(instance_name)
  raise StandardError, "Line object does not exist.  (#{instance_name})" unless self.instance_variables.include?("@#{instance_name}".to_sym)
  remove_instance_variable("@#{instance_name}".to_sym)
  unmake_attr(instance_name.to_sym)
end

#set_elementsObject

Set PURAP Document Elements.



24
25
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
# File 'lib/olefs/common/purap_document.rb', line 24

def set_elements
  super
  # View Related Documents Tab
  element(:view_related_tab_toggle)                           {b.input(:id => "tab-ViewRelatedDocuments-imageToggle")}
  element(:view_related_po_link)                              {b.a(:xpath => "//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Purchase Order')]/a")}
  element(:view_related_requisition_link)                     {b.a(:xpath => "//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Requisition')]/a")}
  # Delivery Tab
  element(:delivery_tab_toggle)                               {b.input(:id => "tab-Delivery-imageToggle")}
  element(:building_field)                                    {b.td(:xpath => "//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]")}
  element(:campus_field)                                      {b.td(:xpath => "//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]")}
  element(:closed_room_field)                                 {b.td(:xpath => "//div[@id='tab-Delivery-div']/div/table/tbody/tr[5]/td[1]")}
  element(:closed_building_field)                             {b.td(:xpath => "//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]")}
  element(:closed_campus_field)                               {b.td(:xpath => "//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]")}
  element(:closed_address_1_field)                            {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[1]")}
  element(:closed_address_2_field)                            {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[4]/th[1]/following-sibling::td[1]")}
  element(:closed_city_field)                                 {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[6]/th[1]/following-sibling::td[1]")}
  element(:closed_state_field)                                {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[7]/th[1]/following-sibling::td[1]")}
  element(:closed_postal_code_field)                          {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[8]/th[1]/following-sibling::td[1]")}
  element(:closed_country_field)                              {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[9]/th[1]/following-sibling::td[1]")}
  element(:closed_delivery_to_field)                          {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[2]")}
  element(:closed_delivery_phone_number_field)                {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[2]")}
  element(:closed_email_field)                                {b.td(:xpath => "//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[2]")}
  # Vendor Tab
  element(:vendor_tab_toggle)                                 {b.input(:id => "tab-Vendor-imageToggle")}
  element(:closed_vendor_name_field)                          {b.td(:xpath => "//tr/th[div[contains(text(),'Suggested Vendor:')]]/following-sibling::td[1]")}
  # Route Log Tab
  element(:route_log_tab_toggle)              {b.input(:id => "tab-RouteLog-imageToggle")}
  # element(:actions_taken)                     {b.bs(:xpath => "//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[1]/b")}
  # element(:actions_taken_by)                  {b.as(:xpath => "//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[2]/a")}
end