[gnome-logs] Added dogtail test for sidebar item click
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs] Added dogtail test for sidebar item click
- Date: Mon, 13 Apr 2015 07:28:02 +0000 (UTC)
commit 81f44c881d5e40310c789790d3fe2f20756f11db
Author: Rashi Aswani <aswanirashi19 gmail com>
Date: Fri Mar 27 00:27:12 2015 +0530
Added dogtail test for sidebar item click
https://bugzilla.gnome.org/show_bug.cgi?id=724796
Makefile.am | 10 ++++++-
configure.ac | 19 +++++++++++---
tests/basic.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 102 insertions(+), 5 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index d22e9cb..3299b52 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,6 +106,8 @@ nodist_man_MANS = data/gnome-logs.1
endif
if LOGS_ENABLE_TESTS
+tests/basic.py: gnome-logs
+
test-desktop-file-validate.sh: Makefile
$(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
echo "$(DESKTOP_FILE_VALIDATE) $(top_builddir)/$(desktop_DATA) || exit 1" >> $@; \
@@ -114,6 +116,11 @@ test-desktop-file-validate.sh: Makefile
check_SCRIPTS = \
test-desktop-file-validate.sh
+# GSettings schema must be compiled and gnome-logs installed in PATH before
+# running the test.
+installcheck-local:
+ $(AM_V_at)env $(TESTS_ENVIRONMENT) $(top_srcdir)/tests/basic.py
+
# Tests:
TESTS_ENVIRONMENT = \
LANG=C \
@@ -224,7 +231,8 @@ dist_noinst_DATA = \
data/icons/gnome-logs.svg
dist_noinst_SCRIPTS = \
- autogen.sh
+ autogen.sh \
+ tests/basic.py
dist-hook: git-changelog-hook
diff --git a/configure.ac b/configure.ac
index 5766262..1b506e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,10 +76,21 @@ AS_IF([test "x$enable_tests" != "xno"],
[AC_PATH_PROG([DESKTOP_FILE_VALIDATE], [desktop-file-validate])
AS_IF([test "x$ac_cv_path_DESKTOP_FILE_VALIDATE" != "xyes"],
[have_desktop_file_validate=yes],
- [have_desktop_file_validate=no])],
- [have_desktop_file_validate=no])
-
-AS_IF([test "x$have_desktop_file_validate" = "xyes"],
+ [have_desktop_file_validate=no])
+ AM_PATH_PYTHON([2.7])
+ py_module=dogtail
+ AC_MSG_CHECKING([for python module $py_module])
+ echo "import $py_module" | python - &>/dev/null
+ AS_IF([test $? != 0],
+ [AC_MSG_RESULT([not found])
+ have_dogtail=no],
+ [AC_MSG_RESULT([found])
+ have_dogtail=yes])],
+ [have_desktop_file_validate=no
+ have_dogtail=no])
+
+AS_IF([test "x$have_desktop_file_validate" = "xyes" \
+ -a "x$have_dogtail" = "xyes"],
[testing_utilities=yes],
[testing_utilities=no
AS_IF([test "x$enable_tests" = "xyes"],
diff --git a/tests/basic.py b/tests/basic.py
new file mode 100755
index 0000000..fa875f9
--- /dev/null
+++ b/tests/basic.py
@@ -0,0 +1,78 @@
+#! /usr/bin/python
+
+# This a simple test, using the dogtail framework:
+#
+# Click on Important, All, Applications, System, Security, Hardware and check
+# that the button state and the log listings update as expected.
+
+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-logs')
+ app_name = 'gnome-logs'
+ app = root.application(app_name)
+
+ important_button = app.child('Important').parent
+ all_button = app.child('All').parent
+ applications_button = app.child('Applications').parent
+ system_button = app.child('System').parent
+ security_button = app.child('Security').parent
+ hardware_button = app.child('Hardware').parent
+
+ important_button.click()
+ assert (important_button.isSelected)
+ assert (not all_button.isSelected)
+ assert (not applications_button.isSelected)
+ assert (not system_button.isSelected)
+ assert (not security_button.isSelected)
+ assert (not hardware_button.isSelected)
+
+ all_button.click()
+ assert (not important_button.isSelected)
+ assert (all_button.isSelected)
+ assert (not applications_button.isSelected)
+ assert (not system_button.isSelected)
+ assert (not security_button.isSelected)
+ assert (not hardware_button.isSelected)
+
+ applications_button.click()
+ assert (not important_button.isSelected)
+ assert (not all_button.isSelected)
+ assert (applications_button.isSelected)
+ assert (not system_button.isSelected)
+ assert (not security_button.isSelected)
+ assert (not hardware_button.isSelected)
+
+ system_button.click()
+ assert (not important_button.isSelected)
+ assert (not all_button.isSelected)
+ assert (not applications_button.isSelected)
+ assert (system_button.isSelected)
+ assert (not security_button.isSelected)
+ assert (not hardware_button.isSelected)
+
+ security_button.click()
+ assert (not important_button.isSelected)
+ assert (not all_button.isSelected)
+ assert (not applications_button.isSelected)
+ assert (not system_button.isSelected)
+ assert (security_button.isSelected)
+ assert (not hardware_button.isSelected)
+
+ hardware_button.click()
+ assert (not important_button.isSelected)
+ assert (not all_button.isSelected)
+ assert (not applications_button.isSelected)
+ assert (not system_button.isSelected)
+ assert (not security_button.isSelected)
+ assert (hardware_button.isSelected)
+finally:
+ os.system('killall gnome-logs')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]