class WindowsTestApp

wrapper for simple test apps

Attributes

window_handle_string[R]

Public Class Methods

new(name:, title:) click to toggle source
# File lib/rutl/appium/windows_test_app_wrapper.rb, line 10
def initialize(name:, title:)
  @name = name
  @title = title
end

Public Instance Methods

find_window_by_title() click to toggle source
# File lib/rutl/appium/windows_test_app_wrapper.rb, line 15
def find_window_by_title
  result = Win32::Window.find(title: @title)
  raise 'found more than one instance of app' if result.size > 1
  result.empty? ? false : result.first
end
kill()
Alias for: stop
quiet_cmd(in_string) click to toggle source
# File lib/rutl/appium/windows_test_app_wrapper.rb, line 37
def quiet_cmd(in_string)
  system in_string + ' 1>nul 2>&1'
end
start() click to toggle source
# File lib/rutl/appium/windows_test_app_wrapper.rb, line 27
def start
  quiet_cmd "start \"NO TITLE\" #{@name}"
  wait_for_started
end
stop() click to toggle source
# File lib/rutl/appium/windows_test_app_wrapper.rb, line 32
def stop
  quiet_cmd "taskkill /f /pid #{@pid} /t"
end
Also aliased as: kill
wait_for_started() click to toggle source
# File lib/rutl/appium/windows_test_app_wrapper.rb, line 21
def wait_for_started
  app_window = await -> { find_window_by_title }
  @pid = app_window.pid
  @window_handle_string = format('0x%08x', app_window.handle)
end