summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtests/actions.py61
-rwxr-xr-xtests/basic.py151
2 files changed, 212 insertions, 0 deletions
diff --git a/tests/actions.py b/tests/actions.py
new file mode 100755
index 0000000..3bb0268
--- /dev/null
+++ b/tests/actions.py
@@ -0,0 +1,61 @@
+#! /usr/bin/python
+
+# This a simple test, using the dogtail framework:
+#
+# Activate the app via the org.gtk.Application bus interface.
+# Check that the expected actions are exported on the session bus.
+# Activate each action and verify the result.
+
+import os
+from gi.repository import Gio
+
+settings = Gio.Settings.new("org.gnome.desktop.interface")
+settings.set_boolean ("toolkit-accessibility", True)
+
+from dogtail.tree import *
+from dogtail.utils import *
+from dogtail.procedural import *
+from dogtail.rawinput import keyCombo
+
+try:
+ run('gnome-software')
+
+ app = root.application('gnome-software')
+
+ bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
+ proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE,
+ None,
+ 'org.gnome.Software',
+ '/org/gnome/Software',
+ 'org.gtk.Application')
+ proxy.call_sync('Activate', GLib.Variant('(a{sv})', ({},)), 0, -1, None)
+
+ doDelay(1)
+ assert (len(app.children) == 1)
+
+ dbus_actions = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE,
+ None,
+ 'org.gnome.Software',
+ '/org/gnome/Software',
+ 'org.gtk.Actions')
+
+ names = dbus_actions.call_sync('List', None, 0, -1, None).unpack()[0]
+ assert (u'quit' in names)
+ assert (u'about' in names)
+
+ dbus_actions.call_sync('Activate',
+ GLib.Variant('(sava{sv})', (u'about', [], {})),
+ 0, -1, None)
+
+ doDelay (1)
+ assert (len(app.children) == 2)
+ keyCombo("<Esc>")
+ doDelay (1)
+ assert (len(app.children) == 1)
+
+ dbus_actions.call_sync('Activate',
+ GLib.Variant('(sava{sv})', (u'quit', [], {})),
+ 0, -1, None)
+ assert (len(app.children) == 0)
+finally:
+ os.system("killall gnome-software")
diff --git a/tests/basic.py b/tests/basic.py
new file mode 100755
index 0000000..1006ecf
--- /dev/null
+++ b/tests/basic.py
@@ -0,0 +1,151 @@
+#! /usr/bin/python
+
+# This a simple test, using the dogtail framework:
+#
+# Click on All, Installed, Updates and check that the button state
+# and the main page content update as expected. Type a few characters
+# on the overview page, hit Enter, and verify that we end up on the
+# search page. Hit Escape and verify that we go back to the overview
+# page.
+
+from gi.repository import Gio
+
+settings = Gio.Settings.new("org.gnome.desktop.interface")
+settings.set_boolean ("toolkit-accessibility", True)
+
+import os
+from dogtail.tree import *
+from dogtail.utils import *
+from dogtail.procedural import *
+
+try:
+ run('gnome-software')
+
+ app_name = 'gnome-software'
+ app = root.application(app_name)
+
+ all_button = app.child('All')
+ installed_button = app.child('Installed')
+ updates_button = app.child('Updates')
+ back_button = app.child('Go back')
+
+ overview_page = app.child('Overview page')
+ installed_page = app.child('Installed page')
+ updates_page = app.child('Updates page')
+ search_page = app.child('Search page')
+ details_page = app.child('Details page')
+ install_button = details_page.child('Install')
+ uninstall_button = details_page.child('Uninstall')
+
+ search_page_listbox = search_page.child(roleName='list box')
+
+ all_button.click()
+ assert (all_button.checked)
+ assert (not installed_button.checked)
+ assert (not updates_button.checked)
+ assert (overview_page.showing)
+ assert (not installed_page.showing)
+ assert (not updates_page.showing)
+ assert (not search_page.showing)
+
+ installed_button.click()
+ assert (not all_button.checked)
+ assert (installed_button.checked)
+ assert (not updates_button.checked)
+ assert (not overview_page.showing)
+ assert (installed_page.showing)
+ assert (not updates_page.showing)
+ assert (not search_page.showing)
+
+ updates_button.click()
+ assert (not all_button.checked)
+ assert (not installed_button.checked)
+ assert (updates_button.checked)
+ assert (not overview_page.showing)
+ assert (not installed_page.showing)
+ assert (updates_page.showing)
+ assert (not search_page.showing)
+
+ installed_button.click()
+ assert (not all_button.checked)
+ assert (installed_button.checked)
+ assert (not updates_button.checked)
+ assert (not overview_page.showing)
+ assert (installed_page.showing)
+ assert (not updates_page.showing)
+ assert (not search_page.showing)
+
+ all_button.click()
+ assert (all_button.checked)
+ assert (not installed_button.checked)
+ assert (not updates_button.checked)
+ assert (overview_page.showing)
+ assert (not installed_page.showing)
+ assert (not updates_page.showing)
+ assert (not search_page.showing)
+
+ type("archive\n")
+ doDelay(2)
+ assert (not all_button.checked)
+ assert (not installed_button.checked)
+ assert (not updates_button.checked)
+ assert (not overview_page.showing)
+ assert (not installed_page.showing)
+ assert (not updates_page.showing)
+ assert (search_page.showing)
+
+ """Details page test section"""
+ search_page_listbox.child(roleName='label', name='Archive Manager').click()
+ doDelay(4)
+ assert (not overview_page.showing)
+ assert (not installed_page.showing)
+ assert (not updates_page.showing)
+ assert (not search_page.showing)
+ assert (details_page.showing)
+ assert (install_button.showing or uninstall_button.showing)
+ assert (back_button.showing)
+ assert (root.application(app_name).child('Details page')
+ .child(roleName='push button', name='History')
+ .states.contains(pyatspi.STATE_VISIBLE))
+ assert (root.application(app_name).child('Details page')
+ .child(roleName='push button', name='Website')
+ .states.contains(pyatspi.STATE_VISIBLE))
+
+ if install_button.showing:
+ assert (not root.application(app_name).child('Details page')
+ .child(roleName='push button', name='Launch')
+ .states.contains(pyatspi.STATE_VISIBLE))
+ else:
+ assert (root.application(app_name).child('Details page')
+ .child(roleName='push button', name='Launch')
+ .states.contains(pyatspi.STATE_VISIBLE))
+
+ back_button.click()
+ assert (not all_button.checked)
+ assert (not installed_button.checked)
+ assert (not updates_button.checked)
+ assert (not overview_page.showing)
+ assert (not installed_page.showing)
+ assert (not updates_page.showing)
+ assert (search_page.showing)
+ assert (not install_button.showing)
+ assert (not uninstall_button.showing)
+ assert (not back_button.showing)
+
+ keyCombo("Escape")
+ assert (all_button.checked)
+ assert (not installed_button.checked)
+ assert (not updates_button.checked)
+ assert (overview_page.showing)
+ assert (not installed_page.showing)
+ assert (not updates_page.showing)
+ assert (not search_page.showing)
+
+ super_menu = root.application('gnome-shell').child(roleName='menu', name='Software')
+ super_menu.click()
+ root.application('gnome-shell').child(roleName='label', name='Software Sources').click()
+ assert (len(app.children) == 2)
+ sources_dialog = app.children[-1]
+ assert (sources_dialog.child(roleName='label', name='Software Sources'))
+finally:
+ os.system("killall gnome-software")