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.



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

def current_page
  @current_page
end

Class Method Details

.current_pagePageObject

Get the currently active PageObject

Examples:

active_page = TestCentricity::PageManager.current_page

Returns:



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

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



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

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

.find_page(page_name) ⇒ Object



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

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



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

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

.register_page_objects(pages) ⇒ Object



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

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