Module: Mohawk
- Extended by:
- RAutomation::WaitHelper
- Includes:
- RAutomation::WaitHelper
- Defined in:
- lib/mohawk.rb,
lib/mohawk/version.rb,
lib/mohawk/accessors.rb,
lib/mohawk/navigation.rb,
lib/mohawk/accessors/link.rb,
lib/mohawk/accessors/tabs.rb,
lib/mohawk/accessors/text.rb,
lib/mohawk/accessors/combo.rb,
lib/mohawk/accessors/label.rb,
lib/mohawk/accessors/radio.rb,
lib/mohawk/accessors/table.rb,
lib/mohawk/accessors/button.rb,
lib/mohawk/accessors/control.rb,
lib/mohawk/accessors/spinner.rb,
lib/mohawk/accessors/checkbox.rb,
lib/mohawk/accessors/menu_item.rb,
lib/mohawk/accessors/table_row.rb,
lib/mohawk/accessors/tree_view.rb,
lib/mohawk/adapters/uia_adapter.rb
Defined Under Namespace
Modules: Accessors, Adapters, Navigation Classes: InvalidApplicationPath
Constant Summary collapse
- VERSION =
"0.0.9"
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
Class Method Summary collapse
Instance Method Summary collapse
-
#active? ⇒ Boolean
Returns whether or not the window is active.
-
#exist? ⇒ Boolean
Returns whether or not the window exists.
-
#has_text?(text_to_find) ⇒ Boolean
Indicates if the window has text or not.
- #initialize(extra = {}) ⇒ Object
-
#present? ⇒ Boolean
Returns whether or not the window is present.
-
#wait_for_control(locator) ⇒ Object
Waits until a control exists.
-
#wait_until_present ⇒ Object
Waits until the window is present.
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
26 27 28 |
# File 'lib/mohawk.rb', line 26 def adapter @adapter end |
Class Method Details
.app ⇒ Object
42 43 44 |
# File 'lib/mohawk.rb', line 42 def self.app @app end |
.app_path=(path) ⇒ Object
46 47 48 |
# File 'lib/mohawk.rb', line 46 def self.app_path=(path) @app_path = path end |
.included(cls) ⇒ Object
22 23 24 |
# File 'lib/mohawk.rb', line 22 def self.included(cls) cls.extend Mohawk::Accessors end |
.start ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/mohawk.rb', line 28 def self.start raise InvalidApplicationPath.new unless @app_path @app = ChildProcess.build(@app_path).start app_window = RAutomation::Window.new :pid => @app.pid wait_until { app_window.present? } end |
.stop ⇒ Object
36 37 38 39 40 |
# File 'lib/mohawk.rb', line 36 def self.stop raise 'An application was never started' unless @app @app.stop unless @app.exited? @app = nil end |
Instance Method Details
#active? ⇒ Boolean
Returns whether or not the window is active
66 67 68 |
# File 'lib/mohawk.rb', line 66 def active? adapter.window.active? end |
#exist? ⇒ Boolean
Returns whether or not the window exists
59 60 61 |
# File 'lib/mohawk.rb', line 59 def exist? adapter.window.exist? end |
#has_text?(text_to_find) ⇒ Boolean
Indicates if the window has text or not
99 100 101 |
# File 'lib/mohawk.rb', line 99 def has_text?(text_to_find) adapter.window.text.include? text_to_find end |
#initialize(extra = {}) ⇒ Object
50 51 52 53 54 |
# File 'lib/mohawk.rb', line 50 def initialize(extra={}) locator = [which_window.merge(extra)] locator << parent_container if respond_to?(:parent_container) @adapter = Mohawk::Adapters::UiaAdapter.new(*locator) end |
#present? ⇒ Boolean
Returns whether or not the window is present
73 74 75 |
# File 'lib/mohawk.rb', line 73 def present? adapter.window.present? end |
#wait_for_control(locator) ⇒ Object
Waits until a control exists
87 88 89 90 91 92 93 94 |
# File 'lib/mohawk.rb', line 87 def wait_for_control(locator) control = adapter.window.control(locator) begin wait_until { control.exist? } rescue raise "A control with #{locator} was not found" end end |
#wait_until_present ⇒ Object
Waits until the window is present
80 81 82 |
# File 'lib/mohawk.rb', line 80 def wait_until_present adapter.window.wait_until_present end |