Skip to content

Instantly share code, notes, and snippets.

@leviwilson
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leviwilson/8825039 to your computer and use it in GitHub Desktop.
Save leviwilson/8825039 to your computer and use it in GitHub Desktop.
mohawk / uia gem setup
require 'mohawk'
require 'rspec-expectations'
require 'childprocess'
World(Mohawk::Navigation)
Mohawk.default_adapter = Mohawk::Adapters::UiaAdapter # use uia rather than RAutomation
source 'http://rubygems.org'
# ...
gem 'mohawk', git: 'git://github.com/leviwilson/mohawk.git', branch: 'uia_gem'
gem 'uia', git: 'git://github.com/northwoodspd/uia.git'
# ...
require 'mohawk'
Mohawk.default_adapter = Mohawk::Adapters::UiaAdapter
Mohawk.app_path = './TelerikWpfApp1.exe'
Mohawk.start
class MainWindow
include Mohawk
window(title: /MainWindow/)
menu_item(:subitem_one, path: ['Item 1', 'Sub Item 1'])
end
main = MainWindow.new
main.click_subitem_one
main.subitem_one # fails, because of the modal dialog
@leviwilson
Copy link
Author

You'll want to gem update mohawk as I had to add the click_#{menu_item} accessor to mouse click rather than select. Select causes an issue if the Invoke on the menu item doesn't return immediately. In this case, because of a modal dialog (see the Notes here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment