Class: TestCentricity::PageManager

Inherits:
Object
  • Object
show all
Defined in:
lib/testcentricity_web.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#current_pageObject

Returns the value of attribute current_page.



34
35
36
# File 'lib/testcentricity_web.rb', line 34

def current_page
  @current_page
end

Class Method Details

.current_pagePageObject

Get the currently active PageObject

Examples:

active_page = TestCentricity::PageManager.current_page

Returns:



67
68
69
# File 'lib/testcentricity_web.rb', line 67

def self.current_page
  @current_page
end

.find_page(page_name) ⇒ Object



56
57
58
59
# File 'lib/testcentricity_web.rb', line 56

def self.find_page(page_name)
  (page_name.is_a? String) ? page_id = page_name.gsub(/\s+/, "").downcase.to_sym : page_id = page_name
  @page_objects[page_id]
end

.loaded?Boolean

Have all PageObjects been registered?

Examples:

TestCentricity::PageManager.loaded?

Returns:

  • (Boolean)

    true if all PageObjects have been registered



52
53
54
# File 'lib/testcentricity_web.rb', line 52

def self.loaded?
  not @page_objects.empty?
end

.register_page_object(page_ref, page_object) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/testcentricity_web.rb', line 38

def self.register_page_object(page_ref, page_object)
  @page_objects[page_ref] = page_object unless @page_objects.has_key?(page_ref)
  page_key = page_object.page_name.gsub(/\s+/, "").downcase.to_sym
  if page_key != page_ref
    @page_objects[page_key] = page_object unless @page_objects.has_key?(page_key)
  end
end

.set_current_page(page) ⇒ Object

Sets the currently active PageObject

Examples:

TestCentricity::PageManager.set_current_page(product_search_page)

Parameters:

  • page (PageObject)

    Reference to the active PageObject



77
78
79
# File 'lib/testcentricity_web.rb', line 77

def self.set_current_page(page)
  @current_page = page
end