Module: Fluent

Includes:
DataBuilder, DataConfig, DataSetter, Enclosers, Evaluators, Locators, Platforms
Defined in:
lib/fluent.rb,
lib/fluent/errors.rb,
lib/fluent/logger.rb,
lib/fluent/factory.rb,
lib/fluent/version.rb,
lib/fluent/locators.rb,
lib/fluent/enclosers.rb,
lib/fluent/platforms.rb,
lib/fluent/workflows.rb,
lib/fluent/evaluators.rb,
lib/fluent/generators.rb,
lib/fluent/data_config.rb,
lib/fluent/data_reader.rb,
lib/fluent/data_setter.rb,
lib/fluent/data_builder.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/image.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: DataBuilder, DataConfig, DataConfigHelper, DataReader, DataSetter, Enclosers, Errors, Evaluators, Factory, Generators, Locators, Platforms, WebElements, Workflow, WorkflowPaths

Constant Summary collapse

VERSION =
'0.7.1'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DataConfig

default_data_path

Methods included from DataReader

#data_path, #data_path=, #load

Methods included from DataConfigHelper

#determine_data_source, #method_missing

Methods included from DataBuilder

#data_for, default_data_path

Methods included from DataSetter

#object_enabled_for, #text_settable_for, #use_check_data_with, #use_select_data_with, #use_set_data_with, #use_text_data_with, #using, #value_checkable_for, #value_selectable_for, #value_settable_for

Methods included from Locators

#locate_by

Methods included from Enclosers

#will_alert, #will_confirm, #will_prompt, #within_modal, #within_window

Methods included from Evaluators

#focused, #markup, #refresh, #remove_cookies, #run_script, #screenshot, #text, #title, #url, #visit, #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



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

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



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

def platform
  @platform
end

Class Method Details

.can_be_enabledObject



99
100
101
# File 'lib/fluent.rb', line 99

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

.can_be_enabled?(method) ⇒ Boolean

Returns:

  • (Boolean)


108
109
110
# File 'lib/fluent.rb', line 108

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

.can_display_textObject



103
104
105
106
# File 'lib/fluent.rb', line 103

def self.can_display_text
  @can_display_text ||= [:button, :link, :list_item, :ordered_list, :unordered_list,
                         :label, :div, :span, :cell, :table, :h1, :h2, :h3, :h4, :h5, :h6]
end

.can_display_text?(method) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/fluent.rb', line 112

def self.can_display_text?(method)
  can_display_text.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.



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

def self.element_level_wait
  @element_wait ||= 5
end

.element_level_wait=(value) ⇒ Object



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

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



53
54
55
56
57
# File 'lib/fluent.rb', line 53

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.



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

def self.page_level_wait
  @page_wait ||= 15
end

.page_level_wait=(value) ⇒ Object



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

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



42
43
44
# File 'lib/fluent.rb', line 42

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



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fluent.rb', line 66

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