Class: RUTL::Interface::Hello

Inherits:
WindowsApp show all
Defined in:
lib/rutl/interface/windows/hello.rb

Overview

The hello world app with an exit button.

Constant Summary

Constants included from Waiter

Waiter::DEFAULT_TIMEOUT, Waiter::POLL_SLEEP_TIME

Instance Attribute Summary

Attributes inherited from Base

#camera, #driver, #views

Instance Method Summary collapse

Methods inherited from WindowsApp

#base_opts, #kill, #open?, #quit

Methods inherited from Base

#find_state, #find_view, #goto, #method_missing, #quit, #respond_to_missing?, #wait_for_transition

Methods included from Waiter

#await

Methods included from CheckView

#view?

Constructor Details

#initializeHello

Returns a new instance of Hello.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rutl/interface/windows/hello.rb', line 14

def initialize
  @app = WindowsTestApp.new(name: "ruby #{file_name}",
                            title: /hello world/i)
  @app.start
  driver_opts = base_opts
  # Have to start app then attach winappdriver because these both fail:
  # 1. passing hello.rb path as [:caps][:app]
  # 2. passing ruby.exe path as [:caps][:app] and passing hello.rb
  #    path as [:caps][:appArguments]
  driver_opts[:caps][:appTopLevelWindow] = @app.window_handle_string
  @driver = Appium::Driver.new(driver_opts, false)
  @driver.start
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RUTL::Interface::Base

Instance Method Details

#current_viewObject



29
30
31
32
33
# File 'lib/rutl/interface/windows/hello.rb', line 29

def current_view
  # This only works because I only have one view.
  # Should I? What about dialogs?
  @views.first
end

#file_nameObject



10
11
12
# File 'lib/rutl/interface/windows/hello.rb', line 10

def file_name
  File.expand_path('../../../../spec/hello.rb', __dir__)
end