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.



41
42
43
# File 'lib/testcentricity_web.rb', line 41

def current_page
  @current_page
end

Class Method Details

.current_pagePageObject

Get the currently active PageObject

Examples:

active_page = TestCentricity::PageManager.current_page

Returns:



72
73
74
# File 'lib/testcentricity_web.rb', line 72

def self.current_page
  @current_page
end

.current_page=(page) ⇒ Object

Sets the currently active PageObject

Examples:

TestCentricity::PageManager.current_page = product_search_page

Parameters:

  • page (PageObject)

    Reference to the active PageObject



82
83
84
# File 'lib/testcentricity_web.rb', line 82

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

.find_page(page_name) ⇒ Object



59
60
61
62
63
64
# File 'lib/testcentricity_web.rb', line 59

def self.find_page(page_name)
  page_id = (page_name.is_a? String) ? page_name.gsub(/\s+/, '').downcase.to_sym : page_name
  page = @page_objects[page_id]
  raise "No page object defined for page named '#{page_name}'" unless page
  page
end

.loaded?Boolean

Have all PageObjects been registered?

Examples:

TestCentricity::PageManager.loaded?

Returns:

  • (Boolean)

    true if all PageObjects have been registered



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

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

.register_page_objects(pages) ⇒ Object



45
46
47
# File 'lib/testcentricity_web.rb', line 45

def self.register_page_objects(pages)
  @page_objects = pages
end