[gnome-logs/wip/test: 43/44] behave and dogtail tests for search and back functionality
- From: Rashi Aswani <aswanirashi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs/wip/test: 43/44] behave and dogtail tests for search and back functionality
- Date: Sun, 16 Aug 2015 20:50:59 +0000 (UTC)
commit c2232cb17e286fcef7eafd62f927d268c3ef0361
Author: Rashi Aswani <aswanirashi19 gmail com>
Date: Sun Aug 16 21:15:14 2015 +0530
behave and dogtail tests for search and back functionality
data/gl-eventtoolbar.ui | 10 +++++++
data/gl-eventviewlist.ui | 5 ++++
tests/common_steps.py | 3 +-
tests/environment.py | 2 +-
tests/general.feature | 17 ++++++++++---
tests/gnome-logs-behave-test.c | 2 +-
tests/steps/general.py | 52 ++++++++++++++++++++++++++++++----------
7 files changed, 71 insertions(+), 20 deletions(-)
---
diff --git a/data/gl-eventtoolbar.ui b/data/gl-eventtoolbar.ui
index c9bc84a..b4b6679 100644
--- a/data/gl-eventtoolbar.ui
+++ b/data/gl-eventtoolbar.ui
@@ -12,6 +12,11 @@
<style>
<class name="image-button"/>
</style>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="Back">
+ <property name="accessible-name" translatable="yes">Back</property>
+ </object>
+ </child>
<child>
<object class="GtkImage" id="go_back_icon">
<property name="icon-name">go-previous-symbolic</property>
@@ -41,6 +46,11 @@
<property name="tooltip-text" translatable="yes">Search the displayed logs</property>
<property name="valign">center</property>
<property name="visible">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="Find">
+ <property name="accessible-name" translatable="yes">Find</property>
+ </object>
+ </child>
<style>
<class name="image-button"/>
</style>
diff --git a/data/gl-eventviewlist.ui b/data/gl-eventviewlist.ui
index 61dfa98..deef4f4 100644
--- a/data/gl-eventviewlist.ui
+++ b/data/gl-eventviewlist.ui
@@ -2,6 +2,11 @@
<template class="GlEventViewList" parent="GtkBox">
<property name="orientation">horizontal</property>
<property name="visible">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="Window">
+ <property name="accessible-name" translatable="yes">Window</property>
+ </object>
+ </child>
<child>
<object class="GlCategoryList" id="categories">
<property name="visible">True</property>
diff --git a/tests/common_steps.py b/tests/common_steps.py
index b449bbd..6d7f372 100644
--- a/tests/common_steps.py
+++ b/tests/common_steps.py
@@ -67,6 +67,7 @@ class App(object):
"""
if self.a11yAppName is None:
self.a11yAppName = self.internCommand
+ self.a11yAppName = 'gnome-logs'
# Trap weird bus errors
for attempt in xrange(0, 30):
@@ -118,7 +119,7 @@ class App(object):
assert not self.isRunning(), "Application cannot be stopped"
- step(u'Make sure that gnome-logs-test is running')
+ step(u'Make sure gnome-logs-behave-test is running')
def ensure_app_running(context):
context.app = context.app_class.startViaCommand()
diff --git a/tests/environment.py b/tests/environment.py
index c8965b4..e7e48ba 100644
--- a/tests/environment.py
+++ b/tests/environment.py
@@ -16,7 +16,7 @@ def before_all(context):
try:
# Close running logs instances
- os.system("./gnome-logs-test --force-shutdown > /dev/null")
+ os.system("./gnome-logs-behave-test --force-shutdown > /dev/null")
# Skip dogtail actions to print to stdout
config.logDebugToStdOut = False
diff --git a/tests/general.feature b/tests/general.feature
index 0794ed4..5fda19c 100644
--- a/tests/general.feature
+++ b/tests/general.feature
@@ -1,9 +1,18 @@
Feature: General
-Background:
- * Make sure that gnome-logs-test is running
-
@start_logs
Scenario: Search
+ * Make sure gnome-logs-behave-test is running
* Click on Search
- Then all selection toolbar buttons are sensitive
+ Then search is focused and selection toolbar buttons are sensitive
+
+ Scenario: Search with text
+ * Make sure gnome-logs-behave-test is running
+ * Type search text
+ Then assert test
+
+ Scenario: Go Back
+ * Make sure gnome-logs-behave-test is running
+ * Select the log listing
+ * Press the back button
+ Then return to the main window
diff --git a/tests/gnome-logs-behave-test.c b/tests/gnome-logs-behave-test.c
index 2030b73..2f1f172 100644
--- a/tests/gnome-logs-behave-test.c
+++ b/tests/gnome-logs-behave-test.c
@@ -47,7 +47,7 @@ main (int argc, char** argv)
g_set_prgname (PACKAGE_TARNAME);
application = gl_application_new ();
status = g_application_run (G_APPLICATION (application), argc, argv);
- g_application_quit (G_APPLICATION (application));
+ //g_application_quit (G_APPLICATION (application));
g_object_unref (application);
return status;
}
diff --git a/tests/steps/general.py b/tests/steps/general.py
index 55720bc..4c6b42e 100644
--- a/tests/steps/general.py
+++ b/tests/steps/general.py
@@ -5,22 +5,48 @@ from pyatspi import STATE_SENSITIVE
from time import sleep
from common_steps import App
- step(u'Run gnome-logs-test')
+ step(u'Open gnome-logs-behave-test')
def run_gnome_logs_test(context):
system("./gnome-logs-test --force-shutdown 2&> /dev/null")
- context.execute_steps(u'* Start a new Logs instance')
+ context.execute_steps(u'* Start a new gnome-logs-behave-test instance')
@step(u'Click on search')
def click_on_search(context):
- context.app.child('Search').parent.click()
+ context.app.child('Find').click()
- then(u'all selection toolbar buttons are sensitive')
-def all_selection_toolbar_buttons_sensitive(context):
- sleep(0.5)
- assert context.app.child(translate('Important')).sensitive
- assert context.app.child(translate('All')).sensitive
- assert context.app.child(translate('Applications')).sensitive
- assert context.app.child(translate('System')).sensitive
- assert context.app.child(translate('Security')).sensitive
- assert context.app.child(translate('Hardware')).sensitive
- sleep(0.5)
+ then(u'search is focused and selection toolbar buttons are sensitive')
+def search_focused_selection_toolbar_buttons_sensitive(context):
+ assert context.app.child('Search').focused
+ assert context.app.child('Important').sensitive
+ assert context.app.child('All').sensitive
+ assert context.app.child('Applications').sensitive
+ assert context.app.child('System').sensitive
+ assert context.app.child('Security').sensitive
+ assert context.app.child('Hardware').sensitive
+ context.app.child('Search').typeText("test")
+ assert context.app.child('This is a test').sensitive
+
+ step(u'Type search text')
+def type_search_text(context):
+ context.app.child('Search').typeText("test")
+
+ step(u'assert test')
+def assert_test(context):
+ assert context.app.child('This is a test').sensitive
+
+ step(u'Go Back')
+def go_back(context):
+ context.app.child('This is a test').click()
+
+ step(u'Select the log listing')
+def select_log_listing(context):
+ context.app.child('This is a test').click()
+
+ step(u'Press the back button')
+def press_back_button(context):
+ context.app.child('Back').click()
+
+ step('return to the main window')
+def return_main_window(context):
+ context.app.child('Window').sensitive
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]