Module: Fluent

Includes:
DataBuilder, DataConfig, DataSetter, Enclosers, Evaluators, Locators, Platforms, RSpec::Matchers
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.5'

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, #get_cookie_value, #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



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

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



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

def platform
  @platform
end

Class Method Details

.can_be_enabledObject



101
102
103
# File 'lib/fluent.rb', line 101

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)


110
111
112
# File 'lib/fluent.rb', line 110

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

.can_display_textObject



105
106
107
108
# File 'lib/fluent.rb', line 105

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)


114
115
116
# File 'lib/fluent.rb', line 114

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.



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

def self.element_level_wait
  @element_wait ||= 5
end

.element_level_wait=(value) ⇒ Object



97
98
99
# File 'lib/fluent.rb', line 97

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



55
56
57
58
59
# File 'lib/fluent.rb', line 55

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.



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

def self.page_level_wait
  @page_wait ||= 15
end

.page_level_wait=(value) ⇒ Object



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

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



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

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



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

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