Class: Kookaburra::UIDriver Abstract
- Inherits:
-
Object
- Object
- Kookaburra::UIDriver
- Extended by:
- Forwardable, HasUIComponents
- Includes:
- Assertion
- Defined in:
- lib/kookaburra/ui_driver.rb,
lib/kookaburra/ui_driver/ui_component.rb,
lib/kookaburra/ui_driver/has_ui_components.rb,
lib/kookaburra/ui_driver/ui_component/address_bar.rb
Overview
Subclass and implement your UI testing DSL
You UIDriver subclass is where you define the DSL for testing your application via its user interface. Methods defined in your DSL should represent business actions rather than user interface manipulations. A good test of this is whether the names of your methods would need to change significantly if the application needed to be implemented in a vastly different manner (a text-only terminal app vs. a web app, for instance).
With larger applications, it may be beneficial to break down your business actions into multiple classes. The top-level UIDriver can have sub-drivers associated with it (and those can have sub-drivers, too; but let's not get carried away, eh?):
class AccountManagementDriver < Kookaburra::UIDriver ui_component :account_list, AccountList # ... end
class MyUIDriver < Kookaburra::UIDriver ui_driver :account_management, AccountManagementDriver # ... end
In your test implementation, you can then do (among other things):
ui.account_management.account_list.should be_visible
Defined Under Namespace
Modules: HasUIComponents Classes: UIComponent
Instance Attribute Summary collapse
- #address_bar ⇒ Kookaburra::UIComponent::UIComponent::AddressBar readonly protected
-
#configuration ⇒ Object
readonly
protected
Returns the value of attribute configuration.
- #mental_model ⇒ Kookaburra::MentalModel readonly protected
Class Method Summary collapse
-
.ui_driver(driver_name, driver_class) ⇒ Object
Tells the UIDriver about sub-drivers (other UIDriver subclasses).
Instance Method Summary collapse
-
#initialize(configuration) ⇒ UIDriver
constructor
It is unlikely that you would instantiate your UIDriver on your own; the object is configured for you when you call #ui.
-
#url ⇒ Object
Returns the URL for this UIDriver.
Methods included from HasUIComponents
Methods included from Assertion
Constructor Details
#initialize(configuration) ⇒ UIDriver
It is unlikely that you would instantiate your UIDriver on your own; the object is configured for you when you call Kookaburra#ui.
84 85 86 |
# File 'lib/kookaburra/ui_driver.rb', line 84 def initialize(configuration) @configuration = configuration end |
Instance Attribute Details
#address_bar ⇒ Kookaburra::UIComponent::UIComponent::AddressBar (readonly, protected)
101 |
# File 'lib/kookaburra/ui_driver.rb', line 101 ui_component :address_bar, UIComponent::AddressBar |
#configuration ⇒ Object (readonly, protected)
Returns the value of attribute configuration.
107 108 109 |
# File 'lib/kookaburra/ui_driver.rb', line 107 def configuration @configuration end |
#mental_model ⇒ Kookaburra::MentalModel (readonly, protected)
105 |
# File 'lib/kookaburra/ui_driver.rb', line 105 def_delegator :configuration, :mental_model |
Class Method Details
.ui_driver(driver_name, driver_class) ⇒ Object
Tells the UIDriver about sub-drivers (other Kookaburra::UIDriver subclasses).
73 74 75 76 77 |
# File 'lib/kookaburra/ui_driver.rb', line 73 def ui_driver(driver_name, driver_class) define_method(driver_name) do driver_class.new(@configuration) end end |
Instance Method Details
#url ⇒ Object
Returns the URL for this Kookaburra::UIDriver.
This implementation simply returns the Configuration#app_host, but you might override it if you are using sub-drivers (see ui_driver) and want them to be addressable.
93 94 95 |
# File 'lib/kookaburra/ui_driver.rb', line 93 def url @configuration.app_host end |