Class: TestCentricity::PageManager
Instance Attribute Summary collapse
-
#current_page ⇒ Object
Returns the value of attribute current_page.
Class Method Summary collapse
-
.current_page ⇒ PageObject
Get the currently active PageObject.
-
.current_page=(page) ⇒ Object
Sets the currently active PageObject.
- .find_page(page_name) ⇒ Object
-
.loaded? ⇒ Boolean
Have all PageObjects been registered?.
- .register_page_objects(pages) ⇒ Object
-
.set_current_page(page) ⇒ Object
deprecated
Deprecated.
Please use #current_page= instead
Instance Attribute Details
#current_page ⇒ Object
Returns the value of attribute current_page.
38 39 40 |
# File 'lib/testcentricity_web.rb', line 38 def current_page @current_page end |
Class Method Details
.current_page ⇒ PageObject
Get the currently active PageObject
81 82 83 |
# File 'lib/testcentricity_web.rb', line 81 def self.current_page @current_page end |
.current_page=(page) ⇒ Object
Sets the currently active PageObject
91 92 93 |
# File 'lib/testcentricity_web.rb', line 91 def self.current_page=(page) @current_page = page end |
.find_page(page_name) ⇒ Object
70 71 72 73 |
# File 'lib/testcentricity_web.rb', line 70 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?
66 67 68 |
# File 'lib/testcentricity_web.rb', line 66 def self.loaded? !@page_objects.empty? end |
.register_page_objects(pages) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/testcentricity_web.rb', line 42 def self.register_page_objects(pages) result = '' pages.each do |page_object, page_class| obj = page_class.new @page_objects[page_object] = obj unless @page_objects.has_key?(page_object) page_names = obj.page_name page_names = Array(page_names) if page_names.is_a? String page_names.each do |name| page_key = name.gsub(/\s+/, '').downcase.to_sym if page_key != page_object @page_objects[page_key] = obj unless @page_objects.has_key?(page_key) end result = "#{result}def #{page_object};@#{page_object} ||= TestCentricity::PageManager.find_page(:#{page_object});end;" end end result end |
.set_current_page(page) ⇒ Object
Deprecated.
Please use #current_page= instead
Sets the currently active PageObject
102 103 104 105 |
# File 'lib/testcentricity_web.rb', line 102 def self.set_current_page(page) warn "[DEPRECATION] 'TestCentricity::PageManager.set_current_page' is deprecated. Please use 'current_page=' instead." @current_page = page end |