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 depends on the gobject-introspection
gem. It also
requires Ruby 3.0 or higher.
Contributing
Contributions are welcome! Please feel free to create issues or pull requests on GitHub.
License
Copyright © 2015-2024 Matijs van Zuijlen. See LICENSE for details.