summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:18:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:18:46 +0000
commit56294d30a82ec2da6f9ce399740c1ef65a9ddef4 (patch)
treebbe3823e41495d026ba8edc6eeaef166edb7e2a2 /tests
parentInitial commit. (diff)
downloadgnome-software-upstream.tar.xz
gnome-software-upstream.zip
Adding upstream version 3.38.1.upstream/3.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/actions.py68
-rwxr-xr-xtests/basic.py157
2 files changed, 225 insertions, 0 deletions
diff --git a/tests/actions.py b/tests/actions.py
new file mode 100755
index 0000000..da0887e
--- /dev/null
+++ b/tests/actions.py
@@ -0,0 +1,68 @@
+#! /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)
+ try:
+ shopping_button = app.child(name=u'Let\u2019s Go Shopping', retry=False)
+ shopping_button.click()
+ except tree.SearchError:
+ print "not first-run, moving on"
+
+ 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..cbca229
--- /dev/null
+++ b/tests/basic.py
@@ -0,0 +1,157 @@
+#! /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')
+ remove_button = details_page.child('Remove')
+
+ search_page_listbox = search_page.child(roleName='list box')
+
+ try:
+ shopping_button = app.child(name=u'Let\u2019s Go Shopping', retry=False)
+ shopping_button.click()
+ except tree.SearchError:
+ print "not first-run, moving on"
+
+ 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 remove_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 remove_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")