Ruby-GNOME2 App Driver¶ ↑
Test driver for Ruby-GNOME2 applications using Atspi
. Takes care of boot and shutdown, and provides a handle on the GUI's main UI frame.
Usage¶ ↑
This driver assumes your application lives in bin/
and uses additional ruby code in lib/
.
Say, your application is called foo
. Then, in your tests, do something like this:
require 'gnome_app_driver' describe 'The application' do before do @driver = GnomeAppDriver.new('foo') # This will boot `ruby -Ilib bin/foo`, wait for its main window to appear, # and focus it. @driver.boot end it 'does stuff' do # Fetch the main window's atspi object frame = @driver.frame # You can now interact with the window's objects # Select item matching /bar/ from combo box: box = frame.find_role :combo_box item = box.find_role :menu_item, /bar/ box.get_action_name(0).must_equal 'press' box.do_action 0 item.get_action_name(0).must_equal 'click' item.do_action 0 # Fetch contents of a text box textbox = frame.find_role :text textbox.get_text(0, 100).must_equal 'Foo bar baz' # Quit application menu_item = frame.find_role :menu_item, /Quit/ menu_item.do_action 0 # Check exit status status = @driver.cleanup status.exitstatus.must_equal 0 end after do # Ensure application is cleaned up @driver.cleanup end end
Installation¶ ↑
gem install gnome_app_driver
Dependencies¶ ↑
Ruby-GNOME2 App Driver needs atspi's GIR data, and needs to be able to interact with the application via atspi and atk. The below are suggested packages to install. Corrections are welcome, of course.
Debian¶ ↑
This should work on Debian unstable.
sudo apt-get install dbus sudo apt-get install libgirepository1.0-dev gobject-introspection sudo apt-get install gir1.2-atspi-2.0 libatk-adaptor
Ubuntu¶ ↑
Please try the instructions for Debian. This will probably not work on Ubuntu 12.04. Again, corrections and additions are welcome.
Other OS¶ ↑
To be determined. Please contribute back your experience in getting Ruby-GNOME2 App Driver working on your favorite operation system.
Contributing¶ ↑
Contributions are welcome! Please feel free to create issues or pull requests on GitHub.
License¶ ↑
Copyright © 2015-2017 Matijs van Zuijlen. See LICENSE for details.