Module: Fluent

Includes:
Enclosers, Evaluators, Platforms
Defined in:
lib/fluent.rb,
lib/fluent/errors.rb,
lib/fluent/logger.rb,
lib/fluent/factory.rb,
lib/fluent/version.rb,
lib/fluent/enclosers.rb,
lib/fluent/platforms.rb,
lib/fluent/evaluators.rb,
lib/fluent/generators.rb,
lib/fluent/web_elements.rb,
lib/fluent/platform_watir.rb,
lib/fluent/web_elements/div.rb,
lib/fluent/platform_selenium.rb,
lib/fluent/web_elements/cell.rb,
lib/fluent/web_elements/form.rb,
lib/fluent/web_elements/link.rb,
lib/fluent/web_elements/span.rb,
lib/fluent/platform_mechanize.rb,
lib/fluent/web_elements/image.rb,
lib/fluent/web_elements/label.rb,
lib/fluent/web_elements/radio.rb,
lib/fluent/web_elements/table.rb,
lib/fluent/web_elements/button.rb,
lib/fluent/web_elements/hidden.rb,
lib/fluent/web_elements/option.rb,
lib/fluent/web_elements/heading.rb,
lib/fluent/web_elements/checkbox.rb,
lib/fluent/web_elements/list_item.rb,
lib/fluent/web_elements/paragraph.rb,
lib/fluent/web_elements/table_row.rb,
lib/fluent/web_elements/text_area.rb,
lib/fluent/web_elements/text_field.rb,
lib/fluent/web_elements/select_list.rb,
lib/fluent/web_elements/web_element.rb,
lib/fluent/web_elements/ordered_list.rb,
lib/fluent/web_elements/unordered_list.rb,
lib/fluent/platform_watir/platform_object.rb,
lib/fluent/platform_selenium/platform_object.rb,
lib/fluent/platform_mechanize/platform_object.rb,
lib/fluent/platform_watir/platform_web_elements/radio.rb,
lib/fluent/platform_watir/platform_web_elements/table.rb,
lib/fluent/platform_watir/platform_web_elements/checkbox.rb,
lib/fluent/platform_watir/platform_web_elements/table_row.rb,
lib/fluent/platform_watir/platform_web_elements/text_area.rb,
lib/fluent/platform_watir/platform_web_elements/text_field.rb,
lib/fluent/platform_watir/platform_web_elements/select_list.rb,
lib/fluent/platform_watir/platform_web_elements/web_element.rb,
lib/fluent/platform_watir/platform_web_elements/ordered_list.rb,
lib/fluent/platform_watir/platform_web_elements/unordered_list.rb

Defined Under Namespace

Modules: Enclosers, Errors, Evaluators, Factory, Generators, Platforms, WebElements

Constant Summary collapse

VERSION =
'0.5.0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Enclosers

#will_alert, #will_confirm, #will_prompt

Methods included from Evaluators

#markup, #refresh, #remove_cookies, #run_script, #screenshot, #text, #title, #url, #wait_for_app, #wait_for_pending_requests, #wait_until

Methods included from Platforms

#get_platform_for, list, register

Instance Attribute Details

#driverObject (readonly)

Browser drivers will be:

Watir::Browser

or [Selenium::WebDriver::Driver]

Returns:

  • (Object)

    browser driver reference



23
24
25
# File 'lib/fluent.rb', line 23

def driver
  @driver
end

#platformObject (readonly)

Platform references will be:

Fluent::Platforms::WatirWebDriver::PlatformObject
Fluent::Platforms::SeleniumWebDriver::PlatformObject
Fluent::Platforms::MechanizeDriver::PlatformObject

Returns:

  • (Object)

    platform reference



31
32
33
# File 'lib/fluent.rb', line 31

def platform
  @platform
end

Class Method Details

.can_be_enabledObject



90
91
92
# File 'lib/fluent.rb', line 90

def self.can_be_enabled
  @can_be_enabled ||= [:button, :text_field, :checkbox, :select_list, :radio]
end

.can_be_enabled?(method) ⇒ Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/fluent.rb', line 94

def self.can_be_enabled?(method)
  can_be_enabled.include? method.to_sym
end

.element_level_waitObject

Returns the default wait value for elements on a page. This value is the default value beyond which a timeout is assumed.



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

def self.element_level_wait
  @element_wait ||= 5
end

.element_level_wait=(value) ⇒ Object



86
87
88
# File 'lib/fluent.rb', line 86

def self.element_level_wait=(value)
  @element_wait = value
end

.included(caller) ⇒ Object

The included callback is used to provide the core functionality of the library to any class or module that includes the Fluent library. The calling class or module is extended with logic that the library makes available as class methods. Those classes become page definitions or activity definitions.

Parameters:

  • caller (Class)

    the class including the library



44
45
46
47
48
# File 'lib/fluent.rb', line 44

def self.included(caller)
  caller.extend Fluent::Generators
  
  Fluent.trace("#{caller.class} #{caller} is now Fluent.")
end

.page_level_waitObject

Returns the default wait value for pages. This value is the default value beyond which a timeout is assumed.



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

def self.page_level_wait
  @page_wait ||= 15
end

.page_level_wait=(value) ⇒ Object



76
77
78
# File 'lib/fluent.rb', line 76

def self.page_level_wait=(value)
  @page_wait = value
end

.trace(message, level = 1) ⇒ Object



2
3
4
# File 'lib/fluent/logger.rb', line 2

def self.trace(message, level=1)
  puts('*' * level + " #{message}") if ENV['FLUENT_TRACE'] == 'on'
end

.versionObject



33
34
35
# File 'lib/fluent.rb', line 33

def self.version
  "Fluent v#{Fluent::VERSION}"
end

Instance Method Details

#initialize(driver = nil, visit = nil) ⇒ Object

The initialize method will be invoked when a definition includes Fluent. A few key things are happening here that are critical to everything working properly:

(1) A browser instance is being created.
(2) A platform object is created for that browser.

Parameters:

  • driver (Object) (defaults to: nil)

    a tool driver instance



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fluent.rb', line 57

def initialize(driver=nil, visit=nil)
  @driver = driver
  
  Fluent::trace("Fluent attached to driver: #{@driver}")
  
  establish_platform_object_for @driver
  
  view if visit && respond_to?(:view)
  
  initialize_page if respond_to?(:initialize_page)
  initialize_activity if respond_to?(:initialize_activity)
end